-
Notifications
You must be signed in to change notification settings - Fork 563
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qualify types as necessary in errors and warnings #4337
Qualify types as necessary in errors and warnings #4337
Conversation
I'm hoping I can find some time to pick this up again soon, but I think what I have here works as a proof of concept, so I'm interested to hear what people think of this approach. Alternatives I can think of:
module Main where
import Data.List as L
x = L.fromFoldable [1,2,3] It would be nice to be able to produce a suggested type signature that says I'm also tempted to get rid of the new field in |
I've not had a chance to look at the meat of this yet, but I'm excited! I did take a stab at this years ago too but my branch got behind master and the diff was too much to deal with. Keeping |
I don't know how much the changes to golden test outputs reflect a work-in-progress state of the implementation versus what you're trying to achieve, but a number of them are, if not mistakes, steps backward in my opinion. Broadly:
Provided none of those objections pose difficulties for the approach, the requalification pass makes a lot of sense to me. |
Completely agree - this is far from what I鈥檇 consider ready. |
This has been superceded by #4409 |
Will hopefully fix #1647, reported by me a mere 7 years ago. 馃く
The idea is to make a note of the
Imports
for the current module before type checking, and then if there are any errors, construct a reverse lookup of more or less the same information in theImports
, so that we can go from fully-qualified names back to names that are qualified as they would be in the source file, and then "requalify" any types in error messages according to that reverse lookup.While this does what we want sometimes (see e.g. the new tests
TypeQualification{1,2,3}
), it doesn't quite do what we want most of the time, and I think one of the main reasons it's not doing what we want is because of missing cases inonTypesInErrorMessage
.Checklist: