File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 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.
185185 tp1.rebind(approximateOr(tp1.parent, tp2))
186186 case tp1 : TypeProxy if ! isClassRef(tp1) =>
187187 orDominator(tp1.superType | tp2)
188+ case err : ErrorType =>
189+ err
188190 case _ =>
189191 tp2 match {
190192 case tp2 : RecType =>
191193 tp2.rebind(approximateOr(tp1, tp2.parent))
192194 case tp2 : TypeProxy if ! isClassRef(tp2) =>
193195 orDominator(tp1 | tp2.superType)
196+ case err : ErrorType =>
197+ err
194198 case _ =>
195199 val commonBaseClasses = tp.mapReduceOr(_.baseClasses)(intersect)
196200 val doms = dominators(commonBaseClasses, Nil )
Original file line number Diff line number Diff line change @@ -2,4 +2,10 @@ object Test {
22 val x : iDontExist = 1 // error: not found: type iDontExist
33
44 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)
511}
You can’t perform that action at this time.
0 commit comments