{{ message }}
Repository navigation
Mention which row label the type error occurs on #4411
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
Merged
MonoidMusician
merged 20 commits into
purescript:master
from
FredTheDino:mention-row-tags-in-type-errors
Feb 1, 2023
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5f5baeb
Add a row-label error
FredTheDino 813783b
Inject the labels in the error messages
FredTheDino 0d56135
Change the error label a bit
FredTheDino 74b5848
Remove stray trace
FredTheDino ec1225f
Add a test
FredTheDino 2e7d90e
Do the tasks in the PR
FredTheDino e642e12
Fix the test output
FredTheDino 9712abc
Refactor alignRowsWith to use a case
FredTheDino 73c49c3
Extract lambdas into bindings
FredTheDino 26cb0e1
Update the errors to be clearer
FredTheDino 461393a
Merge branch 'master' into mention-row-tags-in-type-errors
FredTheDino 5859372
Update the erroneous source file
FredTheDino 560e5ed
Add yet another case for the error files
FredTheDino 2c90056
Update the test outputs
FredTheDino 4b67f95
Update comppiler tests
FredTheDino 102ba80
Other outputs that changed
FredTheDino f9a0aff
Revert "Other outputs that changed"
FredTheDino 24542d4
Revert "Update comppiler tests"
FredTheDino 56bfdde
Fix typo and update comment
FredTheDino 7cd2c20
Rename the module in the test as well
FredTheDino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * Outputs what label the type-error occurred on when types don't match |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| Error found: | ||
| in module [33mNestedRecordLabelOnTypeError[0m | ||
| at tests/purs/failing/NestedRecordLabelOnTypeError.purs:8:9 - 8:15 (line 8, column 9 - line 8, column 15) | ||
|
|
||
| Could not match type | ||
| [33m [0m | ||
| [33m Int[0m | ||
| [33m [0m | ||
| with type | ||
| [33m [0m | ||
| [33m String[0m | ||
| [33m [0m | ||
|
|
||
| while matching label [33mc[0m | ||
| while matching label [33mb[0m | ||
| while matching label [33ma[0m | ||
| while checking that type [33m{ a :: { b :: { c :: Int[0m | ||
| [33m } [0m | ||
| [33m } [0m | ||
| [33m} [0m | ||
| is at least as general as type [33m{ a :: { b :: { c :: String[0m | ||
| [33m } [0m | ||
| [33m } [0m | ||
| [33m} [0m | ||
| while checking that expression [33mrecord[0m | ||
| has type [33m{ a :: { b :: { c :: String[0m | ||
| [33m } [0m | ||
| [33m } [0m | ||
| [33m} [0m | ||
| in value declaration [33merror[0m | ||
|
|
||
| See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, | ||
| or to contribute content related to this error. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| -- @shouldFailWith TypesDoNotUnify | ||
| module NestedRecordLabelOnTypeError where | ||
|
|
||
| record :: { a :: { b :: { c :: Int } } } | ||
| record = { a: { b: { c: 1 } } } | ||
|
|
||
| error :: { a :: { b :: { c :: String } } } | ||
| error = record -- this should trigger an error, telling us there's a mismatch in the field `a > b > c` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| Error found: | ||
| in module [33mRecordLabelOnTypeError[0m | ||
| at tests/purs/failing/RecordLabelOnTypeError.purs:8:5 - 8:6 (line 8, column 5 - line 8, column 6) | ||
|
|
||
| Could not match type | ||
| [33m [0m | ||
| [33m Int[0m | ||
| [33m [0m | ||
| with type | ||
| [33m [0m | ||
| [33m String[0m | ||
| [33m [0m | ||
|
|
||
| while matching label [33mfield[0m | ||
| while checking that type [33m{ field :: Int[0m | ||
| [33m} [0m | ||
| is at least as general as type [33m{ field :: String[0m | ||
| [33m} [0m | ||
| while checking that expression [33ma[0m | ||
| has type [33m{ field :: String[0m | ||
| [33m} [0m | ||
| in value declaration [33mb[0m | ||
|
|
||
| See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, | ||
| or to contribute content related to this error. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| -- @shouldFailWith TypesDoNotUnify | ||
| module RecordLabelOnTypeError where | ||
|
|
||
| a :: { field :: Int } | ||
| a = { field: 1 } | ||
|
|
||
| b :: { field :: String } | ||
| b = a -- this should trigger an error, telling us the `field` tag where the type discrepancy happened |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| Error found: | ||
| in module [33mNestedRecordLabelOnTypeError[0m | ||
| at tests/purs/failing/RecordLabelOnTypeErrorImmediate.purs:5:15 - 5:18 (line 5, column 15 - line 5, column 18) | ||
|
|
||
| Could not match type | ||
| [33m [0m | ||
| [33m String[0m | ||
| [33m [0m | ||
| with type | ||
| [33m [0m | ||
| [33m Int[0m | ||
| [33m [0m | ||
|
|
||
| while checking that type [33mString[0m | ||
| is at least as general as type [33mInt[0m | ||
| while checking that expression [33m"a"[0m | ||
| has type [33mInt[0m | ||
| in value declaration [33mrecord[0m | ||
|
|
||
| See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, | ||
| or to contribute content related to this error. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| -- @shouldFailWith TypesDoNotUnify | ||
| module NestedRecordLabelOnTypeError where | ||
|
|
||
| record :: { a :: Int } | ||
| record = { a: "a" } -- Triggers an error, but the label is explicitly not added since it caused other errors to be worse. See https://github.com/purescript/purescript/pull/4411 for more information. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
You can’t perform that action at this time.

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.
Instead of defining these local helpers in three different places, could you add a helper next to
alignRowsWithcalled(note the absence of
Labelin this type), which simply delegates to your updatedalignRowsWithand adds the hint? (I'd also factor thesequence_call that co-occurs with all of these call sites into this helper, which is whym ()and not[m ()].)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've finally had enough time to look at this. But this is not really possible to do. We get a dependency cycle:
I'm not sure I want to touch this much code and if this is the better change. It would have been great if it worked though. I'm all for exposing less and not moving complexity to the call sites. Curse your cyclic dependencies!
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.
Oh, that's unfortunate. Fine to leave as-is, then.