| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
"sbt" is not an acronym (it used to be, but it isn't any longer).
It's a proper name, like "iPhone" or "eBay".
So, just like you wouldn't write "Get Started With EBay" or
"How To Reset Your IPhone", we don't write "Using the Sbt Build".
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can only do this on 2.12.x, because URLClassLoader#close
is new in JDK 7.
Tested manually with the REPL and resident compilers.
```
% qscalac sandbox/macro.scala && (for i in 1 2; do echo sandbox/client.scala; done; printf '\n') | qscalac -Xresident -Ylog:all -Ydebug 2>&1 | grep "Closing macro runtime classloader"
[log terminal] Closing macro runtime classloader
[log terminal] Closing macro runtime classloader
% qscalac sandbox/macro.scala && (for i in 1 2; do echo Macro.m; done; printf '\n') | qscala -Ylog:all -Ydebug 2>&1 | grep "Closing macro runtime classloader"; stty echo
[log terminal] Closing macro runtime classloader
[log terminal] Closing macro runtime classloader
```
Note: this doesn't close handles to JAR files held by the
compiler classpath implementation, that will require changes
elsewhere.
|
|
|
|
|
|
|
|
|
|
| |
- Language imports are preceding other imports
- Deleted empty file: InlineErasure
- Removed some unused private[parallel] methods in
scala/collection/parallel/package.scala
This removes hundreds of warnings when compiling with
"-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Note that JUnit creates a new instance of the test class for running
each test method. So the compiler instance is added to the companion.
However, the JVM would quickly run out of memory when running multiple
tests, as the compilers cannot be GCd. So we make it a `var`, and set
it to null when a class is done. For that we use JUnit's `@AfterClass`
which is required to be on a static method. Therefore we add a Java
class with such a static method that we can extend from Scala.
|
|\|
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
build.number
src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
src/library/scala/collection/Iterator.scala
versions.properties
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit contains some minor changes made by the way when
implementing flat classpath.
Sample JUnit test that shows that all pieces of JUnit infrastructure
work correctly now uses assert method form JUnit as it should do from
the beginning.
I removed commented out lines which were obvious to me. In the case
of less obvious commented out lines I added TODOs as someone should
look at such places some day and clean them up.
I removed also some unnecessary semicolons and unused imports.
Many string concatenations using + have been changed to string
interpolation.
There's removed unused, private walkIterator method from ZipArchive.
It seems that it was unused since this commit:
https://github.com/scala/scala/commit/9d4994b96c77d914687433586eb6d1f9e49c520f
However, I had to add an exception for the compatibility checker
because it was complaining about this change.
I made some trivial corrections/optimisations like use 'findClassFile'
method instead of 'findClass' in combination with 'binary' to find
the class file.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Introduce `Symbol#packageObject` and `Type#packageObject`
to lookup the member package object of a package class/module,
and use this far and wide.
- Replace the overly complicated (and still buggy) implementation
of `Context#isInPackageObject` with a one liner. The simplifying
insight is that if we select a symbol from a package prefix
that does not own that symbol, it *must* have really been
selected from the package object.
- Change implicit search to use the cache in
`ModuleSymbol#implicitMembers` via `Type#implicitMembers`,
which lets the client code read more naturally.
Fixes a bug with `adapt::insertApply` that Adriaan spotted in a feat
of lateral thinking. This is tested in t8862b.scala. alladin763.scala
adds the test case from the bug originally remedied by `insertApply`
to check we haven't regressed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move code from Global/SymbolTable to separate Reporting traits to
start carving out an interface in scala.reflect.internal.Reporting,
with internals in scala.tools.nsc. Reporting is mixed into the cake.
It contains a nested class PerRunReporting.
Should do the same for debugging/logging.
The idea is that CompilationUnit and Global forward all reporting
to Reporter. The Reporting trait contains these forwarders, and
PerRunReporting, which accumulates warning state during a run.
In the process, I slightly changed the behavior of `globalError`
in reflect.internal.SymbolTable: it used to abort, weirdly.
I assume that was dummy behavior to avoid introducing an abstract method.
It's immediately overridden in Global, and I couldn't find any other subclasses,
so I don't think the behavior in SymbolTable was ever observed.
Provide necessary hooks for scala.reflect.macros.Parsers#parse.
See scala/reflect/macros/contexts/Parsers.scala's parse method,
which overrides the reporter to detect when parsing goes wrong.
This should be refactored, but that goes beyond the scope of this PR.
Don't pop empty macro context stack.
(Ran into this while reworking -Xfatal-warnings logic.)
Fix -Xfatal-warnings behavior (and check files): it wasn't meant to
influence warning reporting, except for emitting one final error;
if necessary to fail the compile (when warnings but no errors were reported).
Warnings should stay warnings.
This was refactored in fbbbb22946, but we soon seem to have relapsed.
An hour of gitfu did not lead to where it went wrong. Must've been a merge.
|
|
|
|
|
|
|
| |
Issue deprecation warning under -Xsource:2.10 so time
travelers can have an authentic deprecation experience before
finding that their unsound code no longer compiles in 2.11.
The relevant ticket to the soundness issue is SI-6566.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reflection API exhibits a tension inherent to experimental things:
on the one hand we want it to grow into a beautiful and robust API,
but on the other hand we have to deal with immaturity of underlying mechanisms
by providing not very pretty solutions to enable important use cases.
In Scala 2.10, which was our first stab at reflection API, we didn't
have a systematic approach to dealing with this tension, sometimes exposing
too much of internals (e.g. Symbol.deSkolemize) and sometimes exposing
too little (e.g. there's still no facility to change owners, to do typing
transformations, etc). This resulted in certain confusion with some internal
APIs living among public ones, scaring the newcomers, and some internal APIs
only available via casting, which requires intimate knowledge of the
compiler and breaks compatibility guarantees.
This led to creation of the `internal` API module for the reflection API,
which provides advanced APIs necessary for macros that push boundaries
of the state of the art, clearly demarcating them from the more or less
straightforward rest and providing compatibility guarantees on par with
the rest of the reflection API.
This commit does break source compatibility with reflection API in 2.10,
but the next commit is going to introduce a strategy of dealing with that.
|
|
|
|
| |
These are a hotspot in the backend.
|
|\
| |
| | |
Remove misc. @deprecated elements
|
| | |
|
|\ \
| | |
| | | |
SI-8129 Plug a leak in perRunCaches
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I guess we've never leaned to heavily on these, because the
registry of caches was forgetting about most of them
immediately if they compared == at the point of creation.
Consequently, maps like `treatedInfos` in Mixin were holding
onto old types and symbols and leaking memory.
You can reproduce the leak with:
(for i in {1..200}; do echo src/library/scala/collection/*.scala; done; printf "\n") | scalac-hash v2.11.0-M7 -J-Xmx256M -Xresident
nsc> warning: there were 6 deprecation warning(s); re-run with -deprecation for details
(... 15 times)
nsc> java.lang.OutOfMemoryError: GC overhead limit exceeded
Dumping heap to java_pid90362.hprof ...
Heap dump file created [340635728 bytes in 7.993 secs]
^CException in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
As a consequence of this change, I had to remove eager clearing of the
uniques types cache. The comment in the code elaborates further.
|
|/
|
|
|
|
|
|
|
|
|
| |
One example were this would lead to subtle bugs otherwise is
Symbol_apply, where after erasure an overloaded symbol containing
Symbol#apply and UniquenessCache#apply is returned.
// findMember considered harmful after erasure; e.g.
//
// scala> exitingErasure(Symbol_apply).isOverloaded
// res27: Boolean = true
|
|
|
|
|
|
|
|
|
|
| |
System.currentTimeMillis is affected by wall-clock time, which means
things can appear to jump back in time.
Use System.nanoTime which is more likely¹ to be monotonic instead.
¹ See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6458294
"nanoTime affected by system clock change on Linux (RH9) or in
general lacks monotonicity".
|
|
|
|
|
|
|
|
|
|
|
| |
1. refactor out FreshNameExtractor out of Quasiquotes cake into
SymbolTable (can’t put it outside due to the fact that names are
path-dependent)
2. add optional parameter to the fresh name creator to cover additional
qq$ prefix needed for quasiquotes
3. add unit tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It we can only safely use vals in Definitions for top-level symbols.
Otherwise, when the IDE switches to loading the symbol from source,
we can hold on to a stale symbol, which in turn impedes implicit
materialization of TypeTags.
This commit moves (most) of the accessors for member symbols
into RunDefinitions, and changes calling code accordingly.
This is a win for presentation compiler correctness, and
might even shave of a few cycles.
In a few cases, I have had to leave a `def` to a member symbol
in Definitions so we can get to it from the SymbolTable cake,
which doesn't see RunDefinitions.
The macro FastTrack facility now correctly recreates the mapping
from Symbol to macro implementation each run, using a new facility
in perRunCaches to create a run-indexed cache.
The enclosed test recreates the situation reported in the ticket,
in which TypeTags.scala is loaded from source.
|
|\
| |
| | |
Add support for packages into quasiquotes and toolbox, improve handling of fresh names, unhardcode quasiquote expansion logic
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This commit extracts out freshTermName and freshTypeName to the top-level
with implicit fresh name creator argument. This will let to refactor out
more methods out of tree builder into treegen that are dependent on fresh
name generator. We also save quite a bit of boilerplate by not having to
redefined fresh functions all over the place.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Mentioned methods mutate the global `atPhaseStack` variable, which can
easily lead to imbalances and, ultimately, to the empty stack error.
Luckily for us, there's only one dummy phase, SomePhase, which is used
by runtime reflection, so there is absolutely zero need to invoke atPhase
in non-compiler reflexive universes.
The cleanest solution would be to override `atPhase` for runtime reflection,
but it's @inline final, so I didn't want to pay performance penalties for
something that's used three times in runtime reflection (during unpickling, in
reflection-specific completers and in `Symbol.typeParams/unsafeTypeParams`).
Therefore I added overrideable analogues of `atPhase` and `atPhaseNotLaterThan`
which are called from the aforementioned code shared between the compiler and
runtime reflection. I also had to duplicate the code of `Symbol.XXXtypeParams`
(only in SynchronizedSymbols, not in normal Symbols) again due to those
methods being very performance-sensitive.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit drops about 700 lines of redundant traversal logic.
There had been ad hoc adjustments to the pickling scheme here and
there, probably in pursuit of tiny performance improvements.
For instance, a Block was pickled expr/stats instead of stats/expr,
a TypeDef was pickled rhs/tparams instead of tparams/rhs.
The benefits derived are invisible compared to the cost of having
several hundred lines of tree traversal code duplicated in half a
dozen or more places.
After making Traverser consistent/complete, it was a straightforward
matter to use it for pickling. It is ALSO now possible to write a
vastly cleaner tree printer than the ones presently in trunk, but I
leave this as an exercise for Dear Reviewer.
|
|/ |
|
|\
| |
| |
| |
| |
| | |
Conflicts:
src/compiler/scala/tools/nsc/Global.scala
src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Historically calling NoSymbol.owner has crashed the compiler.
With this commit, NoSymbol owns itself. This is consistent with
the way ownership chains are handled elsewhere in the compiler
(e.g. NoContext.owner is NoContext, NoSymbol.enclClass is
NoSymbol, and so on) and frees every call site which handles
symbols from having to perform precondition tests against
NoSymbol.
Since calling NoSymbol.owner sometimes (not always) indicates
a bug which we'd like to catch sooner than later, I have
introduced a couple more methods for selected call sites.
def owner: Symbol // NoSymbol.owner is self, log if -Xdev
def safeOwner: Symbol // NoSymbol.owner is self, ignore
def assertOwner: Symbol // NoSymbol.owner is fatal
The idea is that everyone can call sym.owner without undue anxiety
or paranoid null-like tests. When compiling under -Xdev calls to
`owner` are logged with a stack trace, so any call sites for which
that is an expected occurrence should call safeOwner instead to
communicate the intention and stay out of the log. Conversely, any
call site where crashing on the owner call was a desirable behavior
can opt into calling assertOwner.
This commit also includes all the safeOwner calls necessary to
give us a silent log when compiling scala.
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
perRunCaches was using a HashMap of WeakReferences which meant it would
accumulate WeakReferences over time. This commit uses a WeakHashSet
instead so that the references are cleaned up.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Sick of seeing Console printlns during partest runs.
You should not print anything to Console.{out,err} if
it's ever going to happen outside developerland.
|
|
|
|
|
|
|
| |
This commit shortens expressions of the form `if (settings.debug.value)` to
`if (settings.debug)` for various settings. Rarely, the setting is supplied
as a method argument. The conversion is not employed in simple definitions
where the Boolean type would have to be specified.
|
|
|
|
|
| |
Lowering the barriers to sensible logging - these methods are
key in avoiding the "too much trouble" syndrome.
|
| |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
merge-210
* commit 'b43ae58f31':
introduces an exhaustive java-to-scala test
SI-6989 privateWithin is now populated in reflect
* commit 'b579a42ee3':
SI-6888 Loosen criteria for $outer search.
* commit '81fa831609':
Class symbols can't be contravariant.
SI-6666 Catch VerifyErrors in the making in early defs.
Broader checks for poisonous this references.
Add a test case from the comments of SI-6666.
SI-6666 Account for nesting in setting INCONSTRUCTOR
Move a test from pos to run to highlight bytecode deficiencies.
Conflicts:
src/compiler/scala/tools/nsc/interpreter/IMain.scala
|
| |/
| |
| |
| |
| | |
Runtime reflection in JavaMirrors previously forgot to fill in
privateWithin when importing Java reflection artifacts. Now this is fixed.
|
| |
| |
| |
| | |
So I can centralize all the redundant variance code.
|
| |
| |
| |
| |
| |
| |
| |
| | |
It lives on in a branch born from this commit's parent.
It's abrupt; no attempt is made to offer a "smooth transition"
for the serious msil userbase, population zero. If anyone feels
very strongly that such a transition is necessary, I will be
happy to talk you into feeling differently.
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* merge-2.10-wip:
Fixing OSGi distribution.
Fix for rangepos crasher.
SI-6685 fixes error handling in typedApply
Test cases for SI-5726, SI-5733, SI-6320, SI-6551, SI-6722.
Asserts about Tree qualifiers.
Fix for SI-6731, dropped trees in selectDynamic.
neg test added
SI-5753 macros cannot be loaded when inherited from a class or a trait
Take advantage of the margin stripping interpolator.
Adds a margin stripping string interpolator.
SI-6718 fixes a volatile test
Mark pattern matcher synthetics as SYNTHETIC.
Set symbol flags at creation.
Fix for SI-6687, wrong isVar logic.
Fix for SI-6706, Symbol breakage under GC.
findEntry implementation code more concise and DRYer.
Fix for SI-6357, cycle with value classes.
Refactoring of adaptMethod
SI-6677 Insert required cast in `new qual.foo.T`
Conflicts:
src/compiler/scala/tools/nsc/transform/Erasure.scala
src/compiler/scala/tools/nsc/typechecker/Typers.scala
src/reflect/scala/reflect/internal/SymbolTable.scala
src/reflect/scala/reflect/internal/util/package.scala
test/files/neg/gadts1.check
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently only for compiler internal use.
Designed to avoid surprises if the interpolated values
themselves contain the margin delimiter.
Before:
val bip = "\n |.."
s"""fooo
|bar $bip
|baz""".stripMargin
"fooo
bar
..
baz"
After:
sm"""fooo
|bar $bip
|baz"""
"fooo
bar
|..
baz"
|
|\ \
| | |
| | | |
Removing unused code, take 2.
|
| | |
| | |
| | |
| | |
| | | |
Not a bad showing for a newcomer. Of course most of this
code predates scala.reflect by a lot.
|
| | |
| | |
| | |
| | | |
This reverts commit 951fc3a486.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I want to get this commit into the history because
the tests pass here, which demonstrates that every commented
out method is not only unnecessary internally but has zero
test coverage. Since I know (based on the occasional source
code comment, or more often based on knowing something about
other source bases) that some of these can't be removed
without breaking other things, I want to at least record
a snapshot of the identities of all these unused and
untested methods.
This commit will be reverted; then there will be another
commit which removes the subset of these methods which I
believe to be removable. The remainder are in great need of
tests which exercise the interfaces upon which other
repositories depend.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A setting we developers can give all the time and expect to
hear useful things without being buried in debugging output.
As the comment says:
This is for WARNINGS which should reach the ears of scala
developers whenever they occur, but are not useful for normal
users. They should be precise, explanatory, and infrequent. Please
don't use this as a logging mechanism. !!! is prefixed to all
messages issued via this route to make them visually distinct.
This is what I always intended for "debugwarn", the method
I have deprecated in favor of the more accurate:
def devWarning(msg: => String): Unit
In this VERY SAME COMMIT, I performed the CLOSELY RELATED
task of quieting down an -Xlint warning which had become too
noisy thanks to implicit classes tickling it. I tightened that
warn condition to include both -Xlint and -Xdev.
|
| | | |
| \ | |
|\ \ \
| | |/
| |/|
| | |
| | |
| | |
| | | |
master
Conflicts:
src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
|