Skip to content

Drop REPL parse warnings on parse error - #26798

Draft
som-snytt wants to merge 4 commits into
scala:mainfrom
som-snytt:issue/25055-repl-crosstalk
Draft

Drop REPL parse warnings on parse error#26798
som-snytt wants to merge 4 commits into
scala:mainfrom
som-snytt:issue/25055-repl-crosstalk

Conversation

@som-snytt

Copy link
Copy Markdown
Contributor

Fixes #25055

As explained in the comment in Run, REPL does a parse (which may produce diagnostics) and then a compile (which may produce more diagnostics); the parse warnings will be suspended and then moved to the new Run. However, this commit drops those warnings if the parse is erroneous. The errors are issued, and as usual errors have precedence over warnings. Moreover, the warnings are not relevant because the source text must be amended to pass compilation.

The REPL tests are adjusted so that the test text looks the same as a real REPL transcript, where there is a "trailing space" in the prompt but no "leading space" in the diagnostic text. The adjustment makes it easier to paste a transcript to a test.

Have you relied on LLM-based tools in this contribution?

No

How was the solution tested?

New automated tests (including the issue's reproducer, if applicable)

@som-snytt
som-snytt force-pushed the issue/25055-repl-crosstalk branch from 8f480ee to d601742 Compare August 13, 2026 18:21
@som-snytt

Copy link
Copy Markdown
Contributor Author

That is indeed a lot of seconds.

[info] Test dotty.tools.dotc.IdempotencyTests.idempotency started
failed because test 'CheckPosIdempotency from idempotency/check' timed out      
[error] Test dotty.tools.dotc.IdempotencyTests.idempotency failed: java.lang.AssertionError: Run test failed, but should not, reasons:
[error] encountered 1 test failure(s):
[error]   - test 'CheckPosIdempotency from idempotency/check' timed out, took 487.911 sec

================================================================================
Test Report
================================================================================

1 suites passed, 1 failed, 2 total
    CheckPosIdempotency from idempotency/check failed, test 'CheckPosIdempotency from idempotency/check' timed out


[error]     at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkPass(ParallelTesting.scala:1337)
[error]     at dotty.tools.vulpix.ParallelTesting$CompilationTest.checkRuns(ParallelTesting.scala:1297)
[error]     at dotty.tools.dotc.IdempotencyTests.idempotency(IdempotencyTests.scala:61)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[error]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:569)
[error]     ...
[info] Test run dotty.tools.dotc.IdempotencyTests finished: 1 failed, 0 ignored, 1 total, 487.913s

@som-snytt
som-snytt force-pushed the issue/25055-repl-crosstalk branch from d601742 to 4963cb0 Compare August 13, 2026 20:16

@SolalPirelli SolalPirelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, and thanks for all the test adjustments!

@SolalPirelli

Copy link
Copy Markdown
Contributor

(leaving as draft in case you have another change you want to make but feel free to undraft&merge)

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.

REPL has syntax warning crosstalk

2 participants