From 1d009a44e35e4c8990c57213e4d91e521a536e17 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Fri, 25 Oct 2024 12:33:33 +0100 Subject: [PATCH] Remove tvars cleanup in typedArgs --- .../dotty/tools/dotc/typer/ProtoTypes.scala | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala index 6d33e272feca..56cef50cf855 100644 --- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -500,29 +500,6 @@ object ProtoTypes { // We only need to propagate constraints if we typed the arguments in a different // TyperState and if that created additional constraints. if (passedTyperState ne protoTyperState) && (oldConstraint ne newConstraint) then - // To respect the pre-condition of `mergeConstraintWith` and keep - // `protoTyperState` committable we must ensure that it does not - // contain any type variable which don't already exist in the passed - // TyperState. This is achieved by instantiating any such type - // variable. NOTE: this does not suffice to discard type variables - // in ancestors of `protoTyperState`, if this situation ever - // comes up, an assertion in TyperState will trigger and this code - // will need to be generalized. - if protoTyperState.isCommittable then - val passedConstraint = passedTyperState.constraint - val newLambdas = newConstraint.domainLambdas.filter(tl => - !passedConstraint.contains(tl) || passedConstraint.hasConflictingTypeVarsFor(tl, newConstraint)) - val newTvars = newLambdas.flatMap(_.paramRefs).map(newConstraint.typeVarOfParam) - - args1.foreach(arg => Inferencing.instantiateSelected(arg.tpe, newTvars)) - - // `instantiateSelected` can leave some type variables uninstantiated, - // so we maximize them in a second pass. - newTvars.foreach { - case tvar: TypeVar if !tvar.isInstantiated => - tvar.instantiate(fromBelow = false) - case _ => - } passedTyperState.mergeConstraintWith(protoTyperState)(using passedCtx) end if args1