Skip to content

Commit 0d3f41e

Browse files
sirthiasmichelou
authored andcommitted
Fix scala#11792 (Tuple.fromProduct doesn't handle Product0)
1 parent 829f8f0 commit 0d3f41e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

library/src/scala/runtime/Tuples.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ object Tuples {
5858
else TupleXXL.fromIArray(xs).asInstanceOf[Tuple]
5959

6060
def fromProduct(xs: Product): Tuple = (xs.productArity match {
61+
case 0 => EmptyTuple
6162
case 1 =>
6263
xs match {
6364
case xs: Tuple1[_] => xs

tests/run/i11793.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
case class Foo()
2+
@main def Test: Unit = Tuple.fromProduct(Foo())

0 commit comments

Comments
 (0)