scala.runtime.TupleMirror.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scala3-library_3 Show documentation
Show all versions of scala3-library_3 Show documentation
scala3-library-bootstrapped
package scala.runtime
/** A concrete subclass of `scala.deriving.Mirror.Product`, enabling reduction of bytecode size.
* as we do not need to synthesize an anonymous Mirror class at every callsite.
*/
final class TupleMirror(arity: Int) extends scala.deriving.Mirror.Product with Serializable:
assert(arity >= 0) // technically could be used for EmptyTuple also, but it has its own singleton mirror.
override type MirroredMonoType <: Tuple
final def fromProduct(product: Product): MirroredMonoType =
if product.productArity != arity then
throw IllegalArgumentException(s"expected Product with $arity elements, got ${product.productArity}")
runtime.Tuples.fromProduct(product).asInstanceOf[MirroredMonoType]
© 2015 - 2025 Weber Informatics LLC | Privacy Policy