Skip to content

Merge 2.12 to 2.13 [ci: last-only]#9532

Merged
dwijnand merged 22 commits intoscala:2.13.xfrom
lrytz:merge-2.12-to-2.13-mar-5
Mar 11, 2021
Merged

Merge 2.12 to 2.13 [ci: last-only]#9532
dwijnand merged 22 commits intoscala:2.13.xfrom
lrytz:merge-2.12-to-2.13-mar-5

Conversation

@lrytz
Copy link
Member

@lrytz lrytz commented Mar 5, 2021

$> git log HEAD --oneline -n 1 | cat
262f6e9a6d Merge pull request #9530 from lrytz/t12348

$> git log upstream/2.12.x --oneline -n 1 | cat
648486e29f Merge pull request #9529 from lrytz/par-coll-t152

$> export MB=$(git merge-base HEAD upstream/2.12.x)

$> git log --graph --oneline $MB..upstream/2.12.x | cat
*   648486e29f Merge pull request #9529 from lrytz/par-coll-t152
|\
| * 9bc7bfa0f6 [nomerge] Reuse `tasksupport` in CombinerFactory
* |   27cf64d0fe Merge pull request #9531 from lrytz/t12348-backport
|\ \
| * | 02dd73baed [backport] Follow JDK 11+ spec for signature polymorphic methods
|/ /
* |   48c9a39766 Merge pull request #9449 from lrytz/t12308
|\ \
| |/
|/|
| * 25e6bc4f27 Move suspended warnings back from CompilationUnit to RunReporting
| * 81d0b88b8d Store suspended warnings per compilation unit
* |   836b67e024 Merge pull request #9527 from som-snytt/issue/12019-2.12
|\ \
| |/
|/|
| * 5e46039e99 Backport fix for detecting jar
|/
*   98d3781e12 Merge pull request #9526 from som-snytt/issue/12354
|\
| * c3e25a6366 Repl indents for alignment after regression
| * ac99c8258c Enable parser warnings in REPL
|/
*   a20d1c841b Merge pull request #9512 from dwijnand/rip-icode
|\
| * d12ab3800c RIP icode
* fcc5845a3c Merge pull request #9166 from regadas/2.12.x_serial_version
* a5c4802140 Add missing @SerialVersionUID on collections

$> git checkout -b merge-2.12-to-2.13-mar-5
Switched to a new branch 'merge-2.12-to-2.13-mar-5'



$> git merge fcc5845a3c -s ours
$> git merge a20d1c841b
$> git merge 836b67e024 -s ours
$> git merge 48c9a39766
$> git merge 648486e29f -s ours

regadas and others added 21 commits February 18, 2021 08:40
[2.12] Remove trailing references to icode
Silent parsing, then normal reporting when compiling template.

For silence, use method that restores settings when done.
Store suspended warnings per compilation unit and report them
in `typerPhase.apply(unit)` instead of `typerPhase.run` - the latter
is not invoked when using the presentation compiler.
Index suspended warnings by SourceFile.

Test case for issue 12308.
Reported in scala-parallel-collections 152.
[backport] Follow JDK 11+ spec for signature polymorphic methods
[nomerge] Reuse `tasksupport` in CombinerFactory
@lrytz lrytz requested a review from dwijnand March 5, 2021 08:54
@scala-jenkins scala-jenkins added this to the 2.13.6 milestone Mar 5, 2021
@lrytz
Copy link
Member Author

lrytz commented Mar 5, 2021

Parser warnings no longer show in the repl.

When evaluationg a fresh line (scala> def f { println() }), the line (with its wrapping code) is first parsed (In fact it's parsed twice, I'm not sure why) using the existing global.currentRun. The deprecation warning is suspended in PerRunReporting.

The parsed tree is stored in the compilation unit's unit.body.

Then a new run (with a fresh PerRunReporting) is created, so the suspended messages are discarded. The repl then calls run.compileUnits(unit :: Nil). The parser is skipped because unit.body == EmptyTree is false.

Before the change, PerRunReporting had a global flag suppressionsComplete: Boolean, which is set after Typer. This means that the parser warning was reported, because the old run that's used for parsing had the flag set from compiling the previous line. This means that current 2.13.5 doesn't respect @nowarn:

scala> @annotation.nowarn def f { println() }
                                ^
       warning: procedure syntax is deprecated: instead, add `: Unit =` to explicitly declare `f`'s return type

After this patch we have suppressionsComplete: mutable.Set[SourceFile], and the SourceFile for the new line is not in there, so the parser warning doesn't show.

@som-snytt do you know why a new Run is not created immediately when interpreting a fresh line?

@som-snytt
Copy link
Contributor

In my recent PR to fix the 2.12 backport, I noticed snippet is parsed, reparsed with val res0 =, reparsed to probe for package, then finally full compilation in template. Only the full compile matters for messaging. 2.13 is different and tries to be somewhat tree-oriented. But maybe Run lifecycle is a holdover.

I don't remember how I fixed parser messaging on 2.13. Is this it? #7756 (comment)

@lrytz
Copy link
Member Author

lrytz commented Mar 11, 2021

Looking at the repl code, I think the fix I implemented here is the best way forward.

The parser is once called through JLine and once through the interpreter, this seems intended.

The complication is that the interpreter potentially calls the parser multiple times (incomplete input), so it would require some logic to avoid creating a new Run each time. On complete input, it calls compile which currently creates a new Run. This would have to be skipped, but not always, there are other entry points into the compile method.

So overall I'd go ahead with the current fix in this PR.

@dwijnand dwijnand merged commit 0d07e1a into scala:2.13.x Mar 11, 2021
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.

5 participants