diff --git a/tests/init/neg/interleaving-params.scala b/tests/init/neg/interleaving-params.scala new file mode 100755 index 000000000000..f0f9cbaf3f53 --- /dev/null +++ b/tests/init/neg/interleaving-params.scala @@ -0,0 +1,9 @@ +import scala.language.experimental.clauseInterleaving + +class Params{ + def bar[T](x: T)[T]: String = ??? // error + def zoo(x: Int)[T, U](x: U): T = ??? // error + def bbb[T <: U](x: U)[U]: U = ??? // error // error + def f0[T](implicit x: T)[U](y: U) = (x,y) // error + def f1[T](implicit x: T)[U] = (x,y) // error +} \ No newline at end of file diff --git a/tests/init/pos/interleaving-overload.scala b/tests/init/pos/interleaving-overload.scala new file mode 100755 index 000000000000..260b3538214a --- /dev/null +++ b/tests/init/pos/interleaving-overload.scala @@ -0,0 +1,24 @@ +import scala.language.experimental.clauseInterleaving + +class A{ + + def f1[T](x: Any)[U] = ??? + def f1[T](x: Int)[U] = ??? + + f1(1) + f1("hello") + f1[Boolean]("a")[Int] + f1[Boolean](1)[Int] + + case class B[U](x: Int) + def b[U](x: Int) = B[U](x) + + def f2[T]: [U] => Int => B[U] = [U] => (x: Int) => b[U](x) + + f2(1) + f2[Any](1) + f2[Any][Any](1) + + b[Int](5) + +} \ No newline at end of file diff --git a/tests/init/pos/interleaving-params.scala b/tests/init/pos/interleaving-params.scala new file mode 100755 index 000000000000..9f98b5f35d5b --- /dev/null +++ b/tests/init/pos/interleaving-params.scala @@ -0,0 +1,19 @@ +import scala.collection.mutable.AbstractSet +import scala.collection.mutable.BitSet +import scala.language.experimental.clauseInterleaving + +class Params{ + type U + def foo[T](x: T)[U >: x.type <: T](using U)[L <: List[U]](l: L): L = ??? + def aaa(x: U): U = ??? + def bbb[T <: U](x: U)[U]: U = ??? + + foo[AbstractSet[Int]](BitSet())[AbstractSet[Int]](using BitSet())[List[AbstractSet[Int]]](List[AbstractSet[Int]]()) +} + +class Param2 extends Params { + type U = AbstractSet[Int] + + aaa(BitSet()) + bbb[BitSet](BitSet())[AbstractSet[Int]] +} \ No newline at end of file