You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason is that the REPL (same in Scala 2) does, what I'm calling, "speculative" parsing. I.e. it parses the input and figures out from the parse error whether the user has more input to give, on a new line. This disconnect is causing -Vprint to be skipped in the REPL.
I think it's Spree-sized: it's conceptually simple, with the possibility of the complication of -Vprint:parser emitting output on those partial inputs, which I don't think we want.
IIRC it works as expected in Scala 2 because after speculative parsing, the final "template" code is reparsed for compilation, though I remember that was rejiggered to splice trees. But I guess the point is that in Scala 3 it's not reparsed.
This is an interesting question because the point of the REPL is, "tell me what scalac makes of this code." If there is REPL monkey business, then you're debugging REPL not scalac. REPL is already a departure as a resident compiler.
A recent bug about incremental compilation made me think that REPL could be a useful tool for debugging incremental compilation, too, BTW.
since #13173 parsing has been its own phase
and
-Vprint
is a super common way to troubleshoot things, understand better how the compiler works, etc, as code is transformed by successive phasesand with command line scalac you can:
or do the same with
-Vprint:all
and see all the phases. but somehow the same thing doesn't work in the REPL:the other phases work, but something is special about the combination of REPL and the parser phase.
The text was updated successfully, but these errors were encountered: