@@ -110,10 +110,8 @@ trait PatternTypeConstrainer { self: TypeComparer =>
110
110
case scrut : TypeRef if scrut.symbol.isClass =>
111
111
// consider all parents
112
112
val parents = scrut.parents
113
- val andType = trace(i " andType of scrut " , gadts) {
114
- buildAndType(parents)
115
- }
116
- constrainPatternType(pat, andType)
113
+ val andType = buildAndType(parents)
114
+ ! andType.exists || constrainPatternType(pat, andType)
117
115
case scrut @ AppliedType (tycon : TypeRef , _) if tycon.symbol.isClass =>
118
116
val patClassSym = pat.classSymbol
119
117
// find all shared parents in the inheritance hierarchy between pat and scrut
@@ -129,10 +127,8 @@ trait PatternTypeConstrainer { self: TypeComparer =>
129
127
}
130
128
val allSyms = allParentsSharedWithPat(tycon, tycon.symbol.asClass)
131
129
val baseClasses = allSyms map scrut.baseType
132
- val andType = trace(i " andType of scrut " , gadts) {
133
- buildAndType(baseClasses)
134
- }
135
- constrainPatternType(pat, andType)
130
+ val andType = buildAndType(baseClasses)
131
+ ! andType.exists || constrainPatternType(pat, andType)
136
132
case _ =>
137
133
val upcasted : Type = scrut match {
138
134
case scrut : TypeProxy => scrut.superType
0 commit comments