@@ -79,7 +79,7 @@ object Trees {
7979 /** The type constructor at the root of the tree */
8080 type ThisTree [T >: Untyped ] <: Tree [T ]
8181
82- private [ this ] var myTpe : T = _
82+ protected var myTpe : T @ uncheckedVariance = _
8383
8484 /** Destructively set the type of the tree. This should be called only when it is known that
8585 * it is safe under sharing to do so. One use-case is in the withType method below
@@ -92,7 +92,7 @@ object Trees {
9292 /** The type of the tree. In case of an untyped tree,
9393 * an UnAssignedTypeException is thrown. (Overridden by empty trees)
9494 */
95- def tpe : T @ uncheckedVariance = {
95+ final def tpe : T @ uncheckedVariance = {
9696 if (myTpe == null )
9797 throw new UnAssignedTypeException (this )
9898 myTpe
@@ -756,7 +756,6 @@ object Trees {
756756 }
757757
758758 trait WithoutTypeOrPos [- T >: Untyped ] extends Tree [T ] {
759- override def tpe : T @ uncheckedVariance = NoType .asInstanceOf [T ]
760759 override def withTypeUnchecked (tpe : Type ) = this .asInstanceOf [ThisTree [Type ]]
761760 override def pos = NoPosition
762761 override def setPos (pos : Position ) = {}
@@ -769,6 +768,8 @@ object Trees {
769768 */
770769 case class Thicket [- T >: Untyped ](trees : List [Tree [T ]])
771770 extends Tree [T ] with WithoutTypeOrPos [T ] {
771+ myTpe = NoType .asInstanceOf [T ]
772+
772773 type ThisTree [- T >: Untyped ] = Thicket [T ]
773774 override def isEmpty : Boolean = trees.isEmpty
774775 override def toList : List [Tree [T ]] = flatten(trees)
@@ -787,6 +788,7 @@ object Trees {
787788
788789 class EmptyValDef [T >: Untyped ] extends ValDef [T ](
789790 nme.WILDCARD , genericEmptyTree[T ], genericEmptyTree[T ]) with WithoutTypeOrPos [T ] {
791+ myTpe = NoType .asInstanceOf [T ]
790792 override def isEmpty : Boolean = true
791793 setMods(untpd.Modifiers (PrivateLocal ))
792794 }
0 commit comments