File tree 1 file changed +10
-5
lines changed
compiler/src/dotty/tools/dotc/typer 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -149,11 +149,16 @@ object Inferencing {
149
149
tp match {
150
150
case param : TypeParamRef =>
151
151
val constraint = ctx.typerState.constraint
152
- if (constraint.contains(param) &&
153
- (constraint.fullUpperBound(param) frozen_<:< constraint.fullLowerBound(param))) {
154
- typr.println(i " replace singleton $param := ${constraint.fullLowerBound(param)}" )
155
- ctx.typerState.constraint = constraint.replace(param,
156
- ctx.typeComparer.approximation(param, fromBelow = true ))
152
+ constraint.entry(param) match {
153
+ case TypeBounds (lo, hi)
154
+ if constraint.lower(param).isEmpty && constraint.upper(param).isEmpty &&
155
+ hi <:< lo =>
156
+ // if lower or upper is nonEmpty, the full bounds can't be equal, since
157
+ // common type params in lower and upper are eliminated through unification
158
+ typr.println(i " replace singleton $param := ${constraint.fullLowerBound(param)}" )
159
+ ctx.typerState.constraint = constraint.replace(param,
160
+ ctx.typeComparer.approximation(param, fromBelow = true ))
161
+ case _ =>
157
162
}
158
163
case _ =>
159
164
}
You can’t perform that action at this time.
0 commit comments