File tree Expand file tree Collapse file tree 3 files changed +7
-12
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -686,14 +686,12 @@ object TypeOps:
686
686
}
687
687
}
688
688
689
- def isPatternTypeSymbol (sym : Symbol ) = ! sym.isClass && sym.is(Case )
690
-
691
689
// replace uninstantiated type vars with WildcardType, check tests/patmat/3333.scala
692
690
def instUndetMap (implicit ctx : Context ) = new TypeMap {
693
691
def apply (t : Type ): Type = t match {
694
692
case tvar : TypeVar if ! tvar.isInstantiated =>
695
693
WildcardType (tvar.origin.underlying.bounds)
696
- case tref : TypeRef if isPatternTypeSymbol( tref.typeSymbol) =>
694
+ case tref : TypeRef if tref.typeSymbol.isPatternBound =>
697
695
WildcardType (tref.underlying.bounds)
698
696
case _ => mapOver(t)
699
697
}
Original file line number Diff line number Diff line change @@ -55,22 +55,20 @@ object TypeTestsCasts {
55
55
*/
56
56
def checkable (X : Type , P : Type , span : Span )(using Context ): Boolean = {
57
57
def isAbstract (P : Type ) = ! P .dealias.typeSymbol.isClass
58
- def isPatternTypeSymbol (sym : Symbol ) = ! sym.isClass && sym.is(Case )
59
58
60
59
def replaceP (tp : Type )(implicit ctx : Context ) = new TypeMap {
61
60
def apply (tp : Type ) = tp match {
62
- case tref : TypeRef
63
- if isPatternTypeSymbol(tref.typeSymbol) => WildcardType
64
- case AnnotatedType (_, annot)
65
- if annot.symbol == defn. UncheckedAnnot => WildcardType
61
+ case tref : TypeRef if tref.typeSymbol.isPatternBound =>
62
+ WildcardType
63
+ case AnnotatedType (_, annot) if annot.symbol == defn. UncheckedAnnot =>
64
+ WildcardType
66
65
case _ => mapOver(tp)
67
66
}
68
67
}.apply(tp)
69
68
70
69
def replaceX (tp : Type )(implicit ctx : Context ) = new TypeMap {
71
70
def apply (tp : Type ) = tp match {
72
- case tref : TypeRef
73
- if isPatternTypeSymbol(tref.typeSymbol) =>
71
+ case tref : TypeRef if tref.typeSymbol.isPatternBound =>
74
72
if (variance == 1 ) tref.info.hiBound
75
73
else if (variance == - 1 ) tref.info.loBound
76
74
else OrType (defn.AnyType , defn.NothingType )
Original file line number Diff line number Diff line change @@ -464,7 +464,6 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
464
464
* }
465
465
*/
466
466
private def erase (tp : Type , inArray : Boolean = false ): Type = trace(i " $tp erased to " , debug) {
467
- def isPatternTypeSymbol (sym : Symbol ) = ! sym.isClass && sym.is(Case )
468
467
469
468
tp match {
470
469
case tp @ AppliedType (tycon, args) =>
@@ -476,7 +475,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
476
475
AndType (erase(tp1, inArray), erase(tp2, inArray))
477
476
case tp @ RefinedType (parent, _, _) =>
478
477
erase(parent)
479
- case tref : TypeRef if isPatternTypeSymbol( tref.typeSymbol) =>
478
+ case tref : TypeRef if tref.typeSymbol.isPatternBound =>
480
479
if (inArray) tref.underlying else WildcardType
481
480
case _ => tp
482
481
}
You can’t perform that action at this time.
0 commit comments