Skip to content

Commit 1c1788a

Browse files
committed
Add a test case representing the fallout seen in bootstrapping
1 parent eb34c3c commit 1c1788a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/patmat/i12805-fallout.scala

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import scala.annotation.unchecked.uncheckedVariance
2+
3+
type Untyped = Null
4+
5+
class Type
6+
7+
abstract class Tree[-T >: Untyped] {
8+
type ThisTree[T >: Untyped] <: Tree[T]
9+
10+
protected var myTpe: T @uncheckedVariance = _
11+
12+
def withType(tpe: Type): ThisTree[Type] = {
13+
val tree = this.asInstanceOf[ThisTree[Type]]
14+
tree.myTpe = tpe
15+
tree
16+
}
17+
}
18+
19+
case class Ident[-T >: Untyped]() extends Tree[T]
20+
case class DefDef[-T >: Untyped]() extends Tree[T]
21+
22+
def test[T >: Untyped](tree: Tree[T], tp: Type) = tree.withType(tp) match {
23+
case Ident() => 1
24+
case DefDef() => 2
25+
case _ => 3
26+
}

0 commit comments

Comments
 (0)