-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for context bounds migration (#19510)
Improves tests of #19316
- Loading branch information
Showing
6 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
File renamed without changes.