@@ -78,7 +78,7 @@ object Trees {
78
78
/** The type constructor at the root of the tree */
79
79
type ThisTree [T >: Untyped ] <: Tree [T ]
80
80
81
- private [ this ] var myTpe : T = _
81
+ protected var myTpe : T @ uncheckedVariance = _
82
82
83
83
/** Destructively set the type of the tree. This should be called only when it is known that
84
84
* it is safe under sharing to do so. One use-case is in the withType method below
@@ -91,7 +91,7 @@ object Trees {
91
91
/** The type of the tree. In case of an untyped tree,
92
92
* an UnAssignedTypeException is thrown. (Overridden by empty trees)
93
93
*/
94
- def tpe : T @ uncheckedVariance = {
94
+ final def tpe : T @ uncheckedVariance = {
95
95
if (myTpe == null )
96
96
throw new UnAssignedTypeException (this )
97
97
myTpe
@@ -727,7 +727,6 @@ object Trees {
727
727
}
728
728
729
729
trait WithoutTypeOrPos [- T >: Untyped ] extends Tree [T ] {
730
- override def tpe : T @ uncheckedVariance = NoType .asInstanceOf [T ]
731
730
override def withTypeUnchecked (tpe : Type ) = this .asInstanceOf [ThisTree [Type ]]
732
731
override def pos = NoPosition
733
732
override def setPos (pos : Position ) = {}
@@ -740,6 +739,8 @@ object Trees {
740
739
*/
741
740
case class Thicket [- T >: Untyped ](trees : List [Tree [T ]])
742
741
extends Tree [T ] with WithoutTypeOrPos [T ] {
742
+ myTpe = NoType .asInstanceOf [T ]
743
+
743
744
type ThisTree [- T >: Untyped ] = Thicket [T ]
744
745
override def isEmpty : Boolean = trees.isEmpty
745
746
override def toList : List [Tree [T ]] = flatten(trees)
@@ -758,6 +759,7 @@ object Trees {
758
759
759
760
class EmptyValDef [T >: Untyped ] extends ValDef [T ](
760
761
nme.WILDCARD , genericEmptyTree[T ], genericEmptyTree[T ]) with WithoutTypeOrPos [T ] {
762
+ myTpe = NoType .asInstanceOf [T ]
761
763
override def isEmpty : Boolean = true
762
764
setMods(untpd.Modifiers (PrivateLocal ))
763
765
}
0 commit comments