@@ -234,7 +234,7 @@ object TastyImpl extends scala.tasty.Tasty {
234
234
235
235
implicit def TermDeco (t : Term ): AbstractTerm = new AbstractTerm {
236
236
def pos (implicit ctx : Context ): Position = new TastyPosition (t.pos)
237
- def tpe : Types .Type = t.tpe
237
+ def tpe ( implicit ctx : Context ) : Types .Type = t.tpe.stripTypeVar
238
238
239
239
def toExpr [T : quoted.Type ](implicit ctx : Context ): quoted.Expr [T ] = {
240
240
def typecheck (implicit ctx0 : FreshContext ) = {
@@ -410,7 +410,7 @@ object TastyImpl extends scala.tasty.Tasty {
410
410
def unapply (x : Term )(implicit ctx : Context ): Option [(Term , Int , Type )] = x match {
411
411
case x : tpd.Select @ unchecked =>
412
412
x.name match {
413
- case NameKinds .OuterSelectName (_, levels) => Some ((x.qualifier, levels, x.tpe))
413
+ case NameKinds .OuterSelectName (_, levels) => Some ((x.qualifier, levels, x.tpe.stripTypeVar ))
414
414
case _ => None
415
415
}
416
416
case _ => None
@@ -437,7 +437,7 @@ object TastyImpl extends scala.tasty.Tasty {
437
437
438
438
implicit def PatternDeco (x : Pattern ): AbstractPattern = new AbstractPattern {
439
439
def pos (implicit ctx : Context ): Position = new TastyPosition (x.pos)
440
- def tpe : Types .Type = x.tpe
440
+ def tpe ( implicit ctx : Context ) : Types .Type = x.tpe.stripTypeVar
441
441
}
442
442
443
443
def patternClassTag : ClassTag [Pattern ] = implicitly[ClassTag [Pattern ]]
@@ -483,7 +483,7 @@ object TastyImpl extends scala.tasty.Tasty {
483
483
type MaybeTypeTree = tpd.Tree
484
484
485
485
implicit def MaybeTypeTreeDeco (x : MaybeTypeTree ): AbstractMaybeTypeTree = new AbstractMaybeTypeTree {
486
- def tpe : Type = x.tpe
486
+ def tpe ( implicit ctx : Context ) : Type = x.tpe.stripTypeVar
487
487
}
488
488
489
489
// ----- TypeTrees ------------------------------------------------
@@ -494,7 +494,7 @@ object TastyImpl extends scala.tasty.Tasty {
494
494
495
495
implicit def TypeTreeDeco (x : TypeTree ): AbstractTypeTree = new AbstractTypeTree {
496
496
def pos (implicit ctx : Context ): Position = new TastyPosition (x.pos)
497
- def tpe : Types .Type = x.tpe
497
+ def tpe ( implicit ctx : Context ) : Types .Type = x.tpe.stripTypeVar
498
498
def toType (implicit ctx : Context ): quoted.Type [_] = new quoted.Types .TreeType (x)
499
499
}
500
500
@@ -638,35 +638,35 @@ object TastyImpl extends scala.tasty.Tasty {
638
638
639
639
val AppliedType : AppliedTypeExtractor = new AppliedTypeExtractor {
640
640
def unapply (x : Type )(implicit ctx : Context ): Option [(Type , List [MaybeType /* Type | TypeBounds */ ])] = x match {
641
- case Types .AppliedType (tycon, args) => Some ((tycon, args))
641
+ case Types .AppliedType (tycon, args) => Some ((tycon.stripTypeVar , args.map(_.stripTypeVar) ))
642
642
case _ => None
643
643
}
644
644
}
645
645
646
646
val AnnotatedType : AnnotatedTypeExtractor = new AnnotatedTypeExtractor {
647
647
def unapply (x : Type )(implicit ctx : Context ): Option [(Type , Term )] = x match {
648
- case Types .AnnotatedType (underlying, annot) => Some ((underlying, annot.tree))
648
+ case Types .AnnotatedType (underlying, annot) => Some ((underlying.stripTypeVar , annot.tree))
649
649
case _ => None
650
650
}
651
651
}
652
652
653
653
val AndType : AndTypeExtractor = new AndTypeExtractor {
654
654
def unapply (x : Type )(implicit ctx : Context ): Option [(Type , Type )] = x match {
655
- case Types .AndType (left, right) => Some (left, right)
655
+ case Types .AndType (left, right) => Some (left.stripTypeVar , right.stripTypeVar )
656
656
case _ => None
657
657
}
658
658
}
659
659
660
660
val OrType : OrTypeExtractor = new OrTypeExtractor {
661
661
def unapply (x : Type )(implicit ctx : Context ): Option [(Type , Type )] = x match {
662
- case Types .OrType (left, right) => Some (left, right)
662
+ case Types .OrType (left, right) => Some (left.stripTypeVar , right.stripTypeVar )
663
663
case _ => None
664
664
}
665
665
}
666
666
667
667
val ByNameType : ByNameTypeExtractor = new ByNameTypeExtractor {
668
668
def unapply (x : Type )(implicit ctx : Context ): Option [Type ] = x match {
669
- case Types .ExprType (resType) => Some (resType)
669
+ case Types .ExprType (resType) => Some (resType.stripTypeVar )
670
670
case _ => None
671
671
}
672
672
}
@@ -701,7 +701,7 @@ object TastyImpl extends scala.tasty.Tasty {
701
701
702
702
val RecursiveType : RecursiveTypeExtractor = new RecursiveTypeExtractor {
703
703
def unapply (x : RecursiveType )(implicit ctx : Context ): Option [Type ] = x match {
704
- case tp : Types .RecType => Some (tp.underlying)
704
+ case tp : Types .RecType => Some (tp.underlying.stripTypeVar )
705
705
case _ => None
706
706
}
707
707
}
0 commit comments