Skip to content

Conversation

nicolasstucki
Copy link
Contributor

Fixes #14303

@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Jan 24, 2022

Not sure how to create a test for this.

This is the current error message we get for the example in #14303.

Screenshot 2022-01-25 at 09 59 19

def addToLast(str: String): Unit =
diagnostics match
case head :: tail =>
diagnostics = Diagnostic.Error(s"${head.msg.rawMessage}$str", head.pos) :: tail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we catch warnings as well, we should handle them properly too. Although I'm not sure if we really need that and if we can handle this reliably as the external compiler process might not fail if there are some warnings but no error. As far as I know, every time we want to check if a warning was raised we enable fatal warnings and check for errors instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added code to ignore warnings


val dummyStream = new PrintStream(new ByteArrayOutputStream())
val reporter = TestReporter.reporter(dummyStream, ERROR)
val reporter = TestReporter.reporter(System.out, ERROR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say we don't want to show all the logs in all situations as we don't show them by default when compiling with the latest compiler inside the same process. I think it would make sense to show the logs if the external process failed but no errors were parsed or if there's a mismatch between the expected number and positions of errors and the errors that we extracted from the logs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now errors are not printed in neg tests unless the test fails.

@nicolasstucki nicolasstucki merged commit 30a2333 into scala:master Jan 25, 2022
@nicolasstucki nicolasstucki deleted the fix-#14303 branch January 25, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No errors shown on forwards/backwards compat test failure

2 participants