| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
A transformer that provides a convenient way to create
companion objects.
|
|/
|
|
|
|
|
| |
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
|
|\
| |
| | |
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.
|
| |
|
|\
| |
| | |
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.
|
|/
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
For some tests context is required, it should be passed to checker phase.
|
| | |
|
|\ \
| |/
|/| |
Fix/#34 pathresolvers
|
| |
| |
| |
| | |
Right now this one fails.
|
|\ \
| |/
|/|
| | |
Infrastructure for per-phase tests, with inline source as a string.
|
| | |
|
| |
| |
| |
| | |
We need to use Object as parent then, but this was forgotten.
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
| |
Template parents always were constructor calls before. This is not correct because in a situation like the one
elaborated in templateParents, the trait D has the class C as supertype, but it does not call its constructor (in fact, if we added a () parameter list to make it into a constructor this would be wrong because C takes parameters.
Now parents can be either types or constructor calls.
The logic in Namer and Typer that deals with parents is cleaned up. In particular, we now construct any synthetic class parent as a full type, before calling normalizeToClassRefs. This obviates the forwardRefs logic that needed to be done in a cleanup of Namers.
Also added two more checks: (1) All parents except the first one must point to traits. (2) A trait may not call a parent class constructor.
|
| |
|
|
|
|
| |
blacklisted file.
|
|
|
|
|
| |
And silence some of the error messages we print so the build log
doesn't go above 4MB (Travis' limit)
|
| |
|
|\ |
|
| |
| |
| |
| | |
File name issues
|
| | |
|
| | |
|