@@ -79,7 +79,7 @@ object Trees {
79
79
/** The type constructor at the root of the tree */
80
80
type ThisTree [T >: Untyped ] <: Tree [T ]
81
81
82
- private [ this ] var myTpe : T = _
82
+ protected var myTpe : T @ uncheckedVariance = _
83
83
84
84
/** Destructively set the type of the tree. This should be called only when it is known that
85
85
* it is safe under sharing to do so. One use-case is in the withType method below
@@ -92,7 +92,7 @@ object Trees {
92
92
/** The type of the tree. In case of an untyped tree,
93
93
* an UnAssignedTypeException is thrown. (Overridden by empty trees)
94
94
*/
95
- def tpe : T @ uncheckedVariance = {
95
+ final def tpe : T @ uncheckedVariance = {
96
96
if (myTpe == null )
97
97
throw new UnAssignedTypeException (this )
98
98
myTpe
@@ -756,7 +756,6 @@ object Trees {
756
756
}
757
757
758
758
trait WithoutTypeOrPos [- T >: Untyped ] extends Tree [T ] {
759
- override def tpe : T @ uncheckedVariance = NoType .asInstanceOf [T ]
760
759
override def withTypeUnchecked (tpe : Type ) = this .asInstanceOf [ThisTree [Type ]]
761
760
override def pos = NoPosition
762
761
override def setPos (pos : Position ) = {}
@@ -769,6 +768,8 @@ object Trees {
769
768
*/
770
769
case class Thicket [- T >: Untyped ](trees : List [Tree [T ]])
771
770
extends Tree [T ] with WithoutTypeOrPos [T ] {
771
+ myTpe = NoType .asInstanceOf [T ]
772
+
772
773
type ThisTree [- T >: Untyped ] = Thicket [T ]
773
774
override def isEmpty : Boolean = trees.isEmpty
774
775
override def toList : List [Tree [T ]] = flatten(trees)
@@ -787,6 +788,7 @@ object Trees {
787
788
788
789
class EmptyValDef [T >: Untyped ] extends ValDef [T ](
789
790
nme.WILDCARD , genericEmptyTree[T ], genericEmptyTree[T ]) with WithoutTypeOrPos [T ] {
791
+ myTpe = NoType .asInstanceOf [T ]
790
792
override def isEmpty : Boolean = true
791
793
setMods(untpd.Modifiers (PrivateLocal ))
792
794
}
0 commit comments