@@ -1309,19 +1309,15 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
1309
1309
end extension
1310
1310
end TypeBlockMethodsImpl
1311
1311
1312
- type TypeBoundsTree = tpd.TypeBoundsTree
1312
+ type TypeBoundsTree = tpd.TypeBoundsTree | tpd. TypeTree
1313
1313
1314
1314
object TypeBoundsTreeTypeTest extends TypeTest [Tree , TypeBoundsTree ]:
1315
1315
def unapply (x : Tree ): Option [TypeBoundsTree & x.type ] = x match
1316
1316
case x : (tpd.TypeBoundsTree & x.type ) => Some (x)
1317
- case tpt @ tpd.TypeTree () =>
1318
- // TODO only enums generate this kind of type bounds. Is this possible without enums? If not generate tpd.TypeBoundsTree for enums instead
1319
- (tpt.tpe: Any ) match {
1320
- case tpe : Types .TypeBounds =>
1321
- // FIXME return x.type
1322
- Some (tpd.TypeBoundsTree (tpd.TypeTree (tpe.lo).withSpan(x.span), tpd.TypeTree (tpe.hi).withSpan(x.span)).asInstanceOf [TypeBoundsTree & x.type ])
1317
+ case x : (tpd.TypeTree & x.type ) =>
1318
+ x.tpe match
1319
+ case tpe : Types .TypeBounds => Some (x)
1323
1320
case _ => None
1324
- }
1325
1321
case _ => None
1326
1322
end TypeBoundsTreeTypeTest
1327
1323
@@ -1333,8 +1329,12 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
1333
1329
object TypeBoundsTreeMethodsImpl extends TypeBoundsTreeMethods :
1334
1330
extension (self : TypeBoundsTree ):
1335
1331
def tpe : TypeBounds = self.tpe.asInstanceOf [Types .TypeBounds ]
1336
- def low : TypeTree = self.lo
1337
- def hi : TypeTree = self.hi
1332
+ def low : TypeTree = self match
1333
+ case self : tpd.TypeBoundsTree => self.lo
1334
+ case self : tpd.TypeTree => tpd.TypeTree (self.tpe.asInstanceOf [Types .TypeBounds ].lo).withSpan(self.span)
1335
+ def hi : TypeTree = self match
1336
+ case self : tpd.TypeBoundsTree => self.hi
1337
+ case self : tpd.TypeTree => tpd.TypeTree (self.tpe.asInstanceOf [Types .TypeBounds ].hi).withSpan(self.span)
1338
1338
end extension
1339
1339
end TypeBoundsTreeMethodsImpl
1340
1340
0 commit comments