File tree 2 files changed +10
-0
lines changed
compiler/src/dotty/tools/dotc/core 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -185,12 +185,16 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
185
185
tp1.rebind(approximateOr(tp1.parent, tp2))
186
186
case tp1 : TypeProxy if ! isClassRef(tp1) =>
187
187
orDominator(tp1.superType | tp2)
188
+ case err : ErrorType =>
189
+ err
188
190
case _ =>
189
191
tp2 match {
190
192
case tp2 : RecType =>
191
193
tp2.rebind(approximateOr(tp1, tp2.parent))
192
194
case tp2 : TypeProxy if ! isClassRef(tp2) =>
193
195
orDominator(tp1 | tp2.superType)
196
+ case err : ErrorType =>
197
+ err
194
198
case _ =>
195
199
val commonBaseClasses = tp.mapReduceOr(_.baseClasses)(intersect)
196
200
val doms = dominators(commonBaseClasses, Nil )
Original file line number Diff line number Diff line change @@ -2,4 +2,10 @@ object Test {
2
2
val x : iDontExist = 1 // error: not found: type iDontExist
3
3
4
4
val y = x.asInstanceOf [Int ] // No error reported (was: value asInstanceOf does not take type parameters)
5
+
6
+ val a : iDontExist | Int = 1 // error: not found: type iDontExist
7
+ val a2 = a.isInstanceOf [Int ] // No error (used to crash)
8
+
9
+ val b : iDontExist & Int = 1 // error: not found: type iDontExist
10
+ val b2 = a.isInstanceOf [Int ] // No error (worked before too)
5
11
}
You can’t perform that action at this time.
0 commit comments