File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -407,13 +407,19 @@ trait TypeAssigner {
407407 case _ => foldOver(ps, t)
408408 }
409409 }
410- val params = getParams(new mutable.ListBuffer [TypeSymbol ](), pat).toList
411- pat.tpe match
410+ val params1 = getParams(new mutable.ListBuffer [TypeSymbol ](), pat).toList
411+ val params2 = pat.tpe match
412412 case AppliedType (tycon, args) =>
413413 val tparams = tycon.typeParamSymbols
414- for param <- params do param.info = param.info.subst(tparams, args)
415- case _ =>
416- HKTypeLambda .fromParams(params, defn.MatchCase (pat.tpe, body.tpe))
414+ params1.mapconserve { param =>
415+ val info1 = param.info
416+ val info2 = info1.subst(tparams, args)
417+ if info2 eq info1 then param else param.copy(info = info2).asType
418+ }
419+ case _ => params1
420+ val matchCase1 = defn.MatchCase (pat.tpe, body.tpe)
421+ val matchCase2 = if params2 eq params1 then matchCase1 else matchCase1.substSym(params1, params2)
422+ HKTypeLambda .fromParams(params2, matchCase2)
417423 }
418424 else body.tpe
419425 tree.withType(ownType)
You can’t perform that action at this time.
0 commit comments