File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,8 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
186186 // val x: String = null.asInstanceOf[String]
187187 // if (x == null) {} // error: x is non-nullable
188188 // if (x.asInstanceOf[String|Null] == null) {} // ok
189- cls1 == defn.NullClass && cls1 == cls2
189+ if cls1 == defn.NullClass || cls2 == defn.NullClass then cls1 == cls2
190+ else cls1 == defn.NothingClass || cls2 == defn.NothingClass
190191 else if cls1 == defn.NullClass then
191192 cls1 == cls2 || cls2.derivesFrom(defn.ObjectClass )
192193 else if cls2 == defn.NullClass then
Original file line number Diff line number Diff line change 1+ //> using options -language:strictEquality
2+
3+ import scala .collection .LinearSeq
4+
5+ def foo [T ](a : LinearSeq [T ]) = a match
6+ case Nil => - 1
7+ case head +: tail => head
8+
9+ enum Foo derives CanEqual :
10+ case Bar
11+ case Baz (x : String )
12+
13+
14+ def foo (a : Foo ) = a match
15+ case Foo .Bar => - 1
16+ case _ => 0
You can’t perform that action at this time.
0 commit comments