| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
If directly applicable alternatives exists, do not try other
alternatives. The original motivation for this change was to reduce the
number of searches for implicit views we do since some overloaded
methods like `Int#+` are used a lot, but it turns out that this also
makes more code compile (see `overload_directly_applicable.scala` for an
example), this change does not seem to match what the specification
says (it does not define a notion of "directly applicable") but it does
match the behavior of scalac, and it seems useful in general.
|
| |
|
|
|
|
| |
This reduces the number of implicit scopes we cache.
|
|
|
|
|
|
| |
Many intermediate `OfTypeImplicits` are created during a call to
`implicitScope`, but they won't all be used so there is no need to
compute `OfTypeImplicits#refs` unless it's actually used.
|
|
|
|
|
|
|
|
|
| |
According to SLS ยง 7.2, self types are not a named part of a type,
so they're not part of the implicit scope. Before this commit, this was
usually the case because we normally refer to a class using a TypeRef,
but in some cases a class might appear as a ThisType, and
ThisType#underlying returns the self type, we now use ThisType#tref
instead which just returns a TypeRef corresponding to the class.
|
|
|
|
|
| |
This did not work before because we incorrectly looked for their value
in the prefix of the type instead of the type itself.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The issue is subtle: the `tp` in scope in `def ofTypeImplicits` is the
`tp` passed to the top-level `implicitScope` method, not the `tp` passed
to the recursively called `iscope`, this means that before this commit,
all intermediate `OfTypeImplicit` scopes cached while computing an
implicit scope had their `tp` field incorrectly set, which means that we
could miss implicits in later implicit searches.
Note that the `implicit_cache.scala` test worked before this commit
because of the restrictions on caching that exist since
b8b0f381ef2cbcb7bad66fd3e7a9ae929baa45f6, it is included anyway because
our caching strategy might change in the future.
|
| |
|
|\
| |
| | |
[do not merge] remove magic with benchmark tests
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The benchmark project generates a dubious exception when compiling
scala stdlib:
java.lang.ClassCastException: scala.tools.nsc.backend.jvm.BTypes$ClassBType
cannot be cast to scala.tools.nsc.backend.jvm.BTypes$ArrayBType
Upon investigation, this turns out to be a backend incompatibility
problem. The bench project runs with a previous version of scala-compiler.
Explicitly designating the scala-compiler version for bench fixes
the problem.
|
|/
|
|
|
|
|
| |
- remove dependence on junit
- remove `pos` tests
- merge all dotc related tests to a single `dotty` test
- remove `Ycheck:all`
|
|\
| |
| | |
Add sbt incremental compilation support
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
To test this with sbt, see
https://github.com/lampepfl/dotty/wiki/Using-Dotty-with-sbt
The following flags are added:
- -Yforce-sbt-phases: Run the phases used by sbt for incremental compilation
(ExtractDependencies and ExtractAPI) even if the compiler is ran outside of
sbt, for debugging.
- -Ydump-sbt-inc: For every compiled foo.scala, output the API
representation and dependencies used for sbt incremental compilation
in foo.inc, implies -Yforce-sbt-phases.
This commit introduces two new phases which do not transform trees:
- `ExtractDependencies` which extracts the dependency information of the current
compilation unit and sends it to sbt via callbacks
- `ExtractAPI` which creates a representation of the API of the current compilation
unit and sends it to sbt via callbacks
Briefly, when a file changes sbt will recompile it, if its API has
changed (determined by what `ExtractAPI` sent) then sbt will determine
which reverse-dependencies (determined by what `ExtractDependencies`
sent) of the API have to be recompiled depending on what changed.
See http://www.scala-sbt.org/0.13/docs/Understanding-Recompilation.html for
more information on how sbt incremental compilation works.
This phase was originally based on
https://github.com/adriaanm/scala/tree/sbt-api-consolidate/src/compiler/scala/tools/sbt
which attempts to integrate the sbt phases into scalac (and is itself based
on https://github.com/sbt/sbt/tree/0.13/compile/interface/src/main/scala/xsbt),
but it has been heavily refactored and adapted to Dotty. The main
functional differences are:
- ExtractDependencies runs right after Frontend (so that we don't lose
dependency informations because of the simplifications done by PostTyper),
but ExtractAPI runs right after PostTyper (so that SuperAccessors are
part of the API).
- `ExtractAPI` only extract types as they are defined and never "as seen
from" some some specific prefix, see its documentation for more details.
- `ExtractDependenciesTraverser` and `ExtractUsedNames` have been fused into
one tree traversal in `ExtractDependenciesCollector`.
TODO: Try to run these phases in parallel with the rest of the compiler
pipeline since they're independent (except for the sbt callbacks in `GenBCode`) ?
|
| | |
|
| |
| |
| |
| | |
This works similarly to `Trees#TreeTraverser`.
|
| | |
|
| | |
|
|/
|
|
|
| |
SymDenotations#topLevelClass: don't throw an exception
Symbols#associateFile: avoid infinite loop
|
|\
| |
| | |
Fixes to lambdalift that prevent memory leaks.
|
| | |
|
| |
| |
| |
| | |
See t5375.scala for details.
|
| |
| |
| |
| |
| |
| |
| | |
Before there was an implicit assumption that static methods are only
present on objects.
This assumption is invalidated both by linker optimizations and the new
fix to lambdalift.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
CollectDependencies had incorrect handling of `Ident`s.
If it had ever met an `Ident` to a symbol defined outside of current
owner-chain(e.g. Predef.println) it would issue narrowTo(enclosingClass).
This is very conservative and leads to memory leaks
even in trivial lambdas.
My lambda-lift-foo groes stronger :-)
|
|\ \
| | |
| | | |
Fix #1276: `_` binding in patternmatcher
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
One drawback with this approach is that the type seems to propagate.
I.e. if the return type of an expression is `repeated` then the
enclosing variable will get the `repeated` type instead of getting the
expected `Seq` type
|
|/ / |
|
|\ \
| | |
| | | |
Fix bootstrap
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
As explained in the comment, a scalacLinkedClass must also
be a true companion unless the original symbol is a root. This
avoids us to drop the (potentially large) unpickled map and
save some memory.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Otherwise we might get a false owner if completing from somewhere else.
We do not have a failing test to demonstrate the problem, but it looks
like the right thing to do.
|
| | |
| | |
| | |
| | |
| | | |
Include member defs inside templates in the enclosing class,
otherwise they would get localDummy as onwer.
|
| | |
| | |
| | |
| | |
| | | |
Instead of stubbing with potentially wrong owners and hping for the best, we
now compute owners on demand, using the lazy data structure of an OwnerTree.
|
| | |
| | |
| | |
| | |
| | |
| | | |
First step for a more robust scheme to access symbols in Tasty.
This entailed a swap of two fields in RefiendType, to make tree
format more uniform in what concerns where references are found.
|
| | |
| | |
| | |
| | |
| | |
| | | |
Compute initialization flags of possibly enclosing traits
elsewhere (in indexStats). Cleans up the logic and makes
the module more understandable.
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
It's possible that the given phase argument does not exist, in which case
we do not want to set the current phase to NoPhase.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Do this in the inferred (result-)type of ValDefs and DefDefs.
Without this fix, TreeTraverser#traverseChildren in Trees.scala
gets a result type of BoxedUnit (but only when co-compiled from
source, not when unpickled).
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We had a problem where unpickling an annotation containing a
class constant had the wrong type. Unpickling was done after erasure.
The type given to the constant was an alias but aliases got
eliminated during erasure, so the constant was malformed.
Unpickling annotation contents at the same phase as unpickling
the annotation carrier solves the problem.
It seems similar problems can arise when data is unpickled
using a LocalUnpickler. So we now make sure local unpickling
runs at the latest at phase Pickler.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Forcing it led to CyclicReferences involving RefChecks.OptLevelInfo when compiling
dotc/*.scala against Tasty files. The problem was that when transforming OptLevelInfo
the backend forced a transformInfo of RefChecks in TypeErasure which filtered RefCheck's
scope to eliminate non-class type definitions. Without the tweak in this commit this
tried to make all symbols current, and so came back to OptLevelInfo.
|
| | |
| | |
| | |
| | |
| | | |
Instrument Denotations#current to find CyclicReference errors
arising during transforms.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
It caused an assertion error when separately compiling
parts of dotty against TASTY information. Not sure the
test achieves anything or whether it produces a false
negative.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
When reading Tasty we need to pre-set the info of a class to some
ClassInfoType with (as yet) unknown parents and self type. But for
module classes, we need to know the source module at all time, and this
gets determined by the self type. So we now produce a TermRef
for the assumed self type of a module class.
|
|\ \ \
| | | |
| | | | |
Add dotty runner script able to run dotty-compiled class with `main`
|
| | | | |
|
| | | | |
|