Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite loop in compiler #4293

Merged
merged 1 commit into from
Jan 4, 2023
Merged

Fix infinite loop in compiler #4293

merged 1 commit into from
Jan 4, 2023

Conversation

SeanTAllen
Copy link
Member

The following program used to cause an infinite loop in the compiler:

type Message is (String, String, None)

interface tag Manager
  be handle_message(msg: Message val)

actor Main
  new create(env: Env) =>
    Foo(env, recover tag this end)

  be handle_message(msg: Message val) =>
    None

actor Foo
  var manager: Manager

  new create(env: Env, manager': Manager) =>
    manager = manager'
    let notifier = InputNotifier(this)
    env.input(consume notifier)

  be handle_data(data: String) =>
    manager.handle_message(("","",None))

class InputNotifier is InputNotify
  let parent: Foo

  new iso create(parent': Foo) =>
    parent = parent'

  fun ref apply(data': Array[U8 val] iso) =>
    parent.handle_data("")

Fixes #4291

The following program used to cause an infinite loop in the compiler:

```pony
type Message is (String, String, None)

interface tag Manager
  be handle_message(msg: Message val)

actor Main
  new create(env: Env) =>
    Foo(env, recover tag this end)

  be handle_message(msg: Message val) =>
    None

actor Foo
  var manager: Manager

  new create(env: Env, manager': Manager) =>
    manager = manager'
    let notifier = InputNotifier(this)
    env.input(consume notifier)

  be handle_data(data: String) =>
    manager.handle_message(("","",None))

class InputNotifier is InputNotify
  let parent: Foo

  new iso create(parent': Foo) =>
    parent = parent'

  fun ref apply(data': Array[U8 val] iso) =>
    parent.handle_data("")
```

Fixes #4291
@SeanTAllen SeanTAllen requested a review from a team January 3, 2023 23:14
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Jan 3, 2023
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Jan 3, 2023
@SeanTAllen SeanTAllen merged commit 9fef1d6 into main Jan 4, 2023
@SeanTAllen SeanTAllen deleted the 4291-hang branch January 4, 2023 18:35
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Jan 4, 2023
github-actions bot pushed a commit that referenced this pull request Jan 4, 2023
github-actions bot pushed a commit that referenced this pull request Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler "hangs" in function pass
3 participants