Skip to content
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

Improve "this ground coercion is not principal" warning message #5523

Closed
vicuna opened this issue Mar 6, 2012 · 4 comments
Closed

Improve "this ground coercion is not principal" warning message #5523

vicuna opened this issue Mar 6, 2012 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Mar 6, 2012

Original bug ID: 5523
Reporter: @alainfrisch
Assigned to: @garrigue
Status: assigned (set by @garrigue on 2012-03-07T07:02:20Z)
Resolution: open
Priority: normal
Severity: feature
Target version: later
Category: typing
Tags: patch
Monitored by: @ygrek

Bug description

It would be useful if the type-checker could report the inferred type for the sub-expression when a coercion is detected as being non-principal. It would make it simpler to copy and paste this type to the source code in order to make the coercion principal.

File attachments

@vicuna
Copy link
Author

vicuna commented Mar 7, 2012

Comment author: @garrigue

This makes sense, but there is an unfortunate difficulty:
warnings are strings, whereas printing a type requires a formatter.
Of course one can input a type to a string, but the layout may not
be as expected.

@vicuna
Copy link
Author

vicuna commented Mar 7, 2012

Comment author: @alainfrisch

What about turning Warnings.message into a printer
(with a formatter argument), and using the standard trick to count the number of printed lines (i.e. redirecting the "newline" method of the formatter; should probably be done in Location.print_warning, by the way)?

@vicuna
Copy link
Author

vicuna commented Mar 7, 2012

Comment author: @alainfrisch

Proposal attached. I don't fully understand the logic for line counting, so I may have missed something.

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants