| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
They aren't inherited and can be entered into frozen owners.
|
|\
| |
| | |
Implicit scope caching: bug fixes and performance improvements
|
| |
| |
| |
| | |
This reduces the number of implicit scopes we cache.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| |/
|/| |
Fix stdout redirect for REPL's println
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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 bytecode checking infrastructure
|
| | | | |
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Annotated values are encapsulated in a `ConcreteAnnotation`, as such,
the statement `tpe isRef defn.IntClass` would yield false despite the
annotated reference being an Int.
The tpe is now unwrapped if it has an annotation. If the transformation
fails despite having the annotation the compiler will warn.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Name, Symbol, Denotation, Type.
This uncovered two nonsensical comparisons, one in CollectEntryPoints,
the other in DottyBackendInterface.
|
| | |
| | |
| | |
| | |
| | |
| | | |
This is done by checking each instance of an eqAny implicit
so that it does not contain non-bottom instances of equality
types as instances.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Also, check that pattern matching against idents/selects/literals makes
sense.
The hooks perform an implicit search for an instance of `Eq[L, R]`, where
`L`, `R` are the argument types. So far this always succeeeds because Eq.eqAny
matches all such types. A separate commit will check the returned
search term for validity.
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| | |
Compare selected contravariant arguments as if they were covariant.
Which ones is explained in the doc comment for method `isAsSpecificValueType`
in Applications.scala.
This has the same motivation than what @paulp proposed around 2012. The solution is a bit
different from the one proposed then because it only affects top-level parameters.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
During an attempted dotty bootstrap it was noted that Types.scala did not compile
anymore, because `checkUnique` threw a `TypeError` during erasure. The issue was an
overloaded member `name` in TermrefWithSig. In NamedType:
def name: Name
In TermRef:
def name: TermName
Before erasure, there's one member `name`, after erasure there are two (because after
erasure result type counts). The error arose when trying to recompute a member
of a `TermRefWithSig` where the name is `name` and the expected signature is `(Nil, ?)`.
Since there are two members that match the name and the signature, `checkUnique`
triggered a `TypeError`. Before adding `checkUnique`, the previous `atSignature`
call would just have returned an arbitrary choice among the two alternative definitions
of `name`.
The fix is not to use `checkUnique` but to fall back to `d.current` in the case where
several alternatives appear.
Interestingly, the failure only triggers when -Ycheck options are *disabled*. I added a new
test that compiles Types.scala without checks, so we catch this and possibly similar bugs
in the future.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We cannot throw a merge error if atSignature does not give
a unique single denotation. Counter example is compiling dotty itself,
where we get a false negative during bridge generation.
Instead, atSigature needs to return a normal denotation, and we
need to check separately where required that a denotation is in
fact a SingleDenotation.
|
| |
| |
| |
| |
| |
| |
| |
| | |
When finding two symbols in the same class that have the same signature
as seen from some prefix, issue a merge error.
This is simpler and more robust than the alternative of producing an overloaded
denotation and dealing with it afterwards.
|
|/
|
|
|
|
|
|
| |
#1240 shows that we need to detect ambiguous overloads of methods
coming from the same base class (with different signatures there)
that have the same signature in some deriving class. This was
undetected before because the two methods were simply merged into
one overloaded alternative.
|
| |
|
|
|
|
|
| |
Since we now recognize more false dependencies,
we have to dealias the new dependencies accordingly.
|
|
|
|
|
|
| |
Triggered by change in TypeComparer. I guess we should think of
dropping the NotDefiendHere tests, for a long time they gave us only false
negatives.
|
|
|
|
|
|
|
|
|
| |
#1235.scala contains a case of a method type of the form
(x: T) ... x.tail.N ...
where N is an alias. We need to follow the alias to prevent
a mischaracterization that this is a dependent method type.
|
|
|
|
|
|
| |
More generally, avoid forming a type selection on a term prefix which
has a bottom class as a type. There might be other places where we have
to take similar measures. For now, this one fixes #1235.
|
|
|
|
|
|
|
|
|
|
| |
There's a trap otherwise that, when in a class inheriting
from Context (and with it Reporting) a call to println will
go to this.println and therefore might not print at all, if
the current context buffers messages. I lost a lot of time
on this on several occasions when I scratched my head why
a simple debug println would not show. Better avoid this in
the future for myself and others.
|
| |
|