-
Notifications
You must be signed in to change notification settings - Fork 471
Better error messages for GADTs and int overflows #7830
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
Conversation
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.
Nice! Could you please make sure you add error message fixture tests to the super_errors folder? So we cover all error messages we have with fixture tests.
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
b52a874
to
40f90a7
Compare
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.
clearer error messages, thanks @fhammerschmidt !
Awaiting the build running through and apparently another approvement by @zth then it's good to go. |
@@ -85,7 +85,9 @@ let emit_external_warnings : iterator = | |||
( Nonrecursive, | |||
[{ptype_kind = Ptype_variant ({pcd_res = Some _} :: _)}] ) -> | |||
Location.raise_errorf ~loc:str_item.pstr_loc | |||
"GADT has to be recursive types, please try `type rec'" | |||
"GADTs require recursive type syntax.\n\ | |||
Please define your type using `type rec` instead of `type`.\n\ |
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 avoid saying "please" here, we don't do that in other error messages either.
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.
Just saw the int message is for polyvariants, so in the current state none of the suggested fixes are applicable to polyvariants per se (cannot use float nor bigint). I think we can merge anyway since it's better than before. And, there's an issue to add float
support to polyvariants, that should at some point be implemented.
The int overflow stuff is actually for polyvariants.