| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
New phase for extension methods.
Also, split off some type handling functionality that can be used
elsewhere in new TypeUtils decorator. The idea is that TypeUtils should
contain methods on Type that make sense specifically for transformations.
That way, we can keep Types from growing. Might make sense to do similar
decorators for Denotations as well.
There's a bug fix in MacroTransform: Need to treat selfInfo varDels specially, since they have no symbol.
|
|
|
|
|
|
|
|
|
|
|
|
| |
1) We now always generate companion objects for classes. This is done in
mini-phase "companions", which also assures that companion-modules appear
after companion-classes.
2) PostTyperTransformers is gone; the part which normalizes trees has been
rolled into TreeTransform and the part which reordered companion classes
and modules is now in Companions.
Note: Some tests were deisabled; should be re-enabled by Dmitry where needed.
|
|
|
|
|
| |
Rewrote SuperAccessors (more to be done; see comments), and
added stuff here and there to make it work smoother.
|
| |
|
|
|
|
|
| |
Switch to the new scheme where higher-kinded types (and also some polymorphic
type aliases) are represented as instances of Lambda traits.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
abstract type.
This is needed to make the encoding og higher-kinded types work. E.g.
Rep[Int]
would be represented as
Rep { type Arg$0 = Int } # Apply
where Apply is an abstract member of the base class Lambfa$I of Rep.
|
| |
|
|\
| |
| | |
Small fixes
|
| | |
|
| |
| |
| |
| | |
becaus this is the limit imposed by Travis
|
| |
| |
| |
| | |
I still have 1.6 installed. So the two simple fixes are necessary to make my build pass for now.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There's a delicate balance about how much of a prototype should be passed down the
tree when typechecking. Passing little can cause ambiguity errors (both in overloading
and in implicit search). Passing too much can cause spurious errors because implicit conversions
"down the road" that apply to some tree continaing the result might not be considered.
Symptoms of the problems wree that we could not handle the tests included in this commit before.
The new scheme is as follows: we always keep all available information in a prototype, but hide nested
prototypes behined a `IgnoredProto` wall. These trees will not be considered for conformity checking.
When type checking hits an ambiguity, it tries again with a prototype that's one level deeper (has fewer
Ignore links) than the previous one. This continues until there are no more Ignore links to unwrap.
We also generalize the scheme for wrapping qualifiers of select nodes from realApply to all instances where
we compare against a FunProto.
Finally, there are some fixes that avoid assertion violations that were provoked by the new typechecking scheme.
|
| | |
|
|/
|
|
| |
Refactored reporters to increase clarity and to pave the way for having Diagnostics subclasses.
|
| |
|
|
|
|
| |
With the previous fixes, we can now compile dotc/transform without errors.
|
|
|
|
|
|
|
|
|
| |
defaultOptions is now an implicit parameter, which means it can be overridden
on a call-by-call basis.
Added -Ycheck:front to verify that typed trees typecheck again with same types.
The option is disabled for one of the structural tests.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We cannot have same named methods defined in Object and Any because after erasure
the Any references get remapped to the Object methods which would result in a double binding
assertion failure.
Instead we do the following:
- Have some methods exist only in Any, and remap them with the Erasure denotation
transformer to be owned by Object.
- Have other methods exist only in Object.
To achieve this, we synthesize all Any and Object methods; Objetc methods no longer get
loaded from a classfile.
There's a complication with getClass. We need to reconsider what the best treatment of getClass is.
Right now there's too much magic going on for my taste. It might be better to leave getClass on Object only as it
is in Java, forget about the special treatement of its type, and have another getClass like method in
an decorator on class Any. That could produce the right types and could also work for primitive types.
|
|\
| |
| | |
Context escape detection.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
During creation of each of DottyTests context is stolen from test and a
WeakReference for it is created.
After running all tests references are examined to detect if any of them
has leaked.
|
| |
| |
| |
| | |
Eliminates ExprTypes and PolyTypes over value types.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Ported tailcall phase from scalac with such changes:
- all transformation is done in the phase itself
(previously half of the work was done in backend)
- it is now able to run before uncurry
- it is now a treeTransform
- renamed to tailrec to make it more obvious that
this phase transforms only recursive calls.
For now this is a single phase which speculatively
transforms DefDefs.
Speculation can be potentially removed by
splitting into 2 phases:
one detecting which methods should be transformed
second performing transformation.
But, as transformation requires as same amount of work
as detection, I believe it will be simpler to maintain
it as a single phase.
Conflicts:
tests/pos/typers.scala
|
|\ \
| |/
|/| |
Fixing annotations
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A double binding is if a named type gets assigned two denotations in the same period. This is
a side-effect and also a race condition, so it's very bad. I am trying to eliminate all causes of this. But one cause which will likely remain are double defitions in a prgram, if a user writes
class C {
val x: Int
val x: Int
}
Then it's really hard to avoid setting two meanings of C.this.x! That's why the testing
against double bindings is enabled by a -YnoDoubleBindings option. The understanding is that
-YnoDoubleBindings should be set only if there are no double def errors anticipated. Otherwise
the program might fail with an assertion error before the double def error is reported.
|
|/
|
|
|
|
|
| |
Implemented splitting operations
As a side effect, this contains a test ruling out structural term member dispatch.
Tests 0586 and 0625 which used structural dispatch got moved to neg.
|
|
|
|
|
|
|
|
|
|
| |
We are already over limit on output size imposed by travis that is shown
in webpage, if we'll continue to add tests will be soon over limit even
to run builds.
This commit disables printing of classpath, and removes printlns in
several places.
In order for ShowClassTests to print info as is was printing
previously, please set "test.ShowClassTests.verbose" property.
|
|
|
|
| |
Wrong helper method was used.
|
|\
| |
| | |
Transform/erasure
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
1. Object_isInstanceOf/asInstanceOf are no longer parameterized methods (seems there's
no point in writing x.$asInstanceOf[T]() instead of the shorter x.$asInstanceOf[T]).
2. Array constructor's type is unchanged (the previous rules erased it to
def <init>(len: Int)Object
which is clearly wrong).
3. indexing needs to be disabled.
4. typedTypeApply needs to keep type applications that apply to type tests and type casts as well as
array ops.
5. References to self-ids are typed ThisType(cls) before erasure; are replaced by This(cls) references
during erasure.
|
|/ |
|
|
|
|
| |
And avoid name clashes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
test case t0273. Was positive in Scala 2, is now deemed to be negative.
Two two definitions
def a = () => ()
def a[T] = (p:A) => ()
do have matching signatures, so should constitute a double definition.
I previously thought that we can get away if the two definitions have
different result types, but then you immediately have a problem because
the denotations have matching signatures for the pruposes of "&" yet
cannot be merged. Which of the two definitions would override
a definition in a base class is then an arbitrary decision.
|
|
|
|
|
|
|
|
| |
The original test is now in error because the type Meta in the prefix Meta#Event
is not stable and contains an abstract member Slog.
Even after removing Slog, the test in pos was still in error because the bound type parameters
were incorrectly recognized as abstract members. This has been fixed by the changes to Types.
|
|
|
|
|
|
| |
Added more tests which all pass, except for tests in disabled and pending.
t0694 went from pos to neg, because the kind of alias type used in t0695 is no longer supported.
|
|
|
|
|
|
|
|
| |
Test t0288 moved to disabled due to lack of Java interop.
Test t0273 fixed by relaxing double def condition: We only regard two
definitions that define the same name and have exactly the same signature
as double definitions. Previously, signatures that defined the same parameters
were also excluded.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Made desugaring hygienic. Trees that are derived from some other tree are no longer stored as simple
untyped Ident trees, but as TypeTrees that know how to derive their types from some other type.
Test cases in pos: hygiene.scala, t0054.scala and t0085.scala.
The comment in hygiene.scala points to the difficulties we are facing. In particular, we need type
trees that can rebind some references of a source type to local occurrences with the same name. t0054.scala is similar to hygiene.scala. t0085.scala is trickier, but also related. Essentially the problem there is that we have a class
that inherits its outer class. In this case it is important to resolve an identifier in the right context. The identifier added to the copy method of a case class must be resolved outside the class (just like the same
identifier in the constructor of that case class).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Appromiximate union types by intersections of their common base classes. Controlled by option -Xkeep-unions.
If option is set, no approximation is done.
Motivations for approximating: There are two. First, union types are departure from Scala 2. From time to
time they lead to failure of inference. One example experiences in Dotty was in a foldLeft, where the accumulator
type was inferred to be Tree before and was now a union of two tree specific kinds. Tree was the correct type, whereas
the union type was too specific. These failures are not common (in the Dotty codebase there were 3, I believe), but
they cause considerable difficulty to diagnose. So it seems safer to have a compatibility mode with Scala 2.
The second motivation is that union types can become large and unwieldy. A function like TreeCopier has a result
type consisting of ~ 40 alternatives, where the alternative type would be just Tree.
Once we gain more experience with union types, we might consider flipping the option, and making union types the
default. But for now it is safer this way, I believe.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Auto-tupling should satisfy the following spec.
1. An application `f(args)` where `f` is a non-overloaded method which has a single, non-repeated parameter as its
first parameter list and where args consists of two or more arguments is expanded to `f((args))`.
2. A constructor pattern `C(args)` where `C.unapply` is a non-overloaded method which has a single, non-repeated parameter as its first parameter list and where args consists of two or more arguments is expanded to `C((args))`.
Auto-tupling can be disabled by language feature "noAutoTupling".
Conflicts:
test/dotc/tests.scala
|
|
|
|
|
|
| |
All MiniPhases now as are full-fledged phases,
and are given their own periods and can register DenotTransformers.
MiniPhases belonging to same group(list) will be squashed to single phase.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Creates accessors for lazy vals:
1) lazy local vals are rewritten to dotty.runtime.Lazy*** holders
2) for a non-volatile field lazy val create a non-thread-safe accessor and flag:
2.a) if lazy val type indicates that val is not nullable, uses null value as a flag
2.b) else uses boolean flag for sake of performance, method size, and
allowing more jvm optimizations
3) for a volatile field lazy val use double locking scheme, that guaranties no
spurious deadlocks, using long bits as bitmaps and creating companion
objects to store offsets needed for unsafe methods.
Conflicts:
test/dotc/tests.scala
|
|
|
|
|
| |
CreateCompanionObjectTests were re-enabled. They failed in a previous version but succeed again in the latest commit.
Also uncurry.scala got renamed to curried.scala.
|
|
|
|
|
|
|
|
| |
Many small and large changes. Added samplePhase to demonstrate functionality.
To test functioning, run the compiler with args
tests/pos/uncurry.scala -Ylog:sample,terminal
|
|
|
|
|
|
|
| |
This makes naming uniform between trees and types, and also avoids the clash with
transform.TreeTransformer. The idea is that transformers are parts of phases, and
have logic that is phase-specific. In particular, a context is passed around when
transforming a tree. Maps are simpler, they only have a T -> T apply method.
|
|
|
|
|
|
|
|
|
|
|
| |
I'm about to refactor that method in terms of a TreeAccumulator.
Note that I've packaged the test case in `dotty.tools.dotc.ast`
I believe this is the best approach for organizing unit tests:
the import tax is minimized, and use of relative imports is
made less fragile by avoiding creating new packages to test code.
I'll reorganize the other unit tests like this if others agree.
|
|\
| |
| | |
Bullet-proofing companion objects
|