@@ -1309,19 +1309,15 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
13091309 end extension
13101310 end TypeBlockMethodsImpl
13111311
1312- type TypeBoundsTree = tpd.TypeBoundsTree
1312+ type TypeBoundsTree = tpd.TypeBoundsTree | tpd. TypeTree
13131313
13141314 object TypeBoundsTreeTypeTest extends TypeTest [Tree , TypeBoundsTree ]:
13151315 def unapply (x : Tree ): Option [TypeBoundsTree & x.type ] = x match
13161316 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)
13231320 case _ => None
1324- }
13251321 case _ => None
13261322 end TypeBoundsTreeTypeTest
13271323
@@ -1333,8 +1329,12 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext, QuoteUnpickl
13331329 object TypeBoundsTreeMethodsImpl extends TypeBoundsTreeMethods :
13341330 extension (self : TypeBoundsTree ):
13351331 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)
13381338 end extension
13391339 end TypeBoundsTreeMethodsImpl
13401340
0 commit comments