File tree 2 files changed +20
-0
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -2600,6 +2600,10 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2600
2600
}.apply(true , tp)
2601
2601
2602
2602
(tp1.dealias, tp2.dealias) match {
2603
+ case _ if ! ctx.erasedTypes && tp2.isFromJavaObject =>
2604
+ provablyDisjoint(tp1, defn.AnyType )
2605
+ case _ if ! ctx.erasedTypes && tp1.isFromJavaObject =>
2606
+ provablyDisjoint(defn.AnyType , tp2)
2603
2607
case (tp1 : TypeRef , _) if tp1.symbol == defn.SingletonClass =>
2604
2608
false
2605
2609
case (_, tp2 : TypeRef ) if tp2.symbol == defn.SingletonClass =>
Original file line number Diff line number Diff line change
1
+ // scalac: -Werror
2
+ class Test :
3
+ def pmat (xs : java.util.Vector [_]): String = xs.get(0 ) match
4
+ case d : Double => d.toString() // was: error: unreachable case, which is spurious
5
+ case _ => " shrug"
6
+
7
+ def pmatR (xs : java.util.Vector [_]): String =
8
+ val scr = xs.get(0 )
9
+ 1.0 match
10
+ case `scr` => scr.toString() // for the reverse provablyDisjoint case
11
+ case _ => " shrug"
12
+
13
+ def test =
14
+ val x = new java.util.Vector [Double ]()
15
+ x.add(1.0 )
16
+ pmat(x)
You can’t perform that action at this time.
0 commit comments