-
Notifications
You must be signed in to change notification settings - Fork 273
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
bugfix: require relative names in import{Wordy,Symboly}Id #5568
base: trunk
Are you sure you want to change the base?
Conversation
I got confused here: | ||
|
||
3 | use Nat .+ | ||
|
||
|
||
I was surprised to find a '.' here. | ||
I was expecting one of these instead: | ||
|
||
* bang | ||
* binding | ||
* do | ||
* false | ||
* force | ||
* handle | ||
* if | ||
* lambda | ||
* let | ||
* newline or semicolon | ||
* pattern | ||
* quote | ||
* termLink | ||
* true | ||
* tuple | ||
* typeLink |
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.
Side note, I'm not sure which one of these it wants.
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.
Yeah I know, the error messages are atrocious :|
I was expecting something after the use keyword | ||
|
||
3 | use .lib.builtin.Nat + | ||
|
||
Here's a few examples of valid `use` statements: | ||
|
||
use math sqrt Introduces `sqrt` as a local alias for | ||
`math.sqrt` | ||
use List :+ Introduces `:+` as a local alias for | ||
`List.:+`. | ||
use .foo bar.baz Introduces `bar.baz` as a local alias for | ||
the absolute name `.foo.bar.baz` |
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.
Do we not want to allow absolute names for the first one? The example on line 65 suggests it as correct syntax.
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.
I don't see a problem with allowing absolute names in certain places, I can make that change. My instinct was to simplify everything down to relative names, but that could be wrong.
Tentatively approved and seems okay for now, but I could see wanting to distinguish with absolute names in Can you also address the second message I commented on, that suggests the now-unsupported syntax? |
Conclusion: will revert part of this to allow |
For reference the current user docs on |
Ok, this is ready to go. The macOS CI errors look superfluous:
|
Overview
This PR fixes #4536 by changing this from a runtime crash to a parse error:
During implementation, I surveyed other uses of the combinator that parsed ".bar" here (where we want to only allow relative "bar"), and determined that none of them need to allow both absolute and relative names, so for consistency and simplicity, I switched them all to require relative names, even when an absolute name has a sensible interpretation (e.g. "namespace .blah")
The full list of now-disallowed absolute dots (also see transcript where all of these are captured):
Test coverage
PR includes transcript