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 @@ -197,6 +197,9 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
197
197
case c :: rest =>
198
198
val accu1 = if (accu exists (_ derivesFrom c)) accu else c :: accu
199
199
if (cs == c.baseClasses) accu1 else dominators(rest, accu1)
200
+ case Nil => // this case can happen because after erasure we do not have a top class anymore
201
+ assert(ctx.erasedTypes)
202
+ defn.ObjectClass :: Nil
200
203
}
201
204
202
205
def mergeRefined (tp1 : Type , tp2 : Type ): Type = {
Original file line number Diff line number Diff line change
1
+ trait Break { protected val break : Int ; }
2
+ case class BreakImpl (protected val break : Int ) extends Break {}
3
+ object Test {
4
+ def f2 (x : Break ) = x match {
5
+ case BreakImpl (x) => BreakImpl
6
+ case _ => - 1
7
+ }
8
+ def f4 (x : Any ) = x match {
9
+ case BreakImpl (x) => x
10
+ case _ => - 1
11
+ }
12
+ def main (args : Array [String ]): Unit = {
13
+ val break = BreakImpl (22 )
14
+ assert(f2(break) == 22 )
15
+ assert(f4(break) == 22 )
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments