| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Added `since` to deprecation statement
- Added unit to parameter list
- Removed usage of deprecated method polyType
- Replaced deprecated `debugwarn` with `devWarning`
- Changed switch statement to if else in order to remove a warning
- Switched implementation of `init` and `processOptions` to prevent
warning
- Replaced deprecated `Console.readLine` with `scala.io.StdIn.readLine`
- Replaced deprecated `startOrPoint` with `start`
- Replaced deprecated `tpe_=` with `setType`
- Replaced deprecated `typeCheck` with `typecheck`
- Replaced deprecated `CompilationUnit.warning` with `typer.context.warning`
- Replaced deprecated `scala.tools.nsc.util.ScalaClassLoader` with `scala.reflect.internal.util.ScalaClassLoader`
- Replaced deprecated `scala.tools.ListOfNil` with `scala.reflect.internal.util.ListOfNil`
- Replaced deprecated `scala.tools.utils.ScalaClassLoader` with `scala.reflect.internal.util.ScalaClassLoader`
- Replaced deprecated `emptyValDef` with `noSelfType`
- In `BoxesRunTime` removed unused method and commented out unused values. Did not delete to keep a reference to the values. If they are deleted people might wonder why `1` and `2` are not used.
- Replaced deprecated `scala.tools.nsc.util.AbstractFileClassLoader` with `scala.reflect.internal.util.AbstractFileClassLoader`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is just one of the possible strategies for compatibility with
reflection API of 2.10.x family. Here’s the discussion:
1) Do nothing.
Document the fact that we’ve organized internal APIs in a separate module
and let people figure out themselves.
Pros: no boilerplate on our side.
Cons: potential for confusion, major upfront migration effort.
2) (This commit). Introduce a compatibility pack with a manual import.
Compatibility pack lives in a separate module that has to be manually imported.
People will get compilation errors when trying to compile macros using
internal APIs against 2.11, but those will be quenched by a single
`import compat._` import. Compatibility stubs would still produce
deprecation warnings, but people can choose to ignore them to alleviate
migration costs.
Pros: brings attention of the users to the fact that they are using
internal APIs by providing a more powerful nudge than just deprecation.
Cons: even though migration effort is trivial, it is still non-zero.
3) Deprecate internal APIs in-place.
Pros: zero migration effort required.
Cons: those who ignore deprecations will be unaware about using internal APIs,
there will be some naming conflicts between Universe.xxxType and internal.xxxType
type factories.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
SI-8131 fixes residual race condition in runtime reflection
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Apparently some completers can call setInfo while they’re not yet done,
which resets the LOCKED flag, and makes anything that uses LOCKED to
track completion unreliable. Unfortunately, that’s exactly the mechanism
that was used by runtime reflection to elide locking for symbols that are
known to be initialized.
This commit fixes the problematic lock elision strategy by introducing
an explicit communication channel between SynchronizedSymbol’s and their
completers. Now instead of trying hard to infer whether it’s already
initialized or not, every symbol gets a volatile field that can be queried
to provide necessary information.
|
|\ \
| | |
| | | |
deprecates resetAllAttrs and resetLocalAttrs in favor of the new API
|
| |/
| |
| |
| |
| | |
This cute little type is necessary for importers to work correctly.
I wonder how we could overlook its existence for almost 2 years.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This experimental option typechecked arguments of annotations
with an injected value in scope named `self`:
@Foo(self.foo < 1)
This has been slated for removal [1] for some time.
This commit removes it in one fell swoop, without any attempt
at source compatibility with code that constructs or pattern
matches on AnnotatedType.
[1] https://groups.google.com/d/msg/scala-internals/VdZ5UJwQFGI/C6tZ493Yxx4J
|
|
|
|
|
|
|
|
|
|
|
| |
Today’s flight back to Lausanne wasn’t as productive as the recent flight
to Minsk (https://github.com/scala/scala/pull/3305), but I noticed
one minor thingie: ExistentialTypeTree had an imprecise type specified
for its whereClauses. This is now fixed.
I didn’t increment PickleFormat.*Version numbers, because this change
introduces only a miniscule incompatibility with what would have been
a meaningless and most likely crash-inducing pickle anyway.
|
|
|
|
|
|
|
| |
Previously attachments weren't imported by importTree. Now a new marker
trait has been added that lets attachments to import themselves to the
new universe together with all their innards. Additionally a simpler
subtrait is defined to mark attachments that can be imported as-is.
|
|
|
|
|
| |
Looks like emptyValDef.isEmpty was already changed to return
false, so now all that's left is a name which means something.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
After the merge, the test/run/t7733 started to fail on Jenkins.
I tried to reproduce it locally but I couldn't so I think it's
system dependent failure. Per @retronym's suggestion I moved it to pending
to not block the whole merge.
Conflicts:
bincompat-backward.whitelist.conf
bincompat-forward.whitelist.conf
src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
src/compiler/scala/tools/nsc/typechecker/Macros.scala
src/compiler/scala/tools/nsc/typechecker/Namers.scala
src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
src/compiler/scala/tools/nsc/util/MsilClassPath.scala
src/compiler/scala/tools/reflect/ToolBoxFactory.scala
src/reflect/scala/reflect/internal/ClassfileConstants.scala
src/reflect/scala/reflect/internal/Importers.scala
src/reflect/scala/reflect/internal/Trees.scala
src/reflect/scala/reflect/runtime/JavaMirrors.scala
test/files/run/macro-duplicate/Impls_Macros_1.scala
test/files/run/t6392b.check
test/files/run/t7331c.check
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit gets rid off code wrapping that was previously used by
toolbox to get into correct parsing mode. Instead combination of
templateStats/accept(EOF) is used. This is the same solution as the one
used in repl and built-in scriptRunner
This pull request doesn't attempt to generalize this approach in any
way and re-use it all over the place due to the caution of possible
accidental compatibility breakage. I plan to do it separately against
master.
Additionally there are a few more changes that make importers be aware
of positions and a test for that (via @jedesah).
|
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 0ebf72b9498108e67c2133c6522c436af50a18e8.
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Typers.scala
src/reflect/scala/reflect/internal/Trees.scala
|
| |
| |
| |
| |
| | |
ClassfileAnnotArg becoming sealed brought tidings of not being
exhaustive.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Introduces better names, factors out recreation of symbols, trees, types
and completes into separate methods, so that they can be overridden in
specialized importers.
The original motivation for this refactoring was to support JIT
compilation of macros, but I think that most of the introduced
improvements to code quality will be useful in trunk.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It never worked and it would periodically jump out and bite
someone. Slash and burn so new plants can take root. Eliminated
NotNullType and NotNullClass, internal elements. Removed notNull
method on Type, which no longer has a purpose. Retained 'def
isNotNull' because there are types which are known by construction
not to be null (ThisType, ConstantType as long as the constant
isn't null, etc.) and that's still useful to know.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Deprecated tpe_= on Tree, which is redundant with and
less useful than setType. To provide a small layer of
insulation from the direct nulling out of mutable fields
used to signal the typer, added def clearType() which is
merely tree.tpe = null but is shamefaced about the null
and var-settings parts like a respectable method should be.
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* merge-wip-into-2.10.x: (44 commits)
Cleanups of reifyBoundTerm and reifyBoundType
SI-5841 reification of renamed imports
Share the empty LinkedList between first0/last0.
SI-4922 Show default in Scaladoc for generic methods.
SI-6614 Test case for fixed ArrayStack misconduct.
SI-6690 Release reference to last dequeued element.
SI-5789 Use the ReplTest framework in the test
SI-5789 Checks in the right version of the test
SI-5789 Removes assertion about implclass flag in Mixin.scala
SI-6766 Makes the -Pcontinuations:enable flag a project specific preference
more ListOfNil => Nil
DummyTree => CannotHaveAttrs
evicts assert(false) from the compiler
introduces global.pendingSuperCall
refactors handling of parent types
unifies approaches to call analysis in TreeInfo
TypeApply + Select and their type-level twins
SI-6696 removes "helper" tree factory methods
SI-6766 Create a continuations project in eclipse
Now the test suite runs MIMA for compatibility testing.
...
Conflicts:
src/compiler/scala/reflect/reify/codegen/GenUtils.scala
src/compiler/scala/tools/nsc/ast/Trees.scala
src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
src/compiler/scala/tools/nsc/typechecker/Contexts.scala
src/compiler/scala/tools/nsc/typechecker/Namers.scala
src/compiler/scala/tools/nsc/typechecker/Typers.scala
src/eclipse/scala-compiler/.classpath
src/eclipse/scalap/.classpath
src/reflect/scala/reflect/internal/StdNames.scala
src/reflect/scala/reflect/internal/TreeInfo.scala
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Similarly to global.emptyValDef, which is a dummy that stands for an
empty self-type, this commit introduces global.pendingSuperCall, which
stands for a yet-to-be-filled-in call to a superclass constructor.
pendingSuperCall is emitted by Parsers.template, treated specially by
Typers.typedParentType and replaced with a real superclass ctor call
by Typers.typedTemplate.
To avoid copy/paste, this commit also factors out and unifies dumminess
of EmptyTree, emptyValDef and pendingSuperCall - they all don't have a
position and actively refuse to gain one, same story for tpe.
|
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
|
| |
Suggestion by retronym that the obvious implementation of
"hasSymbol" be called "hasSymbol" reminded me we have a method
called "hasSymbol" which does not have that implementation, and
which has burned us already with subtle bugginess. I think that
"hasSymbolField" is self-documenting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Turns importer caches into fully weak hash maps, and also applies
manual cleanup to toolboxes every time they are used.
It's not enough, because reflection-mem-typecheck test is still leaking
at a rate of ~100kb per typecheck, but it's much better than it was before.
We'll fix the rest later, after 2.10.0-final.
For more information, see https://issues.scala-lang.org/browse/SI-6412 and
http://groups.google.com/group/scala-internals/browse_thread/thread/eabcf3d406dab8b2
In comparison with https://github.com/scala/scala/commit/b403c1d,
the original commit that implemented the fix, this one doesn't crash tests.
The problem with the original commit was that it called tryFixup() before
updating the cache, leading to stack overflows.
|
|
|
|
|
|
|
|
|
| |
At times it's useful to know whether a lazy type can change
the flags of the underlying symbol or not.
If the completer is flag-agnostic, this means that we can safely
use flag-inspection facilities such as hasFlag and isXXX tests
without fear of looking into not yet initialized data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some names I missed in 55b609458fd .
How one might know when one is done:
mkdir scratch && cd scratch
mkdir annotation beans collection compat concurrent io \
math parallel ref reflect runtime scala sys testing \
text tools util xml
scalac $(find ../src/library -name '*.scala')
Until recently that would fail with about a billion errors. When it
compiles, that's when you're done. And that's where this commit
takes us, for src/library at least.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1) Free symbols no longer carry signatures in their constructors.
Previously to reify a free symbol (i.e. to generate a ValDef that creates it)
one had to reify sym.info first. However reification of sym.info might lead to
unexpected side effects, including stack overflows, if reification of sym.info
recursively required reifying sym itself.
Now it's not a problem. First we reify a "header" of a free symbol
by emitting something like:
val free$Foo1 = build.newFreeTerm("Foo", Foo.this, NoFlags)`
Afterwards, when doing code generation for the reification symbol table, we
populate free symbols by inserting calls to `build.setTypeSignature($sym.info)`
This techniques transforms recursion into memoized iteration, because even if
reifying sym.info indirectly requires reification of sym itself, we remember
that we already reified sym and simply return things like Ident(free$Foo1).
2) Unfortunately I haven't been able to get rid of recursion completely.
Since some symbols (e.g. local classes) aren't pickled, we need to recreate
them during reification (this is necessary e.g. to reify RefinedTypes).
Reifier uses a special function, named `reifySymDef`, for that purpose.
Here's an example of how it works:
val symdef$_1 = build.newNestedSymbol(free$U1, newTypeName("_"),
NoPosition, DEFERRED | PARAM, false);
`reifySymDef` expands into a call to `newNestedSymbol`, which requires an owner
This essentially turns `reifySymDef` into a recursion of `reifySymDef` calls,
so that the entire owner chain get reified.
This is an implementation strategy that was employed in the first revision
of the reifier written by Martin, and personally I have no clue whether it's
really necessary to reify the parents. I leave this as a future work.
3) When working with free symbols, it's necessary to attach free symbols
to their reification. This is required in obscure nested reification scenarios,
when a symbol that was free for an inner reifee is no longer free for an outer
reifee. In that case we need to remove that free symbol from the symbol table
of the inner reification.
Back then we didn't have tree attachments, so I had to introduce a phantom
"value" parameter for `newFreeType` to keep track of the original symbols for
free types. Now when we have attachments, this is no longer necessary and
allowed me to clean up the code.
|
|
|
|
|
|
|
|
|
| |
This pull request applies some tuning changes to the reflection library:
1) the traits scala.reflect.api.FlagSets, scala.reflect.api.Mirrors
and scala.reflect.internal.Importers extend their corresponding
trait in the base layer of the cake.
2) method isType and asType in trait TypeSymbolBase is declared final
3) small changes in the docs.
|
|
|
|
|
|
|
|
|
| |
profiling data shows that accessing the hashCode field has a cost of about 10% of fully hot running times. We speculate that it's megamorphic dispatch which is costing us this much.
Rewrote code so that UniqueType is not an abstract base class with the hashCode field.
Also removed fingerPrinting bloom filter on findMember because it caused complexity and did not gain us anything accdoring to the tests.
Made TypeVar an abstract case class to avoid extractor calls in TypeMap.
|
|
|
|
|
|
| |
mostly removes [Eugene] marks that I left back then and reviews related code
some of those tokens got left in place, because I don't know to how fix them
without imposing risks on 2.10.0
|
|
|
|
|
|
|
|
| |
Removes the `freeTypes` parameters on `typeCheckExpr` and `runExpr`,
since we now have public `substituteTypes` on both trees and types.
Also implements long-awaited `inferImplicitValue` and `inferImplicitView`
(thanks to Miles Sabin for nudging me!)
|
|
|