| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Reducing variation of tree creation methods.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
TreeDSL has no future - it was always a temporary measure
waiting for something like quasiquotes to come along. In this
commit I cull as much of it as I can, especially the delicate
matter of creating new DefDefs and ValDefs, which I completely
turn over to the old style creators.
I unified all the symbol-based DefDef and ValDef creators under
a single method, since it was yet another place where ctrl-C and
ctrl-V were being punched with glee. Was beaten to the punch on
adding copyTypeDef to fill out the *Def creators.
Eliminated as many redundant positioning calls as I could find.
If you are creating a DefTree tree based on a symbol, it will
always have an atPos(sym.pos) { ... } wrapped around it. You
don't need another one.
All of this is motivated by positions work: positions are
assigned in so many places and in such an ad hoc fashion that
it is impossible to bring consistency to that without first
bringing some consistency to tree creation.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The implementation had come to depend on finalResultType
accidentally doing things beyond its charter - in particular,
widening types. After hunting down and fixing the call sites
depending on the bugs, I was able to rewrite the method to do
only what it's supposed to do.
I threw in a different way of writing it entirely to suggest how
some correctness might be obtained in the future. It's a lot
harder for a method written like this to break.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
And changed the implementation internal traits to private[util]
rather than sealed because that's closer to the point. I would
make them "private" except that this incurs "private type escapes
scope" errors where private[util] does not.
Also improved file organization.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Having now been burned several times thinking I had a chunk
of positions under my belt only to find my pants had vanished
when I forged ahead, I am carving out some intermediate stages
for positions.
This one only reshuffles the internals. It consolidates almost
all the behavior into one class, leaving little stub subclasses
to mimic the classes which came before - since nothing is final
or has access anything less than public, there's no way to touch
any constructor without breakage, so they all have to stay.
I removed redundant/incorrect documentation and rewrote the
rest of it, although I don't expect the lifespan of any of it
to be enormous.
The overall thinking behind the existing design was a bit elusive.
Concrete exception-throwing implementations were provided in the base
class for every method, with less exceptional overrides defined
in selected subclasses. If you're going to define every method
in the base class, concretely no less, then there is little
advantage and lots of disadvantage to spreading out over a bunch
of subclasses.
Note that now Position contains no state and has no constructor,
characteristics which behoove its possibly distant ambition
toward AnyValhood. Though that does ignore the "api" class it
inherits which brims with implementation detail, api.Position.
It is a burden which will likely prove heavy.
|
|\
| |
| | |
SI-7622 Clean Up Phase Assembly
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Refactor the calculation of the "phase chain" a bit.
In particular, initial and terminal phases are not special
except that they must be head and last.
When done, filter for enabled phases. At this commit,
nobody claims to be disabled.
Additional sanity support of phases settings.
|
|\ \
| | |
| | | |
SI-7801 Fix a nightmarish bug in Symbols#adaptInfos
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The compiler-in-residence has always been a sketchy affair;
FSC and REPL offers a bounty of bugs that exploit the menagerie
of time-travel mechanisms in play for symbols' metadata (type, flags,
name and owner.) but are often cleverly masked by optimizations in
the compiler based on reference equality.
The latest: an innocuous change in Erasure:
https://github.com/scala/scala/commit/d8b96bb8#commitcomment-3995163
means that some `ErasureMap`-s over `MethodType`-s are now true
identities (as `UnitTpe` is always the same object, whereas
`erasedTypeRef(UnitClass)` returns an different `TypeRef` each
time.)
This, in turn, enables `TypeMap#mapOver` to reuse
the existing enclosing type, and so on. On such subtleties hinge
further optimizations, such as whether or not a given phase's
`InfoTransformer` needs to add an entry in a symbols type history.
When the REPL (or FSC / Presentation Compiler) creates a new
`Run`, `Symbol#rawInfo` tries to adapt the entries in the type
history for the new run. For packages, this was taken to be a
no-op; each entry is marked as being valid in the new run and
no further action is taken. This logic lurks in `adaptInfos`.
But, when the namer enters a new symbol in a package, it
*mutates* the Scope of that package classes info `enteringTyper`.
So the later entries in the type history *must* be invalidated
and recomputed.
We have two choices for a fix:
1) modify `Namers#enterInScope` to blow away the subsequent
type history for the owning symbol after inserting the
new member. Something like `owner.setInfo(owner.info)` would
have the desired effect.
2) Change `adaptInfos` to be more conservative when it comes
to package classes, and retain only the oldest entry in the
type history.
This commit goes for option 2.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Foo.this.x and Foo.super.x were roughly unrelated in the eyes
of isSubType. I implemented conformance as described in the comment:
This is looking for situations such as B.this.x.type <:< B.super.x.type.
If it's a ThisType on the lhs and a SuperType on the right, and they originate
in the same class, and the 'x' in the ThisType has in its override chain
the 'x' in the SuperType, then the types conform.
I think this is overly conservative but it's way ahead of
where it was.
|
|\ \ \
| | | |
| | | | |
Various bugfixes and improvements for the quasiquotes
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Syntax spec mislead me to believe that annotation can't have type
parameters or multiple argument lists... I guess the lesson here is
don't trust the spec.
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
1. blocks now match single term-level expressions to account for
automatic block elimination. E.g.
val q"{ ..$stats }" = q"foo"
will match into stats = List(q"foo"). This is useful to uniformly
deal with blocks on term level.
2. blocks in quasiquotes collapse into single expressions
3. Applied and TypeApplied now have constructors too which helps
to unify matching and extraction in quasiquote reifier
4. TypeApplied now matches AppliedTypeTree too
5. Add Syntactic prefix to Applied and TypeApplied
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | | |
1. Make superPos parameter optional with default value NoPosition
2. use Option instead of List for local optional constructor variable
|
| | | |
| | | |
| | | |
| | | | |
This is needed for quasiquotes to implement SyntacticNew combinator.
|
| | | | |
|
| | | | |
|
| | | | |
|
| |/ / |
|
|\ \ \
| | | |
| | | | |
SI-7810 Reflect private constructor
|
| |/ /
| | |
| | |
| | |
| | | |
`JavaMirror.constructorToJava` uses `getDeclaredConstructor` now
instead of `getConstructor`.
|
|\ \ \
| | | |
| | | | |
Noise reduction + minor enhance in TreeCheckers.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Misc irrelevant work, which I can only offer as-is. It lowers
the noise in -Ycheck:* output and performs some common sense
chillaxes like not screaming ERROR IN INTERNAL CHECKING! WE'RE
ALL GOING TO DIE! when a tree doesn't hit all nine points at
the Jiffy Tree.
You can see some reasonably well reduced symbol flailing if
you run the included pending tests:
test/partest --show-diff test/pending/pos/treecheckers
Example output,
Out of scope symbol reference {
tree TypeTree Factory[Traversable]
position OffsetPosition test/pending/pos/treecheckers/c5.scala:3
with sym ClassSymbol Factory: Factory[CC]
and tpe ClassArgsTypeRef Factory[Traversable]
encl(1) ModuleSymbol object Test5
ref to AbstractTypeSymbol X (<deferred> <param>)
}
|
|\ \ \ \
| |/ / /
|/| | | |
SI-7817 Fix regression in structural types
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Calls to structural types are converted to reflective calls
in the `cleanup` phase, which, along with `mixin`, does its work
after `flatten`.
`Symbol#owner` behaves in a phase dependent manner; after flatten
the owner of lifted class is given as the enclosing package.
Except when they're not.
`ModuleSymbol`s representing an object nested inside a class
are viewed dually as modules *and* methods (see the comments on
`isModuleNotMethod` for some background). When it comes time to
flatten, we're presented with a quandary: the method must clearly
stay owned by the enclosing class, but surely the lifted module
should be owned by the enclosing package, to have the same owner
as its associated module class.
The `method` nature of this symbol seems to win:
override def owner = {
if (Statistics.hotEnabled) Statistics.incCounter(ownerCount)
if (!isMethod && needsFlatClasses) rawowner.owner
else rawowner
This wrinkle leads to a wrong turn in `TreeGen#mkAttributedRef`,
which incorrectly rewrites `REF(O)` to `p1.`package`.O`. It seems
this problem has gone unnoticed because the tree emitted referred
to a static symbol (the reflection cache for structural types),
and the backend simply elided the qualifier `p1.package`.
A recent change to the backend makes it more conservative about
dropping qualifiers on the floor, and it started emitting a reference
to a package object that doesn't exist.
This commit despairingly checks `isDefinedInPackage` of both the
module *and* the module class. The test cases from the previous
commit illustrated the status quo, and this commit updates the
joint compilation test with the bug fix. A new test is to show that
the symptom (structural type crash) is now fixed.
|
|\ \ \
| | | |
| | | | |
SI-7791 Line number table reflects underlying file
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Since positions ultimately know their ultimate
positions in their ultimate source, use that line
number, ultimately, when emitting line number
table entries.
It is possible, but possibly not useful, to emit
both the actual (ultimate) line number and the
nominal one.
The `int`-valued line number of the `StackTraceElement`
is "derived" from the attribute.
In global, wrapping a `BatchSourceFile` as a
`ScriptSource` happens in `compileSources` to
facilitate testing.
A `ScriptTest` facility is provided to facilitate
testing the script facility. It is rather facile.
|
|\ \ \ \
| |_|/ /
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Conflicts:
bincompat-backward.whitelist.conf
bincompat-forward.whitelist.conf
src/reflect/scala/reflect/internal/SymbolTable.scala
src/reflect/scala/reflect/internal/util/WeakHashSet.scala
src/reflect/scala/reflect/runtime/JavaMirrors.scala
|
| |\ \ \
| | | | |
| | | | | |
Backport #2605 to 2.10.x: SI-7149 Use a WeakHashSet for type uniqueness
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Currently type uniqueness is done via a HashSet[Type], but
that means the Types live through an entire compile session, even
ones that are used once. The result is a huge amount of unnecessarily
retained memory. This commit uses a WeakHashSet instead so that Types
and their WeakReferences are cleaned up when no longer in use.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Replaces scala.reflect.internal.WeakHashSet with a version that
* extends the mutable.Set trait
* doesn't leak WeakReferences
* is unit tested
|
| |\ \ \ \
| | |/ / /
| |/| | | |
SI-7782 Derive type skolems at the ground level
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Rather than at the current value of `skolemizationLevel`,
which could be influenced by an in-flight existential
subtype computation.
This method is called in `PolyTypeCompleter`, which
could be constructed by the lazy type completer of the
enclosing class. So currently it is closing over a mutable
variable; hence the Heisenbug.
This issue was exposed by the changes in b74c33eb860,
which was introduced in Scala 2.10.1.
|
| |\ \ \ \
| | | | | |
| | | | | | |
SI-7779 Account for class name compactification in reflection
|
| | |/ / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
We have to assume that the classes we are reflecting on were
compiled with the default value for -Xmax-classfile-name (255).
With this assumption, we can apply the same name compactification
as done in the regular compiler.
The REPL is particularly prone to generating long class names
with the '$iw' prefixes, so this is an important fix for runtime
reflection.
Also adds support for getting the runtime class of `O.type` if
`O` is a module.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-6240 Synchronizes Names
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Marking some methods as final. Once known to be overriden
in scala-ide are instead marked with @deprecatedOveriding.
This is to signal the new means of synchronization to
subclasses.
|
| | |_|_|/
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Merge 2.10.x into master
|
| |\ \ \ \ \
| | | |/ / /
| | |/| | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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
|