| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A retrospective test case which covers typechecking idempotency which
was introduced in 0b78a0196 / 148736c3df. It also tests the
implicit class handling, which was fixed in the previous commit.
It is difficult to test this using existing presentation compiler
testing infrastructure, as one can't control at which point during
the first typechecking the subesquent work item will be noticed.
Instead, I've created a test with a custom subclass of
`interactive.Global` that allows precise, deterministic control
of when this happens. It overrides `signalDone`, which is called
after each tree is typechecked, and watches for a defintion with
a well known name. At that point, it triggers a targetted typecheck
of the tree marked with a special comment.
It is likely that this approach can be generalized to a reusable
base class down the track. In particular, I expect that some of
the nasty interactive ScalaDoc bugs could use this single-threaded
approach to testing the presentation compiler.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When we name an implicit class, `enterImplicitWrapper` is called,
which enters the symbol for the factory method into the
owning scope. The tree defining this factory method is stowed into
`unit.synthetics`, from whence it will be retrieved and incorporated
into the enclosing tree during typechecking (`addDerivedTrees`).
The entry in `unit.synthetics` is removed at that point.
However, in the presentation compiler, we can typecheck a unit
more than once in a single run. For example, if, as happens
in the enclosed test, a call to ask for a type at a given
position interrupts type checking of the entire unit, we
can get into a situation whereby the first type checking
invocation has consumed the entry from `unit.synthetics`,
and the second will crash when it can't find an entry.
Similar problems have been solved in the past in
`enterExistingSym` in the presentation compiler. This method
is called when the namer encounters a tree that already has
a symbol attached. See 0b78a0196 / 148736c3df.
This commit takes a two pronged approach.
First, `enterExistingSym` is extended to handle implicit classes.
Any previous factory method in the owning scope is removed, and
`enterImplicitWrapper` is called to place a new tree for the factory
into `unit.synthetics` and to enter its symbol into the owning scope.
Second, the assertions that could be tripped in `addDerivedTrees`
and in `ImplicitClassWrapper#derivedSym` have been converted to
positioned errors.
The first change is sufficient to fix this bug, but the second
is also enough to make the enclosed test pass, and has been retained
as an extra layer of defence.
|
|
|
|
|
|
|
|
| |
Seeing too many of these failures on our build servers.
https://scala-webapps.epfl.ch/jenkins/view/2.N.x/job/scala-nightly-auxjvm-2.11.x/148/jdk=jdk8,label=auxjvm/console
This is most likely due to load on the machines.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit seems bigger than it is. Most of it is tests, and moving
some code around. The actual changes are small, but a bit subtle.
The InnerClass and EnclosingMethod attributes should now be close to
the JVM spec (which is summarized in BTypes.scala). New tests make
sure that changes to these attributes, and changes to the way Java
reflection sees Scala classfiles, don't go unnoticed.
A new file, BCodeAsmCommon, holds code that's shared between the two
backend (it could hold more, future work).
In general, the difficulty with emitting InnerClass / EnclosingMethod
is that we need to find out source-level properties. We need to make
sure to do enough phase-travelling, and work around destructive
changes to the ownerchain in lambdalift (we use originalOwner a lot).
The change to JavaMirrors is prompted by the change to the
EnclosingMethod attribute, which changes Java reflection's answer to
getEnclosingMethod and getEnclosingConstructor. Classes defined in
field initializers no longer have an enclosing method, just an
enclosing class, which broke an assumption in JavaMirrors.
There's one change in erasure. Before this change, when an object
declaration implements / overrides a method, and a bridge is required,
then the bridge method was actually a ModuleSymbol (it would get the
lateMETHOD flag and be emitted as a method anyway). This is confusing,
when iterating through the members of a class, you can find two
modules with the same name, and one of them doesn't have a module
class. Now, such bridge methods will be MethodSymbols.
Removed Symbol.originalEnclosingMethod, that is a backend thing and
doesn't need to live in the symbol API.
|
|
|
|
|
|
|
|
|
|
|
| |
And the Scala runner exits with 0 for info settings.
Producing the version string is consolidated.
The compiler driver uses the default settings hook to
short-circuit on -version. That's to avoid creating
the compiler; really it should check shouldStopWithInfo
first, as the runner does.
|
|\
| |
| | |
Fix regression for using Scala IDE on scala-library
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If the class path is incomplete, the presentation compiler might crash during construction.
If the PC thread was already started, it will never get the chance to shutdown, and the
thread leaks. In the IDE, where the PC is started when needed, this can lead to a very
quick depletion of JVM threads.
See Scala IDE #1002016.
|
|/
|
|
|
|
|
|
| |
And uses a map per-compilation unit, rather than one per Typer.
One small change required: we now need to clear this map in the
the interactive compiler which reuses compilation units, rather
than in the call to `Typer#reset`.
|
|
|
|
| |
Made loop invariant / recursion metric explicit.
|
|
|
|
|
| |
This cute little type is necessary for importers to work correctly.
I wonder how we could overlook its existence for almost 2 years.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The presentation compiler is primarily interested in trees that
represent the code that one sees in the IDE, not the expansion of
macros.
This commit continues to expand macros, but adds a hook in which
the presentation compiler discards the expansion, retaining instead
the expandee. The expandee is attributed with the type of the
expansion, which allows white box macros to work. In addition,
any domain specific errors and warnings issued by the macro will
still be reported, as a side-effect of the expansion.
The failing test from the last commit now correctly resolves
hyperlinks in macro arguments.
Related IDE ticket:
https://www.assembla.com/spaces/scala-ide/tickets/1001449#
This facility is configured as follows:
// expand macros as per normal
-Ymacro-expand:normal
// don't expand the macro, takes the place of -Ymacro-no-expand
-Ymacro-expand:none
// expand macros to compute type and emit warnings,
// but retain expandee. Set automatically be the presentation
// compiler
-Ymacro-expand:discard
This leaves to door ajar for a new option:
// Don't expand blackbox macros; expand whitebox
// but retain expandee
-Ymacro-expand:discard-whitebox-only
The existing test for SI-6812 has been duplicated. One copy exercises
the now-deprecated -Ymacro-no-expand, and the other uses the new
option.
|
|
|
|
| |
Report null symbols in an civilised manner, rather than with a NPE.
|
|\
| |
| | |
SI-8030 force symbols on presentation compiler initialization
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit forces a number of built-in symbols in presentation
compiler to prevent them from being entered during parsing.
The property “parsing doesn’t enter new symbols” is tested on
a rich source file that contains significant number of variations
of Scala syntax.
|
|/
|
|
|
|
|
|
|
|
|
|
| |
Conflicts:
bincompat-forward.whitelist.conf
src/interactive/scala/tools/nsc/interactive/Global.scala
test/files/presentation/scope-completion-2.check
test/files/presentation/scope-completion-3.check
test/files/presentation/scope-completion-import.check
Conflicts in the scope completion tests handled with the help
of @skyluc in https://github.com/scala/scala/pull/3264
|
|
|
|
|
| |
Conflicts:
src/interactive/scala/tools/nsc/interactive/CompilerControl.scala
|
|
|
|
|
| |
Conflicts:
src/compiler/scala/tools/nsc/interactive/Global.scala
|
|\
| |
| | |
SI-7221 Rewrites pollForWork non-recursively
|
| |
| |
| |
| | |
Fixes #1001407
|
|\ \
| | |
| | | |
Removing deprecated code.
|
| | |
| | |
| | |
| | |
| | | |
Code which has been deprecated since 2.10.0 and which allowed
for straightforward removal.
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Updates localeContext() to return the best context possible when there are none directly
associated with the given position. It happens when an expression cannot be
successfully typed, as no precise ContextTree covers the expression location, or if the
position is not inside any expression.
Adds corresponding tests
|
|/
|
|
|
| |
Adds a new marker /*_*/ to trigger scope completion test.
Original type completion test oracles update for the tweaked output
|
|
|
|
|
| |
Conflicts:
src/interactive/scala/tools/nsc/interactive/Global.scala
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Actual modularization is delayed until 2.12.
The one big (one-line) change is to make the interactive compiler independent
of scaladoc. We have one "integration test": `MemoryLeaksTest`.
This commit adds a bunch of comments marked `TODO: modularize the compiler`,
that should be uncommented when we're ready to continue the modularization
effort.
I decided to merge them commented out to avoid having to rebase xml patches.
There's still some chance of bitrot, but I'm willing to take my chances.
I previously refactored the build to make it easier to add jars in a coherent
way, which hinges on the `init-project-prop` mechanism, so the relevant
properties are already injected there.
|
|
|
|
|
|
| |
Calling position factories rather than instantiating these
particular classes. Not calling deprecated methods. Added a few
position combinator methods.
|
|\
| |
| | |
Follow good interrupt discipline in Response
|
| |
| |
| |
| |
| | |
Restores the interrupted status of the waiting thread after catching
an InterruptException.
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One last flurry with the broom before I leave you slobs to code
in your own filth. Eliminated all the trailing whitespace I
could manage, with special prejudice reserved for the test cases
which depended on the preservation of trailing whitespace.
Was reminded I cannot figure out how to eliminate the trailing
space on the "scala> " prompt in repl transcripts. At least
reduced the number of such empty prompts by trimming transcript
code on the way in.
Routed ConsoleReporter's "printMessage" through a trailing
whitespace stripping method which might help futureproof
against the future of whitespace diseases. Deleted the up-to-40
lines of trailing whitespace found in various library files.
It seems like only yesterday we performed whitespace surgery
on the whole repo. Clearly it doesn't stick very well. I suggest
it would work better to enforce a few requirements on the way in.
|
|
|
|
|
|
|
|
|
|
| |
Without it, the enclosed test fails with:
ArrayBuffer(Problem(RangePosition(partial-fun/src/PartialFun.scala, 62, 62, 77),type mismatch;
found : Int => Int
required: PartialFunction[Int,Int],2))
And with that, we can remove this option altogether.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we didn't have all possible name creation facilities covered
with locks, so some of them silently misbehaved and caused much grief:
http://groups.google.com/group/scala-internals/browse_thread/thread/ec1d3e2c4bcb000a.
This patch gets all the name factories under control.
Rather than relying on subclasses to override mutating methods
and add synchronization, they should instead override `synchronizeNames`
to return true and leave the placement of the locks up to
`reflect.internal.Names`.
These locks are placed around sections that mutate `typeHashtable`
and `termHashtable`.
This is done in the reflection universe, and in the interactive
compiler. The latter change will obviate an incomplete attempt
do to the same in `ScalaPresentationCompiler` in the scala-ide
project.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 only usages of scala.tools.nsc.io.{Lexer,Pickler,PrettyWriter,
Replayer} can be found in scala.tools.nsc.interactive.
Let's move those files closer to their dependencies.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Optimistically, this is preparation for a day when we don't
let numeric types drift with the winds. Even without the optimism
it's a good idea. It flushed out an undocumented change in
the math package object relative to the methods being forwarded (a
type is widened from what is returned in java) so I documented
the intentionality of it.
Managing type coercions manually is a bit tedious, no doubt,
but it's not tedious enough to warrant abandoning type safety
just because java did it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have lots of core classes for which we need not go through
the symbol to get the type:
ObjectClass.tpe -> ObjectTpe
AnyClass.tpe -> AnyTpe
I updated everything to use the concise/direct version,
and eliminated a bunch of noise where places were calling
typeConstructor, erasedTypeRef, and other different-seeming methods
only to always wind up with the same type they would have received
from sym.tpe. There's only one Object type, before or after erasure,
with or without type arguments.
Calls to typeConstructor were especially damaging because (see
previous commit) it had a tendency to cache a different type than
the type one would find via other means. The two types would
compare =:=, but possibly not == and definitely not eq. (I still
don't understand what == is expected to do with types.)
|
|
|
|
|
|
|
|
|
|
|
| |
The nondeterminism presently showing itself in
presentation/implicit-member is a consequence of the
presentation compiler tests relying on details of the
behavior of toString calls. We need to stomp this out,
but it will take a while. Based on the check file
changes enclosed with this commit, this will suffice
for the presentation compiler tests. A broader assault
will have to take place, but not yet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Symbol::isStable` is now independent of `Symbol::hasVolatileType`,
so that we can allow stable identifiers that are volatile in ident patterns.
This split is validated by SI-6815 and the old logic in RefChecks,
which seems to assume this independence, and thus I don't think ever worked:
```
if (member.isStable && !otherTp.isVolatile) {
if (memberTp.isVolatile)
overrideError("has a volatile type; cannot override a member with non-volatile type")
```
Introduces `admitsTypeSelection` and `isStableIdentifierPattern` in treeInfo,
and uses them instead of duplicating that logic all over the place.
Since volatility only matters in the context of type application,
`isStableIdentifierPattern` is used to check patterns (resulting in `==` checks)
and imports.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Confusing, now-it-happens now-it-doesn't mysteries lurk
in the darkness. When scala packages are declared like this:
package scala.collection.mutable
Then paths relative to scala can easily be broken via the unlucky
presence of an empty (or nonempty) directory. Example:
// a.scala
package scala.foo
class Bar { new util.Random }
% scalac ./a.scala
% mkdir util
% scalac ./a.scala
./a.scala:4: error: type Random is not a member of package util
new util.Random
^
one error found
There are two ways to play defense against this:
- don't use relative paths; okay sometimes, less so others
- don't "opt out" of the scala package
This commit mostly pursues the latter, with occasional doses
of the former.
I created a scratch directory containing these empty directories:
actors annotation ant api asm beans cmd collection compat
concurrent control convert docutil dtd duration event factory
forkjoin generic hashing immutable impl include internal io
logging macros man1 matching math meta model mutable nsc parallel
parsing partest persistent process pull ref reflect reify remote
runtime scalap scheduler script swing sys text threadpool tools
transform unchecked util xml
I stopped when I could compile the main src directories
even with all those empties on my classpath.
|
|\
| |
| | |
Merge 2.10.x
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
bincompat-forward.whitelist.conf
src/compiler/scala/tools/nsc/matching/Patterns.scala
src/compiler/scala/tools/nsc/transform/patmat/Logic.scala
src/compiler/scala/tools/nsc/typechecker/Infer.scala
src/scaladoc/scala/tools/nsc/doc/model/ModelFactory.scala
test/files/neg/t5663-badwarneq.check
|
| |
| |
| |
| |
| |
| | |
I resisted the urge to fix "aksTypeCompletion" for as long
as I possibly could. While I was there I threw in what seem
to be like significant output improvements, but you tell me.
|
| |
| |
| |
| | |
Code by retronym, test by huitseeker, I just move stuff around.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since we don't throw exceptions for normal errors it was a bit odd
that we don't do that for DivergingImplicit.
As SI-7291 shows, the logic behind catching/throwing exception
was broken for divergence. Instead of patching it, I rewrote
the mechanism so that we now another SearchFailure type related
to diverging expansion, similar to ambiguous implicit scenario.
The logic to prevent diverging expansion from stopping the search
had to be slightly adapted but works as usual.
The upside is that we don't have to catch diverging implicit
for example in the presentation compiler which was again showing
that something was utterly broken with the exception approach.
|
|
|
|
|
|
| |
Some unused private code, unused imports, and points where
an extra pair of parentheses is necessary for scalac to have
confidence in our intentions.
|
|\
| |
| | |
SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlag
|