Skip to content

Fix isUnquotedKey, fixes #3479 - #3480

Merged
hdgarrood merged 1 commit into
masterfrom
fix-record-label-quoting
Dec 14, 2018
Merged

Fix isUnquotedKey, fixes #3479#3480
hdgarrood merged 1 commit into
masterfrom
fix-record-label-quoting

Conversation

@hdgarrood

Copy link
Copy Markdown
Contributor

Fixes labels not being quoted in error messages in some cases where they
should have been. For example:

Input code:

test :: { "Oops" :: Int }
test = { }

Before:

  Type of expression lacks required label Oops.

while checking that expression {}
  has type { Oops :: Int
           }
in value declaration test

After:

  Type of expression lacks required label "Oops".

while checking that expression {}
  has type { "Oops" :: Int
           }
in value declaration test

At the time of writing, there is just this one use of isUnquotedKey
throughout the entire compiler, so the refactoring I've done here is
safe.

There doesn't appear to be a good way to test this, so I haven't added tests.

Fixes labels not being quoted in error messages in some cases where they
should have been. For example:

Input code:
```
test :: { "Oops" :: Int }
test = { }
```

Before:
```
  Type of expression lacks required label Oops.

while checking that expression {}
  has type { Oops :: Int
           }
in value declaration test
```

After:
```
  Type of expression lacks required label "Oops".

while checking that expression {}
  has type { "Oops" :: Int
           }
in value declaration test
```

At the time of writing, there is just this one use of `isUnquotedKey`
throughout the entire compiler, so the refactoring I've done here is
safe.

@garyb garyb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better 👍

@hdgarrood

Copy link
Copy Markdown
Contributor Author

🎉 thanks for the review!

@hdgarrood
hdgarrood merged commit 6976148 into master Dec 14, 2018
@hdgarrood
hdgarrood deleted the fix-record-label-quoting branch December 14, 2018 15:09
@garyb garyb mentioned this pull request Jan 12, 2019
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants