aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Refine "&" for denotations.Martin Odersky2015-06-021-9/+45
| | | | | | | | | The policy is now made clear in a doc comment. The new part is that we will prefer a symbol defined in a subclass over a symbol defined in a superclass. With the previous commit 0a0d3dd1 on "More precise and uniform modelling of isCurrent" we got runtime test failures for Course-2002-03.scala because the new definition isCurrent assumed a behavior of `member` which was not assured: Namely that the merged denotation would prefer symbols in subclasses over symbols in superclasses.
* More precise and uniform modelling of "isCurrent"Martin Odersky2015-06-012-8/+5
| | | | | | | | For implemented getters and forwarded methods we need a notion of "isCurrent", which means: would the getter or method before the implementation is added be a member of the implementing class? Only in this case do we need to do anything. The method formulation was previously weaker than the getter formulation, which led to an error when compiling core (duplicate methods: andThen and size).
* Avoid generating trait setters for constants.Martin Odersky2015-06-011-1/+2
| | | | Scalac does not generate them either.
* Uncomment important test for Scala trait forwardingMartin Odersky2015-06-011-1/+1
| | | | Scala 2 doe snot generate default methods, so we always need forwarders.
* Fix missing implementation class forwardMartin Odersky2015-06-011-9/+1
| | | | | A transformFollowingDeep was missing, so LinkScala2ImplClasses never got to see the call.
* Elim ElimWildcardIdentsMartin Odersky2015-06-016-46/+12
| | | | | | Instead of cleaning up, generate sensical code in the first place. This is shorter and (I would argue) clearer, and also has the advantage that some initializing assignments are not generated at all.
* Make elimWildcardIdents apply to AssignmentsMartin Odersky2015-06-012-1/+4
| | | | | | | | Fixes junit failure in dotty where a lazy val was initialized with a "...$lazy = _" assignment. Moved ElimWiildcard to one group before. It does not really matter where it goes so it might as well go someshere in the middle of the pack.
* Improve commentsMartin Odersky2015-06-012-2/+14
|
* New phase: LinkScala2ImplClassesMartin Odersky2015-06-012-1/+59
| | | | This phase rewrites supercalls to calls to static implementation class methods.
* Make memberSignature work after erasure.Martin Odersky2015-06-011-3/+9
| | | | Erasure uncurries arguments, need to track that in memberSignature.
* New phase: AugmentScala2TraitsMartin Odersky2015-06-014-4/+103
|
* Avoid referring to initial$x methods when implementing Scala2 traitsMartin Odersky2015-06-011-6/+11
| | | | | They don't exist for Scala2 traits. Instead we let the initializer be `_' and rely on trait setters (to be implemented) to initialize the field.
* New utility method tpd.UnderscoreMartin Odersky2015-06-015-5/+7
| | | | A typed `_'. This is needed in a few places.
* Make ensureMethodic work after erasure.Martin Odersky2015-06-012-2/+2
| | | | | Previously it didn't, because it created an ExprType, which is illegal after erasure.
* Use $init$ as the name of trait constructorsMartin Odersky2015-06-011-1/+1
| | | | This brings it in line with Scala2 conventions.
* Move needsForwarder logic from ResolveSuper to MixinOps.Martin Odersky2015-06-012-8/+13
| | | | We'd like to make it reusable for a phase that treats Scala2 traits.
* New NameOps methods for Scala2 traitsMartin Odersky2015-06-013-4/+12
| | | | Also: generalize expandedName so that it can cater for trait setters.
* Make Mutable a ModifierFlag.Martin Odersky2015-06-012-2/+8
| | | | | | It definitely does appear in trees, so should be included in the set. Affects how things are printed. Before, typed var's would still show up as vals.
* Merge postConditions of memoize and constructorsMartin Odersky2015-06-012-11/+9
| | | | | | | If memoize and constructors are run in different groups, memoize's previous postcondition "all concerete methods are implemented" is wrong, because constructors are not implemengted yet. Solved by moving the postcondition to phase Constructors.
* Add missing string interpolator prefix in some AST nodes' toStringGuillaume Martres2015-05-311-2/+2
|
* Merge pull request #625 from smarter/add/ast-toStringodersky2015-05-311-2/+7
|\ | | | | Trees: Add toString for AST nodes which are not case classes
| * Trees: Add toString for AST nodes which are not case classesGuillaume Martres2015-05-301-2/+7
| | | | | | | | This makes debugging trees easier.
* | Fix ElimStaticThis#transformIdentGuillaume Martres2015-05-302-4/+9
| | | | | | | | | | | | | | | | | | - Only transform static methods which are inside module classes. - Make sure that the prefix of the underlying type of the Ident is a ThisType of the current module class. For example in "scala.Int.box(42)", "box" is an Ident whose underlying type is "TermRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,scala)),Int$)),box)", but we should not trigger an assertion in this case.
* | New phase: ElimStaticThisDmitry Petrashko2015-05-292-0/+39
| |
* | Eliminate `_' from rhs of ValDefsMartin Odersky2015-05-294-35/+22
| | | | | | | | Previously was only done for DefDefs. Caused backend failure.
* | Revert "Fix #580: use isContainedIn to support cases where the enclosing ↵Martin Odersky2015-05-291-1/+1
| | | | | | | | | | | | class is also the top-level class" This reverts commit 6898d2c296326779d373ef0e0b84e4451550120a.
* | Fix compilation failure by refining adaptation of constantsMartin Odersky2015-05-291-1/+13
|/ | | | | | | | | Constants that are adapted to a different supertype need to do this explicitly (not just by changing the type). Otherwise tree checkers will compute the original type and fail. This caused a test failure in pos/harmonize. The mystery is why this was not caught in the checkin tests.
* Merge pull request #611 from dotty-staging/supercalls-traits-testDmitry Petrashko2015-05-284-8/+14
|\ | | | | Add a test for supercalls in traits.
| * Refine definition of isCurrentMartin Odersky2015-05-281-2/+3
| | | | | | | | Fixes problem with run/t261.scala.
| * Extended test case.Martin Odersky2015-05-271-2/+2
| | | | | | | | Also added non-unit fields and a class that directly implements two traits with the same fields.
| * Mixin: generate a getter in implementing class only if currentMartin Odersky2015-05-272-4/+9
| | | | | | | | | | | | A class might implement several fields in inherited traits with the same and type. In that case only one getter should be produced, but all initializing expressions have to be executed.
| * Fix bug in typer erasure's transformInfoMartin Odersky2015-05-271-1/+1
| | | | | | | | ()Unit translates to ()BoxedUnit not BoxedUnit.
* | ParamForwarding: do not require param accessors to be private[this]Guillaume Martres2015-05-281-2/+2
| | | | | | | | | | | | | | | | | | | | Also mark the forwarder as Stable otherwise we get a RefChecks error. This fixes #608. Note that we do less parameter forwarding than scalac. See for example D and Y in tests/run/paramForwarding.scala which don't get their own local fields in scalac but do in dotty.
* | Improve doc commentsMartin Odersky2015-05-272-1/+7
| |
* | Introduce harmonization of numeric argumentsMartin Odersky2015-05-272-15/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Harmonization is Dotty's alternative to Scala 2's notion of weak conformance. It is less powerful but also less entangled with the core type system. The idea is that in some specific contexts trees that all have primitive numeric types will be converted as necessary so that they all have the same numeric type. These tree sets are: - the two branches of an if - the alternatives of a match - the body together with the catch blocks of a try - the arguments of a vararg parameter Examples are in the test file, harmonize.scala.
* | Add harmonization method for harmonizing numeric types.Martin Odersky2015-05-273-1/+25
|/
* Make ClassfileConstants thread-safe.Martin Odersky2015-05-262-34/+29
|
* Merge pull request #585 from dotty-staging/fix/collection-relatedodersky2015-05-2520-111/+298
|\ | | | | Improvements to higher-kinded types
| * Calibrate findMember logging thresholds and test caseMartin Odersky2015-05-211-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | Adds IterableSelfRec.scala which caused lockup of the compiler. After a lot of work the problem was determined to be polyomial or exponential behavior of the compiler when executing findMember on refined types that contain several bindings where the resutling & causes a recursive invokation of findMember with the same name. We do have a stop for this now, but if the stop comes too late the runtime will grow very fast. Problem addressed by kiccking in earlier with the stopping logic.
| * Move findMember count tracking from TypeComparer to ContextMartin Odersky2015-05-213-11/+17
| | | | | | | | | | Typecomparer is not a good place because it gets re-generated for new context, which causes the counts to be reset.
| * Rename Reporter#echo -> printlnMartin Odersky2015-05-214-17/+17
| | | | | | | | | | More refular that way. Also, change some raw printlns in low-level code to reporter.printlns in order to harden them against prints over prints.
| * Harden display logicMartin Odersky2015-05-213-3/+12
| | | | | | | | | | Displaying stuff should never report an exception or cause more messages to be displayed that relate to the displaying.
| * Avoid cycle between findMember and &Martin Odersky2015-05-212-15/+33
| | | | | | | | | | | | | | | | | | | | | | As test case IterableDotty shows, there can be a cycle findMember --> & --> <:< --> hasMatchingMember --> findMember which leads to an infinite recursion. This commit avoids this by keeping track of names of outstanding findMember searches and falling back to forming AndTypes instead of `&' is we repeat a findMember search on a name seen before after a certain recursion depth.
| * Add equals and hashcode to LazyRefMartin Odersky2015-05-211-0/+5
| |
| * Show LazyRefs nicelyMartin Odersky2015-05-211-0/+2
| | | | | | | | Previously, this fell back to toString
| * Move threshold values to ConfigMartin Odersky2015-05-215-24/+29
| | | | | | | | It's a more logical home for them than the Context object.
| * Implement type beta reduction in lookupRefinedMartin Odersky2015-05-211-14/+44
| | | | | | | | lookupRefined now reduces fully instantiated lambdas.
| * Generaize canWiden to classBoundsMartin Odersky2015-05-212-11/+16
| | | | | | | | | | This gives us a cheap way to bound the search of all baseclasses in testLifted.
| * Rename for clarityMartin Odersky2015-05-211-4/+4
| |
| * Fix DenotationNotDefinedHere in pattern matcherMartin Odersky2015-05-213-3/+5
| | | | | | | | | | This was uncovered by previous commit "Fix isSubType bug ...". Also removed two redundants ".fresh" calls in "fresh.addMode".