fixes #606: allow unquoted reserved words in more positions - #699
Conversation
... as well as other related positions
There was a problem hiding this comment.
Could do this as lexeme $ (:) <$> identStart <*> many identLetter I think?
There was a problem hiding this comment.
Yeah that should work. Would that be clearer?
There was a problem hiding this comment.
Not sure it makes much of a difference either way, but I think we use applicative style in the parser most of the time at the moment whenever it's not ridiculous. I could be wrong though, just going by memory!
|
Looks good to me! 👍 |
|
How about this? I borrowed the name |
|
Sorry to be picky, but maybe we should call it |
|
Yeah, I think I agree about |
|
Sure, I will change it back to |
|
This is good to go, right? |
|
Yep. |
|
How many libraries actually use the existing string literals? Can't be many. |
|
One of mine does. But the string literals are still allowed. This just makes it more permissive for un-quoted names. |
fixes #606: allow unquoted reserved words in more positions
|
Gotcha, thanks. |
|
Congrats @michaelficarra 😃 |
Fixes #3482. We have allowed reserved names (like `data` or `type`) to be used as record labels without being quoted since #699 was resolved. This commit makes the `isUnquotedKey` function aware of this, having the effect that these labels are no longer unnecessarily quoted in error messages. For example, if we enter > {} :: { data :: Int } in the repl, we now receive: Error found: Type of expression lacks required label data. while checking that expression {} has type { data :: Int } whereas previously, `data` would have been quoted.
Fixes #3482. We have allowed reserved names (like `data` or `type`) to be used as record labels without being quoted since #699 was resolved. This commit makes the `isUnquotedKey` function aware of this, having the effect that these labels are no longer unnecessarily quoted in error messages. For example, if we enter > {} :: { data :: Int } in the repl, we now receive: Error found: Type of expression lacks required label data. while checking that expression {} has type { data :: Int } whereas previously, `data` would have been quoted.
My first non-trivial pull request 😄. Fixes #606. Allows reserved words to be used in record literal keys, property updates, property accessors, destructurings, and record type signatures.