We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eb34c3c commit 1c1788aCopy full SHA for 1c1788a
tests/patmat/i12805-fallout.scala
@@ -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