-
Notifications
You must be signed in to change notification settings - Fork 26
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
Polymorphic types are incorrectly propagated into aggregated objects implementing traits using the same type variable names #297
Comments
For the record, the error does not appear if |
Could you provide a complete example? My attempt seems to working. Maybe I missed your original idea.
|
You aren't actally creating a |
I updated my initial example to make something which at least looks runnable. I've been on Windows all day, so I forgot some of the crucial syntax at first... X3 |
I just need to use
|
Weird. I'll try it out to see where the line is drawn... (And that was a typo in the example, my original code doesn't have any such errors.) |
Okay, I've isolated it. Foo needs to implement a trait, like this:
|
I tried changing the names around in |
Confirmed. Fix on the way. |
Can't reproduce it on |
When an aggregated polymorphic class is parameterised with a type name the trait it implements uses internally for a different type variable, the typechecker will propagate the types incorrectly. Consider the following:
Now you would expect
foo
to be aAB<real, int>
, but the typechecker will turn it into aAB<int, int>
while still keepingBar<real, int>
, promptly causing errors withBar.fun()
as the type ofbb
(real
) doesn't match the type incorrectly expected byfoo.fun()
(int
).EDIT:
Hopefully made my example runnable.
EDIT:
Changed the example to an example which actually contains the bug, and updated the description accordingly. Note that it's the names in Bar and AB which are clashing. The names in Foo are irrelevant.
The text was updated successfully, but these errors were encountered: