@@ -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
@@ -754,7 +754,6 @@ object Trees {
754
754
}
755
755
756
756
trait WithoutTypeOrPos [- T >: Untyped ] extends Tree [T ] {
757
- override def tpe : T @ uncheckedVariance = NoType .asInstanceOf [T ]
758
757
override def withTypeUnchecked (tpe : Type ) = this .asInstanceOf [ThisTree [Type ]]
759
758
override def pos = NoPosition
760
759
override def setPos (pos : Position ) = {}
@@ -767,6 +766,8 @@ object Trees {
767
766
*/
768
767
case class Thicket [- T >: Untyped ](trees : List [Tree [T ]])
769
768
extends Tree [T ] with WithoutTypeOrPos [T ] {
769
+ myTpe = NoType .asInstanceOf [T ]
770
+
770
771
type ThisTree [- T >: Untyped ] = Thicket [T ]
771
772
override def isEmpty : Boolean = trees.isEmpty
772
773
override def toList : List [Tree [T ]] = flatten(trees)
@@ -785,6 +786,7 @@ object Trees {
785
786
786
787
class EmptyValDef [T >: Untyped ] extends ValDef [T ](
787
788
nme.WILDCARD , genericEmptyTree[T ], genericEmptyTree[T ]) with WithoutTypeOrPos [T ] {
789
+ myTpe = NoType .asInstanceOf [T ]
788
790
override def isEmpty : Boolean = true
789
791
setMods(untpd.Modifiers (PrivateLocal ))
790
792
}
0 commit comments