TypeLevelString/TypeConcat should not be quoted#2586
TypeLevelString/TypeConcat should not be quoted#2586hdgarrood merged 3 commits intopurescript:masterfrom
Conversation
|
It would of course be nice to test this, but I don't think we have a good way of testing error messages with the current test suite, so I'm inclined to leave it without tests for now. |
|
What happens if you have a Warn constraint with a type level string which contains lone surrogates? |
|
@hdgarrood It will just print the type like any other. Changing line 4 of foo :: forall t. Warn (TypeConcat "Custom warning \xD800 " (TypeString t)) => t -> tresults in
If you'd like, we could print it instead using Unicode replacement characters or omitting the lone surrogates. Additionally, TypeConcat on a lone high surrogate and lone low surrogate will not result in a surrogate pair, but that doesn't bother me so much. We could also fix that if you'd really like. |
hdgarrood
left a comment
There was a problem hiding this comment.
Cool, as long as it doesn't do anything like producing an internal error I'm happy. LGTM 👍
|
@hdgarrood I went ahead and pushed an additional commit to add support for combining lone surrogates into surrogate pairs and using the Unicode replacement character when attempting to print lone surrogates. This type: foo :: forall t. Warn (TypeConcat (TypeConcat "Custom warning \xD834" "\xDF06 ") (TypeString t)) => t -> tnow prints
Please review again. |
5c2a698 to
efd8759
Compare
|
Now that we have a use for it, I think I'd rather export a new function from the module which defines PSString rather that implementing it in terms of |
|
@hdgarrood I can do that. Also, yes, that was a mistake which I've already corrected. |
|
@hdgarrood See 5dda947. |
|
👍 LGTM, thanks! |
|
Looks great, would you mind resolving the conflicts and then I think we can merge this? |
5dda947 to
8d38494
Compare
|
Rebased. |
|
Hmm, I'm not sure why Appveyor has failed or why Travis is seemingly stuck forever without starting any builds. I'll try just amending and force-pushing to restart everything. |
8d38494 to
d1a88d7
Compare
|
That's weird. Do the tests pass locally for you? |
|
@hdgarrood Yes. On both of my development machines (Fedora and macOS). |
|
In that case I'm tempted to just go ahead and merge this, what do people think? |
|
Sounds good. |
|
Thanks @michaelficarra! |
Fixes #2568. No tests, but I manually confirmed by compiling
examples/warning/CustomWarning.purs. Before this change, the warning would be quoted. After, it is not. If you want me to add a test, let me know how it should be done.