@@ -298,13 +298,6 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
298
298
n == m
299
299
case _ => this .asClass eq that.asClass // class equality otherwise
300
300
301
- def isSub (that : MirrorSource )(using Context ): Boolean = (this .arity, that.arity) match
302
- case (n, m) if n > 0 || m > 0 =>
303
- // we shortcut when at least one was a tuple.
304
- // This protects us from comparing classes for two TupleXXL with different arities.
305
- n == m
306
- case _ => this .asClass isSubClass that.asClass
307
-
308
301
def asClass (using Context ): Symbol = this match
309
302
case ClassSymbol (cls) => cls
310
303
case GenericTuple (arity, _) =>
@@ -375,9 +368,11 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
375
368
val mirroredClass = msrc.asClass
376
369
val accessors = mirroredClass.caseAccessors.filterNot(_.isAllOf(PrivateLocal ))
377
370
val elemLabels = accessors.map(acc => ConstantType (Constant (acc.name.toString)))
378
- val nestedPairs = msrc match
379
- case MirrorSource .GenericTuple (_, args) => TypeOps .nestedPairs(args)
380
- case _ => TypeOps .nestedPairs(accessors.map(mirroredType.resultType.memberInfo(_).widenExpr))
371
+ val (arity, nestedPairs) = msrc match
372
+ case MirrorSource .GenericTuple (arity, args) =>
373
+ (Some (arity), TypeOps .nestedPairs(args))
374
+ case MirrorSource .ClassSymbol (cls) =>
375
+ (None , TypeOps .nestedPairs(accessors.map(mirroredType.resultType.memberInfo(_).widenExpr)))
381
376
val (monoType, elemsType) = mirroredType match
382
377
case mirroredType : HKTypeLambda =>
383
378
(mkMirroredMonoType(mirroredType), mirroredType.derivedLambdaType(resType = nestedPairs))
@@ -392,11 +387,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
392
387
.refinedWith(tpnme.MirroredElemLabels , TypeAlias (elemsLabels))
393
388
val mirrorRef =
394
389
if mirroredClass.useCompanionAsProductMirror then companionPath(mirroredType, span)
395
- else
396
- val arity = msrc match
397
- case MirrorSource .GenericTuple (arity, _) => Some (arity)
398
- case _ => None
399
- anonymousMirror(monoType, ExtendsProductMirror , arity, span)
390
+ else anonymousMirror(monoType, ExtendsProductMirror , arity, span)
400
391
withNoErrors(mirrorRef.cast(mirrorType))
401
392
end makeProductMirror
402
393
0 commit comments