-
Notifications
You must be signed in to change notification settings - Fork 126
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
Shadowing in a lambda list gives an unexpected result #567
Comments
Note also:
So it seems specifically to be a problem with the translation of multi-argument lambdas. |
Note something strange about the warning from the original post:
The warning says that the second occurrence of Things seem to get even weirder when more complex patterns (e.g. tuple patterns) are involved. With
But if we put a tuple pattern in the second argument, now the second
If we put a tuple pattern in both arguments, then we get not just a shadowing warning, as I'd expect, but instead we get an "overlapping symbols" error!
|
Another weird one:
The |
Yeah, I think that all of these should be errors saying "multiple definitions for 'thing'". |
I think that in all cases, |
Agreed... I'm a bit surprised this isn't literally how the desuguaring works... |
OK, we can leave them as just shadowing warnings, if you prefer that, although I can't really think about why might we want to allow people to write I suspect the actual bug is that some list is reversed somewhere, so I'll have a go at fixing it. |
Well, I see that ghc actually gives an error if you write I got as far as identifying this line in the function I think it should read I couldn't figure out what was causing the inconsistent behavior with |
That might be due to an interaction with
I guess this has the effect of EDIT: correct the words. |
I see... Yes, we are doing Is there any reason why we couldn't run the renamer before the |
This is probably the right thing to do, although it probably would require some refactoring. Originally we just had NoPat and no renamer and I can't think of a reason for the renamer to run after. The main reason to do NoPat was to make all variable binding sites completely explicit, as this makes it easy to associate type signatures with them (I think NoPat moves the signatures into the bindings). It seems that this should still work, but we'd have to change the type names NoPat works with. I don't think that should be a problem though. Since you are already looking into it, I'll un-assign myself :) |
Just to confirm, this bug still exists as of current master (2338302) |
I'm looking into this a bit, and I thought I'd jot down some things I learned. The The renamer then assumes all this work has been done. In particular, it expects to find type signatures (if they exist) for names when it does renaming in the bodies of definitions. This may bring type variables into scope, which then may be mentioned in type applications and numeric demotions. Ultimately, I think this work probably all needs to be done in one unified pass instead. |
The name binding structure that results from multi-parameter functions with repeated names, and the interaction with pattern desugaring is currently very counterintuitive. See issue #567 for more discussion.
The name binding structure that results from multi-parameter functions with repeated names, and the interaction with pattern desugaring is currently very counterintuitive. See issue #567 for more discussion.
Moved from:
GaloisInc/saw-script#367
This is unexpected:
The text was updated successfully, but these errors were encountered: