From a7ac03eb636e683eeb4d6a0e7c4532c34b7ba245 Mon Sep 17 00:00:00 2001 From: Eugene Flesselle Date: Fri, 17 May 2024 15:47:20 +0200 Subject: [PATCH] Adapt toInstantiate in interpolateTypeVars to consider c6081770 constrainIfDependentParamRef can now not only instantiate the tvar being constrained, but also tvars having already been added to buf. We simply re-filter buf at the end as this should be a rare occurrence. [test_scala2_library_tasty] --- compiler/src/dotty/tools/dotc/typer/Inferencing.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala index ed37a869d612..92be3130c99d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala @@ -706,7 +706,9 @@ trait Inferencing { this: Typer => else typr.println(i"no interpolation for nonvariant $tvar in $state") ) - buf.toList + // constrainIfDependentParamRef could also have instantiated tvars added to buf before the check + buf.filterNot(_._1.isInstantiated).toList + end toInstantiate def typeVarsIn(xs: ToInstantiate): TypeVars = xs.foldLeft(SimpleIdentitySet.empty: TypeVars)((tvs, tvi) => tvs + tvi._1)