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 incorrect "field not initialized" error with while/else #4009

Merged
merged 1 commit into from
Feb 16, 2022
Merged

Conversation

SeanTAllen
Copy link
Member

Previously, due to a bug in the compile's while/else handling code, the
following code would be rejected as not initializing all object fields:

actor Main
  var _s: (String | None)

  new create(env: Env) =>
    var i: USize = 0
    while i < 5 do
       _s = i.string()
       i = i + 1
    else
      _s = ""
    end

This commit fixes while/else handling in refer_while so that it matches the
correct logic as seen in refer_if.

Partially addresses a series of related bugs in #3283.

@SeanTAllen SeanTAllen requested a review from a team February 15, 2022 01:39
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Feb 15, 2022
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Feb 15, 2022
Previously, due to a bug in the compiler's while/else handling code, the
following code would be rejected as not initializing all object fields:

```pony
actor Main
  var _s: (String | None)

  new create(env: Env) =>
    var i: USize = 0
    while i < 5 do
       _s = i.string()
       i = i + 1
    else
      _s = ""
    end
```

This commit fixes while/else handling in `refer_while` so that it matches the
correct logic as seen in `refer_if`.

Partially addresses a series of related bugs in #3283.
@ergl ergl merged commit 3986fcf into main Feb 16, 2022
@ergl ergl deleted the issue-3283 branch February 16, 2022 10:56
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Feb 16, 2022
github-actions bot pushed a commit that referenced this pull request Feb 16, 2022
github-actions bot pushed a commit that referenced this pull request Feb 16, 2022
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.

3 participants