aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* New scheme for TypeTrees that refer to othersMartin Odersky2014-03-204-12/+68
| | | | | Adds a new scheme by which a TypeTree() can refer for its type to the symbol of some other type. Applies the scheme to setter parameters, replacing the previous ad-hoc solution.
* Better diagnostics for failing stub count testsMartin Odersky2014-03-201-1/+1
|
* Merge pull request #85 from dotty-staging/topic/language-featuresDmitry Petrashko2014-03-2021-42/+384
|\ | | | | Topic/language features
| * Removed annotations forced by union typesMartin Odersky2014-03-202-4/+6
| | | | | | | | | | Removed annotations from the dotty codebase that were necessary because the inferred union types caused inference errors later on.
| * Appromiximate union types by intersections.Martin Odersky2014-03-205-2/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Merge refined types when distributing via "|".Martin Odersky2014-03-201-12/+23
| | | | | | | | | | | | | | | | Use the equality (where ~ is any form of refinement) T1 { x ~ R1 } & T2 { x ~ R2 } == T1 & T2 { x ~ R1 & R2 } We already did the same thing when distributing via "&".
| * Allow And/OrTypes in baseType operationsMartin Odersky2014-03-202-9/+31
| | | | | | | | | | | | | | Introduce new cases for AndTypes and OrTypes in methods `derivesFrom`, `baseClasses`, and `baseTypeWithArgs`. These cases are ultimately needed so that `baseTypeWithArgs` makes sense for union and intersection types. Also, fixed embarrassing typo in method `TypeBounds#|`.
| * Removed explicit tuplings from dotc codebase.Martin Odersky2014-03-206-10/+10
| | | | | | | | Eliminated all "Dotty deviations" which were due to lack of auto-tupling.
| * Added auto-tupling.Martin Odersky2014-03-209-5/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Add language feature mechanismMartin Odersky2014-03-205-1/+67
|/ | | | | | | | | | | | | | | | | | | | | | Add a method "featureEnabled" that checks whether a feature is enabled. Features can be enabled by imports or by command-line options. The Scala 2.10 way of enabling features by implicits got dropped, because the use of the feature mechanism is now different. Previously, features imposed restrictions on what used to work. So it was important to offer way to avoid the restrictions it that was as smooth as possible, and implicits fit the bill. Furthermore, features did not change the way things were compiled, so it was OK to test them only once all types were compiled. Now, features are essentially switches that change compile time behavior. keepUnions and noAutoTupling, if on, will modify the way type inference works. So we need to interprete a switch on the spot, and doing an implicit search to determine a switch value is too dangerous in what concerns causing cyclic references. At the same time, because we are dealing with new functionality, there is less of a concern for being able to set or reset features for large pieces of code with some implicit. You could argue that's not even desirable, and that an explicit import or command line option is preferable. Conflicts: src/dotty/tools/dotc/core/SymDenotations.scala
* Merge pull request #81 from DarkDimius/integration/lazyodersky2014-03-2032-219/+1267
|\ | | | | Allow MiniPhase to be DenotTransformer & LazyVals
| * Allow MiniPhase to be DenotTransformerDmitry Petrashko2014-03-1914-129/+278
| | | | | | | | | | | | 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.
| * LazyVals phase.Dmitry Petrashko2014-03-199-7/+864
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Re-enabled and renamed testsMartin Odersky2014-03-182-4/+4
| | | | | | | | | | 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.
| * Refactored denotation transformersMartin Odersky2014-03-1811-92/+106
| | | | | | | | | | | | | | | | 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
| * Renaming core.Transformer(s) -> core.DenotTransformer(s)Martin Odersky2014-03-187-18/+17
| | | | | | | | To bring in line with TreeTransformer terminology.
| * Renamings TreeTransformer -> TreeMap, TreeMapper -> TreeTypeMapMartin Odersky2014-03-189-17/+13
| | | | | | | | | | | | | | 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.
| * Reorg of info transformer frameworkMartin Odersky2014-03-184-37/+70
| |
* | Merge pull request #84 from samuelgruetter/srewrite-tests-1odersky2014-03-20156-71/+71
|\ \ | | | | | | Explicit types for implicits in tests/untried
| * | move all tests in tests/untried/neg which use implicits to ↵Samuel Gruetter2014-03-19113-0/+0
| | | | | | | | | | | | tests/untried/neg-with-implicits
| * | apply srewrite (no procedure syntax for constructors) to tests/untried/negSamuel Gruetter2014-03-193-6/+6
| | |
| * | apply srewrite (explicit types for implicits + no procedure syntaxSamuel Gruetter2014-03-1940-65/+65
|/ / | | | | | | for constructors) to tests/untried/pos
* | Merge pull request #79 from DarkDimius/noxmlodersky2014-03-198-45/+196
|\ \ | |/ |/| Remove dependency on scala-xml.
| * Remove dependency on scala-xml.Dmitry Petrashko2014-03-188-45/+196
| | | | | | | | Mimic https://github.com/scala/scala/commit/4e9b33ab24bb3bf922c37a05a79af364b7b32b84
* | Merge pull request #76 from retronym/topic/defPath-accumodersky2014-03-173-22/+44
|\ \ | |/ |/| Test and refactor TreeInfo#defPath
| * Refactor TreeInfo#defPathJason Zaugg2014-03-161-22/+11
| | | | | | | | Uses a TreeAccumulator, rather than ad-hoc descent through `productIterator`.
| * Test case for TreeInfo#defPathJason Zaugg2014-03-162-0/+33
|/ | | | | | | | | | | 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.
* Merge pull request #69 from odersky/topic/generalize-companionsodersky2014-03-168-18/+143
|\ | | | | Bullet-proofing companion objects
| * Fixed parse error with @uncheckedMartin Odersky2014-03-131-1/+1
| | | | | | | | 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.
| * Bullet-proofing companion objectsMartin Odersky2014-03-138-18/+143
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #71 from odersky/fixes-for-transformsDmitry Petrashko2014-03-142-4/+17
|\ \ | | | | | | Fixes for transforms
| * | Reset frozen for transformed class denotations.Martin Odersky2014-03-141-2/+13
| | | | | | | | | | | | ... so that we can add new members to transformed class denotations.
| * | Stop running phases after errors were encounteredMartin Odersky2014-03-141-2/+4
| |/
* | Merge pull request #70 from odersky/fix/annotations-in-patternsodersky2014-03-145-10/+15
|\ \ | | | | | | Fixed two problems with annotated types in patterns
| * | Fixed two problems with annotated types in patternsMartin Odersky2014-03-145-10/+15
| |/ | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #65 from samuelgruetter/scala-tests-rawodersky2014-03-133539-0/+49725
|\ \ | | | | | | Add untried tests from scala/test/files/{pos,neg}
| * | add tests from scala/test/files/{pos,neg}Samuel Gruetter2014-03-123539-0/+49725
| | | | | | | | | | | | with explicit Unit return type
* | | Merge pull request #64 from DarkDimius/PostTyperTransformerSébastien Doeraene2014-03-1310-46/+421
|\ \ \ | |/ / |/| | Post typer transformer
| * | CreateCompanionObjects transformerDmitry Petrashko2014-03-132-0/+170
| | | | | | | | | | | | | | | A transformer that provides a convenient way to create companion objects.
| * | TreeTransform: add support for transforming statsDmitry Petrashko2014-03-131-37/+54
| | | | | | | | | | | | | | | | | | Added a prepareForStats&transformStats pair of methods, which provide a convinient way to alter scopes of PackageDefs, Templates and Block's.
| * | PostTyper transformersDmitry Petrashko2014-03-133-1/+181
| | | | | | | | | | | | | | | | | | | | | 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 for #55Martin Odersky2014-03-122-2/+6
| | | | | | | | | | | | | | | Distringuish between ModifierFlags -- which can appear in trees -- and SourceModifierFlags -- which are modifiers according to the language spec.
| * | Fix of #56 - newModuleSymbol & newCompleteModuleSymbolMartin Odersky2014-03-122-6/+10
| |/ | | | | | | | | 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.
* | Merge pull request #63 from odersky/implicit-testodersky2014-03-121-2/+10
|\ \ | |/ |/| Added test for implicits which fail in Scala 2.11.
| * Added test for implicits which fail in Scala 2.11.Martin Odersky2014-03-121-2/+10
|/ | | | Mentioned in scala-user by Haoyi Li on 12-Mar-2014
* Merge pull request #61 from odersky/fixes-t00xxodersky2014-03-128-10/+45
|\ | | | | Fixes t00xx
| * Fix constructor completion problem detected in t0054Martin Odersky2014-03-124-7/+20
| | | | | | | | | | | | | | | | | | 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.
| * Fix problems related to t0039Martin Odersky2014-03-106-8/+24
| | | | | | | | | | | | | | | | | | | | | | 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.
| * Fix for t1002Martin Odersky2014-03-102-1/+7
| | | | | | | | | | 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.
* | Merge pull request #60 from odersky/fix/#50-volatileodersky2014-03-1210-70/+113
|\ \ | |/ |/| Fix/#50 volatile