| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
To bring in line with TreeTransformer terminology.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Uses a TreeAccumulator, rather than ad-hoc descent through `productIterator`.
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
| |
| |
| | |
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.
|
|\ \
| | |
| | | |
Fixes for transforms
|
| | |
| | |
| | |
| | | |
... so that we can add new members to transformed class denotations.
|
| |/ |
|
|\ \
| | |
| | | |
Fixed two problems with annotated types in patterns
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Problem 1: The parser did not accept them. It has to accept a "RefinedType" as an ascription,
not a "WithType" (as it did before), or even a "SimpleType" (as speced in the SyntaxSummary).
Problem 2: Annotations are always typed as expressions. The annotations in question were typed
as patterns before.
Tests in Patterns.scala and in the Dotty compiler itself.
|
| |
| |
| |
| |
| | |
A transformer that provides a convenient way to create
companion objects.
|
| |
| |
| |
| |
| |
| | |
Added a prepareForStats&transformStats pair of methods,
which provide a convinient way to alter scopes of
PackageDefs, Templates and Block's.
|
| |
| |
| |
| |
| |
| |
| | |
1) reorders companion objects so that they allways follow matching
classes
2) removes imports and named arguments
3) rewrites all trees holding types are to TypeTrees
|
| |
| |
| |
| |
| | |
Distringuish between ModifierFlags -- which can appear in trees -- and SourceModifierFlags -- which are
modifiers according to the language spec.
|
|/
|
|
|
| |
Needs new TypeRef creation method that works for NoPrefix and at the same time
does not need a denotation. This is provided by method TermRef.withNakedSymbol.
|
|\
| |
| | |
Fixes t00xx
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Constructors need to be completed in the context which immediately encloses
a class. Otherwise type references in the constructor see the wrong types,
as is demonstrated in t0054. The difficulty here is that the inner class B
nested in A also extends from A. Then it makes a difference whether the constructor
parameter types of B are resolved in the context of B or in the context of A.
Added explanation for context handling of constructors.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This test case exercised several problems:
1.)2.) Two ways to run into a cyclic references. Fixed by
- assuming an early info when completing a typedef, similarly to what is done for a classdef
- doing wellformed bounds checking in a later phase.
Failure to check whether arguments correspond to F-bounds.
- a substitution was missing.
|
| |
| |
| |
| |
| | |
Need to compile the self type of a class not in the context of the class members but one context further out.
Reason: self type should not be able to see the members.
|
|\ \
| |/
|/| |
Fix/#50 volatile
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Volatile checking needs to take all intersections into account; previously these
could be discarded through needsChecking.
Plus several refactorings and additions.
1) Module vals now have Final and Stable flags set
2) All logic around isVolatile is now in TypeOps; some of it was moved from Types.
3) Added stability checking to Select and SelectFromType typings.
Todo: We should find a better name for isVolatile. Maybe define the negation instead under the name
"isRealizable"?.
|
|/
|
|
|
|
|
|
|
| |
1) New method compileFiles which allows one to compile the content of a directory one file or directory
after another.
2) max constraint is printed to typr.
Added new test pos_all. Other pos tests can be retired.
|
|
|
|
| |
Common code between tpd and Typer has been factored out into class TypeAssigner.
|
|
|
|
|
| |
TypeAssigners assign a toplevel type to a node. They are mixed into Typer, and can be accessed from tpd using
ctx.typeAssigner.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Goal is better modularization and avoiding code duplication and divergence between Typer and tpd. As a first step, we split Inferencing into Inferencing, Checking, and ProtoTypes. Inferencing and Checking become Typer traits, while ProtoTypes remains a global object.
Eventually:
- we want to have a SimpleTyper, which does the main stuff in tpd, and can mixin either full checking or no checking. Each method in SimpleTyper takes an untyped tree (which is assumed to have typed arguments) and adds a toplevel type to that tree. The methods subsume the type-checking parts in Typers, except for
(1) simplifications and expansions (2) computing prototypes and recursing with them into childtrees (3) adaptation. The method calls the necessary checking operations, which may however be stubbed out.
The idea is already exercised in the typechecking code for Literal and New, except that for now it calls methods in tpd (they will become methods in SimpleTyper instead).
- Typer should inherit from SimpleTyper, and forward all logic except for (1) - (3) to it.
- tpd should call the simple typer it gets from ctx.typer
- ctx.typer should be a SimpleTyper, not a complete one.
|
| |
|
| |
|
|
|
|
| |
Overloaded TermRefs do not have an info, and consequently do not support =:=. Yet in Typer#checkNewOrShadowed we compared termrefs with =:=. This gives an exception if the termrefs are overloaded. The fix is to provide a new method isSameRef in TypeComparer which is called instead of =:= in Typer#checkNewOrShadowed.
|
|
|
|
| |
Rewrap needs to produce alternatives with signatures. Otgerwise the new denotation will simply overwrite the old because both the overloaded TermRef and the alternative will hash to the same unique TermRef.
|
| |
|
|\
| |
| | |
Get rid of SharedTree
|
| | |
|
|\ \
| | |
| | | |
Tree transformer&TreeTransform
|
| |/
| |
| |
| |
| |
| |
| |
| | |
1) using fast tracks in case node type isn't altered by Transformation;
2) using pre-computed hints(nxTransformXXX arrays) to quickly jump to next transformation interested in transforming particular Tree type;
3) using pre-computed hints(nxPrepareXXX arrays) to know which transformations are going to 'prepare' for transforming particular Tree type;
4) recomputing those hints in case some transformation changed implementation class during 'prepare';
5) TreeTransform is now responsible of calling transformFollowing on nodes created by it.
|
|\ \
| |/
|/| |
Fix of #39
|
| |
| |
| |
| |
| |
| |
| |
| | |
Two fixes:
1) Avoid the infinite recursion in checkAccessible if the accessibility check fails.
2) Make accessibility succeed for the test, and in general if the target denotation does not have a symbol.
Added original test in pos and a negative test which makes accessibility fail.
|
|/ |
|
|\
| |
| | |
Typos, better assertions, dead code
|
| |
| |
| |
| |
| | |
More verbose assertions.
Unnecessary semicolons removed.
|
| | |
|
|\ \
| |/
|/| |
Fix/#34 pathresolvers
|
| |
| |
| |
| |
| |
| |
| |
| | |
The root cause of #34 was that we took a type argument which was an existential type. These are returned as type bounds, which make no sense in the calling context. To avoid that problem in the future, `typeArgs`
got renamed to `argInfos`, so it is clear we get an info, not necessarily a value type. There are
also added method `argTypes`, `argTypesLo`, `argTypesHi`, which return a type, but either throw an exception or return a lower/upper approximation of the argument is an existential type.
There's another issue that the existential type only arose when compiling the same couple fo files the seciond time. We need to chase that one down separately.
|
|\ \
| |/
|/|
| | |
Infrastructure for per-phase tests, with inline source as a string.
|
| | |
|