Skip to content

Commit 93f8ebd

Browse files
More tests added for zip on tuples
1 parent b911e17 commit 93f8ebd

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

tests/neg/tuple-ops.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ val r6: (Int, Int, String) = a.map[[t] =>> Int]([t] => x: t => x match { // err
1919

2020
val r7: ((1, Foo[1]), (2), (3, Foo[3])) =
2121
a.map[[t] =>> (t, Foo[t])]( [t] => x: t => (x, Foo(x)) ) // error
22+
23+
// More Zip
24+
val t1: Int *: Long *: Tuple = (1, 2l, 100, 200)
25+
val t2: Int *: Char *: Tuple = (1, 'c', 33, 42)
26+
val t3: (Int, Int) *: (Long, Long) *: Tuple = t1.zip(t2) // error

tests/run/tuple-ops.check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
()
66
(1,4,9)
77
((1,Foo(1)),(2,Foo(2)),(3,Foo(3)))
8+
((1,1),(2,c),(100,33),(200,42))
9+
()

tests/run/tuple-ops.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,13 @@ val r6: (Int, Int, Int) = a.map[[t] =>> Int]([t] => x: t => x match {
2121
val r7: ((1, Foo[1]), (2, Foo[2]), (3, Foo[3])) =
2222
a.map[[t] =>> (t, Foo[t])]( [t] => x: t => (x, Foo(x)) )
2323

24+
// More Zip
25+
val t1: Int *: Long *: Tuple = (1, 2l, 100, 200)
26+
val t2: Int *: Char *: Tuple = (1, 'c', 33, 42)
27+
val t3: (Int, Int) *: (Long, Char) *: Tuple = t1.zip(t2)
28+
29+
val t4: Unit = d.zip(d)
30+
2431
@main def Test =
25-
List(r1, r2, r3, r4, r5, r6, r7).foreach(println)
32+
List(r1, r2, r3, r4, r5, r6, r7, t3, t4).foreach(println)
33+

0 commit comments

Comments
 (0)