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
This change improves the usability and the display of the current
-Xshow-phases flag. Currently when this is used you just get a big
flattened list like so:
```
❯ scala3-compiler -Xshow-phases
parser
typer
inlinedPositions
sbt-deps
extractSemanticDB
posttyper
prepjsinterop
sbt-api
SetRootTree
pickler
inlining
postInlining
staging
pickleQuotes
{firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkStatic, checkLoopingImplicits, betaReduce, inlineVals, expandSAMs}
initChecker
{elimRepeated, protectedAccessors, extmethods, uncacheGivenAliases, byNameClosures, hoistSuperArgs, specializeApplyMethods, refchecks, tryCatchPatterns, patternMatcher}
{elimOpaque, explicitJSClasses, explicitOuter, explicitSelf, elimByName, stringInterpolatorOpt}
{pruneErasedDefs, uninitializedDefs, inlinePatterns, vcInlineMethods, seqLiterals, intercepted, getters, specializeFunctions, liftTry, collectNullableFields, elimOuterSelect, resolveSuper, functionXXLForwarders, paramForwarding, genericTuples, letOverApply, arrayConstructors}
erasure
{elimErasedValueType, pureStats, vcElideAllocations, arrayApply, addLocalJSFakeNews, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}
{constructors, instrumentation}
{lambdaLift, elimStaticThis, countOuterAccesses}
{dropOuterAccessors, checkNoSuperThis, flatten, transformWildcards, moveStatic, expandPrivate, restoreScopes, selectStatic, junitBootstrappers, Collect entry points, collectSuperCalls, repeatableAnnotations}
genSJSIR
genBCode
```
This changes mimics the Scala 2 compiler and provides a more structured
output that also contains the description of the phase:
```
sbt:scala3> scala3/scalac -Xshow-phases
phase name description
---------- -----------
parser scan and parse sources
typer type the trees
inlinedPositions check inlined positions
sbt-deps sends information on classes' dependencies to sbt
extractSemanticDB extract info into .semanticdb files
posttyper additional checks and cleanups after type checking
prepjsinterop additional checks and transformations for Scala.js
sbt-api sends a representation of the API of classes to sbt
SetRootTree set the rootTreeOrProvider on class symbols
pickler generates TASTy info
inlining inline and execute macros
postInlining add mirror support for inlined code
staging check staging levels and heal staged types
pickleQuotes turn quoted trees into explicit run-time data struct
{
firstTransform some transformations to put trees into a canonical f
checkReentrant check no data races involving global vars
elimPackagePrefixes eliminate references to package prefixes in Select n
cookComments cook the comments: expand variables, doc, etc.
checkStatic check restrictions that apply to @static members
checkLoopingImplicits check that implicit defs do not call themselves in a
betaReduce reduce closure applications
inlineVals check right hand-sides of an `inline val`s
expandSAMs expand SAM closures to anonymous classes
elimRepeated rewrite vararg parameters and arguments
refchecks checks related to abstract members and overriding
}
initChecker check initialization of objects
{
crossVersionChecks check issues related to deprecated and experimental
protectedAccessors add accessors for protected members
extmethods expand methods of value classes with extension metho
uncacheGivenAliases avoid caching RHS of simple parameterless given alia
elimByName map by-name parameters to functions
hoistSuperArgs hoist complex arguments of supercalls to enclosing s
forwardDepChecks ensure no forward references to local vals
specializeApplyMethods adds specialized methods to FunctionN
tryCatchPatterns compile cases in try/catch
patternMatcher compile pattern matches
}
{
elimOpaque turn opaque into normal aliases
explicitJSClasses make all JS classes explicit
explicitOuter add accessors to outer classes from nested ones
explicitSelf make references to non-trivial self types explicit a
stringInterpolatorOpt optimize raw and s string interpolators
}
{
pruneErasedDefs drop erased definitions and simplify erased expressi
uninitializedDefs replaces `compiletime.uninitialized` by `_`
inlinePatterns remove placeholders of inlined patterns
vcInlineMethods inlines calls to value class methods
seqLiterals express vararg arguments as arrays
intercepted handling of `==`, `|=`, `getClass` methods
getters replace non-private vals and vars with getter defs
specializeFunctions specialize Function{0,1,2} by replacing super with s
liftTry Lifts try's that might be executed on non-empty expr
collectNullableFields collect fields that can be nulled out after use in l
elimOuterSelect expand outer selections
resolveSuper implement super accessors
functionXXLForwarders add forwarders for FunctionXXL apply methods
paramForwarding add forwarders for aliases of superclass parameters
genericTuples optimize generic operations on tuples
letOverApply lift blocks from receivers of applications
arrayConstructors intercept creation of (non-generic) arrays and intri
}
erasure rewrite types to JVM model
{
elimErasedValueType expand erased value types to their underlying implme
pureStats remove pure statements in blocks
vcElideAllocations peep-hole optimization to eliminate unnecessary valu
etaReduce reduce eta expansions of pure paths
arrayApply optimize `scala.Array.apply`
addLocalJSFakeNews adds fake new invocations to local JS classes in cal
elimPolyFunction rewrite PolyFunction subclasses to FunctionN subclas
tailrec rewrite tail recursion to loops
completeJavaEnums fill in constructors for Java enums
mixin expand trait fields and trait initializers
lazyVals expand lazy vals
memoize add private fields to getters and setters
nonLocalReturns expand non-local returns
capturedVars represent vars captured by closures as heap objects
}
{
constructors collect initialization code in primary constructors
instrumentation count calls and allocations under -Yinstrument
}
{
lambdaLift lifts out nested functions to class scope
elimStaticThis replace This references to static objects by global
countOuterAccesses identify outer accessors that can be dropped
}
{
dropOuterAccessors drop unused outer accessors
checkNoSuperThis check that supercalls don't contain references to Th
flatten lift all inner classes to package scope
transformWildcards replace wildcards with default values
moveStatic move static methods from companion to the class itse
expandPrivate widen private definitions accessed from nested class
restoreScopes repair rendered invalid scopes
selectStatic get rid of selects that would be compiled into GetSt
junitBootstrappers generate JUnit-specific bootstrapper classes for Sca
Collect entry points collect all entry points and save them in the contex
collectSuperCalls find classes that are called with super
repeatableAnnotations aggregate repeatable annotations
}
genSJSIR generate .sjsir files for Scala.js
genBCode generate JVM bytecode
```
The mini-phases are still grouped and indicated by the surrounding `{}`.
There are also some small changes in all the phase files to ensure they
are all done the same way with overriding the phaseName and the
description, both provided in a companion object. The descriptions
themselves were just pulled from the comments in the code.
0 commit comments