| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Don't suggest "_: <none>" as an alternative when the pattern
type doesn't conform to the expected type.
|
|\
| |
| | |
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.
|
|\ \
| | |
| | | |
SI-7785 Preserve TypeVar suspension through TypeMaps
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
During `findMember`, TypeVars in `this` are placed into suspended
animation. This is to avoid running into recursive types when
matching members to those in base classes.
However, the mechanism used to do this is superficial, and doesn't
work when TypeVars are copied by TypeMaps. This seems to crop up
when using `AppliedTypeVar` with higher-kinded type vars.
In the enclosed test case, the cyclic type led to a SOE in
CommonOwnerMap.
This commit allows a TypeVar to delegate its `suspended` attribute
to the TypeVar from which it was copied. This is done in
`TypeVar#applyArgs`, which is called by:
// TypeMap#mapOver
case tv@TypeVar(_, constr) =>
if (constr.instValid) this(constr.inst)
else tv.applyArgs(mapOverArgs(tv.typeArgs, tv.params))
We should review the other places this is called to make sure
that it make sense to link in this way:
Types#appliedType
TypeVar#normalize
|
|\ \ \
| | | |
| | | | |
SI-7501 Pickler: owner adjustment for param syms in annotation args
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Pickling of trees within annotation arguments led to an unfortunate
situation: the MethodType of a symbol contained a value parameter
symbol that was pickled as though it were owned by the enclosing
class (the root symbol of the pickle.)
Under separate compilation, this would appear as a member of that
class.
Anyone using `@deprecatedName('oldName)` was exposed to this problem,
as the argument expands to `Symbol.apply("oldName")`.
This commit extends some similar treatment of local type parameters
to also consider value parameters.
|
|\ \ \ \
| | | | |
| | | | | |
(1 of 2) of the rest of the new bytecode emitter + feedback
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
In keeping with the baby steps towards pipelining of
class building and class writing, this commit gets one step closer
to that. Only thing missing: the actual thread-pool.
That will be the focus of an upcoming commit.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
To recap from the previous commit, another baby step towards
pipelining of class building and class writing.
Implementing similar functionality in GenASM is up for grabs,
see https://issues.scala-lang.org/browse/SI-6164
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This commit and two follow-up commits (recognizable because
of the starting words "decouple this from that" in the commit message)
are baby steps towards pipelining of class building and class writing,
ie allowing class building (which requires typer) and "the rest"
which doesn't) to run in parallel.
The commits have been broken up following a previous review comment.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
A better diagnostic error for corrupt or missing JARs.
|
| | |_|_|/
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Augment the IOException with the name of the file we're trying
to open.
Motivated by a troubleshooting session with partial downloads
of JARs from Maven central breaking the Scala build on Martin's
laptop.
The test case only tests our part of the error message, so as not
to be platform / JDK specific. Otherwise, it would check that the
correct cause exception was present and accounted for.
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
Value class Depth.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Reduced the amount of extraneous logging noise at the
default logging level.
Was brought to my usual crashing halt by the discovery of identical
logging statements throughout GenASM and elsewhere. I'm supposing
the reason people so grossly underestimate the cost of such duplication
is that most of the effects are in things which don't happen, aka
"silent evidence".
An example of a thing which isn't happening is the remainder of
this commit, which exists only in parallel universes.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
It's the obvious translation from a raw Int into a value class.
It wasn't that long ago one could find a signature like this:
def merge(tps: List[Type], variance: Int, depth: Int): Type
Do you feel lucky, method caller? Well, do ya?
Anyway, now it is:
def merge(tps: List[Type], variance: Variance, depth: Depth): Type
Forget for a moment the fact that you'd probably rather not pass variance
for depth and depth for variance and look at the type signatures:
(List[Type], Variance, Depth) => Type
(List[Type], Int, Int) => Type
|
|\ \ \ \ \
| |/ / / /
|/| | | | |
SI-6507 completely sidestep handlers in REPL when :silent in on
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This is a cleanup of 6db8a52, the original fix for SI-6507.
When the REPL is :silent, all handlers are ignored when it comes to
generating the printed result. The result extraction code (`lazy val
resN = ...`) is still generated, but now it isn't called until the
user calls it.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Fix typo in sample code in scaladoc for package scala.sys.process
|
| | |_|_|/
| |/| | | |
|
|\ \ \ \ \
| | | | | |
| | | | | | |
ProcessBuilder.lines(log) *does* throw an exception.
|
| | | | | | |
|
|\ \ \ \ \ \
| |_|/ / / /
|/| | | | | |
Constructors refactoring [Rebase of #2715]
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
And it's a nice golf clinic and all, but let's remove our
golf gloves and take in some film.
for (stat <- defBuf.iterator ++ auxConstructorBuf.iterator)
A quick count:
- defBuf is a ListBuffer (1 mutant)
- auxConstructorBuf is a ListBuffer (2 mutants)
- two mutable iterators over mutable sequences (3, 4 mutants)
- Iterator.++ joins them and is BY-NAME (4 mutants, 1 tragedy in waiting)
- the joined Iterator is a new mutable structure (5 mutants, now 3 deep)
- omittables is a mutable Set (6 mutants)
- the 5-layer-3-deep iterator mutates omittables as it walks
[The following is a public service breakdown. The letter
sequence y-o-u is a local variable which should be replaced
with your name, whoever "you" are, if you commit any code in
these parts.]
Hear my plea! YOU DON'T HAVE TO DO IT THIS WAY! It isn't simpler,
faster, easier, more satisfying, shorter, more pixelated, there
just isn't any advantage to it, even if you're lazy! Especially
if you're lazy! Whatever combination of virtues and vices exist
in your personal petri dish, this will never be a hilltop!
PLEASE COME ENJOY A DRINK WITH ME AND MY FRIEND 'VAL' !!
I'LL INTRODUCE YOU! I THINK YOU WILL REALLY LIKE HER! I HOPE
YOU WILL SEE A LOT OF ONE ANOTHER! REMEMBER THAT NAME, 'VAL' !!
SHE'LL HAVE HER EYE OUT FOR YOU!
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This commit modularizes TemplateTransformer by moving two methods
from TemplateTransformer into the newly added OmittablesHelper.
The methods in question are:
- mergeConstructors(genericClazz, originalStats, specializedStats)
- guardSpecializedInitializer(stats)
That way, the rewriting that introduces a guard for the execution of
non-specialized ctor-statements is encapsulated in
trait GuardianOfCtorStmts.
|
| | | | | | |
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This commit modularizes TemplateTransformer by moving a few members
from TemplateTransformer into the newly added OmittablesHelper.
The members in question include
- a few methods:
# isParamCandidateForElision(Symbol)
# isOuterCandidateForElision(Symbol)
# mustbeKept(Symbol)
- a few vals:
# paramCandidatesForElision
# outerCandidatesForElision
# bodyOfOuterAccessor
- class UsagesDetector
That way, all trace of rewriting to elide param-accessor fields
has vanished from TemplateTransformer and is encapsulated in
OmittablesHelper.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This commit modularizes TemplateTransformer by moving a few methods
from TemplateTransformer into the newly added DelayedInitHelper.
The methods in question
- delayedInitCall()
- delayedInitClosure()
- delayedEndpointDef()
build trees that rewriteDelayedInit() puts together.
That way, all trace of rewriting related to delayed-init
have vanished from TemplateTransformer and are encapsulated in
DelayedInitHelper.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Before this commit, each activation of transformClassTemplate()
performed the rewriting that the constructors phase is well-known for.
Lots of auxialiary objects were created in the process,
with lifetime confined to said activation.
The same auxiliary objects (having same lifetimes as before)
also are in effect starting with this commit,
but now it's an instance of TemplateTransformer
that holds them together. In other words,
there's a one-to-one correspondence between:
- (what used to be) transformClassTemplate() activation
- TemplateTransformer initialization
After initialization, the result of TemplateTransformer
can be found in its `transformed` member val.
In fact, the refactoring to get here from the previous commit
basically involves taking the body of method transformClassTemplate()
as-is to become the template of TemplateTransformer.
The TemplateTransformer in question will allow modularizing
sub-transformations (e.g., DelayedInit) into dedicated traits
(see upcoming commits).
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Removing the old implementation of elision in constructors
in favor of the new one which is both faster, more readable.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
For now both old and new implementations of elision coexist,
allowing cross-checking their results.
In the next commit only the new one will remain.
|
| | | | | | |
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
This way the contract of `transformClassTemplate()` can focus on
non-AnyVal cases, which are more regular from the perspective of
transforming their templates in the constructors phase.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The check in question relies on helper maps and methods that don't
belong outside that check. This commit encapsulates those helpers into
the newly added `checkUninitializedReads()` , thus uncluttering
`transformClassTemplate()`
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-1980 A lint warning for by-name parameters in right assoc methods
|
| | |_|_|_|/
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The desugaring of right associative calls happens in the parser. This
eagerly evaluates the arguments (to preserve left-to-right evaluation
order the arguments are evaluated before the qualifier).
This is pretty surprising if the method being called has a by-name
parameter in the first parameter section.
This commit adds a warning under -Xlint when defining such a method.
The relevent spec snippets:
> SLS 4.6.1 says that call-by-name argument "is not evaluated at the point of function application, but instead is evaluated at each use within the function".
>
> But 6.12.3 offers:
> "If op is right- associative, the same operation is interpreted as { val x=e1; e2.op(x ) }, where x is a fresh name."
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
@compileTimeOnly: moved to scala-library.jar, got some fixes
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Looks like we've got the entire language covered now.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
http://docs.scala-lang.org/overviews/macros/annotations.html
say sincere "thank you!".
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Now that @compileTimeOnly is part of the standard library, why don't
we use it within the standard library.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
This is the notion that's come to be universally useful, so I suggest
we promote it to be universally accessible.
Note that the attached test incorrectly fails to report errors for
definitions coming from the empty package and for annotations. These
are bugs, and they are fixed in subsequent commits of this pull request.
|
| |_|_|_|_|/
|/| | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
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
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Conflicts:
src/compiler/scala/tools/nsc/Global.scala
src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Historically calling NoSymbol.owner has crashed the compiler.
With this commit, NoSymbol owns itself. This is consistent with
the way ownership chains are handled elsewhere in the compiler
(e.g. NoContext.owner is NoContext, NoSymbol.enclClass is
NoSymbol, and so on) and frees every call site which handles
symbols from having to perform precondition tests against
NoSymbol.
Since calling NoSymbol.owner sometimes (not always) indicates
a bug which we'd like to catch sooner than later, I have
introduced a couple more methods for selected call sites.
def owner: Symbol // NoSymbol.owner is self, log if -Xdev
def safeOwner: Symbol // NoSymbol.owner is self, ignore
def assertOwner: Symbol // NoSymbol.owner is fatal
The idea is that everyone can call sym.owner without undue anxiety
or paranoid null-like tests. When compiling under -Xdev calls to
`owner` are logged with a stack trace, so any call sites for which
that is an expected occurrence should call safeOwner instead to
communicate the intention and stay out of the log. Conversely, any
call site where crashing on the owner call was a desirable behavior
can opt into calling assertOwner.
This commit also includes all the safeOwner calls necessary to
give us a silent log when compiling scala.
|
| |\ \ \ \ \
| | | | | | |
| | | | | | | |
SI-7756 Uncripple refchecks in case bodies
|