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
If I understand §3.2.10 of the language reference correctly then
Map[x.type#S, x.type#S] forSome { val x: T }
should be equivalent to
Map[t#S, t#S] forSome { type t <: T with Singleton }
but they do seem to behave different in practice. When compiling
trait Type {
type S
}
class ConcreteType extends Type {
type S = Double
}
trait Base {
type T <: Type
val m: Map[t#S, t#S] forSome { type t <: T with Singleton }
val n: Map[x.type#S, x.type#S] forSome { val x: T }
}
abstract class Derived extends Base {
override type T = ConcreteType
override val m = Map[Double, Double]()
/** This does not work. §3.2.10 indicates that types n is shorthand for type of m. */
override val n = Map[Double, Double]()
}
There is an error for overriding n, but no error for overriding m. Am I misunderstanding the language reference?
The text was updated successfully, but these errors were encountered:
If I understand §3.2.10 of the language reference correctly then
should be equivalent to
but they do seem to behave different in practice. When compiling
There is an error for overriding
n
, but no error for overridingm
. Am I misunderstanding the language reference?The text was updated successfully, but these errors were encountered: