From 30ca28dba2f01deef9574e48736c25dcb6a41f56 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 7 Nov 2023 17:21:42 +0100 Subject: [PATCH] Avoid pure expression warning with Scala2 library TASTy 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. --- tests/neg/i16601.check | 8 ++++---- tests/neg/i16601.scala | 2 +- tests/neg/i16601a.check | 8 ++++---- tests/neg/i16601a.scala | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/neg/i16601.check b/tests/neg/i16601.check index 25baef04e479..c2059506cb09 100644 --- a/tests/neg/i16601.check +++ b/tests/neg/i16601.check @@ -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` diff --git a/tests/neg/i16601.scala b/tests/neg/i16601.scala index 2e058db0093c..00d0c7c9b15e 100644 --- a/tests/neg/i16601.scala +++ b/tests/neg/i16601.scala @@ -1 +1 @@ -@main def Test: Unit = new concurrent.ExecutionContext // error \ No newline at end of file +@main def Test: Any = new concurrent.ExecutionContext // error \ No newline at end of file diff --git a/tests/neg/i16601a.check b/tests/neg/i16601a.check index f6ddd66ca107..6640f5b41749 100644 --- a/tests/neg/i16601a.check +++ b/tests/neg/i16601a.check @@ -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`) |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/neg/i16601a.scala b/tests/neg/i16601a.scala index 232f9c1c9d03..b85828122e8a 100644 --- a/tests/neg/i16601a.scala +++ b/tests/neg/i16601a.scala @@ -1,3 +1,3 @@ //> using options -explain -@main def Test: Unit = new concurrent.ExecutionContext // error \ No newline at end of file +@main def Test: Any = new concurrent.ExecutionContext // error \ No newline at end of file