| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
This special case was added two years ago, quoting from
5428549a57b710b11e57aab4eee24e9b89b8b97c
"Inlined pure values are pure even if referenced from impure
prefixes (i.e. prefix need not be evaluated)"
This does not match the current semantics for inline where the prefix is
always evaluated.
|
|
|
|
|
|
|
|
| |
Pure expressions with function types now are considered
conforming. Necessitated a change in TreeInfo to accept
closures as pure expressions.
Test case in inlineForeach
|
|
|
|
|
| |
The body might still refer to an inline closure argument without
fully applying it. In that case the binding may not be dropped.
|
|
|
|
|
|
|
|
| |
This makes existsing uses of inline mostly compile.
Todo: Verify that stdlib can be compiled.
Todo: Implement accessors for assignments to priavte variables
Todo: Figure out what to do with accesses to private types.
|
|
|
|
| |
Prefer to access directly via symbol.
|
|
|
|
|
|
| |
Roll its functionality into Select. Since we can always
tell whether a tree is a type or term there is no expressiveness
gained by having a separate tree node.
|
|
|
|
|
|
|
|
|
| |
Now it's annotated first, annotation second.
This is in line with AnnotatedType and in line with the principle
that tree arguments should come in the order they are written. The
reason why the order was swapped before is historical - Scala2 did it
that way.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In particular:
- get rid of envelope, it's too complicated and hides too many errors
- check that everywhere in parsed trees the position range of a parent
node contains the position ranges of its children.
- check that all non-empty trees coming from parser have positions.
The commit contains lots of fixes to make these checks pass.
In particular, it changes the scheme how definitions are positioned.
Previously the position of a definition was the token range of the
name defined by it. That does obviously not work with the parent/children
invariant. Now, the position is the whole definition range, with the
point at the defined name (care is taken to not count backticks).
Namer is changed to still use the token range of defined name as the
position of the symbol.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
If an application has functions with implicit parameter types we need to be
more aggressive about propagating knowledge of the expected result type into
the constraint.
Fixes #1378.
|
| |
|
|
|
|
|
| |
Since we now have two forms of (almost) everything in Definitions,
might as well profit from it.
|
|
|
|
|
|
|
| |
A constant expression with pure arguments is pure. Previously, this
was not taken into account, which meant that literalize did not
work for constant expressions contiaining primitive operations or
String adds.
|
|
|
|
|
|
| |
They used to be discoverable using repeatedType, but ElimRepeated eliminates it.
Instead I'm using internal synthetic Typed nodes name, similar to how it's done for non-star Wildcards.
This makes handling Wildcards and Wildacard_Star more symmetric in patmat.
|
|
|
|
|
| |
Instead of classifying class members with a TreeInfo.DefKind, we
use directly the flags into which kinds were previously translated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous stale symbol was discovered because NormalizeFlags looks
at all declarations of a MoInits trait in the SymTransformer. I.e it does
this for all no-init traits, whether loaded from a classfile or currently
compiled. This is wasteful because it forces too many definitions.
The new scheme drops the scan in favor of producing PureInterface
together with NoInits. PureInterface is already read as a flag from
Java snd Scala2 classfiles. For source and Tasty it is now generated
as members are indexed.
|
|
|
|
|
| |
Methods like + can have multiple parameters. In that case
+= also takes multiple parameters.
|
|
|
|
|
| |
I scanned the main sources with IntellIJ's spell checker and
corrected what showed up.
|
|
|
|
|
|
|
| |
The pickling package got rather large and confusing with three
separate tasks that each had their own conventions: read JVM classfiles,
read Scala2 pickle info, read Tasty. The classes for each task are now in
separate packages.
|
|\
| |
| | |
Implement/i499
|
| |
| |
| |
| | |
Implements #499
|
|/
|
|
|
|
|
| |
If a unit has several top-level classes or object (which are not linked classes
of each other) each gets its own pickle information, which contains
any enclosing package clauses and imports and then just the top-level
class/object and its companion object.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
ElimLocals becomes a slightly less trivial transform: NormalizeFlags.
It also computes PureInterface flag, thus relieving Namer and Unpickler
from doing the same in two different ways. Besides, the computation in
Namer/TreeInfo was flawed because it did not take into account that
nested non-static classes are not allowed in an interface (only static
classes are, but these would not be members of the interface in the Scala
sense).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Lazy trees can live longer than runs, so it is important
that they capture as little as possible. In particular they
should not capture contexts.
This change led with a ripple through effect to many changes
where operations now have to parameterzied with contexts, in
particular in what concerns tree folding.
The changes in turn uncovered some areas where dotc was
incompatible with scalac, and flagged correct things as errors.
These will be fixed in the next commits.
Another small twist: EmptyTrees will not be read in delayed mode,
so that one can check for lacking definitions without deserializing
the rhs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Lazy fields are
- the rhs field of a ValDef or DefDef
- the body field of a Template
These can be instantiated with Lazy instances.
The scheme is such that lazy fields are completely
transparent for users of the Trees API.
The only downside is that the parameter used to initialize
a potentially lazy field has a weak type (now it's Any, with
Dotty it would be a union type of the form `T | Lazy[T]`.
Therefore, the parameter cannot be recovered through pattern
matching.
|
|
|
|
| |
Typed MemberDef trees now take the modifiers from their symbol's data.
|
|
|
|
|
|
|
|
|
|
| |
Previous implementation was confused about the meaning of interface (with default methods
or without?).
Now instead of Interface/JavaInterface we have
PureInterface - all members are abstract methods
NoInits - all members are methods
|
|
|
|
| |
Goes into a separate source files. Several simplifying refactorings.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New phase ElimByName elimintaes by-name parameters. All other
occurrences of parameterless methods and ExprTypes are eliminated
in erasure.
The reason for the split like this is that it is very hard for
Nullarify to determine when to insert ()'s. The logic for this
is fragile because we need to look at previous denotations which might
not exist (before splitter) or might result from a merge
between parameterless and nullary methods. In Erasure
the same is much simpler to achieve.
|
|
|
|
| |
Would be flagged as unimplemented members in refChecks otherwise
|
|
|
|
|
|
| |
Added decorators for symbols that can query specific
annotations and annotation arguments (for now, -deprecated
and -migration are added)
|
|
|
|
|
|
|
| |
Having two repeated param classes (and two types) does not work,
because we need to maintain an overriding relationship between
Scala repeated param methods and Java repeated param methods (this
will be resolved later by bridges).
|
| |
|
|
|
|
|
|
|
|
|
| |
Added two levels: pure and idempotent and fixed what look like
obvious bugs. It seems the previous treatment confused the two
levels.
Changed EtaExpansion and Erasure to use Pure instead of Idempotent
where appropriate.
|
|
|
|
| |
Uses a TreeAccumulator, rather than ad-hoc descent through `productIterator`.
|
|
|
|
| |
Dotty currently cannot parse @unchecked annotations in pattern types. That's why the previous commit failed. We need to come back to this and fix it. For the moment, to make on the current branch, the annotation is removed.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Companion class/module computations now also work for local classes and modules. For this to work,
either one of two conditions must be met: (1) some enclosing context refers to a scope that
contains the companions. (2) the context's compilation unit has a typed tree that contains the
companions. (1) is usually true when type-checking, (2) when transforming trees.
Local companions are searched as follows: If (2) holds, we locate the statement sequence containing
the companions by searching down from the root stored in the compilation unit. Otherwise, we search
outwards in the enclosing contexts for a scope containing the
companions.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
... and I believe should not compile under Scala2x either. The problem is in line 361 of TreeInfo.scala
methPart(tree) match { ...
Here,
tree: tpd.Tree
methPart: (tree: this.Tree): Tree
So we need to show that
tpd.Tree <: this.Tree
LHS expands to
ast.Tree[Type]
RHS expands to
ast.Tree[T] where T >: Untyped is TreeInfo's type parameter
Since Tree is contravariant, we need to etablish
T <: Type
but I see nothing that could prove this. The Dotty typechecker detected the problem, yet Scala2x's didn't. Need to follow up on why not. For now, adding the necessary constraint to the codebase.
|
|
|
|
|
|
|
|
|
|
|
|
| |
In a case like
val (x, y) = if (...) (a, b) else (c, d)
we can pass the tuples directly. Previously, this would have been translated to
val (x, y) = (if (...) (a, b) else (c, d): @unchecked) match {
case (s, t) => (s, t)
}
|
|
|
|
| |
To avoid duplication between by-name parameters and expr types, we treat by-name parameters as as having ExprType. A part of this is introducing ByNameTypeTree, a specific tree class for => T types.
|
| |
|
|
|
|
| |
Shadowing got confused if the shadowing expression truned out to be a closure.
|
| |
|
|
|
|
|
|
|
|
|
| |
1. We forgot to mark declaration symbols Deferred.
2. Types with NoPrefix and the same name got identified. Fixed by adding a new category WithNoPrefix to named types, and changing the way named types get generated.
3. Self types lacked parameters. (Question: Do we need to also track type members?)
4. Printers caused cyclic reference errors. Now some print operations are more careful with forcing.
5. Namedparts accumulator has to be more careful with ThisTypes. Because self types now contain parameters, which might lead back to this, we only add the class name (or the source module, if it's a module class).
6. toBounds in TypeApplications needs to use Co/Contra aliases for expanded name parameters, not just local ones.
|
|
|
|
| |
Before, TreeInfo would mis-predict whenever trees were inserted with TypedSplice. We should make sure the rest of the compiler also takes TypedSplices into account when matching on trees. It's a systemic risk. Not sure we can avoid it with a better design.
|