| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|\
| |
| | |
Properly report errors when cli flags are malformed
|
| |
| |
| |
| |
| | |
Previously we returned an empty Reporter with no errors so partest
reported the test as a success.
|
|\ \
| | |
| | | |
Implicit scope caching: bug fixes and performance improvements
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
|
| | | |
|
| | | |
|
| |/
|/| |
|
|\ \
| | |
| | | |
Fix #1292: give position when failing to emit switch on annotated match
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This fix gives the position and refactors the code that gave off
warnings, but it also begs the question - should we be able to handle
emitting a switch for the following case:
```scala
(x: @switch) match {
case 'a' if somePredicate(x) => // ...
case 'b' => // ...
}
```
Currently if there is a guard, the patternmatcher will fail to emit
a switch. Scalac can handle these cases currently.
|
|\ \
| |/
|/| |
Fix stdout redirect for REPL's println
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
When printing in the REPL via `println`, the output would end up on the
same line, since stdout had not been redirected. This commit remedies
that.
It also adds syntax highlighting to result types.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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 :-)
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
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).
|