Skip to content

Commit 028c666

Browse files
committed
Harden new productMirrorCode to work for erroneous code
1 parent 367d730 commit 028c666

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
278278
val (monoType, elemsType) = mirroredType match
279279
case mirroredType: HKTypeLambda =>
280280
def accessorType(acc: Symbol) =
281-
acc.info.subst(cls.typeParams, mirroredType.paramRefs)
281+
if cls.typeParams.hasSameLengthAs(mirroredType.paramRefs) then
282+
acc.info.subst(cls.typeParams, mirroredType.paramRefs)
283+
else
284+
acc.info
282285
val elems =
283286
mirroredType.derivedLambdaType(
284287
resType = TypeOps.nestedPairs(accessors.map(accessorType))

0 commit comments

Comments
 (0)