You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This compiles but fails with -Ycheck:all because the block inside the method xy() is assigned the type Foo[A | B] but the expression x.foo(new B) is assigned the type Foo[M]:
The issue is that in TypeAssigner#avoid, when we see the type parameter S >: x.T | B we replace it by A | B (see TypeAssigner.scala#L90-L93), but in TypeVar#interpolate we instantiate S to M because its upper bound is not a union-type (see Types.scala#L2457-L2461).
@odersky : in #750 you said "Maybe we should instantiate those type variables that have escaping refs as bounds", this would also solve this issue. Note that this issue is currently blocking me from experimenting with improving type inference by removing/reducing the use of interpolateUndetVars.
The text was updated successfully, but these errors were encountered:
This is another case where
avoid
is wrong (see #750, #741, #711, and I can probably come up with more contrived examples too):This compiles but fails with
-Ycheck:all
because the block inside the methodxy()
is assigned the typeFoo[A | B]
but the expressionx.foo(new B)
is assigned the typeFoo[M]
:The issue is that in
TypeAssigner#avoid
, when we see the type parameterS >: x.T | B
we replace it byA | B
(see TypeAssigner.scala#L90-L93), but inTypeVar#interpolate
we instantiateS
toM
because its upper bound is not a union-type (see Types.scala#L2457-L2461).@odersky : in #750 you said "Maybe we should instantiate those type variables that have escaping refs as bounds", this would also solve this issue. Note that this issue is currently blocking me from experimenting with improving type inference by removing/reducing the use of
interpolateUndetVars
.The text was updated successfully, but these errors were encountered: