@@ -75,24 +75,22 @@ class GadtConstraint private (
75
75
val self = externalize(param)
76
76
constraint.minLower(param).foldLeft(nonParamBounds(param).lo) { (acc, p) =>
77
77
externalize(p) match
78
- case tp : TypeRef
79
- // drop any lower param that is a GADT symbol
80
- // and is upper-bounded by a non-Any super-type of the original parameter
81
- // e.g. in pos/i14287.min
82
- // B$1 had info <: X and fullBounds >: B$2 <: X, and
83
- // B$2 had info <: B$1 and fullBounds <: B$1
84
- // We can use the info of B$2 to drop the lower-bound of B$1
85
- // and return non-bidirectional bounds B$1 <: X and B$2 <: B$1.
86
- if tp.symbol.isPatternBound && ! tp.info.hiBound.isExactlyAny && self <:< tp.info.hiBound => acc
78
+ // drop any lower param that is a GADT symbol
79
+ // and is upper-bounded by a non-Any super-type of the original parameter
80
+ // e.g. in pos/i14287.min
81
+ // B$1 had info <: X and fullBounds >: B$2 <: X, and
82
+ // B$2 had info <: B$1 and fullBounds <: B$1
83
+ // We can use the info of B$2 to drop the lower-bound of B$1
84
+ // and return non-bidirectional bounds B$1 <: X and B$2 <: B$1.
85
+ case tp : TypeRef if tp.symbol.isPatternBound && self =:= tp.info.hiBound => acc
87
86
case tp => acc | tp
88
87
}
89
88
90
89
def fullUpperBound (param : TypeParamRef )(using Context ): Type =
91
90
val self = externalize(param)
92
91
constraint.minUpper(param).foldLeft(nonParamBounds(param).hi) { (acc, u) =>
93
92
externalize(u) match
94
- case tp : TypeRef // same as fullLowerBounds
95
- if tp.symbol.isPatternBound && ! tp.info.loBound.isExactlyNothing && tp.info.loBound <:< self => acc
93
+ case tp : TypeRef if tp.symbol.isPatternBound && self =:= tp.info.loBound => acc // like fullLowerBound
96
94
case tp =>
97
95
// Any as the upper bound means "no bound", but if F is higher-kinded,
98
96
// Any & F = F[_]; this is wrong for us so we need to short-circuit
0 commit comments