-
Notifications
You must be signed in to change notification settings - Fork 571
Add support polykind for Quote from Prim.TypeError
#4142
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
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 @@ | ||
| * Make `Prim.TypeError`'s `Quote` work on all kinds, not just kind `Type`. |
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
18 changes: 18 additions & 0 deletions
18
tests/purs/failing/ProgrammablePolykindedTypeErrorsTypeString.out
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,18 @@ | ||
| Error found: | ||
| in module [33mMain[0m | ||
| at tests/purs/failing/ProgrammablePolykindedTypeErrorsTypeString.purs:23:7 - 23:17 (line 23, column 7 - line 23, column 17) | ||
|
|
||
| A custom type error occurred while solving type class constraints: | ||
|
|
||
| Don't want to show Just @Type String because. | ||
|
|
||
|
|
||
| while checking that type [33mFail (Beside (Beside (Text "Don\'t want to show ") (... ...)) (Text " because.")) => String[0m | ||
| is at least as general as type [33mString[0m | ||
| while checking that expression [33msomeString[0m | ||
| has type [33mString[0m | ||
| in value declaration [33mmain[0m | ||
|
|
||
| See https://github.com/purescript/documentation/blob/master/errors/NoInstanceFound.md for more information, | ||
| or to contribute content related to this error. | ||
|
|
||
23 changes: 23 additions & 0 deletions
23
tests/purs/failing/ProgrammablePolykindedTypeErrorsTypeString.purs
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,23 @@ | ||
| -- @shouldFailWith NoInstanceFound | ||
|
|
||
| module Main where | ||
|
|
||
| import Prelude | ||
| import Prim.TypeError | ||
| import Effect (Effect) | ||
| import Effect.Console (log) | ||
|
|
||
| data Maybe :: forall k. k -> Type | ||
| data Maybe a | ||
|
|
||
| foreign import data Nothing :: forall k. Maybe k | ||
| foreign import data Just :: forall k. k -> Maybe k | ||
|
|
||
| someString :: Fail (Text "Don't want to show " <> Quote (Just String) <> Text " because.") => String | ||
| someString = "someString" | ||
|
|
||
| infixl 6 type Beside as <> | ||
|
|
||
| main :: Effect Unit | ||
| main = do | ||
| log someString |
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.
Uh oh!
There was an error while loading. Please reload this page.
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 think we should probably strip the kind annotations out here (the
@Typebit).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.
We still want to show them when
--verbose-errorsis set, right?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.
If we already decided on a strategy of showing kind annotations when verbose errors is on, then applying that same strategy here sounds good. I can’t remember whether that should be happening anyway; do the tests run with verbose errors on?
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.
As far as I can tell, in the only places we're currently erasing kind annotations in error messages, we do so conditional on verbose errors being off. I believe the tests don't run with verbose errors, which maybe makes testing that the erasure is conditional on verbosity difficult.
Also, it seems there are plenty of other places where we don't do this and perhaps should (just grep for
@intests/**/*.out), which maybe makes dumping this request on this PR a little unfair? I agree that it should be done, but maybe we should clean this up holistically (and figure out how to test it robustly) in a separate PR.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.
Ok, yes, that makes sense.
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.
We don’t strip them in the error “trace” to aid debugging.