Skip to content

Commit 3a4aabd

Browse files
committed
not constrain if formal contains instantiated type vars
1 parent e41045e commit 3a4aabd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4364,9 +4364,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
43644364
val tm = new TypeMap:
43654365
def apply(t: Type): Type = t match
43664366
case tvar: TypeVar =>
4367-
formalConstrained |= ctx.typerState.constraint.contains(tvar) || tvar.instanceOpt.exists
4368-
val inst = tvar.instanceOpt
4369-
if (inst.exists && !formalConstrained) mapOver(inst) else tvar
4367+
formalConstrained |= ctx.typerState.constraint.contains(tvar) || tvar.instanceOpt.isInstanceOf[TypeVar]
4368+
tvar
43704369
case _ =>
43714370
if formalConstrained then t
43724371
else mapOver(t)

0 commit comments

Comments
 (0)