File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed
compiler/src/dotty/tools/dotc/typer
library/src/scala/runtime Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -408,11 +408,8 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
408408 }
409409 val mirrorRef =
410410 if cls.useCompanionAsProductMirror then companionPath(mirroredType, span)
411- else
412- if defn.isTupleClass(cls) then // add `|| cls == defn.PairClass` when we support TupleXXL
413- newTupleMirror(arity = typeElems.size)
414- else
415- anonymousMirror(monoType, ExtendsProductMirror , span)
411+ else if defn.isTupleClass(cls) then newTupleMirror(typeElems.size) // TODO: cls == defn.PairClass when > 22
412+ else anonymousMirror(monoType, ExtendsProductMirror , span)
416413 withNoErrors(mirrorRef.cast(mirrorType))
417414 end makeProductMirror
418415
Original file line number Diff line number Diff line change @@ -4,13 +4,11 @@ package scala.runtime
44 * as we do not need to synthesize an anonymous Mirror class at every callsite.
55 */
66final class TupleMirror (arity : Int ) extends scala.deriving.Mirror .Product with Serializable :
7- assert(arity > 0 ) // EmptyTuple is not a valid `MirroredType` for TupleMirror
7+ assert(arity >= 0 ) // technically could be used for EmptyTuple also, but it has its own singleton mirror.
88
9- override type MirroredMonoType <: NonEmptyTuple
9+ override type MirroredMonoType <: Tuple
1010
1111 final def fromProduct (product : Product ): MirroredMonoType =
1212 if product.productArity != arity then
1313 throw IllegalArgumentException (s " expected Product with $arity elements, got ${product.productArity}" )
1414 runtime.Tuples .fromProduct(product).asInstanceOf [MirroredMonoType ]
15-
16- override final def toString : String = s " <tuple-mirror@ ${Integer .toHexString(hashCode).nn.take(6 )}> "
You can’t perform that action at this time.
0 commit comments