| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This is achieved in a following way:
1. Similarly to toolbox quasiquotes can go away with wrapping for
parsing purpose after introduction of `parseStats` and `parseRule`
entry points.
2. In case of syntax error quasiquote computes equivalent corresponding
position in the source code with the help of `corrrespondingPosition`
mapper which relies on position data collected into `posMap` during
code generation.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Change toolbox parsing to use `parseStats` parser entry point
instead of current code-wrappign technique that makes positions
much less useful to end users.
There is also no need to create a compiler `Run` for parsing.
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This commit contains three logical changes:
1. Split `templateStatSeq` into two methods as we need more reliable
parsing of template body alone for new `parseStats` entry point.
2. Add new parser entry point called `parseStats` which is aimed towards
use in tools that require parsing of Scala code that can be written
inside of a template.
Such functionality is required for parsing lines in repl, parsing
code through toolbox, parsing and running scala scripts and lastly
for quasiquotes. All of them are refactored to use this very method
in the next commits.
A new method called `templateStatsCompat` is also added to make this
commit pass the tests but it's a temporary hack that will be removed
in next commit in favor of `parseStats`.
3. Extract out a few methods like `isCaseDefStart`, `expectedMsgTemplate`
and `parseRule`. These are needed to override parser behaviour in
updated quasiquotes parser (see next commits).
|
|\ \ \
| | | |
| | | | |
SI-7715 String inpatternation s"$_" for s"${_}"
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In a pattern,
```
scala> implicit class RX(val sc: StringContext) {
| def rx = sc.parts.mkString("(.+)").r }
defined class RX
scala> "2 by 4" match { case rx"$a by $_" => a }
res0: String = 2
scala> val rx"$_ by $b" = "2 by 4"
b: String = 4
```
|
|\ \ \ \
| | | | |
| | | | | |
SI-7470 implements fundep materialization
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This fix provides implicit macros with an ability to affect type inference
in a more or less sane manner. That's crucial for materialization of
multi-parametric type class instances (e.g. Iso's from shapeless).
Details of the technique can be found in comments.
|
|\ \ \ \
| | | | |
| | | | | |
SI-7704 Fix partest's test category selection
|
| | | | |
| | | | |
| | | | |
| | | | | |
... not Unit now.
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
My recent changes to command line parsing in 6090709 broke partest's
functionality of picking test categories (e. g. --pos or --run).
The breakage was caused because scala.tools.cmd._ stored the command
line options with the `--` prefix, but TestKinds.standardKinds did not.
|
|\ \ \ \ \
| |_|_|_|/
|/| | | | |
SI-7544 Interpolation message for %% literal
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The new error text: "conversions must follow a splice; use %% for
literal %, %n for newline".
The error is emitted when % is not at the start of a part; only
the non-conversions %% and %n are allowed.
It would be nice if it were convenient to parse the part to see
what the user may have intended, but c'est l'erreur.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
in various places. This includes actors, compiler (mostly some new
macro parts) continuations, partest, scaladoc, scalap.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The changes are actually pretty small:
scala.language.implicitConversions is moved around so that it is only
emitted to the source file if there is an actual implicit conversion.
The rest of the diff are mostly the new generated source files
reflecting that change.
|
| | | |
| | | |
| | | |
| | | |
| | | | |
The files are not regenerated here, because additional fixes will
follow in the next commit.
|
| |_|/
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I added a language.existential import to LazyCombiner.scala which
should not be necessary, but causes a spurious warning otherwise:
scala/src/library/scala/collection/parallel/mutable/LazyCombiner.scala:33:
warning: the existential type
scala.collection.parallel.mutable.LazyCombiner[_$1,_$2,_$3] forSome {
type _$1; type _$2; type _$3 <: scala.collection.generic.Growable[_$1] with scala.collection.generic.Sizing },
which cannot be expressed by wildcards, should be enabled by making the implicit value scala.language.existentials visible.
if (other.isInstanceOf[LazyCombiner[_, _, _]]) {
^
I created ticket SI-7750 to track this issue.
|
|\ \ \
| | | |
| | | | |
SI-7690 ghost error message fails compile [Rebase of #2763]
|
| |/ /
| | |
| | |
| | |
| | |
| | | |
I won't even try to explain the error reporting code, because
it would have no basis in reality. However this change appears
to fix the symptom reported.
|
|\ \ \
| | | |
| | | | |
DefDef.name is now TermName again
|
| |/ /
| | |
| | |
| | |
| | | |
Now when there's no hope left for type macros, it's reasonable to provide
a more specific type for DefDef.name.
|
|\ \ \
| |/ /
|/| | |
Fix N^2 spot in erasure.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
An expression containing nested casts would type the same tree 2^N
times where N is the number of nested casts. This was particularly
visible in Vector.scala where one can find a six-cast expression.
It's currently line "why was six afraid of seven", aka line 789.
display5((index >> 25) & 31)
.asInstanceOf[Array[AnyRef]]((index >> 20) & 31)
.asInstanceOf[Array[AnyRef]]((index >> 15) & 31)
.asInstanceOf[Array[AnyRef]]((index >> 10) & 31)
.asInstanceOf[Array[AnyRef]]((index >> 5) & 31)
.asInstanceOf[Array[AnyRef]](index & 31)
.asInstanceOf[T]
Compiling Vector.scala, before/after.
< #unique types : 10805
> #unique types : 9722
< #created tree nodes : 26716
> #created tree nodes : 25647
I found a similar bug about a year ago in 39f01d4f48. It's
interesting to consider how little defense we have against bugs
of this nature - visually non-obvious differences in tree
traversal can have spectacular impact on complexity.
|
|\ \ \
| |/ /
|/| | |
Refactor the cake so SymbolTable does not depend on Global
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
SymbolTable refactoring introduced some TODOs that were supposed
to be addressed after M5 release. The reason I couldn't address
those problems right away was a conflict with our plans to modularize
Scaladoc and interactive. However, we decided to delay that work
until after M5 is released so addressing TODOs is not blocked
anymore.
This commit introduces the following changes:
* Eclipse project definitions for interactive and scaladoc
depend on scala-compiler project so they are builded against
latest version of the compiler (quick) instead of STARR.
This aligns our Eclipse project definitions with build.xml
structure.
* Introduce GlobalSymbolLoaders class which wires dependencies
of SymbolLoaders with assumption of dependency on Global.
* Switch to GlobalSymbolLoaders in BrowsingLoaders,
interactive Global and ScaladocGlobal; this eliminates all
TODO comments introduced before
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
At the moment we have just one Platform: JavaPlatform in the
compiler. The whole Platform abstraction feels dubious and
Java backends need to downcast to JavaPlatform to implement some
optimizations. It seems like for now it's just better to fix platform
declared in Global to be JavaPlatform and get rid of downcasting.
I checked that even JavaScript backend declares itself as a subtype
of JavaPlatform so it seems like our abstraction is not that useful.
If we have an alternative platform with specific requirements we
might want to refactor our Platform abstraction again but for now
it seems dubious to pay a price for abstraction nobody uses.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is rather large commit so I'll first explain the motivation
behind it and then go through all changes in detail explaining
the choices I made.
The motivation behind this refactoring was to make SymbolTable
unit testable. I wanted a lightweight way of initializing
SymbolTable and then writing unit tests for subtyping algorithm,
various functionality related to Symbols, etc.
All of that should be possible by precisely controlling what we
test, e.g., create types and symbols by hand and not have them
defined in source code as we normally do in partest (functional)
tests.
The other motivation was to reduce and clarify dependencies we
have in the compiler. Explicit dependencies lead to cleaner
design. Also, explicit and reduces dependencies help incremental
compilation which is a big problem for us in compiler's code
base at the moment.
One of the challenges I faced during that refactoring was
cyclic dependency between Platform and SymbolLoaders.
Platform depended on `SymbolLoaders.SymbolLoader` because it
would define a root loader. SymbolLoaders depended on Platform
for numerous reasons like deferring decision how to load a given
symbol based on some Platform-specific hooks.
I decided to break that cycle by removing methods related to
symbol loading from Platform interface. One could argue, that
better fix would be to make SymbolLoaders to not depend on Platform
(backend) concept but that would be much bigger refactoring. Also,
we have a new concept for dealing with symbol loading: Mirrors.
For those reasons both `newClassLoader` and `rootLoader`
were dropped from Platform interface.
Note that JavaPlatform still depends on Global so it can
access phases defined in Global to implement `platformPhases`
method.
Both GenICode and BCodeBodyBuilder have some Platform specific
logic that requires casting because pattern matcher doesn't narrow
types to give them a proper refinement. Check the changes for details.
Some logging utilities has been moved from Global to SymbolTable
because they are accessed by SymbolTable. Since Global inherits from
SymbolTable this should be a source compatible change.
The SymbolLoaders has dependency on `compileLate` method defined in Global.
The purpose behind `compileLate` is not clear to me but the dependency looks
a little bit dubious. At least we made that dependency explicit.
ScaladocGlobal and Global defined in interactive has been adapted in a way
that makes them compile both with quick.comp and 2.11.0-M4 so my refactorings
are not blocking the modularization effort.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The 27c8266e introduced `Platform.BinaryRepr` abstract type that
was meant to abstract over binary representation of a classfile.
The abstraction was needed at the time because we had both jvm
backend and msil backend. The msil backend has been removed but
the abstraction was kept in place. The type has been deprecated
and set to be an alias for AbstractFile. The alias will be
removed later in 2.11 milestone cycle.
All references to `Platform.BinaryRepr` has been removed in
the compiler in favour of using AbstractFile directly.
If we ever need to abstract over multiple backends we should
do that based on real requirements of given backends.
This is a first step towards breaking the cyclic dependency
between Platform and SymbolLoaders.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
ClassfileParser depends on forcing infos during typer phase.
It's not entirely clear why this is needed (git blame doesn't
help much) but I decided to preserve the logic.
Therefore, I introduced an abstract method called
`lookupMemberAtTyperPhaseIfPossible` which preserves the original
semantics but is implemented outside of ClassfileParser so the
ClassfileParser itself doesn't need to depend on typer phase and
phase mutation utilities.
I removed `loaders` override in `test/files/presentation/doc`.
I would have to update it to implement the
`lookupMemberAtTyperPhaseIfPossible` method. However, the override
doesn't seem to be doing anything useful so I just removed it.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
ClassfileParser contained some ICodeReader-specific logic
like `forceMangledName` and `getMemberSymbol` methods.
The `getMemberSymbol` method was defined in ConstantPool class
because it must access some internal state of ConstantPool. In order
to move that method to ICodeReader we had two options:
1. Make all internal state accessible from outside of ConstantPool
class so getMemberSymbol could be implemented outside of
ConstantPool hierarchy
2. Make it possible to subclass ConstantPool in ICodeReader so
getMemberSymbol can be implemented in a subclass and can access
internal state of ConstantPool
Given the fact that getMemberSymbol mutates ConstantPool's internal
state I decided that subclassing is a cleaner approach. It required
significant refactoring because we had to make sure that we create
an instance of proper class when initializing the `pool` variable.
I ended up introducing `ConstantPoolManager` class which is essentially
a mutable variable that can be reset multiple times.
This change makes ClassfileParser independent from the ICodeReader and
its implementation details.
|
|\ \ \
| | |/
| |/| |
|
| |\ \
| | | |
| | | | |
Improve type printing (toString/debugging)
|
| | | | |
|
|\ \ \ \
| |/ / /
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Conflicts:
bincompat-backward.whitelist.conf
bincompat-forward.whitelist.conf
src/compiler/scala/reflect/reify/phases/Reshape.scala
src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
src/compiler/scala/tools/nsc/transform/Mixin.scala
src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
src/compiler/scala/tools/nsc/typechecker/Typers.scala
src/library/scala/concurrent/impl/Promise.scala
src/reflect/scala/reflect/internal/StdAttachments.scala
test/files/neg/macro-override-macro-overrides-abstract-method-b.check
test/files/run/t7569.check
|
| |\ \ \
| | | | |
| | | | | |
SI-7455 Drop dummy param for synthetic access constructor
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Java synthesizes public constructors in private classes to
allow access from inner classes. The signature of
that synthetic constructor (known as a "access constructor")
has a dummy parameter appended to avoid overloading clashes.
javac chooses the type "Enclosing$1" for the dummy parameter
(called the "access constructor tag") which is either an
existing anonymous class or a synthesized class for this purpose.
In OpenJDK, this transformation is performed in:
langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java
(Incidentally, scalac would just emits a byte-code public
constructor in this situation, rather than a private constructor /
access constructor pair.)
Scala parses the signature of the access contructor, and drops
the $outer parameter, but retains the dummy parameter. This causes
havoc when it tries to parse the bytecode for that anonymous class;
the class file parser doesn't have the enclosing type parameters
of Vector in scope and crash ensues.
In any case, we shouldn't allow user code to see that constructor;
it should only be called from within its own compilation unit.
This commit drops the dummy parameter from access constructor
signatures in class file parsing.
|
| |\ \ \ \
| | | | | |
| | | | | | |
SI-7636 Fix a NPE in typing class constructors
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
If we encountered an erroneous super call due to a
failure in parent type argument inference, we must
avoid inspecting the untyped children of erroneous
trees.
|
| |\ \ \ \ \
| | | | | | |
| | | | | | | |
SI-7687 Handle spaces in %COMSPEC% path in scala.bat.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Double quoted %COMSPEC% to allow for spaces in the path to the
default interpreter (cmd.exe or equivalent).
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
introduced in 5b54681: the end position of Postfix operators should
take the operator length into account.
review by @som-snytt
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Currently we allow macros to override non-abstract methods (in order
to provide performance enhancements such as foreach for collections),
and we also disallow macros to override abstract methods (otherwise
downcasting might lead to AbstractMethodErrors).
This patch fixes an oversight in the disallowing rule that prohibited
macros from overriding a concrete method if that concrete method itself
overrides an abstract method. RefCheck entertains all overriding pairs,
not only the immediate ones, so the disallowing rule was triggered.
Now macros can override abstract methods if and only if either the base
type or the self type contain a matching non-abstract method.
|
| |\ \ \ \
| | | | | |
| | | | | | |
SI-7649 Fix positions for reshaped tag materializers
|
| | |/ / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Calls to `materializeClassTag[T]` are replaced during reification with
`implicitly[ClassTag[T]]` in the `reify` macro. This is done to avoid
referring to symbols in scala-compiler.jar. Class- and Type-Tag
materialization is treated in the same way.
This commit positions the replacement trees to avoid triggering
assertions under -Yrangepos.
|
| |\ \ \ \
| | | | | |
| | | | | | |
SI-7617 typedAssign no longer expands lhs
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This makes sure that setter and updateDynamic macros work as intended
rather than in some cases expanding incorrectly or prematurely.
Setter invocations are desugared from assignments of values to getters.
If a typecheck of an assignment's lhs yields an invocation of a getter,
then the assignment is rewritten into an invocation of a setter. However
if a getter is a macro, then it just expands, destroying the prerequisite
for desugaring. Therefore we need to disable expansion for the typecheck
of an lhs.
Similar thing happens to updateDynamic that first desugars a getter
invocation into q"$target.updateDynamic($fieldName)" and then expects
typedAssign to rewrite the corresponding Assign node into an additional
application of a partially applied updateDynamic to a rhs. Here we also
need to disable the typecheck of an lhs, because macros cannot be
partially applied.
|
| | | | | | |
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The crash was caused by a symbol lookup to rewire the super calls,
done after pickler, but specialization added new traits and new
members, thus making the super rewiring impossible. To avoid such
problems, this patch moves symbol lookup after specialization,
so the changes done by specialization (and miniboxing) become
visible to mixin.
NOTE: This patch will be followed by a similar patch to master.
Review by @adriaanm or @retronym.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-7668 Better return type inheritance for dep. method types
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Return type inheritance already handles substitution of
type parameters of the overriding method for those of the
overriding.
This commit extends this to do the same for parameter symbols.
|