@@ -690,8 +690,10 @@ object Trees {
690
690
type ThisTree [- T >: Untyped ] = ByNameTypeTree [T ]
691
691
}
692
692
693
- /** >: lo <: hi */
694
- case class TypeBoundsTree [- T >: Untyped ] private [ast] (lo : Tree [T ], hi : Tree [T ])(implicit @ constructorOnly src : SourceFile )
693
+ /** >: lo <: hi
694
+ * >: lo <: hi = alias for RHS of bounded opaque type
695
+ */
696
+ case class TypeBoundsTree [- T >: Untyped ] private [ast] (lo : Tree [T ], hi : Tree [T ], alias : Tree [T ])(implicit @ constructorOnly src : SourceFile )
695
697
extends TypTree [T ] {
696
698
type ThisTree [- T >: Untyped ] = TypeBoundsTree [T ]
697
699
}
@@ -760,7 +762,8 @@ object Trees {
760
762
/** mods class name template or
761
763
* mods trait name template or
762
764
* mods type name = rhs or
763
- * mods type name >: lo <: hi, if rhs = TypeBoundsTree(lo, hi) & (lo ne hi)
765
+ * mods type name >: lo <: hi, if rhs = TypeBoundsTree(lo, hi) or
766
+ * mods type name >: lo <: hi = rhs if rhs = TypeBoundsTree(lo, hi, alias) and opaque in mods
764
767
*/
765
768
case class TypeDef [- T >: Untyped ] private [ast] (name : TypeName , rhs : Tree [T ])(implicit @ constructorOnly src : SourceFile )
766
769
extends MemberDef [T ] {
@@ -811,8 +814,6 @@ object Trees {
811
814
extends ProxyTree [T ] {
812
815
type ThisTree [- T >: Untyped ] = Annotated [T ]
813
816
def forwardTo : Tree [T ] = arg
814
- override def disableOverlapChecks = true
815
- // disable overlaps checks since the WithBounds annotation swaps type and annotation.
816
817
}
817
818
818
819
trait WithoutTypeOrPos [- T >: Untyped ] extends Tree [T ] {
@@ -1151,9 +1152,9 @@ object Trees {
1151
1152
case tree : ByNameTypeTree if (result eq tree.result) => tree
1152
1153
case _ => finalize(tree, untpd.ByNameTypeTree (result)(sourceFile(tree)))
1153
1154
}
1154
- def TypeBoundsTree (tree : Tree )(lo : Tree , hi : Tree )(implicit ctx : Context ): TypeBoundsTree = tree match {
1155
- case tree : TypeBoundsTree if (lo eq tree.lo) && (hi eq tree.hi) => tree
1156
- case _ => finalize(tree, untpd.TypeBoundsTree (lo, hi)(sourceFile(tree)))
1155
+ def TypeBoundsTree (tree : Tree )(lo : Tree , hi : Tree , alias : Tree )(implicit ctx : Context ): TypeBoundsTree = tree match {
1156
+ case tree : TypeBoundsTree if (lo eq tree.lo) && (hi eq tree.hi) && (alias eq tree.alias) => tree
1157
+ case _ => finalize(tree, untpd.TypeBoundsTree (lo, hi, alias )(sourceFile(tree)))
1157
1158
}
1158
1159
def Bind (tree : Tree )(name : Name , body : Tree )(implicit ctx : Context ): Bind = tree match {
1159
1160
case tree : Bind if (name eq tree.name) && (body eq tree.body) => tree
@@ -1304,8 +1305,8 @@ object Trees {
1304
1305
cpy.MatchTypeTree (tree)(transform(bound), transform(selector), transformSub(cases))
1305
1306
case ByNameTypeTree (result) =>
1306
1307
cpy.ByNameTypeTree (tree)(transform(result))
1307
- case TypeBoundsTree (lo, hi) =>
1308
- cpy.TypeBoundsTree (tree)(transform(lo), transform(hi))
1308
+ case TypeBoundsTree (lo, hi, alias ) =>
1309
+ cpy.TypeBoundsTree (tree)(transform(lo), transform(hi), transform(alias) )
1309
1310
case Bind (name, body) =>
1310
1311
cpy.Bind (tree)(name, transform(body))
1311
1312
case Alternative (trees) =>
@@ -1428,8 +1429,8 @@ object Trees {
1428
1429
this (this (this (x, bound), selector), cases)
1429
1430
case ByNameTypeTree (result) =>
1430
1431
this (x, result)
1431
- case TypeBoundsTree (lo, hi) =>
1432
- this (this (x, lo), hi)
1432
+ case TypeBoundsTree (lo, hi, alias ) =>
1433
+ this (this (this ( x, lo), hi), alias )
1433
1434
case Bind (name, body) =>
1434
1435
this (x, body)
1435
1436
case Alternative (trees) =>
0 commit comments