-
Notifications
You must be signed in to change notification settings - Fork 204
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: Fix an ICE when reassigning a mutable lambda variable to one with a different environment type #2172
fix: Fix an ICE when reassigning a mutable lambda variable to one with a different environment type #2172
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need a check specifically for closures in assignments which don't otherwise have any closure-specific logic. If we were to go forward with this approach, we'd need a closure-specific check everywhere two closures may be unified (e.g. if statements, storing them in structs, arrays, etc). We should instead make it so that two closures with different environment types do not unify or subtype with each other.
93901d6
to
dfc0ba0
Compare
Fair enough. fixed in dfc0ba0 |
* master: chore: Remove symlink and dummy config file (#2200) fix: Fix an ICE when reassigning a mutable lambda variable to one with a different environment type (#2172) feat: Only create new witnesses for distinctiveness when duplicates exist (#2191) chore: Use helper functions for getting values of `AcirVar`s (#2194) feat: Add support for slices of structs and nested slices in brillig (#2084) feat: Perform sorting of constant arrays at compile time (#2195)
* master: chore: Remove symlink and dummy config file (#2200) fix: Fix an ICE when reassigning a mutable lambda variable to one with a different environment type (#2172) feat: Only create new witnesses for distinctiveness when duplicates exist (#2191) chore: Use helper functions for getting values of `AcirVar`s (#2194) feat: Add support for slices of structs and nested slices in brillig (#2084) feat: Perform sorting of constant arrays at compile time (#2195) chore: Improve unary error (#2199) chore: separate integration test cases into directories based on expected result (#2198) chore: remove stale comment (#2197) feat(nargo): Support custom entry points specified in TOML (#2158) fix(nargo): Indicate which TOML file is missing package name (#2177) fix: remove duplicated `name` option in `nargo new` (#2183) chore: add documentation to the `nargo lsp` command (#2169) feat(nargo)!: Require package `type` be specified in Nargo.toml (#2134) fix(nargo): Make dependencies section optional in TOML (#2161) chore: Do not create new memory block when not needed (#2142) fix: fix an ICE happening when we call a closure result from if/else (#2146) chore: remove unnecessary cloning of package dependencies (#2175)
* master: (35 commits) feat: Issue warning for signed integers (#2185) chore: Add `noir_wasm` testing workflow (#1921) chore: Remove symlink and dummy config file (#2200) fix: Fix an ICE when reassigning a mutable lambda variable to one with a different environment type (#2172) feat: Only create new witnesses for distinctiveness when duplicates exist (#2191) chore: Use helper functions for getting values of `AcirVar`s (#2194) feat: Add support for slices of structs and nested slices in brillig (#2084) feat: Perform sorting of constant arrays at compile time (#2195) chore: Improve unary error (#2199) chore: separate integration test cases into directories based on expected result (#2198) chore: remove stale comment (#2197) feat(nargo): Support custom entry points specified in TOML (#2158) fix(nargo): Indicate which TOML file is missing package name (#2177) fix: remove duplicated `name` option in `nargo new` (#2183) chore: add documentation to the `nargo lsp` command (#2169) feat(nargo)!: Require package `type` be specified in Nargo.toml (#2134) fix(nargo): Make dependencies section optional in TOML (#2161) chore: Do not create new memory block when not needed (#2142) fix: fix an ICE happening when we call a closure result from if/else (#2146) chore: remove unnecessary cloning of package dependencies (#2175) ...
Description
Problem
This code type-checks properly, but an assertion fails during SSA generation.
The reassignment is invalid since the two lambdas have different environment types, and should be caught during type-checking.
Resolves #2139
Summary
This adds an additional check to assignments, to cover this case and throw an error if an invalid assignment happens.
Documentation
This PR requires documentation updates when merged.
Additional Context
PR Checklist*
cargo fmt
on default settings.