aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Rename methods on FreshContext to make mutation obviousDmitry Petrashko2014-03-2719-88/+88
| | | | And avoid name clashes
* Fix Denotations#currentMartin Odersky2014-03-272-20/+35
| | | | | | | | | | | The logic for dealing with periods in denotation histories did not correctly take into account the case where the current validity period of a denotation ends some phases before the next type transformer starts. And there was an off-by-one error in startPid. And Types#computeDenot erroneously tried to reload denotations even the run did not change.
* Fix context.withPhaseMartin Odersky2014-03-275-9/+9
| | | | | | Previous version was wrong because every context is a fresh context at runtime, so the overriding version would always be executed, which means that withPhase becomes a side-effecting operation!
* Changes to how we compute type parametersMartin Odersky2014-03-271-2/+6
| | | | | | | | | Aim: Avoid expensive scanning of definitions in denotations other than the initial one. Technique: 1. If phase is erased, type params is Nil (except for Array class) 2. Otherwise, type params is the same as it was in initial phase.
* Reworked phases.Martin Odersky2014-03-271-40/+68
| | | | | | | | | | | | | | | Aims 1) next/prev should be context-independent. Phase now stores its ContextBase in a field. 2) More robust handling of phaseNamed and the phase properties erasedTypes, flattened, refchecked, etc. These were previously dependent on when the first call to any of these methods was made, which led to a data race. There is now an init method in phases which centralizes all necessary intialization. It is checked that a phase is initialized only once.
* Merge pull request #89 from dotty-staging/fix/transform-contextsDmitry Petrashko2014-03-242-3/+8
|\ | | | | | | Fix phase of context for denotation transformer
| * Fix phase of context for denotation transformerMartin Odersky2014-03-242-3/+7
| | | | | | | | The phase is now always the phase on which the denotation transformer is defined.
* | Merge pull request #86 from dotty-staging/fixesSébastien Doeraene2014-03-24140-143/+316
|\ \ | | | | | | Fixes for various txxxx tickets
| * | Fix of Fix of t1236: higher-kindedMartin Odersky2014-03-213-12/+18
| | | | | | | | | | | | | | | | | | Fix of d6df293d2120f2247198cb6646a23c338f7dcbbf. It turned out the original commit was faulty in that iterator.flatten did not typecheck. The problem is fixed in this commit and flatten is added to the collections test.
| * | Fix of t1272: overloading resolutionMartin Odersky2014-03-212-3/+9
| | | | | | | | | | | | stripImplicits needs to take polytypes into account.
| * | Reverting decision what constitutes a double def.Martin Odersky2014-03-214-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Fix of t1279a: baseTypeWithArgsMartin Odersky2014-03-212-5/+25
| | | | | | | | | | | | | | | baseTypeWithArgs now also keeps track of refinements in the subtypes. Without that, the approximated lub in t1279a is too coarse and the program fails to typecheck.
| * | Refactored lookupRefinedMartin Odersky2014-03-212-10/+10
| | | | | | | | | | | | Turned parameter into receiver (reciever was not used before at all).
| * | More tests, currently disabledMartin Odersky2014-03-2132-0/+0
| | | | | | | | | | | | Mostly Java interop tests which are not yet supported. The test infrastructure for Java ocmpilation and the java parser from Scala are still missing.
| * | Fix of t1236: higher-kindedMartin Odersky2014-03-2110-39/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (and also of t0625, which reappeared). Several fixes were made. In summary: 1. Naming and representation of KigherKinded traits changed. It's now $HigherKinded$NIP where the letters after the second $ indicate variance (N)egative, (I)nvariant, (P)ositive. The HKtraits themselves are always non-variant in their parameters. 2. When deriving refined types over higher-kinded types, the variance of a type alias is the variance of the new type constructor. 3. isSubTypeHK was changed, as was the position from where it is called. 4. appliedTo also works for PolyTypes.
| * | Fix of t1280 - type of selfMartin Odersky2014-03-212-1/+1
| | | | | | | | | | | | | | | | | | The type of self name "x" was taken to be the thisType of the current owner. But the current owner was a local dummy of the class in question, so the ThisType was NoPrefix. Inserting an enclosingClass fixes the problem.
| * | Fix for t1292 - legal prefixesMartin Odersky2014-03-214-5/+60
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | More testsMartin Odersky2014-03-2147-20/+25
| | |
| * | Fix of t1123 - Unit discardingMartin Odersky2014-03-212-2/+4
| | | | | | | | | | | | Need to do unit discarding also in selection prototypes.
| * | Fix of t112606A - path dependent typesMartin Odersky2014-03-212-1/+14
| | | | | | | | | | | | Needed an extra case in isSubType.
| * | Fix of t1056 - PartialFunctionMartin Odersky2014-03-212-2/+4
| | | | | | | | | | | | type T was not recorgnized as a SAM type because a case was missing in zeroParamClass.
| * | Fix of t0625 - compare method typesMartin Odersky2014-03-212-2/+6
| | | | | | | | | | | | | | | | | | Method type comparison via <:< yielded false if the signatures of the two method types differed. This is too strict, because methods can have the same parametyers but different result types and still be in a subtype relationship. We now onyl demand that the sighatures have the same parameters.
| * | More testsMartin Odersky2014-03-2112-26/+8
| | | | | | | | | | | | which all pass.
| * | Fix of t0774: empty fileMartin Odersky2014-03-215-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Was previously wrapped in a package <empty> but the resulting tree had no position, which caused a Typer assertion. If now represented as EmptyTree.
| * | Fix of t0786: view boundsMartin Odersky2014-03-212-4/+4
| | | | | | | | | | | | | | | | | | | | | Previously, only implicit method types were eligible as views. This is too strict, as it rules out view bounds. We now also consider types that derive from Function1. The reason for not allowing any type is that this would cause us to check many more types for applicability when an implicit view is searched.
| * | More testsMartin Odersky2014-03-2115-5/+47
| | | | | | | | | | | | | | | | | | 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.
| * | Fix of t0591: implicitlyMartin Odersky2014-03-212-6/+1
| | | | | | | | | | | | A debug assertion in implicitSearch gave a false alarm and was removed.
| * | Fix of t0504: _root_ not foundMartin Odersky2014-03-212-2/+15
| | | | | | | | | | | | _root_ is now entered into an enclosing context.
| * | Fix of t0438 - lambdas and eta expansionMartin Odersky2014-03-217-45/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two fixes were needed 1) When typing a function value (x1: T1, ..., xN: Tn) => e, don't unconditionally issue an error if the expected function type arity is different from N. Instead, issue an error only if one of the types T1, ..., Tn is absent. The idea is that only then we need to consult the expected type for the parameter type. This allows to fix the problem later by an implicit conversion applied to the function value. 2) When eta-expanding, do not automtically take the arity of the expected function value as the arity of the generated lambda. Instead, take the method's arity, and copy method parameters into the lambda in case the arities are different.
| * | Tests t01xx and t02xxMartin Odersky2014-03-2111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #90 from samuelgruetter/java8-classfilesodersky2014-03-223-5/+29
|\ \ \ | |/ / |/| | ClassfileParser: Java8 bytecode (fixes #83)
| * | ClassfileParser: apply scala commit e78896f (invokedynamic)Samuel Gruetter2014-03-212-2/+9
| | |
| * | ClassfileParser: apply scala commit b2c67b3 (java8 default methods)Samuel Gruetter2014-03-212-0/+10
| | |
| * | ClassfileParser: apply scala commit f91242c6959471b6c463538beSamuel Gruetter2014-03-211-3/+10
| | |
* | | Merge pull request #87 from gzm0/context-in-prep-transformDmitry Petrashko2014-03-211-65/+65
|\ \ \ | |/ / |/| | Make context available in TreeTransform.prepareForXX methods
| * | Make context available in TreeTransform.prepareForXX methodsTobias Schlatter2014-03-201-65/+65
| |/
* | Merge pull request #88 from dotty-staging/try/hygienic-desugaringodersky2014-03-2133-56/+458
|\ \ | |/ |/| Try/hygienic desugaring
| * Minor improvements to tests (remove old comments)Tobias Schlatter2014-03-207-22/+7
| |
| * Hygienic desugaringMartin Odersky2014-03-2032-77/+447
| | | | | | | | | | | | | | | | | | | | | | | | 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).
| * Generalize derived type tree scheme.Martin Odersky2014-03-203-34/+25
| | | | | | | | | | | | To get truly hygienic desugared trees, we need a derived type tree scheme that's more flexible than just the previous two choices of info-of-symbol and typeref-of-symbol. The new scheme based on DerivedTypeTrees allows arbitrary methods to derive the type tree's type.
| * 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