Skip to content

REPL: emit parse warnings by reusing the reporter #13209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2021

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Jul 29, 2021

The original report requires the -deprecation and -source:future flags,
for which there is seems to be no support in repl.ScriptedTests. So
switched to a non-deprecation syntax warning, that isn't guarded by
-source.

I might come back and add "pragma" support to the REPL scripts so I can
move the test out of pending.

Co-authored-by: Seth Tisue [email protected]

Fixes #13208

The original report requires the -deprecation and -source:future flags,
for which there is seems to be no support in repl.ScriptedTests.  So
switched to a non-deprecation syntax warning, that isn't guarded by
-source.

I might come back and add "pragma" support to the REPL scripts so I can
move the test out of pending.

Co-authored-by: Seth Tisue <[email protected]>
@dwijnand dwijnand force-pushed the repl-issue-parse-warnings branch from 502fda1 to 438a041 Compare July 29, 2021 20:17
Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

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

This is somewhat related to scala/scala@79ca1408c7

Reminds me that I need to test #12857 with the REPL.

@dwijnand dwijnand merged commit 699cb21 into scala:master Jul 30, 2021
@dwijnand dwijnand deleted the repl-issue-parse-warnings branch July 30, 2021 14:37
@@ -243,7 +243,7 @@ class ReplDriver(settings: Array[String],
unfusedPhases(using ctx).collectFirst { case phase: CollectTopLevelImports => phase.imports }.get

implicit val state = {
val state0 = newRun(istate)
val state0 = newRun(istate, parsed.reporter)
state0.copy(context = state0.context.withSource(parsed.source))
Copy link
Member Author

Choose a reason for hiding this comment

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

Btw, before I wired the reporter through newRun I was adding it here with .fresh.setReporter(reporter) but that was breaking something to do with class-loading, which seemed complicated. I'm not sure if that's expected and if anyone knows why that happened.

@Kordyjan Kordyjan added this to the 3.1.0 milestone Aug 2, 2023
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 fails to issue warnings from parser
3 participants