| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Unlike normal fields, they aren't initialised in $init method, and need to know a bit about class layout of implementation class.
Luckily AugmentScala2Traits added just enough symbols to make this work.
|
|
|
|
| |
Scala-2 lazy vals are @volatile according to Dotty conventions.
|
| |
|
|
|
|
| |
For the moment, we keep all annotations on getters and setters, but this could be changed.
|
| |
|
|
|
|
| |
Implementations inherit all annotations on the implemented trait methods.
|
|
|
|
|
| |
The logic to add trait setters to Scala 2 traits was wrong. This led
to AbstractMethodErrors in the formerly commented out part of scala-trait.scala.
|
|\
| |
| | |
Implement Scala2 traits
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The previius commit on "Refine & for Denotations" caused
NotDefinedHere errors in the backend when compiling dotc/typer.
These were tracked down to three occurrences in LazyVals where `enter` instead
of `enteredAfter` was used. `enter` will enter a symbol in an unknown set of
previous phases. Transformations that traverse scope (like erasedMembers in
TypeErasure will then see the denotations of these symbols outside the
scope in which they are defined.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The policy is now made clear in a doc comment. The new part is that we will prefer
a symbol defined in a subclass over a symbol defined in a superclass. With the previous
commit 0a0d3dd1 on "More precise and uniform modelling of isCurrent" we got runtime test
failures for Course-2002-03.scala because the new definition isCurrent assumed a behavior
of `member` which was not assured: Namely that the merged denotation would prefer symbols
in subclasses over symbols in superclasses.
|
| |
| |
| |
| |
| |
| |
| |
| | |
For implemented getters and forwarded methods we need a notion of "isCurrent",
which means: would the getter or method before the implementation is added be
a member of the implementing class? Only in this case do we need to do anything.
The method formulation was previously weaker than the getter formulation, which
led to an error when compiling core (duplicate methods: andThen and size).
|
| |
| |
| |
| | |
Scalac does not generate them either.
|
| |
| |
| |
| | |
Scala 2 doe snot generate default methods, so we always need forwarders.
|
| |
| |
| |
| |
| | |
A transformFollowingDeep was missing, so LinkScala2ImplClasses never got to see
the call.
|
| |
| |
| |
| |
| |
| | |
Instead of cleaning up, generate sensical code in the first place. This is shorter and
(I would argue) clearer, and also has the advantage that some initializing assignments
are not generated at all.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes junit failure in dotty where a lazy val was initialized with
a "...$lazy = _" assignment.
Moved ElimWiildcard to one group before. It does not really matter where it goes
so it might as well go someshere in the middle of the pack.
|
| | |
|
| |
| |
| |
| | |
This phase rewrites supercalls to calls to static implementation class methods.
|
| |
| |
| |
| | |
Erasure uncurries arguments, need to track that in memberSignature.
|
| | |
|
| |
| |
| |
| |
| | |
They don't exist for Scala2 traits. Instead we let the initializer be `_'
and rely on trait setters (to be implemented) to initialize the field.
|
| |
| |
| |
| | |
A typed `_'. This is needed in a few places.
|
| |
| |
| |
| |
| | |
Previously it didn't, because it created an ExprType, which is
illegal after erasure.
|
| |
| |
| |
| | |
This brings it in line with Scala2 conventions.
|
| |
| |
| |
| | |
We'd like to make it reusable for a phase that treats Scala2 traits.
|
| |
| |
| |
| | |
Also: generalize expandedName so that it can cater for trait setters.
|
| |
| |
| |
| |
| |
| | |
It definitely does appear in trees, so should be included in the set.
Affects how things are printed. Before, typed var's would still show up
as vals.
|
| |
| |
| |
| |
| |
| |
| | |
If memoize and constructors are run in different groups,
memoize's previous postcondition "all concerete methods are implemented"
is wrong, because constructors are not implemengted yet. Solved
by moving the postcondition to phase Constructors.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
LambdaLift needs to compute outer.path at the phase in which
the results are constructed, i.e. phase lambdaLift.next. Or else
we get an error in outer.path for lost fo files, including pos/Fileish.scala
as a minimized test case. Previously outer as computed at phase lambdaLift.
The reason for this is that lambdaLift name mangles inner classes, which
causes outer acessors to be not found. We now correct for the problem
in outer.path itself, by calling outerAccessor only at a safe phase.
|
| |
| |
| |
| |
| | |
Lambdas should stay inside static objects if they reference to them with
a This or Ident. Fixes test case `llist.scala` but demonstrates another problem.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 3d240ad40ccfb570174ec9758bfe68ba4e91eefb.
This commit got in without succeding the review.
It broke what already was working(inner static objects),
and made impossible moving static methods from companion object to companion class.
Additionally, commenting or removing assertions is not the way to go, and should not pass review.
See discussion here: https://github.com/dotty-staging/dotty/commit/3d240ad40ccfb570174ec9758bfe68ba4e91eefb
|
|/
|
|
|
|
|
|
| |
See https://github.com/lampepfl/dotty/pull/624#issuecomment-107064519
for a lengthy explanation.
We now solve the problem in LambdaLift. The formerly failing tests are
all reverted to theor original, failing, version.
|
| |
|
|\
| |
| | |
Trees: Add toString for AST nodes which are not case classes
|
| |
| |
| |
| | |
This makes debugging trees easier.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Only transform static methods which are inside module classes.
- Make sure that the prefix of the underlying type of the Ident
is a ThisType of the current module class. For example in
"scala.Int.box(42)", "box" is an Ident whose underlying type is
"TermRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,scala)),Int$)),box)",
but we should not trigger an assertion in this case.
|
| | |
|
| |
| |
| |
| | |
Previously was only done for DefDefs. Caused backend failure.
|
| |
| |
| |
| |
| |
| | |
class is also the top-level class"
This reverts commit 6898d2c296326779d373ef0e0b84e4451550120a.
|
|/
|
|
|
|
|
|
|
| |
Constants that are adapted to a different supertype need to do this
explicitly (not just by changing the type). Otherwise tree checkers
will compute the original type and fail.
This caused a test failure in pos/harmonize. The mystery is why this
was not caught in the checkin tests.
|
|\
| |
| | |
Add a test for supercalls in traits.
|
| |
| |
| |
| | |
Fixes problem with run/t261.scala.
|
| |
| |
| |
| | |
Also added non-unit fields and a class that directly implements two traits with the same fields.
|
| |
| |
| |
| |
| |
| | |
A class might implement several fields in inherited traits with the same and type.
In that case only one getter should be produced, but all initializing expressions
have to be executed.
|
| |
| |
| |
| | |
()Unit translates to ()BoxedUnit not BoxedUnit.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Also mark the forwarder as Stable otherwise we get a RefChecks error.
This fixes #608.
Note that we do less parameter forwarding than scalac. See for example D
and Y in tests/run/paramForwarding.scala which don't get their own local
fields in scalac but do in dotty.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Harmonization is Dotty's alternative to Scala 2's notion of weak conformance. It is less powerful but also
less entangled with the core type system. The idea is that in some specific contexts trees that
all have primitive numeric types will be converted as necessary so that they all have the same numeric type.
These tree sets are:
- the two branches of an if
- the alternatives of a match
- the body together with the catch blocks of a try
- the arguments of a vararg parameter
Examples are in the test file, harmonize.scala.
|
|/ |
|
| |
|