Skip to content

Commit 905e4bc

Browse files
Avoid pure expression warning with Scala 2 library TASTy (#18876)
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.
2 parents 849ee9c + 30ca28d commit 905e4bc

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

tests/neg/i16601.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
-- [E042] Type Error: tests/neg/i16601.scala:1:27 ----------------------------------------------------------------------
2-
1 |@main def Test: Unit = new concurrent.ExecutionContext // error
3-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
4-
| ExecutionContext is a trait; it cannot be instantiated
1+
-- [E042] Type Error: tests/neg/i16601.scala:1:26 ----------------------------------------------------------------------
2+
1 |@main def Test: Any = new concurrent.ExecutionContext // error
3+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
| ExecutionContext is a trait; it cannot be instantiated
55
|
66
| longer explanation available when compiling with `-explain`

tests/neg/i16601.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@main def Test: Unit = new concurrent.ExecutionContext // error
1+
@main def Test: Any = new concurrent.ExecutionContext // error

tests/neg/i16601a.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
-- [E042] Type Error: tests/neg/i16601a.scala:3:27 ---------------------------------------------------------------------
2-
3 |@main def Test: Unit = new concurrent.ExecutionContext // error
3-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
4-
| ExecutionContext is a trait; it cannot be instantiated
1+
-- [E042] Type Error: tests/neg/i16601a.scala:3:26 ---------------------------------------------------------------------
2+
3 |@main def Test: Any = new concurrent.ExecutionContext // error
3+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
| ExecutionContext is a trait; it cannot be instantiated
55
|---------------------------------------------------------------------------------------------------------------------
66
| Explanation (enabled by `-explain`)
77
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

tests/neg/i16601a.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
//> using options -explain
22

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

0 commit comments

Comments
 (0)