Skip to content

Commit

Permalink
Avoid pure expression warning with Scala 2 library TASTy (#18876)
Browse files Browse the repository at this point in the history
The extra information on trait initialization causes an extra warning.
The warning/errors in the check files should be the same. The test now
do not desugar the erroneous code into a statement anymore to avoid this
warning.
  • Loading branch information
nicolasstucki authored Nov 8, 2023
2 parents 849ee9c + 30ca28d commit 905e4bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions tests/neg/i16601.check
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- [E042] Type Error: tests/neg/i16601.scala:1:27 ----------------------------------------------------------------------
1 |@main def Test: Unit = new concurrent.ExecutionContext // error
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ExecutionContext is a trait; it cannot be instantiated
-- [E042] Type Error: tests/neg/i16601.scala:1:26 ----------------------------------------------------------------------
1 |@main def Test: Any = new concurrent.ExecutionContext // error
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ExecutionContext is a trait; it cannot be instantiated
|
| longer explanation available when compiling with `-explain`
2 changes: 1 addition & 1 deletion tests/neg/i16601.scala
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@main def Test: Unit = new concurrent.ExecutionContext // error
@main def Test: Any = new concurrent.ExecutionContext // error
8 changes: 4 additions & 4 deletions tests/neg/i16601a.check
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- [E042] Type Error: tests/neg/i16601a.scala:3:27 ---------------------------------------------------------------------
3 |@main def Test: Unit = new concurrent.ExecutionContext // error
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ExecutionContext is a trait; it cannot be instantiated
-- [E042] Type Error: tests/neg/i16601a.scala:3:26 ---------------------------------------------------------------------
3 |@main def Test: Any = new concurrent.ExecutionContext // error
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ExecutionContext is a trait; it cannot be instantiated
|---------------------------------------------------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/i16601a.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//> using options -explain

@main def Test: Unit = new concurrent.ExecutionContext // error
@main def Test: Any = new concurrent.ExecutionContext // error

0 comments on commit 905e4bc

Please sign in to comment.