-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Looking at the documentation on AnyRef
: "Class AnyRef is the root class of all reference types. All types except the value types descend from this class", I believe the following shouldn't compile:
case class Boo(i: Int) extends AnyVal
val b: AnyRef = Boo(1)
dottc accepts that code, but I think it should complain in the same way that scalac does:
scala> val a: AnyRef = Boo(1)
^
error: type mismatch;
found : Boo
required: AnyRef
Note that Boo extends Any, not AnyRef.
Such types can participate in value classes, but instances
cannot appear in singleton types or in reference comparisons.
Metadata
Metadata
Assignees
Labels
No labels