Skip to content

Commit 1d009a4

Browse files
committed
Remove tvars cleanup in typedArgs
1 parent 6d9c46b commit 1d009a4

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala

-23
Original file line numberDiff line numberDiff line change
@@ -500,29 +500,6 @@ object ProtoTypes {
500500
// We only need to propagate constraints if we typed the arguments in a different
501501
// TyperState and if that created additional constraints.
502502
if (passedTyperState ne protoTyperState) && (oldConstraint ne newConstraint) then
503-
// To respect the pre-condition of `mergeConstraintWith` and keep
504-
// `protoTyperState` committable we must ensure that it does not
505-
// contain any type variable which don't already exist in the passed
506-
// TyperState. This is achieved by instantiating any such type
507-
// variable. NOTE: this does not suffice to discard type variables
508-
// in ancestors of `protoTyperState`, if this situation ever
509-
// comes up, an assertion in TyperState will trigger and this code
510-
// will need to be generalized.
511-
if protoTyperState.isCommittable then
512-
val passedConstraint = passedTyperState.constraint
513-
val newLambdas = newConstraint.domainLambdas.filter(tl =>
514-
!passedConstraint.contains(tl) || passedConstraint.hasConflictingTypeVarsFor(tl, newConstraint))
515-
val newTvars = newLambdas.flatMap(_.paramRefs).map(newConstraint.typeVarOfParam)
516-
517-
args1.foreach(arg => Inferencing.instantiateSelected(arg.tpe, newTvars))
518-
519-
// `instantiateSelected` can leave some type variables uninstantiated,
520-
// so we maximize them in a second pass.
521-
newTvars.foreach {
522-
case tvar: TypeVar if !tvar.isInstantiated =>
523-
tvar.instantiate(fromBelow = false)
524-
case _ =>
525-
}
526503
passedTyperState.mergeConstraintWith(protoTyperState)(using passedCtx)
527504
end if
528505
args1

0 commit comments

Comments
 (0)