-
Notifications
You must be signed in to change notification settings - Fork 35
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
Type refinement of map keys and values #509
Type refinement of map keys and values #509
Conversation
9ecec52
to
c8709c1
Compare
c8709c1
to
1bf80ce
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.
Looks great!
Ahh, I've also noticed we get a new self-check warning, but I'm not sure if it's a false-positive or actually stems from some code issue:
It might be a true positive, but it's also possible that multiple constraints are registered on the type var in question leading to a conflict. I imagine it might stem from
returned by |
I know what's going on. Since the constraints are stored in maps, and maps do not preserve the item order, the results from the constraint solver are sometimes somewhat nondeterministic (the solver iterates over one of the maps and it dictates the order in which the analysis is carried on). The error that shows up is just another manifestation of a problem that was there before this PR, too:
We can see that by comparing the results of running
We see that the last error line is reported from the same location. Since it's a known problem, I think we don't have to worry about it in this PR. |
So we should store the constraints ordered, e.g. in a list of tuples instead of a map? |
Or just sort the map keys before accessing values. Yeah, I'll create a ticket not to lose track of it. |
Fixes #507