aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Make type creators work for erased types.Martin Odersky2014-08-2410-44/+121
| | | | | | | | - Some types are different when erased (e.g. prefixes are NoPrefix) - Some types are forbidden when erased. Put in assertions to check that fact. Also, some renaming and doc comments to make creation of TermRefs and TypeRefs clearer.
* renaming: core.transform.Erasure -> core.TypeErasureMartin Odersky2014-08-248-29/+49
| | | | | | | The name duplications transform.Erasure / core.transform.Erasure caused irregularities in the imports and the smae name was confusing. Besides Erasure was the only class in core.transform, so it seemed better to eliminate the package alltogether.
* Comments about phase orderings and shadowed references.Martin Odersky2014-08-242-1/+49
| | | | ... try to explain two tricky consequences of the denotation and signature model.
* Fix signature of by-name parameters.Martin Odersky2014-08-202-2/+6
|
* Make-not privateMartin Odersky2014-08-194-29/+55
| | | | | Refchecks now makes all members not-private that need it. This is done by setting flag NotJavaPrivate. No name change is involved.
* Fixed class doc comment for ElimByNameMartin Odersky2014-08-191-14/+4
|
* Changed phase dependencies from names to classes.Martin Odersky2014-08-186-25/+46
| | | | Don't want stringly types for this.
* Rename in Phase: name -> phaseNameMartin Odersky2014-08-1822-40/+40
| | | | | Most transformations are subclasses of phase. Having a generic name like `name` in scope everywhere is therefore very risky.
* Refactored TreeTypeMapMartin Odersky2014-08-187-158/+155
| | | | Goes into a separate source files. Several simplifying refactorings.
* Make ElimByName change owners of by-name parametersMartin Odersky2014-08-182-4/+7
| | | | | | | | | By-name parameters did not have their owner changed before. This was not noticed in treecheck because the method generated for the closure did not have its Method flag set by accident, so owmer checking ignored the new val. Once the Methgod flag was set, owner checking failed. Once changeOwner was added, a whole lot of other things failed, which led to the fixes in the previous commits.
* Fixes to TreeTypeMapMartin Odersky2014-08-184-39/+88
| | | | | | | | | (1) Template nodes have to be treated specially. They contain primary constructors, self definitions and local dummys, all of which have to be properly mapped and re-integrated. (2) Symbol substitutions have ot be done all together instead of one after the other. (3) When creating new symbols, need to create ClassSymbols for ClassSymbols.
* Fixed re-tpying of Return nodes.Martin Odersky2014-08-181-14/+17
| | | | | Need to honor `from` if it exists, instead of searching for enclosing method. Code motion might move the code under a different method.
* Extend owner checking in TreeCheckerMartin Odersky2014-08-181-7/+17
| | | | Now also checks owners of primary constructors and template local dummys.
* Fixing handling of self in DeepTypeMap#mapClassInfoMartin Odersky2014-08-181-5/+5
| | | | | | The previous version used `self` which referred to the `val` in the implicit TypeOps value class (duh!). We really should make value classes not require to have public fields.
* Make local dummy a non-member type.Martin Odersky2014-08-182-3/+3
| | | | Local dummys in templates are not members of their enclosing classes.
* Add pathTo method for Positioned.Martin Odersky2014-08-181-1/+27
| | | | This is not yet needed but will probably come in handy later.
* Fix to isAnonymousClassMartin Odersky2014-08-181-1/+1
|
* Three fixes to substSymMartin Odersky2014-08-181-1/+15
| | | | | | (1) Also handle This types - we need to be able to substitute the class symbol there. (2) Keep NonMemberSym property when substituting (3) In p.T, substitute in `p` even if `T` is replaced by substitution.
* Add #ids for This trees and ClassDefsMartin Odersky2014-08-181-2/+6
| | | | if uniqid is set, print them with their unique ids.
* Moved -Ycheck to last phase before erasureMartin Odersky2014-08-171-2/+1
| | | | | This should set the foundation to turn debug erasure so that it can be turned on by default
* Split Nullarify functionality to ElimByName, ErasureMartin Odersky2014-08-1715-210/+203
| | | | | | | | | | | | | New phase ElimByName elimintaes by-name parameters. All other occurrences of parameterless methods and ExprTypes are eliminated in erasure. The reason for the split like this is that it is very hard for Nullarify to determine when to insert ()'s. The logic for this is fragile because we need to look at previous denotations which might not exist (before splitter) or might result from a merge between parameterless and nullary methods. In Erasure the same is much simpler to achieve.
* Disabling adapt in TreeCheckerMartin Odersky2014-08-173-14/+22
| | | | | | | | well-typed code should not need further adapations. That's why `adapt` is replaced by a subtype assertion in TreeChecker. Flushed out two instances where typechecking did not produce well-adapted trees - one in typedClosure, the other manifested itself in typedSuper.
* Moved -Ycheck after SplitterMartin Odersky2014-08-161-11/+6
| | | | | | | This required a change in Ycheck where we now only test that the new tree has a subtype of the old one. Previously the requirement was "same type" but this caused "sigs.scala" to fail because a new tree had a constant Int type where the old tree had just Int as the type. It's hard to guard against these narrowings and they look harmless.
* Roll Uncurry into ErasureMartin Odersky2014-08-164-58/+31
| | | | | | | | | | | Making cpy recompute types uncovered errors in uncurry. In a nutshell, the intermediate Apply nodes of a curried function were ill-typed, which caused errors produced by TypeAssigner. These nodes were eliminated down the road, but the errors are already issued. I did not find a good way to treat uncurry as a treetransform. Since it is rather trivial, it did not seem warranted to make it a full transformer either. So in the end the uncurry functionality became part of erasure.
* Extend retyping to more copy methods.Martin Odersky2014-08-154-27/+76
| | | | | | | | We now retype basically everything except leave nodes and definitions. This provides for more robust tree copying and transformation. It also flushed out errors in SuperAccessors (fixed by a hack, awaiting systematic phase change there) and UnCurryTreeTransform. Uncurry is disabled for now, will be fixed shortly.
* Add hook for phase when a TreeTransform is run.Martin Odersky2014-08-151-33/+35
| | | | | | Achieved by overridanle method treeTransformPhase in TreeTransform. This is currently by default the current phase. We should migrate it to the one after current phase.
* Delete propagateType and RetypingTreeMapMartin Odersky2014-08-152-129/+10
| | | | Their functionality is now rolled into TypedTreeCopier.
* Make typed tree copiers selectively retype nodes.Martin Odersky2014-08-153-15/+102
| | | | | | Those nodes that had so far a propagateType method defined on them are automatically retyped on copying. No more manual interventions are needed.
* Drop commented out code.Martin Odersky2014-08-131-35/+0
|
* Restrict treee copiers with default arguments to trees with more than 2 ↵Martin Odersky2014-08-135-46/+46
| | | | | | | elements. It's not really an abbreviation to do it for trees with fewer elements and it leads to unncessessary syntactic variation.
* Switched to new cpy scheme.Martin Odersky2014-08-1310-44/+45
| | | | Avoid mentioning arguments that are unchanged.
* Changes to tree copyingMartin Odersky2014-08-1322-324/+378
| | | | | | | | 1) Add copiers with default arguments, to avoid boilerplate 2) All copiers are now curried wrt first argument (which is the original tree). We already make use of the new features in cpy.DefDef, but not yet elsewhere.
* Fix and enable RefChecksMartin Odersky2014-08-132-11/+26
| | | | RefChecks is now enabled. Some of the tests had to be fixed to be refchecks-correct.
* Change access boundary of protected[this]Martin Odersky2014-08-131-1/+1
| | | | Should be `base`, was the class enclosing the definition.
* Erasure should copy denotations only if they are changed.Martin Odersky2014-08-131-6/+11
|
* Package denotations are never transformedMartin Odersky2014-08-134-9/+19
| | | | | | | | | | | | Packages should always have a single denotation, which is invariant for all transformations. Package members should always be entered in the first phase, and should never be entered after a given phase. This reflects the fact that package members correspond to classfiles. Once you create a classfile, it stays around and is available from the start of the next run. Also, we need to prevent multiple denotation versions of packages from hanging on to stale symbols. It would not be enough to replace a package member by a newly compiled one; if packages had multiple denotations we'd have to do this for all of them.
* mergeDenot should prefer concerete over deferred.Martin Odersky2014-08-121-3/+6
| | | | | | Previously it did this only sometimes. Now it always prefers concrete over deferred unless the deferred info is a proper subtype of the concrete info.
* Add matchesLooselyMartin Odersky2014-08-122-1/+11
| | | | | For overriding checks we need a concept where a val can match a def. Normal matches does not provide this.
* Two fixes in desugarMartin Odersky2014-08-121-2/+4
| | | | | | | (1) set position of companion object def (2) companions of case classes taking multiple parameter lists do not inherit from a function type (reason: we can't straightforwardly converyt a curried method with multiple parameter lists to a function value).
* Fix a problem due to different type inferenceMartin Odersky2014-08-121-2/+6
|
* Use _1 intstead of get for accessing unary case class parametersMartin Odersky2014-08-111-3/+1
| | | | | Now that caes classes always inherit from ProductX, we can avoid the special case. (We need to define _1 anyway to implement Product1).
* Avoid printing expanded namesMartin Odersky2014-08-111-1/+1
| | | | If a TypeRef with an expanded name is an alias type, print the alias instead.
* Add SyntheticMethods miniphaseMartin Odersky2014-08-114-2/+182
| | | | | New phase for Synthetic Method generation. Scala 2.x did it in Typer, but it's cleaner to do it in a separate phase.
* Sperate matchingDecl and mathingMember.Martin Odersky2014-08-112-15/+24
| | | | RefChecks needs both methods.
* New methods in DefinitionsMartin Odersky2014-08-112-5/+17
| | | | | Also renamed Boolean_and/or to _&&/||, to make it conform to naming convention for other Definition operators.
* Added some more methods as infix tree operations:Martin Odersky2014-08-114-13/+19
| | | | | | asInstance/isInstance/ensureConforms/and/or. They replace some former "mk..." methods.
* Add CaseAccessor flag for case accessorsMartin Odersky2014-08-112-2/+3
| | | | Was missing before.
* Fix Object's scope after ersureMartin Odersky2014-08-111-10/+22
| | | | | | After erasure, former Any members become Object members. Also, fixed some typos and added some TODOs on addBridges.
* Add Product{1,2} supertrait to case classesMartin Odersky2014-08-103-3/+27
| | | | | | | | Case classes with arity <= 1 now also get a ProductN parent trait. This is necessary because we inherit productArity and Element methods in case classes from the ProdictN trait. Needed to add Product0 for this, which is not defined in Scala2.x.
* More targeted eta-liftingMartin Odersky2014-08-104-14/+19
| | | | | | | | Eta-lifting picked some arbitrary base type. It turned out that i94-nada failed once we add a product trait to case classes (in the next commit) because Eta-Kifting picked Product as the base type, even though the target type was bounded by Monad. We now change the scheme so that the target type is included in the lifting, in order to avoid that we lift to useless types.