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
The above, unexpectedly, compiles and works with Dotty[1], but not with Scala 2.13[2]
Expectation
Expected Xa.s of type Xa.internal.S to have a distinct implicit scope from other values of type X#S and include the implicits in Xa in implicit scope - as it works in dotty
Another example:
objectA {
objectB { objectC { classS } }
}
objectAX {
finalvalB=A.Bimplicitvalx:AX.B.C.S=newAX.B.C.S
}
objectTest {
deffoo(implicitx: AX.B.C.S) = x
foo // could not find implicit value for parameter x: AX.B.C.S
}
Expected reference to AX.B.C.S to have a different implicit scope than A.B.C.S, despite being the same type.
} elseif (sym.isAliasType) {
getParts(tp.normalize) // scala/bug#7180 Normalize needed to expand HK type refs
It looks like scalac and dotty disagree on the order in which rules should be applied 🤔
neko-kai
changed the title
Alias prefix is not in implicit scope, unlike Dotty
Non-definition prefix is not in implicit scope, unlike Dotty
Jun 1, 2020
@joroKr21 Ah, sorry for the misleading title, the issue in question is not about type aliases, it's about value aliases of form final val B = A.B, the first example above is the same even without the type alias[1]:
traitX {
traitS
}
classXa(valinternal:X) {
defs: internal.S=new internal.S{}
implicitclassXS(s: internal.S) {
defprintX:Unit= println(s)
}
}
objectXaextendsXa(newX{})
objectAppextendsApp {
Xa.s.printX // no such member
}
In dotty, Xa.s has type Xa.internal.S where Xa is prefix of internal and Xa.XS conversion is thus in implicit scope, allowing Xa.s.printX to resolve. This is not the behavior of scalac, for which the prefix of Xa.internal.S is only X because Xa.internal has type X.
Minimized code
Output
The above, unexpectedly, compiles and works with Dotty[1], but not with Scala 2.13[2]
Expectation
Expected
Xa.s
of typeXa.internal.S
to have a distinct implicit scope from other values of typeX#S
and include the implicits inXa
in implicit scope - as it works in dottyAnother example:
Expected reference to
AX.B.C.S
to have a different implicit scope thanA.B.C.S
, despite being the same type.Companion issue in dotty scala/scala3#9094
The text was updated successfully, but these errors were encountered: