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
Pattern matching between identical let-bindings produce no shadowing errors #4529
Comments
From recollection the shadowing/unused warnings are calculated against the bindings in the original form without the construction of mutually recursive binding groups (where the pattern binding is partitioning this into 2 binding groups). There may be a test around this for unused, at least I was aware of it at the time and considered it not blocking. |
Is there a good way to fix this? I'd be more than happy to help out. We had an outage in production due to another bug that was triggered because we had two declarations with the same name like in the example. The wrong declaration was used in the actual code and a warning would likely have made it apparent that there was a bug. |
I haven't looked into it thoroughly yet, but I believe this is the relevant chunk of code: purescript/src/Language/PureScript/Linter.hs Lines 39 to 79 in 5589e81
The interesting functions there are in AST/Traversals.hs: purescript/src/Language/PureScript/AST/Traversals.hs Lines 544 to 666 in 5589e81
|
The issue is that currently purescript/src/Language/PureScript/Make.hs Line 114 in 5589e81
|
Description
Patterns between variable declarations in let-bindings seem to confuse the compiler's ability to detecting shadowing
To Reproduce
As long as a pattern match is between two identical declarations it doesn't complain
Expected behavior
A shadowing warning/error
PureScript version
0.15.14
The text was updated successfully, but these errors were encountered: