mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
![]() This code has a shadowing error: ``` b = False f = \b -> b f b ``` but prior to this commit, the compiler would hit an internal error during monomorphization and not even get to report the error. The reason was that when we entered the closure `\b -> b`, we would try to introduce the identifier `b` to the scope, see that it shadows an existing identifier, and not insert the identifier. But this meant that when checking the body of `\b -> b`, we would think that we captured the value `b` in the outer scope, but that's incorrect! The present patch fixes the issue by generating new symbols for shadowing identifiers, so deeper scopes pick up the correct reference. This also means in the future we may be able to compile and execute code with shadows, even though it will still be an error. Closes #2343 |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |