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
To me (and to @milessabin in #4583 and scala/bug#10916), type projections of abstract types are meant to be, indeed, abstract types between their bounds.
But the SLS says that Derived <: Base implies Derived#A <: Base#A. Hence, if Base#A >: S <: U, I can ensure that Base#A = U by defining a subclass with Derived#A = U to ensure that Base#A >: Derived#A = U. That fails in Scalac but works in Dotty, yet it doesn't have justification in either the intended semantics or in the nuObj paper. On the other hand, if that's meant to actually hold, it should be part of type equality — while right now you can only witness this indirectly.
scala>traitBase { typeA }
// defined class Base
scala>classDerivedextendsBase { typeA=Any }
// defined class Derived
scala>defcast(x: Any):A#T= (x: B#T):A#Tdefcast(x: Any):A#T
scala>defcast2(x: Any):A#T=x: A#T1|defcast2(x: Any):A#T=x: A#T|^|found: Any(x)
|required: A#T|
Relatedly, I've long been concerned that underlying on TypeBounds returns the upper bound, even though one would think that tp.underlying is always meant to be =:= tp.
The text was updated successfully, but these errors were encountered:
To me (and to @milessabin in #4583 and scala/bug#10916), type projections of abstract types are meant to be, indeed, abstract types between their bounds.
But the SLS says that
Derived <: Base
impliesDerived#A <: Base#A
. Hence, ifBase#A >: S <: U
, I can ensure thatBase#A = U
by defining a subclass withDerived#A = U
to ensure thatBase#A >: Derived#A = U
. That fails in Scalac but works in Dotty, yet it doesn't have justification in either the intended semantics or in the nuObj paper. On the other hand, if that's meant to actually hold, it should be part of type equality — while right now you can only witness this indirectly.Relatedly, I've long been concerned that
underlying
onTypeBounds
returns the upper bound, even though one would think thattp.underlying
is always meant to be=:= tp
.The text was updated successfully, but these errors were encountered: