Skip to content
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

Can't stop after phases between parser and typer #7683

Closed
scabug opened this issue Jul 22, 2013 · 3 comments
Closed

Can't stop after phases between parser and typer #7683

scabug opened this issue Jul 22, 2013 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jul 22, 2013

You can't try enteringPhase with phases that aren't in the current run.

The current crash is at Global#Run#resetPackageClass, which has the comment, "Reset package class to state at typer (not sure what this is needed for?)."

A similar bug was fixed at

scala/scala@541a669

But I think even that fix assumes there are no phases between parser and namer, which ain't necessarily so. stopPhase means the stop-before is exactly that phase, but you could -Ystop-before:my-post-parser so that there is no namer.

So the useful idiom might be something like, enteringPhaseOrError or enteringPhaseMaybe, depending on whether it's OK to omit the work unit in this run. Rather than assert and crash.

apm@mara:~/tmp$ scalac -Ydebug -Ystop-after:namer trivial.scala 
[running phase parser on trivial.scala]
[running phase namer on trivial.scala]
error: 
     while compiling: trivial.scala
        during phase: global=terminal, atPhase=namer
     library version: version 2.10.1
    compiler version: version 2.10.1
  reconstructed args: -Ydebug -deprecation -feature -Ystop-after:namer
@scabug
Copy link
Author

scabug commented Jul 22, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7683?orig=1
Reporter: @som-snytt
Affected Versions: 2.10.1, 2.11.0-M3

@scabug
Copy link
Author

scabug commented Jul 22, 2013

@som-snytt said:
Given phase assembly

apm@mara:~/tmp$ scalac -Ydebug -Xplugin:../projects/deprecator/checker.jar -Xshow-phases -Xgenerate-phase-graph phase-bug
             phase name  id  description
             ----------  --  -----------
                 parser   1  parse source into ASTs, perform simple desugaring
       elide-deprecated   2  
                  namer   3  resolve names, attach symbols to named trees
         packageobjects   4  load package objects
                  typer   5  the meat and potatoes: type the trees
       check-deprecated   6  
                 patmat   7  translate match expressions
         superaccessors   8  add super accessors in traits and nested classes

then stop-after:parser fails

apm@mara:~/tmp$ scalac -Ydebug -Xplugin:../projects/deprecator/checker.jar -Ystop-after:parser trivial.scala [running phase parser on trivial.scala]
error: uncaught exception during compilation: java.lang.AssertionError
error: java.lang.AssertionError: assertion failed: <no phase>
	at scala.reflect.internal.SymbolTable.phase_$eq(SymbolTable.scala:161)

@scabug
Copy link
Author

scabug commented Dec 2, 2014

@som-snytt said:
The minimum: scala/scala#4180

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

No branches or pull requests

2 participants