forked from scala/scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scala#10858 from lrytz/pr10856light
Relax PhaseAssembly about loose constraints
- Loading branch information
Showing
33 changed files
with
641 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
fatal error: Phases form a cycle: parser -> beforeparser -> parser | ||
warning: Dropping phase beforeparser, it is not reachable from parser | ||
sample_2.scala:8: error: type mismatch; | ||
found : String("") | ||
required: Int | ||
def f: Int = "" | ||
^ | ||
1 error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
phase name id description | ||
---------- -- ----------- | ||
parser 1 parse source into ASTs, perform simple desugaring | ||
namer 2 resolve names, attach symbols to named trees | ||
packageobjects 3 load package objects | ||
typer 4 the meat and potatoes: type the trees | ||
C8 0 C8 makes C7 reachable | ||
superaccessors 6 add super accessors in traits and nested classes | ||
C7 0 C7 has only a before constraint | ||
extmethods 8 add extension methods for inline classes | ||
pickler 9 serialize symbol tables | ||
refchecks 10 reference/override checking, translate nested objects | ||
patmat 11 translate match expressions | ||
uncurry 12 uncurry, translate function values to anonymous classes | ||
fields 13 synthesize accessors and fields, add bitmaps for lazy vals | ||
tailcalls 14 replace tail calls by jumps | ||
specialize 15 @specialized-driven class and method specialization | ||
explicitouter 16 this refs to outer pointers | ||
erasure 17 erase types, add interfaces for traits | ||
posterasure 18 clean up erased inline classes | ||
lambdalift 19 move nested functions to top level | ||
constructors 20 move field definitions into constructors | ||
flatten 21 eliminate inner classes | ||
mixin 22 mixin composition | ||
cleanup 23 platform-specific cleanups, generate reflective calls | ||
delambdafy 24 remove lambdas | ||
jvm 25 generate JVM bytecode | ||
terminal 26 the last phase during a compilation run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
package t8755 | ||
|
||
import scala.tools.nsc, nsc.{Global, Phase, plugins}, plugins.{Plugin, PluginComponent} | ||
|
||
class P(val global: Global) extends Plugin { | ||
override val name = "Testing phase assembly" | ||
override val description = "C7 is not dropped even though it has no runs[Right]After" | ||
override val components = List[PluginComponent]( | ||
component7, | ||
component8, | ||
) | ||
|
||
object component7 extends PluginComponent { | ||
override val global = P.this.global | ||
override val phaseName = "C7" | ||
override val description = "C7 has only a before constraint" | ||
override val runsRightAfter = None | ||
override val runsAfter = Nil | ||
override val runsBefore = List("patmat") | ||
override def newPhase(prev: Phase) = new phase(prev) | ||
class phase(prev: Phase) extends Phase(prev) { | ||
override val name = s"phase $phaseName" | ||
override def run() = println(name) | ||
} | ||
} | ||
object component8 extends PluginComponent { | ||
override val global = P.this.global | ||
override val phaseName = "C8" | ||
override val description = "C8 makes C7 reachable" | ||
override val runsRightAfter = None | ||
override val runsAfter = List("typer") | ||
override val runsBefore = List("C7") // component name, not phase name! | ||
override def newPhase(prev: Phase) = new phase(prev) | ||
class phase(prev: Phase) extends Phase(prev) { | ||
override val name = s"phase $phaseName" | ||
override def run() = println(name) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//> using options -Xplugin:. -Xplugin-require:"Testing phase assembly" -Vphases -Werror | ||
package sample | ||
// just a sample that is compiled with the sample plugin enabled | ||
object Sample extends App { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<plugin> | ||
<name>Testing phase assembly</name> | ||
<classname>t8755.P</classname> | ||
</plugin> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
warning: No phase `refchicks` for ploogin.runsAfter - did you mean refchecks? | ||
warning: No phase `java` for ploogin.runsBefore - did you mean jvm? | ||
warning: Dropping phase ploogin, it is not reachable from parser | ||
phase name id description | ||
---------- -- ----------- | ||
parser 1 parse source into ASTs, perform simple desugaring | ||
namer 2 resolve names, attach symbols to named trees | ||
packageobjects 3 load package objects | ||
typer 4 the meat and potatoes: type the trees | ||
superaccessors 5 add super accessors in traits and nested classes | ||
extmethods 6 add extension methods for inline classes | ||
pickler 7 serialize symbol tables | ||
refchecks 8 reference/override checking, translate nested objects | ||
patmat 9 translate match expressions | ||
uncurry 10 uncurry, translate function values to anonymous classes | ||
fields 11 synthesize accessors and fields, add bitmaps for lazy vals | ||
tailcalls 12 replace tail calls by jumps | ||
specialize 13 @specialized-driven class and method specialization | ||
explicitouter 14 this refs to outer pointers | ||
erasure 15 erase types, add interfaces for traits | ||
posterasure 16 clean up erased inline classes | ||
lambdalift 17 move nested functions to top level | ||
constructors 18 move field definitions into constructors | ||
flatten 19 eliminate inner classes | ||
mixin 20 mixin composition | ||
cleanup 21 platform-specific cleanups, generate reflective calls | ||
delambdafy 22 remove lambdas | ||
jvm 23 generate JVM bytecode | ||
terminal 24 the last phase during a compilation run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
package t8755 | ||
|
||
import scala.tools.nsc.{Global, Phase} | ||
import scala.tools.nsc.plugins.{Plugin, PluginComponent} | ||
import scala.reflect.io.Path | ||
import scala.reflect.io.File | ||
|
||
/** A test plugin. */ | ||
class Ploogin(val global: Global) extends Plugin { | ||
import global._ | ||
|
||
val name = "ploogin" | ||
val description = "A sample plugin for testing." | ||
val components = List[PluginComponent](TestComponent) | ||
|
||
private object TestComponent extends PluginComponent { | ||
val global: Ploogin.this.global.type = Ploogin.this.global | ||
override val runsBefore = List("java") | ||
val runsAfter = List("refchicks") | ||
val phaseName = Ploogin.this.name | ||
override def description = "A sample phase that doesn't know when to run." | ||
def newPhase(prev: Phase) = new TestPhase(prev) | ||
class TestPhase(prev: Phase) extends StdPhase(prev) { | ||
override def description = TestComponent.this.description | ||
def apply(unit: CompilationUnit): Unit = { | ||
// kewl kode | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.