diff --git a/tests/neg/context-bounds-migration-3.5.check b/tests/neg/context-bounds-migration-3.5.check new file mode 100644 index 000000000000..dd8a2aeefbf3 --- /dev/null +++ b/tests/neg/context-bounds-migration-3.5.check @@ -0,0 +1,6 @@ +-- Error: tests/neg/context-bounds-migration-3.5.scala:9:2 ------------------------------------------------------------- +9 | foo(C[Int]()) // error + | ^^^ + | Context bounds will map to context parameters. + | A `using` clause is needed to pass explicit arguments to them. + | This code can be rewritten automatically under -rewrite -source 3.4-migration. diff --git a/tests/neg/context-bounds-migration-3.5.scala b/tests/neg/context-bounds-migration-3.5.scala new file mode 100644 index 000000000000..e5c571d0e22e --- /dev/null +++ b/tests/neg/context-bounds-migration-3.5.scala @@ -0,0 +1,10 @@ +//> using options -source 3.5 + +class C[T] +def foo[X: C] = () + +given [T]: C[T] = C[T]() + +def Test = + foo(C[Int]()) // error + foo(using C[Int]()) // ok diff --git a/tests/neg/context-bounds-migration-future.check b/tests/neg/context-bounds-migration-future.check new file mode 100644 index 000000000000..f56da5d6b28d --- /dev/null +++ b/tests/neg/context-bounds-migration-future.check @@ -0,0 +1,6 @@ +-- [E050] Type Error: tests/neg/context-bounds-migration-future.scala:9:2 ---------------------------------------------- +9 | foo(C[Int]()) // error + | ^^^ + | method foo does not take more parameters + | + | longer explanation available when compiling with `-explain` diff --git a/tests/neg/context-bounds-migration-future.scala b/tests/neg/context-bounds-migration-future.scala new file mode 100644 index 000000000000..6d0e94c0b434 --- /dev/null +++ b/tests/neg/context-bounds-migration-future.scala @@ -0,0 +1,10 @@ +//> using options -source future + +class C[T] +def foo[X: C] = () + +given [T]: C[T] = C[T]() + +def Test = + foo(C[Int]()) // error + foo(using C[Int]()) // ok diff --git a/tests/warn/context-bounds-migration-3.4.check b/tests/warn/context-bounds-migration-3.4.check new file mode 100644 index 000000000000..5341cfbe3ea5 --- /dev/null +++ b/tests/warn/context-bounds-migration-3.4.check @@ -0,0 +1,6 @@ +-- Warning: tests/warn/context-bounds-migration-3.4.scala:9:2 ---------------------------------------------------------- +9 | foo(C[Int]()) // warn + | ^^^ + | Context bounds will map to context parameters. + | A `using` clause is needed to pass explicit arguments to them. + | This code can be rewritten automatically under -rewrite -source 3.4-migration. diff --git a/tests/warn/context-bounds-migration.scala b/tests/warn/context-bounds-migration-3.4.scala similarity index 100% rename from tests/warn/context-bounds-migration.scala rename to tests/warn/context-bounds-migration-3.4.scala