Skip to content

Commit 650c722

Browse files
committed
Add Tuple1 generic constuctor
1 parent 3d1fee7 commit 650c722

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

library/src-bootstrapped/scala/Tuple.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ object Tuple {
160160
/** Empty tuple */
161161
def apply(): EmptyTuple = scala.runtime.Tuple0.asInstanceOf[EmptyTuple]
162162

163+
/** Tuple with one element */
164+
def apply[T](x: T): T *: EmptyTuple = Tuple1(x)
165+
163166
/** Matches an empty tuple. */
164167
def unapply(x: EmptyTuple): true = true
165168

tests/run-deep-subtype/Tuple-toArray.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object Test {
1414
testArray(i, j => j)
1515

1616
printArray(Tuple().toArray)
17-
printArray(Tuple1(1).toArray)
17+
printArray(Tuple(1).toArray)
1818
printArray((1, 2).toArray)
1919
printArray((1, 2, 3).toArray)
2020
printArray((1, 2, 3, 4).toArray)

0 commit comments

Comments
 (0)