| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
1. macro parsing doesn't use toolbox any more but calls parser directly
2. in order for this to work parser has to be refactored to limit
usage of currentUnit and rewire it into parser's local unit
method which might use currentUnit for some parsers but will
user proper unit for UnitParser
3. similar change has to be done to make compilation unit's
reporter overridable
|
|\
| |
| | |
Topic/patmat inference prep
|
| | |
|
|\ \
| | |
| | | |
SI-7810 Reflect private constructor
|
| | |
| | |
| | |
| | |
| | | |
`JavaMirror.constructorToJava` uses `getDeclaredConstructor` now
instead of `getConstructor`.
|
|\ \ \
| | | |
| | | | |
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.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
To `package`, or not `package`, that is the question.
This lines marked with !!! get this wrong, and be remedied
by the next commit.
This problem is culpable for the crash in the enclosed `pending` test.
|
|\ \ \ \
| | | | |
| | | | | |
Eliminate TypeTrees with null original.
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This is a retry of #2801 after figuring out the range position
error. Should there be anyone out there who compiles with -Xdev,
know that this commit eliminates the 1406 errors one presently
incurs compiling src/library.
A val declared in source code receives only one tree from the
parser, but two are needed - one for the field and one for the
getter. I discovered long ago that if the val had an existential
type, this was creating issues with incompatible existentials
between the field and the getter. However the remedy for that
did not take into account the whole of the wide range of super
subtle issues which accompany tree duplication.
In particular, the duplicated tree must be given not only a
fresh TypeTree(), but that TypeTree cannot share the same
original without running afoul of range position invariants.
That's because typedTypeTree resurrects the original tree with
whatever position it has - so the "original" needs to be a
duplicate of the original with a focused position.
Should the call to TypeTree.duplicate also duplicate the original?
I think so, but I bequeath this question to others.
This commit also eliminated some duplicate error messages, because
duplicate suppression depends on the errors having the same position.
See c478eb770d, 7a6fa80937 for previous related work.
|
|\ \ \ \
| | | | |
| | | | | |
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.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Alter TailRec to have map and flatMap
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
As described in the "Stackless Scala with Free Monads" paper
scala> import scala.util.control.TailCalls._
import scala.util.control.TailCalls._
scala> :paste
// Entering paste mode (ctrl-D to finish)
def isEven(xs: List[Int]): TailRec[Boolean] =
if (xs.isEmpty) done(true) else tailcall(isOdd(xs.tail))
def isOdd(xs: List[Int]): TailRec[Boolean] =
if (xs.isEmpty) done(false) else tailcall(isEven(xs.tail))
// Exiting paste mode, now interpreting.
isEven: (xs: List[Int])util.control.TailCalls.TailRec[Boolean]
isOdd: (xs: List[Int])util.control.TailCalls.TailRec[Boolean]
scala> isEven((1 to 100000).toList).result
res0: Boolean = true
scala> def fib(n: Int): TailRec[Int] =
| if (n < 2) done(n) else for {
| x <- tailcall(fib(n - 1))
| y <- tailcall(fib(n - 2))
| } yield (x + y)
fib: (n: Int)util.control.TailCalls.TailRec[Int]
scala> fib(40).result
res1: Int = 102334155
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-7805 REPL -i startup
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Tested with a ReplTest that loads an include script.
ReplTests can choose to be `Welcoming` and keep a
normalized welcome message in their check transcript.
One recent SessionTest is updated to use the normalizing API.
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
Modularize: xml & parser-combinators
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Every test deleted here has found its way to the respective
repositories of scala-xml and scala-parser-combinators,
where they will continue to be tested with partest.
The modified tests became independent of these modules,
as they should've been from the start.
|
|\ \ \ \ \
| |_|_|/ /
|/| | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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
|
| |\ \ \ \
| | | | | |
| | | | | | |
typedAnnotated no longer emits nulls
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Adds a null-check in original synthesis for the result of typedAnnotated.
Previously it was possible for the aforementioned result to look like
TypeTree(<tpe>) setOriginal Annotated(..., null). Not anymore.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Replaces scala.reflect.internal.WeakHashSet with a version that
* extends the mutable.Set trait
* doesn't leak WeakReferences
* is unit tested
|
| |\ \ \ \ \
| | | | | | |
| | | | | | | |
SI-7775 Harden against the shifting sands of System.getProperties
|
| | |/ / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
If another thread writes a new system property (which can happen
in pretty innocuous code such as `new Date`!), the compiler startup
could fail with a `ConcurrentModificationException` as it iterated
all bindings in the properties map in search of a boot classpath
property for esoteric JVMs.
This commit uses `Properties#getStringProperties` to get a snapshot
of the keys that isn't backed by the live map, and iterates these
instead. That method will also limit us to bindings with String
values, which is all that we expect.
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The test should normalize the elided message,
not strip it. (Thanks qerub; I was frustrated
with kitteh's turnaround that night, hence
unwilling to improve once it passed.)
|
| |_|/ /
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The handy stack trace truncation in REPL doesn't
show cause like a regular trace.
This commit fixes that and also adds the usual
indicator for truncation, viz, "... 33 more".
The example from the ticket produces:
```
scala> rewrapperer
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure
at .rewrapper(<console>:9)
at .rewrapperer(<console>:10)
... 32 elided
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Point of failure
at .wrapper(<console>:8)
... 34 more
Caused by: java.lang.RuntimeException: Point of failure
at .sample(<console>:7)
... 35 more
```
Suppressed exceptions on Java 7 are handled reflectively.
```
java.lang.RuntimeException: My problem
at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:56)
... 27 elided
Suppressed: java.lang.RuntimeException: Point of failure
at scala.tools.nsc.util.StackTraceTest.sample(StackTraceTest.scala:29)
at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:54)
... 27 more
```
|
|\ \ \ \
| | | | |
| | | | | |
Deprecate early type defs
|
| | |/ /
| |/| |
| | | |
| | | |
| | | |
| | | | |
This feature is neither properly supported by Scala compiler
nor a part of the language spec and therefore should be removed.
Due to source compatiblity with 2.10 we need to deprecate it first.
|
|\ \ \ \
| |_|_|/
|/| | | |
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
|
| | |\
| | | |
| | | | |
[nomaster] macro expansions are now auto-duplicated
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The fix still requires macro developers to be careful about sharing trees
by references, because attributed DefTrees will still bring trouble.
However this is an improvement, because it doesn't make matters worse
and automatically fixes situations similar to one in the test.
A much more thorough discussion with a number of open questions left:
http://groups.google.com/group/scala-internals/browse_thread/thread/492560d941b315cc
Was fixed ages ago in master in one of the paradise backports.
Never got to 2.10.x, but it's very useful, so I'm backporting it now.
|
| | |\ \
| | | | |
| | | | | |
SI-7733 reflective packages now more consistent with scalac
|
| | | |/
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Previously PackageScopes from scala.reflect ignored all classes that
had $'s in non-rightmost positions in their names.
Unfortunately this behaviour is inconsistent with how scalac does things,
and I reconciled this as usual, by pulling corresponding logic into
scala-reflect.jar and sharing it between runtime reflection and compiler.
This change has seprate pull requests for 2.10.x and 2.11.0. The latter
deprecates `scala.tools.nsc.util.ClassPath.isTraitImplementation`
whereas the former (which you're looking at right now) does not, because
we can't deprecated members in minor releases.
|
| | |\ \
| | | | |
| | | | | |
showRaw now prints symbols of def trees
|
| | | | |
| | | | |
| | | | |
| | | | | |
A very useful addition that came in handy when hacking macro annotations
|
| | | |/
| | |/|
| | | |
| | | | |
Another random bug uncovered and extinguished when hacking macro annots.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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).
|
| | |\ \
| | | | |
| | | | | |
Assorted toolbox fixes
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Apparently there are still discrepancies between how the vanilla compiler
turns class files into symbols and how the reflective compiler does it.
Working on bringing these guys in sync, one bug at a time.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-7763 Avoid dropping casts in erasure
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Even if the result isn't used, the potential ClassCastException
is observable, so we must retain them.
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
466b7d29f avoided quadratic complexity in Erasure's treatment
of chained `asInstanceOf` calls. It did so by using the typechecked
qualifier, rather than discarding it.
However, that also dropped the cast altogether! In many cases this
was masked by later inclusion of a cast to the expected type
by `adaptToType`:
at scala.tools.nsc.transform.Erasure$Eraser.cast(Erasure.scala:636)
at scala.tools.nsc.transform.Erasure$Eraser.scala$tools$nsc$transform$Erasure$Eraser$$adaptToType(Erasure.scala:665)
at scala.tools.nsc.transform.Erasure$Eraser.adapt(Erasure.scala:766)
at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5352)
This commit re-wraps the typechecked `qual` in its original
`<qual>.asInstanceOf[T]` to preserve semantics while avoiding
the big-O blowup.
The test includes the compiler option `-Ynooptimize` because dead code
elimination *also* thinks that this cast is superfluous. I'll follow up
on that problem seprately.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
(1 of 2) of the rest of the new bytecode emitter + feedback
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
GenBCode runs only under a flag, and moreover only if -optimise
is not present (see ScalaSettings for details).
Therefore during a nightly, when tests are run under -optimise,
we need -Ynooptimise to deactivate the optimizer.
With that, GenBCode can run and tackle the test case successfuly.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
As partest is now resolved from maven, `test/partest` uses `ant test.suite.init`
to determine the classpath (serialized to build/pack/partest.properties)
that's necessary to run `scala.tools.partest.nest.ConsoleRunner`.
Thus, partest gets exactly the same classpath, whether run from
the command line through `test/partest` or via `ant test`.
The version of partest we're using is specified by
properties defined in versions.properties (formerly `starr.number`).
Currently, we're using:
```
scala.binary.version=2.11.0-M4
partest.version.number=1.0-RC3
```
NOTES:
- The version of Scala being tested must be backwards binary compatible with
the version of Scala that was used to compile partest.
- Once 2.11 goes final, `scala.binary.version=2.11`, and `starr.version=2.11.0`.
- Need scalacheck on classpath for test/partest scalacheck tests.
- Removed atrophied ant tests (haven't been run/changed for at least two years
I checked 81d659141a as a "random" sample).
- Removed scalacheck. It's resolved as a partest dependency.
- For now, use a locally built scalap
- Kept the trace macro in the main repo (partest-extras)
- New targets for faster pr validation: test-core-opt, test-stab-opt
- Reused partest eclipse/intellij project to partest-extras
(note: the partest dependency is hard-coded)
|
|\ \ \ \
| | | | |
| | | | | |
SI-7740 Trim stack trace before printing in REPL
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Can't finnesse the drop method. Call it blindly for now, even
though in the long run you won't have to write drop.
|