-
Notifications
You must be signed in to change notification settings - Fork 33
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
<
is weirdly sensitive to being less-than or extends in SAFE
#1225
Comments
I'm not sure what the issue is exactly. The first example is a valid type, so is treated as such, while the second isn't, so the longest possible prefix that's a type gets used. In general, Civet (Hera/PEG) greedily matches what it can for a given rule. What was the behavior you expected? Are you suggesting we e.g. disable |
One issue is when one of the branches is a call:
const x = ($: number extends 0 ? -1 : Math.sqrt) => $(5);
const y = ($1: number) => ($1 < 0 ? Math.sqrt(5) : 1); Really this just caught me off-guard: I forgot |
Another option that comes to mind is requiring a typed |
We could allow the parenless version for simple types like |
These two functions are not compiled alike:
Even more strangely, if you swap them (defining
y
beforex
), that's a ParseError.The text was updated successfully, but these errors were encountered: