Skip to content

Commit d06e320

Browse files
Update tests after tuple changes
- dotc/scala-collections.blacklist: Blacklist Unit and TupleN from scala-collections test - tests/neg/i1653.scala: Having an additional superclass on Unit seams to affect the error here (not sure why). - tests/pos/t0301.scala: Since `_2` is now added thought implicit conversion, the pattern used in this case is no longer stable. - tests/pos/tcpoly_bounds1.scala: This test uses the fact that `(A, B) <: Product2[A, B]`, which is no longer the case. - tests/repl/patdef.check: Having the `_i` via implicit conversions remove the @unchecked here - tests/run/tuple-match.scala: Replace Tuple1 in pattern matching with explicit TupleCons pattern. TupleN can still be used in apply position (defined as defs in DottyPredef), but not in unapply position. - tests/run/unapply.scala: Also uses the fact that `(A, B) <: Product2[A, B]`. - tests/run/withIndex.scala: Might be a limitation in typer?: 14 | case _: Array[Tuple2[_, _]] => true | ^^^^^^^^^^^^ |unreducible application of higher-kinded type [A, B] => dotty.TupleCons[A, dotty.TupleCons[B, Unit]] to wildcard arguments
1 parent c3e1dee commit d06e320

File tree

10 files changed

+39
-18
lines changed

10 files changed

+39
-18
lines changed

compiler/test/dotc/scala-collections.blacklist

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,27 @@ scala/util/control/Exception.scala
8181
# 51 | implicit def throwableSubtypeToCatcher[Ex <: Throwable: ClassTag, T](pf: PartialFunction[Ex, T]) =
8282
# | ^
8383
# | cyclic reference involving method mkCatcher
84+
85+
scala/Unit.scala
86+
scala/Tuple1.scala
87+
scala/Tuple2.scala
88+
scala/Tuple3.scala
89+
scala/Tuple4.scala
90+
scala/Tuple5.scala
91+
scala/Tuple6.scala
92+
scala/Tuple7.scala
93+
scala/Tuple8.scala
94+
scala/Tuple9.scala
95+
scala/Tuple10.scala
96+
scala/Tuple11.scala
97+
scala/Tuple12.scala
98+
scala/Tuple13.scala
99+
scala/Tuple14.scala
100+
scala/Tuple15.scala
101+
scala/Tuple16.scala
102+
scala/Tuple17.scala
103+
scala/Tuple18.scala
104+
scala/Tuple19.scala
105+
scala/Tuple20.scala
106+
scala/Tuple21.scala
107+
scala/Tuple22.scala

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,24 +211,20 @@ class CompilationTests extends ParallelSummaryReport with ParallelTesting {
211211
val opt = Array(
212212
"-classpath",
213213
// compile with bootstrapped library on cp:
214-
defaultOutputDir + "lib$1/src/:" +
214+
Jars.dottyLib + ":" +
215215
// as well as bootstrapped compiler:
216216
defaultOutputDir + "dotty1$1/dotty/:" +
217217
Jars.dottyInterfaces
218218
)
219219

220-
def lib =
221-
compileDir("../library/src",
222-
allowDeepSubtypes.and("-Ycheck-reentrant", "-strict", "-priorityclasspath", defaultOutputDir))
223-
224220
def dotty1 =
225221
compileDir("../compiler/src/dotty", opt)
226222

227223
def dotty2 =
228224
compileShallowFilesInDir("../compiler/src/dotty", opt)
229225

230226
{
231-
lib.keepOutput :: dotty1.keepOutput :: {
227+
dotty1.keepOutput :: {
232228
dotty2 +
233229
compileShallowFilesInDir("../compiler/src/dotty/tools", opt) +
234230
compileShallowFilesInDir("../compiler/src/dotty/tools/dotc", opt) +

library/test/dotty/ShowTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ShowTests {
5656
}
5757

5858
@Test def showMaps = {
59-
val mp = scala.collection.immutable.Map("str1" -> "val1", "str2" -> "val2")
59+
val mp = scala.collection.immutable.Map(scala.Tuple2("str1", "val1"), scala.Tuple2("str2", "val2"))
6060
assertEquals("Map(\"str1\" -> \"val1\", \"str2\" -> \"val2\")", mp.show)
6161
}
6262

tests/neg/i1653.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
trait Foo {
2-
def foo() = new Unit with Foo // error: cannot extend final class Unit // error: illegal trait inheritance
2+
def foo() = new Unit with Foo // error: cannot extend final class Unit
33
}

tests/pos/t0301.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ case class Var() extends Expr
66
object Analyzer {
77
def substitution(expr: Expr, cls: (Var,Var)): Expr =
88
expr match {
9-
case cls._2 => cls._1 // source of the error
9+
case e if e == cls._2 => cls._1 // source of the error
1010
case _ => expr
1111
}
1212
}

tests/pos/tcpoly_bounds1.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
class Foo[t[x]<: Tuple2[Int, x]]
1+
case class OldTuple2[+T1, +T2](_1: T1, _2: T2) extends Product2[T1, T2]
22

3-
//
4-
class MyPair[z](a: Int, b: z) extends Tuple2[Int, z](a,b)
3+
class Foo[t[x]<: OldTuple2[Int, x]]
4+
5+
class MyPair[z](a: Int, b: z) extends OldTuple2[Int, z](a,b)
56

67
object foo extends Foo[MyPair]
78

tests/repl/patdef.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ scala> val (Const, List(`x`, _, a), b) = (0, List(0, 1337, 1), 2)
55
val a: Int = 1
66
val b: Int = 2
77
scala> val a@b = 0
8-
val a: Int @unchecked = 0
9-
val b: Int @unchecked = 0
8+
val a: Int = 0
9+
val b: Int = 0
1010
scala> :quit

tests/run/tuple-match.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ object Test {
77
case (_, _, 3, _) => "4, #3"
88
case (_, 2, _, _) => "4, #2"
99
case (_, 2, _) => "3, #2"
10-
case Tuple1(1) => "1, #1"
10+
case dotty.TupleCons(1, ()) => "1, #1"
1111
case (_, _, _, 4) => "4, #4"
1212
case THREE => "THREE"
1313
case (_, 2) => "2, #2"

tests/run/unapply.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object VarFoo {
3232
}
3333

3434
object Foo {
35-
def unapply(x: Any): Option[Product2[Int, String]] = x match {
35+
def unapply(x: Any): Option[(Int, String)] = x match {
3636
case y: Bar => Some(y.size, y.name)
3737
case _ => None
3838
}
@@ -68,7 +68,7 @@ object Foo {
6868
// same, but now object is not top-level
6969
object Mas {
7070
object Gaz {
71-
def unapply(x: Any): Option[Product2[Int, String]] = x match {
71+
def unapply(x: Any): Option[(Int, String)] = x match {
7272
case y: Baz => Some(y.size, y.name)
7373
case _ => None
7474
}

tests/run/withIndex.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object Test {
1111
Console.println(str.zipWithIndex.toList)
1212
assert {
1313
ary.zipWithIndex match {
14-
case _: Array[Tuple2[_,_]] => true
14+
case _: Array[(_, _)] => true
1515
case _ => false
1616
}
1717
}

0 commit comments

Comments
 (0)