scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
230 stars 21 forks source link

-Xgenerate-phase-graph is -Xdegenerate-phase-graph #12959

Closed som-snytt closed 3 months ago

som-snytt commented 3 months ago

Questions are not bug reports

Is this feature supposed to work?

Reproduction steps

Scala version: 2.13.13

➜  scalac -Xgenerate-phase-graph pg
Phase graph of 24 components output to pg*.dot.
➜  ls -l pg*.dot
[snip] 2 Feb 26 08:10 pg-1.dot
[snip] 2 Feb 26 08:10 pg-2.dot
[snip] 2 Feb 26 08:10 pg-3.dot
[snip] 2 Feb 26 08:10 pg-4.dot
➜  snips sdk use scala 2.12.18

Using scala version 2.12.18 in this shell.
➜  scalac -Xgenerate-phase-graph pg13
Phase graph of 24 components output to pg13*.dot.
➜  ls -l pg13*.dot
[snip] 1156 Feb 26 08:11 pg13-1.dot
[snip] 1156 Feb 26 08:11 pg13-2.dot
[snip] 1156 Feb 26 08:11 pg13-3.dot
[snip] 1261 Feb 26 08:11 pg13-4.dot

Problem

The dot files in 2.13 are degenerate. (Maybe only the last line is output?)

Since no one uses the compiler option, it should be removed or deprecated as not functional.

Probably the dot file output is not helpful, but -Vphases --debug --verbose should list the input components with their constraints, and also output the infoTransformers which correspond to the phases which contribute them.

(Pun on 2.13 and PG-13 is intended.)

som-snytt commented 3 months ago

https://github.com/scala/scala/commit/759b9795e908a0098b18abc25a88c32d625304bd says

Log phase levels under scalac -Xshow-phases -Ydebug -Ylog:all

so bigger brains have trod this path before.

Logging does announce info transformers, which is almost as good as a summary.

The example from dependency graph rewrite was that async phase relied on alpha sorting.

Edit: oh, commits were reverted at https://github.com/scala/scala/commit/64294e0ed2fb6efaa690fbae5afed7827e918b4d

I think github should always tell me if I'm looking at a commit that was reverted, which to me means simply: don't let me go looking for LOC which don't exist any more.

som-snytt commented 3 months ago

Broke in 2.13.3 due to "cleanup" at https://github.com/scala/scala/pull/9042/commits/19253e2c08acce9f1c21d790fb8e7106da615506

which characterizes itself as:

Nothing particularly important.

Trying not to be an expert in reflect.io.File, but it looks like printlnAll is not the same as appendAll.

At least this field experiment demonstrates that the -X flag is unused by real people. (I never got graphviz working on my ageing WSL.)

SethTisue commented 3 months ago

If you (or anyone) tinkers with this, I'd suggest also renaming this to be a -Y flag. Or -V? In any case, not -X.

som-snytt commented 3 months ago

To increase the likelihood of a quick merge, the PR renames it -Vphase-graph with alias ("abbreviation") to existing name. This is a good time to do that, since no one uses the option and possibly never will. That should be the semantics of -Z, stuff no one uses.