bug icon indicating copy to clipboard operation
bug copied to clipboard

`T =:= RefinedType(List(T, AnyRef), Nil)` is false

Open lrytz opened this issue 1 year ago • 0 comments

In 2.13.13:

scala> :power
scala> trait T

scala> val t = typeOf[T]
scala> val tr = RefinedType(List(t, typeOf[AnyRef]), EmptyScope)

scala> t =:= tr
val res0: Boolean = false

scala> t <:< tr
val res1: Boolean = true

scala> tr <:< t
val res2: Boolean = true

This leads to

scala> trait X { def f: Int }; trait T { def f: X }; class C extends T { def f = new X { def f = 1 } }
                                                                             ^
       error: under -Xsource:3-cross, the inferred type changes to X [quickfixable]

The inferred type for f is RefinedType(List(X, AnyRef), Nil).

lrytz avatar Mar 12 '24 15:03 lrytz