| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-9181 Exhaustivity checking does not scale (regression)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
reachability analysis are too big to be solved in reasonable time, then we skip
the analysis. I also cleaned up warnings.
Why did `t9181.scala` work fine with 2.11.4, but is now running out of memory?
In order to ensure that the scrutinee is associated only with one of the 400
derived classes we add 400*400 / 2 ~ 80k clauses to ensure mutual exclusivity.
In 2.11.4 the translation into CNF used to fail, since it would blow up already
at this point in memory. This has been fixed in 2.11.5, but now the DPLL solver
is the bottleneck.
There's a check in the search for all models (exhaustivity) that it would avoid
a blow up, but in the search for a model (reachability), such a check is
missing.
|
|\ \
| | |
| | | |
SI-8731 don't issue a @switch warning for two-case matches
|
| | |
| | |
| | |
| | |
| | |
| | | |
This allows annotating small pattern matches with `@switch` without
getting any warnings. There's no reason to warn, the performance of
the generated bytecode is good.
|
|\ \ \
| | | |
| | | | |
SI-8861 Handle alias when probing for Any
|
| | |/
| |/|
| | |
| | |
| | |
| | | |
If args to a method are alias types, dealias to see if they
contain Any before warning about inferring it. Similarly for
return and expected types.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
As discussed:
https://groups.google.com/forum/#!topic/scala-internals/m8I_3GQR4vQ
We need to ensure a happens-before relationship between the callback
that prints "success" and the end of the main method.
|
|\ \ \
| |_|/
|/| | |
Remove deprecation warnings
|
| | | |
|
|\ \ \
| | | |
| | | | |
SI-9182 Fix runtime reflection with package object, overloads
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Eponymous modules and methods should be allowed to live in the
same package scope. This can happen when using a module and
and implicit class, or when defining the overloads manually.
This commit tones back an assertion that was added for sanity checking
runtime reflection thread safety to only fire when we are sure that
neither the existing and current symbol of the given name are methods.
|
|\ \ \ \
| |_|/ /
|/| | | |
better errors for macro applications with wrong number of arguments
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The tryNamesDefaults branch of application typechecking contains the
checkNotMacro check, which errors out when we try to do named/default arguments
for macros (that's not supported yet, see SI-5920 for discussion).
Unfortunately, the check activates too early, because it turns out that
we can also enter tryNamesDefaults when the user just provides insufficient
number of arguments to a method by mistake, without expecting any default
arguments at all.
This leads to really confusing errors, which can luckily be fixed in a
very simple way by moving the checkNotMacro check down the happy path
of named/default typechecking.
|
|\ \ \
| | | |
| | | | |
SI-9127 Xlint doesn't think spaces are significant
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
For purposes of warning about missing interpolators,
such as `"$greeting"` when the intended code was `s"$greeting"`,
spaces are no longer significant.
The heuristic was previously intended to allow compileresque
strings, where the dollar sign is a common prefix.
Currently, the Xlint warning can be selectively disabled.
|
|\ \ \ \
| | | | |
| | | | | |
SI-9020 Avoid spurious value discarding warning post-typer
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Typechecking during the specialization phase was emitting a
bogus warning about value discarding. Such warnings in the
typer should be guarded by `!isPastTyper` to restrict the
analysis to the code the user originally wrote, rather than
the results of later typechecking.
I've made this change to the value discarding warning. I've also
changed a numeric widening warning in the vicinity, although I do
not have a test case for that.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-9170 Fix resident compilation / specialization NPE
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The resident compiler does its best to clean the decks at
the conclusion of a compilation batch.
One part of this is as follows: if the run was erroneous,
reset the info of top level symbols defined in this run
to the initial state, that is, to a `SourceFileLoader`.
However, if the errors came late in the compilation pipeline,
the map from symbols to the source files includes the results
of the specialization transformation, which ends up with
mappings like `Function1$sp... -> null`.
This results in a `NullPointerException` on subsequent runs.
This commits filters out null source files during the reset
process.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-9170 More flexible SessionTest
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
SessionTest session text can include line continuations
and pasted text. Pasted script (which looks like a
double prompt) probably doesn't work.
This commit includes @retronym's SI-9170 one-liner.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-9231 Don't attempt implicit search for erroneous parameter
|
| | |_|/ /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
If the instantiated type of an implicit parameter is erroneous,
we should not attempt the implicit search. This avoids the following
useless error message in the enclosed test:
error: ambiguous implicit values: ... match expected type M[<error>]
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-9102: Reflect method invoke with mixed args
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Cover the second use case reported on the ML (ctors).
Improve formatting per the review. And it really does look
a lot better.
|
| | |_|_|/
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | | |
A missing default branch when a method had value class
or by-name params caused other args to present as null
under reflective invocation.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-9219 Stream toString returns unexpected result
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
- Cursor was not advanced before appending the second element
when only the first two elements of the stream were known.
- When there is no cycle in the stream, the "scout" (and
"cursor") ends up pointing to a stream where tailDefined
is false. This means that cursor is either empty, or
cursor.tail is not yet evaluated. The former case is handled
properly, but in the latter case, one more element
(cursor.head) needs to be appended.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Resurrect a test for type inference
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This test was removed in ... when case class extension was disallowed.
But the intent of the test was actually to exercise a path through
type inference, described in `Infer#exprTypeArgs`.
When I remove that special case, the test still fails:
```
test/files/pos/jesper.scala:29: error: No implicit view available from Pair.Cons[Int,Pair.Cons[Boolean,Pair.End]] => Boolean.
val x2 : Boolean = p.find[Boolean] // Doesn't compile
^
one error found
```
This special case is important to understand when deciphering
the inference in this program:
```
object Test {
trait Cov[+A]
def cov[A](implicit ev: Cov[A]): A = ???
implicit def covImp[A]: Cov[A] = ???
trait Inv[A]
def inv[A](implicit ev: Inv[A]): A = ???
implicit def invImp[A]: Inv[A] = ???
trait Con[-A]
def con[A](implicit ev: Con[A]): A = ???
implicit def conImp[A]: Con[A] = ???
cov : String // (Test.this.cov[String](Test.this.covImp[Nothing]): String);
// (Test.this.cov[Nothing](Test.this.covImp[Nothing]): String) (or, without the special case in exprTypeArgs)
inv : String // (Test.this.inv[Nothing](Test.this.invImp[Nothing]): String);
con : String // (Test.this.con[Any](Test.this.conImp[Any]): String)
}
```
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Inliner for GenBCode
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Issue precise warnings when the inliner fails to inline or analyze a
callsite. Inline failures may have various causes, for example because
some class cannot be found on the classpath when building the call
graph. So we need to store problems that happen early in the optimizer
(when building the necessary data structures, call graph, ClassBTypes)
to be able to report them later in case the inliner accesses the
related data.
We use Either to store these warning messages. The commit introduces
an implicit class `RightBiasedEither` to make Either easier to use for
error propagation. This would be subsumed by a biased either in the
standard library (or could use a Validation).
The `info` of each ClassBType is now an Either. There are two cases
where the info is not available:
- The type info should be parsed from a classfile, but the class
cannot be found on the classpath
- SI-9111, the type of a Java source originating class symbol cannot
be completed
This means that the operations on ClassBType that query the info now
return an Either, too.
Each Callsite in the call graph now stores the source position of the
call instruction. Since the call graph is built after code generation,
we build a map from invocation nodes to positions during code gen and
query it when building the call graph.
The new inliner can report a large number of precise warnings when a
callsite cannot be inlined, or if the inlining metadata cannot be
computed precisely, for example due to a missing classfile.
The new -Yopt-warnings multi-choice option allows configuring inliner
warnings.
By default (no option provided), a one-line summary is issued in case
there were callsites annotated @inline that could not be inlined.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The inliner forces some method symbols to complete that would not be
completed otherwise. This triggers SI-9111, in which the completer of
a valid Java method definition reports an error in mixed compilation.
The workaround disables error reporting while completing lazy method
and class symbols in the backend.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
In mixed compilation, the bytecode of Java classes is not availalbe:
the Scala compiler does not produce any, and there are no classfiles
yet.
When inlining a (Scala defined) method that contains an invocation to
a Java method, we need the Java method's bytecode in order to check
whether that invocation can be transplanted to the new location
without causing an IllegalAccessError. If the bytecode cannot be
found, inlining won't be allowed.
|
| |/ / / /
|/| | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Usually, the compiler tries avoids creating a field in a subclass
for a constructor parameter that is known to be stored in a field
in one of its superclasses.
However, in the enclosed test `run/t9223.scala`, this mechanism
confuses `=> A` with `A`, which results in a runtime
`ClassCastException`.
This commit avoids using param aliases for by-name parameters.
I have also added a test for something close the opposite case, where
the subclass has a strict parameter and the superclass has a by-name
parameter. This was working correctly before this patch.
|
|\| | | |
| |/ / /
|/| | | |
Emit the ScalaInlineInfo attribute under GenASM
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The goal of this commit is to allow the new inliner (in GenBCode,
coming soon) to inline methods generated by the GenASM backend of
2.11.6.
The ScalaInlineInfo attribute is added to every classfile generated
by GenASM. It contains metadata about the class and its methods that
will be used by the new inliner.
Storing this metadata to the classfile prevents the need to look up a
class symbol for a certain class file name, a process that is known to
be brittle due to name mangling. Also, some symbols are not exactly
the same when originating in a class being compiled or an unpickled
one. For example, method symbols for mixed-in members are only added
to classes being compiled.
The classfile attribute is relatively small, because all strings it
references (class internal names, method names, method descriptors)
would exist anyway in the constant pool. It just adds a few references
and bits for each method in the classfile.
Jar sizes before:
480142 scala-actors.jar
15531408 scala-compiler.jar
5543249 scala-library.jar
4663078 scala-reflect.jar
785953 scalap.jar
After:
490491 scala-actors.jar (102.1%)
15865500 scala-compiler.jar (102.1%)
5722504 scala-library.jar (103.2%)
4788370 scala-reflect.jar (102.7%)
805890 scalap.jar (102.5%)
|
|\ \ \
| |_|/
|/| | |
Merge 2.10.x to 2.11.x
|
| |\ \
| | | |
| | | |
| | | |
| | | |
| | | | |
Conflicts:
src/library/scala/concurrent/Promise.scala
test/files/jvm/future-spec/PromiseTests.scala
|
| | |\ \
| | | | |
| | | | | |
SI-8689 Avoid internal error in Promise after sequence of completions
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Calling `completeWith` when the `DefaultPromise` is already completed,
leads to callbacks not being properly executed.
This happened because `Future.InternalCallbackExecutor` extends
`BatchingExecutor`[1] which assumes `unbatchedExecute` to be async,
when in this case it is sync, and if there is an exception thrown
by executing the batch, it creates a new batch with the remaining
items from the current batch and submits that to `unbatchedExecute`
and then rethrows, but if you have a sync `unbatchedExecute`, it will
fail since it is not reentrant, as witnessed by the failed `require`
as reported in this issue.
This commit avoids problem by delegating `completeWith` to
`tryComplete`, which has the effect of using `onComplete` +
`tryComplete` i.s.o. `complete`, which means that when it fails
(because of a benign race condition between completers) it won't
throw an exception.
It has been tested by the minimized reproducer.
[1] Actually, in the 2.10.x branch where this patch is starting out,
"The BatchingExecutor trait had to be inlined into
InternalCallbackExecutor for binary compatibility.". This comment
will be more literally correct in the context of 2.11.x and beyond
|
| | |/ / |
|
| | |\ \
| | | | |
| | | | | |
[backport] SI-7756 Uncripple refchecks in case bodies
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In 65340ed4ad2e, parts of RefChecks were disabled when
we traversed into the results of the new pattern matcher.
Similar logic existed for the old pattern matcher, but in
that case the Match / CaseDef nodes still existed in the tree.
The new approach was too broad: important checks no longer
scrutinized the body of cases.
This commit turns the checks back on when it finds the remnants
of a case body, which appears as an application to a label def.
Conflicts:
src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
Cherry pick of 3df1d77fc984b976efa68098206e801cf3b83a9e
|
| | |\ \ \
| | | | | |
| | | | | | |
[backport] SI-7470 implements fundep materialization
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
To quote gkossakowski:
Thinking about it more, could we hide this behind 'Y' flag instead?
We have lesser obligation to keep around Y flags and this is something
we should remove from 2.11/2.12.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Backports 21a8c6c from the 2.11.x branch under -Xfundep-materialization
as per Miles Sabin's request. Thanks Miles!
|
| | |/ / /
| | | | |
| | | | |
| | | | | |
Backports 7122560063 and 4133eb8454 from the 2.11.x branch
|
| |_|_|/
|/| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Initial implementation of pluginsEnterStats was incorrect, because I got
the foldLeft wrong, making it perpetuate the initial value of stats.
This worked fine if zero or one macro plugins were active at a time,
but broke down if there were multiple of such plugins (concretely,
I discovered this issue when trying to marry macro paradise with scalahost).
|
|\ \ \ \
| |/ / /
|/| | | |
SI-8801 Another test for fixed exponential-time compilation
|