Skip to content

Commit d08609b

Browse files
committed
Remove incorrect type simplification
`TypeOps#simplify` is supposed to produce a type `=:=` the original type, but it replaced type variables created using `newTypeVar` by one of their bound, this is wrong since that type variable might get instantiated to a different type later. This simplification was added in #2209 to prevent a pickling crash in tests/pos/i2152.scala but does not appear to be needed anymore: an uninstantiated type variable being preserved after typer is always wrong, so the underlying bug must have been fixed since then.
1 parent 38272aa commit d08609b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

compiler/src/dotty/tools/dotc/core/TypeOps.scala

+2-8
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,8 @@ object TypeOps:
137137
case tp1 => tp1
138138
}
139139
case tp: TypeParamRef =>
140-
if (tp.paramName.is(DepParamName)) {
141-
val bounds = ctx.typeComparer.bounds(tp)
142-
if (bounds.lo.isRef(defn.NothingClass)) bounds.hi else bounds.lo
143-
}
144-
else {
145-
val tvar = ctx.typerState.constraint.typeVarOfParam(tp)
146-
if (tvar.exists) tvar else tp
147-
}
140+
val tvar = ctx.typerState.constraint.typeVarOfParam(tp)
141+
if (tvar.exists) tvar else tp
148142
case _: ThisType | _: BoundType =>
149143
tp
150144
case tp: AliasingBounds =>

0 commit comments

Comments
 (0)