Skip to content

Commit 3a6f874

Browse files
committed
Update tests
1 parent 99fb102 commit 3a6f874

11 files changed

+33
-40
lines changed

tests/neg/interleaving-ab.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ object Ab:
22
given String = ""
33
given Double = 0
44

5-
def ab[A][B](x: A)(using B): B = summon[B]
6-
5+
def illegal[A][B](x: A)(using B): B = summon[B] // error: Type parameter lists must be separated by a term or using parameter list
6+
7+
def ab[A](x: A)[B](using B): B = summon[B]
78
def test =
89
ab[Int](0: Int) // error

tests/neg/interleaving-typeApply.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
object typeApply:
22

3-
def f3[T <: Int][U <: String](): T => T = ???
4-
def f5[T <: Int][U <: String]: [X <: Unit] => X => X = ???
5-
def f7[T <: Int][U <: String]()[X <: Unit]: X => X = ???
3+
def f3[T <: Int](using DummyImplicit)[U <: String](): T => T = ???
4+
def f5[T <: Int](using DummyImplicit)[U <: String]: [X <: Unit] => X => X = ???
5+
def f7[T <: Int](using DummyImplicit)[U <: String]()[X <: Unit]: X => X = ???
66

77
@main def test = {
88
f3[String]() // error

tests/neg/namedTypeParams.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ object Test {
1717
def f[X, Y](x: X, y: Y): Int = ???
1818

1919
f[X = Int, String](1, "") // error // error
20-
/* Conflicts with Clause Interweaving, stems from named type parameters assuming one type clause
2120
f[X = Int][X = Int][Y = String](1, "") // error: illegal repeated type application
2221

2322
f[X = Int][Y = String](1, "") // error: illegal repeated type application
2423
f[X = Int][String](1, "") // error: illegal repeated type application
2524

2625
f[Y = String][X = Int](1, "") // error: illegal repeated type application
2726
f[Y = String][Int](1, "") // error: illegal repeated type application
28-
*/
27+
28+
def f2[X](using DummyImplicit)[Y](x: X, y: Y): Int = ???
29+
30+
f2[Y = String][X = Int](1, "") // error: Y is undefined
31+
f2[Y = String](1, "") // error: Y is undefined
2932
}

tests/pos/interleaving-ba.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ object BA {
44
given String = ""
55
given Double = 0
66

7-
def ba[B][A](x: A)(using B): B = summon[B]
7+
def ba[A](x: A)[B](using B): B = summon[B]
88

9-
def test = ba[String](0)
9+
def test = ba(0)[String]
1010

1111
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def f1[T][U](x: T, y: U): (T, U) = (x, y)
1+
def f1[T]()[U](x: T, y: U): (T, U) = (x, y)
22
def f2[T](x: T)[U](y: U): (T, U) = (x, y)
3-
def f3[T, U][V](x: T): U = ???
4-
def f4[T](x: T)[U <: x.type](y: U): (T, U) = (x, y)
3+
def f3[T, U](using DummyImplicit)[V](x: T): U = ???
4+
def f4[T](x: T)[U <: x.type](y: U): (T, U) = (x, y)

tests/pos/interleaving-functorInterleaving.scala renamed to tests/pos/interleaving-functor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object functorInterweaving:
1010
def map[A](x: List[A])[B](f: A => B): List[B] =
1111
x.map(f)
1212

13-
def assertTransformation[F[_]: Functor][A](original: F[A])[B](expected: F[B])(mapping: A => B): Unit =
13+
def assertTransformation[F[_]: Functor, A](original: F[A])[B](expected: F[B])(mapping: A => B): Unit =
1414
assert(expected == summon[Functor[F]].map(original)(mapping))
1515

1616
@main def testInterweaving =

tests/pos/interleaving-functorCurrying.scala

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/pos/interleaving-overload.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
class A{
33

4-
def f1[T][U](x: Any) = ???
5-
def f1[T][U](x: Int) = ???
4+
def f1[T](x: Any)[U] = ???
5+
def f1[T](x: Int)[U] = ???
66

77
f1(1)
88
f1("hello")

tests/pos/interleaving-params.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Params{
22
type U
3-
def foo[T](x: T)[U >: x.type <: T][L <: List[U]](l: L): L = ???
3+
def foo[T](x: T)[U >: x.type <: T](using U)[L <: List[U]](l: L): L = ???
44
def aaa(x: U): U = ???
55
def bbb[T <: U](x: U)[U]: U = ???
66
}

tests/pos/interleaving-typeApply.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
object typeApply:
22

33
def f0[T]: [U] => T => T = ???
4-
def f1[T][U]: T => T = ???
5-
def f2[T][U](): T => T = ???
6-
def f3[T <: Int][U <: String](): T => T = ???
7-
def f4[T <: Int][U <: String]: T => T = ???
8-
def f5[T <: Int][U <: String]: [X <: Unit] => X => X = ???
9-
def f6[T <: Int][U <: String](): [X <: Unit] => X => X = ???
10-
def f7[T <: Int][U <: String]()[X <: Unit]: X => X = ???
4+
def f1[T](using DummyImplicit)[U]: T => T = ???
5+
def f2[T](using DummyImplicit)[U](): T => T = ???
6+
def f3[T <: Int](using DummyImplicit)[U <: String](): T => T = ???
7+
def f4[T <: Int](using DummyImplicit)[U <: String]: T => T = ???
8+
def f5[T <: Int](using DummyImplicit)[U <: String]: [X <: Unit] => X => X = ???
9+
def f6[T <: Int](using DummyImplicit)[U <: String](): [X <: Unit] => X => X = ???
10+
def f7[T <: Int](using DummyImplicit)[U <: String]()[X <: Unit]: X => X = ???
1111

1212
@main def test = {
1313
f0[Int][String]

tests/pos/namedTypeParams.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@ object Test {
99
f[Y = String](1, "")
1010

1111

12+
def f2[X](using DummyImplicit)[Y](x: X, y: Y): Int = ???
13+
14+
f2[X = Int][Y = String](1, "")
15+
f2[X = Int](1, "")
16+
17+
1218
}

0 commit comments

Comments
 (0)