| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Avoid null checks when emitting "".== and SomeModule.==
|
| |
| |
| |
| |
| |
| |
| |
| | |
- Directly count null checks, rather than diffing the textual
bytecode of the entire method
- Add a test to show that the LHS needs to be a direct module
reference, not just a tree with a module type, to elide the
null check.
|
| |
| |
| |
| | |
For the same reasons outlined in the previous commits.
|
| |
| |
| |
| |
| | |
For which we can also elide the null check, and will in the
next commit.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Although the same the code would be later optimized by -Yconst-opt,
we can offer the same lean byte code to those compiling without that
option by being more discerning when translating ==.
This helps people using bytecode based code coverage tools
such as jacoco that would emit "branch not covered" warnings
for the impossible null check.
|
| |
| |
| |
| | |
Will be somewhat leaner after the next commit.
|
| |
| |
| |
| |
| |
| | |
The bug itself was fixed earlier in 95fe19545d60ae9aa79d2c8d5665c7f3b0cbdb1a
It was caused by improper wrapping of blocks in the toolbox's parse method.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The parser hole I found while working on the generated positions
serves as the umbrella for a host of improvements. Upgraded
positions assigned during some specific challenging situations mostly
involving the creation of synthetic trees, e.g. for comprehensions
and closures. While doing so improved some error messages.
Eliminated some of the most glaring duplication in the parser.
It's written like there is some payoff associated with being
spectacularly imperative. Not so far.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Can't ensure range position points are meaningful when we never
see them. To limit noise, only print the point when it != start.
[x:y] // point=x, start=x, end=y
[p/x:y] // point=p, start=x, end=y
I'm open to a different syntax.
Also prints NoPosition as [X] rather than [NoPosition] because
noise is for construction workers and attenders of rock concerts.
Some range position and parser tests are included so we can see
the checkfile change when the forthcoming fix happens (either an
error message improvement or a positional one.)
|
|\ \
| | |
| | | |
Cull extraneous whitespace.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|\ \ \
| |/ /
|/| | |
SI-7853 Regression in explicit outer
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Rather than localizing the fix to the outerAccessor, this
commit pushed the call to `memberType` into *all* usages of
`newValDef` and `newDefDef`.
The TPT of `applyOrElse` in synthetized partial functions must
be set explicitly to pass the pos/t7853-partial-function.scala.
Otherwise, the as-seen-from ends up cloning the type parameter
`B1` of `applyOrElse` as it transforms (questionably)
its bound from `List[Int @unchecked]` to `List[Int]`.
Partial Function synthesis was already a delicate area, and this
makes things more explicit which could be counted as an improvement.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The attempt to placate pos/t4970.scala in 55c6fd4 roused another
dragon.
We've got two levers here: the type of the symbol of the outer
accessor, and the type of its DefDef.
They have been historically out of sync due to the vaguaries of
finalResultType (which is far less vague since 671e6e03c7), but
the finicky operation of ExplicitOuter now has a hard time when
we try to bring them into line.
This stuff is notoriously difficult to understand because the
trees you see from `-Xprint` show a tpt derived from the method
symbol's info, and discards the actual tpt in the tree.
Rather than letting `DefDef(acc)` call `TypeTree(sym)` and use
`sym.tpe_*.finalResultType`, this commit computes the member type
of the accessor from the current class and explicitly uses that as
the return type of the outer accessor def.
We should try to push this a little deeper. I tried to put it into
`def TypeTree`, but that broke, among others,
run/concurrent-stream.scala. Maybe `def DefDef` and `def ValDef`?
But a localised fix is the right start as it addresses the regression
in a minimal fashion to get the IDE building again.
|
| |
| |
| |
| |
| | |
15 seconds is crazy aggressive. I have fast hardware and it's still
really easy for a test to take to fifteen seconds under load.
|
|\ \
| | |
| | | |
SI-7847 Static forwarders for case apply/unapply
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
These were excluded in f901816b3f because at the time they
were compiler fiction and translated to calls to the case
class constructor or accessors.
But since they are now bona-fide methods (albeit still occasionally
bypassed as an optimization), we can expose them conveniently to our
Java brethren.
The cut-and-pastiness of GenBCode starts to hinder maintenance.
Here's a report of further duplication that we have to fix up
post haste: https://gist.github.com/retronym/6334389
|
|\ \ \
| |_|/
|/| | |
Damage control related to AnyRef specialization
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Names like `T1$sp`, which can arise from `AnyRef` specialization,
were leading to negative length Names if they ever passed through
`unspecializedName` or `splitSpecializedName`. This code path was
touched when printing the tree of a certain AnyRef specialized
classes after specialization, such as `AbstractPartialFunction`
(which had such specialization until a few commits ago.)
This commit handles that case correctly, and generally hardens
against unexpected names, which could pop up from third party
classes.
The documentation for `splitSpecializedName` transposed the
class and method specializations. The things you discover
when you turn examples in documentation in to test cases!
In addition, we now require non-negative length and offset in
`newTermName`
|
|\ \
| | |
| | | |
SI-6701, SI-7304, SI-6489, variable arity definitions refactoring
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | | |
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For Paul, it steals focus when it runs.
For me, it fails with some platform specific extra output:
-ScriptEngineManager providers.next(): javax.script.ScriptEngineFactory: Provider apple.applescript.AppleScriptEngineFactory could not be instantiated: java.lang.UnsatisfiedLinkError: no AppleScriptEngine in java.library.path
n: Object = 10
12345678910
So off to the holding pen for now.
|
|\ \
| | |
| | | |
SI-1909 SI-3832 SI-7007 SI-7223 Improved handling of larval objects
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It's a clunky flag used to determine very early on whether
we're in the self-call, super-call or early-init section.
In SI-6666 / fd6125428, the check was improved to consider nesting.
But, that caused this regression, as Function's haven't been
translated to classes yet, so our check for enclosing non-term
owners failed wrongly flagged definitins body of a anonymous function
as INCONSTRUCTOR.
With this patch, we correctly flag:
class C extends D {
// INCONSTRUCTOR
() => {
!INCONSTRUCTOR
}
// INCONSTRUCTOR
}
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Rather than the old behaviour, which compiled successfully
but led us into the jaws of a LinkageError.
Related to SI-6666.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
SI-1909 modified LambdaLift to lift in auxiliary constructors methods as STATIC
so they could be called before the self-constructor was called.
That allowed for:
class Foo (x: Int) {
def this() = this( {
def bar() = 5
bar
})
}
However, if the method is in a statement that trails the self constructor call,
this is unnecessary and in fact incorrect as it robs the lifted method of `this`.
This commit uses the machinery established in SI-6666 to limit the STATIC-ness
of lifted methods to those used in arguments for self-constructor calls.
This is used exclusively; the `isAuxillaryConstructor` check wasn't the right
way to solve this, as was seen by the regression it caused in SI-3832.
A new test case shows that we can statically lift methods in super-constructor
calls, rather than just self-constructor calls.
We also have to avoid statically lifting objects in these positions. For now,
I just emit a dev warning that a VerifyError is in your future. With some more
thought we could escalate that to a implementation restriction and emit an error.
|
| |/
| |
| |
| |
| |
| |
| |
| | |
When we're in the neighbourhood of VerifyErrors, it's better to run
the code.
This change is leading up to a fix for SI-3832, which regressed
with fix for SI-1909.
|
|\ \
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | | |
This is the key ingredient so TypeTree(sym) can resist
widening the type.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The 2.10 fix to remove the ScriptEngine service entry
was inadvertently forwarded to 2.11.
This commit reverts and adds a test.
This situation was entirely foreseen by retronym,
proving beyond doubt that he is in fact a time traveler,
as hinted by his name. He brings bugs forward into the
future and returns into the past with fixes and other
alien technology like scalaz.
|
|\ \
| | |
| | | |
SI-7622 Clean Up Phase Assembly
|
| | |
| | |
| | |
| | | |
Restores the verbiage "run right after".
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Let optimiser components and continuations plugin opt-out
when required flags are not set.
Wasted time on a whitespace error in check file, so let
--debug dump the processed check file and its diff.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Plugins can interrogate options and declare themselves not
enabled. The plugin itself can return false from its init
if the options do not compute. A plugin phase component
can declare itself not enabled, same as an internal phase.
No one exploits this facility at this commit.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Fixing hash on nodes makes fault detection deterministic,
which aids testing.
Error messages are shortened and .dot files are dumped
automatically on faults to guard against future flakiness.
|
|\ \ \
| | | |
| | | | |
merge 2.10.x to master
|
| |\ \ \
| | | |/
| | |/|
| | | |
| | | | |
Conflicts:
src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
|
| |\ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
Conflicts:
src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
|
| | |\ \ \
| | | | | |
| | | | | | |
SI-7818 Cast our way out of extended existential angst
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
`substituteSymbols` is not sophisticated enough to
operate on `TypeSkolem`-s which are based on one of the
"from" symbols.
The pertinant usage of `substituteSymbols` for this bug in
in `Extender`. Recapping on that transform:
// orig
class C[T](...) extends AnyVal { def foo[U] = <rhs> }
// transform
class C[T] extends AnyVal { ... }
object C { def foo$extension[T', U'] = <rhs'> }
Where `<rhs'>` has been subtituted with, among other things,
`[T, U] ~> [T', U']`.
In this case our expected type contains a new type parameter
(of the extension method), whereas the type of the RHS contains
an existential skolem still pinned to the corresponding class type
parameter.
tree.tpe = Observable1#7037[_$1#12344]
<_$1#12344>.info = <: T#7040
pt = Observable1#7037[T#15644]
The limitation of substution is lamented in the comments
of `adaptMismatchedSkolems`, which faces the harder version of
the issue where the skolems are in the expected type.
But, we're in the "easy" case with the skolems in the tree's type;
we can cast our way out of the problem.
See also f335e447 / ed915c54.
|
| | |\ \ \ \
| | | | | | |
| | | | | | | |
SI-7767 avoid rejecting Scaladoc comments in early initializers
|
| | | |\ \ \ \
| | | | |/ / /
| | | |/| | |
| | | | | | | |
Test case for SI-7767
|
| | | |/ / / |
|
| | |\ \ \ \
| | | | | | |
| | | | | | | |
SI-7269 Rework MapLike#retains to account for desugaring change
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
`MapLike#retains` contains a for-comprehension that relied on the strict
`filter` by its generator. You can't, in general, iterate a mutable map
and remove items in the same pass.
Here's the history of the desugaring of:
def retain[A, B](thiz: mutable.Map[A, B])(p: (A, B) => Boolean): thiz.type = {
thiz.foreach {
case (k, v) =>
if (p(k, v)) thiz -= k
}
Before regression (c82ecabad6~1):
thiz.filter(((check$ifrefutable$1) => check$ifrefutable$1: @scala.unchecked match {
case scala.Tuple2((k @ _), (v @ _)) => true
case _ => false
})).withFilter(((x$1) => x$1: @scala.unchecked match {
case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang
})).foreach(((x$2) => x$2: @scala.unchecked match {
case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k)
}));
After regression (c82ecabad6, which incorrectly assumed in the parser that
no filter is required for isInstanceOf[Tuple2])
thiz.withFilter(((x$1) => x$1: @scala.unchecked match {
case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang
})).foreach(((x$2) => x$2: @scala.unchecked match {
case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k)
}));
After the reversion of c82ecabad6, v2.10.2
This is also after 365bb2b4e, which uses `withFilter` rather than `filter`.
thiz.withFilter(((check$q$1) => check$ifrefutable$1: @scala.unchecked match {
case scala.Tuple2((k @ _), (v @ _)) => true
case _ => false
})).withFilter(((x$1) => x$1: @scala.unchecked match {
case scala.Tuple2((k @ _), (v @ _)) => p(k, v).unary_$bang
})).foreach(((x$2) => x$2: @scala.unchecked match {
case scala.Tuple2((k @ _), (v @ _)) => thiz.$minus$eq(k)
}));
This commit does the same as `SetLike#retains`, and converts the map to
an immutable list before the rest of the operation.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Some tests for specialization use a modified version of
the standard library that count boxing, array lookups etc.
These sources are updated manually with the script:
% test/instrumented/mkinstrumented.sh build
Looks that that wasn't done for a while, though.
This commit brings it up to date, and adjusts a few braces in
ScalaRuntime.scala so the patch srt.scala (used by that script)
is shorter.
We should really avoid checking in the products of that script and
run it as part of the build, or, better, use the bytecode
instrumentation framework instead of a modified standard library.
But I have to leave that for another day.
|