aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fixed typoMartin Odersky2014-07-221-1/+1
|
* Defined substitution which follows aliasesMartin Odersky2014-07-223-8/+49
| | | | | Used in FullParameterization to substitute type parameters. Fixes test failure for t2399.scala
* Make trees after TailRec type correctDmitry Petrashko2014-07-221-90/+73
| | | | | | | | | TailRec now relies on FullParameterization and uses two passes for transformation. First one decides weather the method will be transformed and if yes, starts rewriting calls in taill position. Second one lifts the method body to a fully parameterized one, correcting types.
* Fix typo in lazyValsDmitry Petrashko2014-07-221-1/+1
|
* Create RetypingTreeMap that propagates typesDmitry Petrashko2014-07-223-30/+154
| | | | | | | | | | If some node in tree is transformed changing the type, the outer node could potentially also change type. This patch implements a RetypingTreeMap that propagates those changes until types converge. Propagation is done for tree nodes that are able to compute their type based on their children: Pair, Block, If, Match, CaseDef, Try, SeqLiteral, Annotated, Select.
* Allow FullParametrization to work on localy defined methodsDmitry Petrashko2014-07-221-3/+3
|
* Merge pull request #152 from dotty-staging/fux/substThisDmitry Petrashko2014-07-212-2/+6
|\ | | | | Fix of FullParameterization
| * Fix of FullParameterizationMartin Odersky2014-07-212-2/+6
| | | | | | | | Avoid substitituting A.this if A is a globally accesisble mdoule.
* | Merge pull request #149 from dotty-staging/fix/#148Nada Amin2014-07-201-1/+1
|\ \ | | | | | | fix/#148
| * | fix/148Martin Odersky2014-07-201-1/+1
| |/ | | | | | | Fixed typo in Splitter. Closes #148.
* / Fixed #143Martin Odersky2014-07-191-4/+6
|/ | | | | The problem was that TermRefWithSignatures did not take shadowed names into account when reconstituting themselves under a new prefix.
* Made FullParameterization more customizableMartin Odersky2014-07-171-5/+15
| | | | Can now decide on rewiring on a node-by-nide basis.
* Handle selftypes in FullParameterizationMartin Odersky2014-07-171-9/+9
| | | | Adapt the transformation so that self types are handled correctly.
* Make self types always include a reference to the classMartin Odersky2014-07-171-8/+20
| | | | | | | | | | | | In a situation like class C { this: D => } the effective self type of the class is taken to be D & C. Why? First, Scala 2.x does it that way. Second, it's needed to make the FullParameterization transform go though.
* Fixed problem with missing denotations in polyDefDefMartin Odersky2014-07-172-2/+5
| | | | Problem was reported by @darkdimius. Test case will come in next commit.
* Fix to rewire typesMartin Odersky2014-07-171-16/+53
| | | | | | | t6574 has a new test where we produce identical code in an if-then-else. This broke the rewiring logic before, and is fixed now. Also, more comments and test cases.
* Refactored reusable full parameterization code into base trait.Martin Odersky2014-07-174-144/+197
| | | | | | Methods dealing with fully parameterized versions of classes were pulled from `TypeUtils` and `ExtensionMethods` into `FullyParameterization`. `TypeUtils` is left for possible future use, but is empty right now.
* Make ExtensionMethods not rely on TailRecMartin Odersky2014-07-172-12/+54
| | | | | | | | | | | | | | This acommit allows TailRec to run after ExtensionMethods. This is due to the following changes: 1) Extension methods now "rewire" calls to other extension methods of the same class, so that they go directly to other extension methods instead of to the original method in the class. 2) Tailrec annotations get removed from original method and get added to the extension method instead. With this commit all tests can be re-enabled again.
* Fixes to ReTyperMartin Odersky2014-07-172-9/+21
| | | | | | | | 1) Disabled insertApplyOrImplicit - it leads to untyped trees which cause assertion errors down the road. In any case, neither apply methods nor implicits can be inserted when retyping. 2) Avoid copying tree annotations into symbols when retyping.
* Fixes to TreeTypeMapMartin Odersky2014-07-171-3/+13
| | | | | | 1) Avoid double transformation of a tree 2) Apply the type map to the type of the tree-mapped tree, instead of to the type of the original tree.
* Avoid forming SeqLiterals with singleton type element.Martin Odersky2014-07-171-1/+1
| | | | | Singleton types are normally widened before inferring types, yet they did show up as elements of SeqLiterals.
* Semantic printingMartin Odersky2014-07-172-9/+19
| | | | | | | | | | | When refined printing a DefTree, if one is after typer, print the symbol's definition plus the rhs of the tree rather than the contents of the tree. Why: After typer, it's always the symbol's contents that should matter. Question: Can we enforce through the types that parts of DefTree reflected by the symbol disappear/are ignored?
* Made ExtensionMethods work as an InfoTransformerMartin Odersky2014-07-171-16/+37
| | | | | | | | | | | The previous version of ExtensionMethods added extension methods manually, in the companion objetct scope, using enteredAfter. Extension methods therefore had to run before pickling, so that other modules would see the generated extension methods. This is suboptimal, for two reasons; (1) Mixin is very much like extension methods, yet it has to run after pickling. (2) The pickling info gets larger than it has to be. With this commit, extension methods are added as an InfoTransformer. So extension methods now should run after pickling.
* Fix problem with dynamicSignature.Martin Odersky2014-07-172-4/+6
| | | | | | | Pattern match needs to compare against list of names, not single name. Universal equality bites again... Also fix comment for ElimRepeated.
* Simplification: dynamicSignature instead of toDynamicMartin Odersky2014-07-172-42/+12
| | | | | When figuring out which of a number of static methods corresponds to an overloaded dynamic method, we only need to compare signatures. No need to resconstruct the full dynamic type.
* Silenced ElimRepeated.Martin Odersky2014-07-171-8/+0
| | | | Removed diagnsostics message.
* Enabled ExtensionMethodsMartin Odersky2014-07-172-22/+33
| | | | | | | | | Fixed extension methods so that it now runs and passes the build. Also enables ElimRepeated, which is a prerequistite for ExtensionMethods. Exception: Tailrec is currently disabled, because it needs to run before ExtensionMethods but it fails the -Ycheck test. Therefore the current tests skip this phase.
* Revamped TreeTypeMapMartin Odersky2014-07-171-21/+63
| | | | | | | | TreeTypeMap needs to track all binding occurrences and propagate maps to all usage occurrences. Also, fixed `ref` for prefixless types (these mapped to a SelectFromType tree before, now are mapped to Idents).
* New phase: ElimRepeatedMartin Odersky2014-07-172-0/+80
| | | | | Makes sure there are no references to RepeatedParamClass left in the types. Also added placeholder for ElimLocals, which remains to be written.
* Fixes to TypeUtilsMartin Odersky2014-07-171-1/+7
| | | | Some fixes to toStatic. Also added a method that transforms a RepeatedType to the corresponding Seq type.
* Small cleanups and additions.Martin Odersky2014-07-173-3/+11
|
* Add unique ids for definitionsMartin Odersky2014-07-171-3/+5
| | | | If -uniqid is on, RefinedPrinter now prints unique ids in definitions.
* Avoid some classes of StaleSymbol errorsMartin Odersky2014-07-172-5/+31
| | | | | | | | If a symbol is defined in phases M..N, and that symbol is then accessed in a phase before M, but in a new run, we should not issue a stale symbol error (after all, the symbol is not defined yet). Instead we now return a NoDenotation.
* Make more Definition methods depend on implicit context argumentMartin Odersky2014-07-171-5/+5
| | | | | | | | | The problem is that exploration methods are run and phase dependent, whereas Definitions has an implicit context that freezes the period when Definitions ewas created. We should complement this by splitting Definitions into a global and per/run part, but that is independent of the change in this commit.
* Fixes to MacroTransform and TreeTransformerMartin Odersky2014-07-172-4/+20
| | | | | | | 1) Make local context go to module class if the tree symbol is a package val. Perviously, this gave the wrong context owner for package definitions. 2) Add a hook to define the phase in which a transform should be run.
* Invalidate member caches in different periodsMartin Odersky2014-07-171-2/+10
| | | | | | | | | A membercache is not valid in a period different from the one it was created in. Reason: The denotations stored in the cache might have different infos in different periods. Also: add maybeOwner convenience method for printing, which handles NoDenotation/NoSymbol gracefully.
* Make TypeParamCreation flags depend on ownerMartin Odersky2014-07-176-6/+13
| | | | | | Type params should have different flags, depending on whether they are owned by a method or a class. Only class type parameters are marked Deferred, protected, and Local.
* Add definedPeriodsString method for disgnostics.Martin Odersky2014-07-171-19/+16
|
* Move valueclass functionality into its own ValueClass module.Martin Odersky2014-07-176-34/+53
|
* Fix bad type passed to indexOf.Martin Odersky2014-07-171-1/+1
| | | | This is a trap waiting to happen elsewhere as well. Not clear how to avoid it.
* Revised purity tests in TreeInfoMartin Odersky2014-07-173-29/+58
| | | | | | | | | Added two levels: pure and idempotent and fixed what look like obvious bugs. It seems the previous treatment confused the two levels. Changed EtaExpansion and Erasure to use Pure instead of Idempotent where appropriate.
* New Flag: InlineMartin Odersky2014-07-171-6/+9
| | | | | | Added now because it affects purity if expressions: Inlined pure values are pure even if referenced from impure prefixes (i.e. prefix need not be evaluated).
* New micro phase: LiteralizeMartin Odersky2014-07-172-1/+67
| | | | Convert expressions with constant types to Literals.
* Added infix methods for some tree constructionsMartin Odersky2014-07-1712-67/+85
| | | | | | | Added several forms of "select" and "appliedTo" methods which construct Select, Apply, TypeApply trees. Motivation: Infix methods allow chaining which is more legible than deep nesting.
* ExtensionMethods phase and TypeUtilsMartin Odersky2014-07-174-1/+292
| | | | | | | | | | | | New phase for extension methods. Also, split off some type handling functionality that can be used elsewhere in new TypeUtils decorator. The idea is that TypeUtils should contain methods on Type that make sense specifically for transformations. That way, we can keep Types from growing. Might make sense to do similar decorators for Denotations as well. There's a bug fix in MacroTransform: Need to treat selfInfo varDels specially, since they have no symbol.
* Various cleanups and utility additionsMartin Odersky2014-07-1711-41/+116
| | | | | | | - Some new functionality in tpd and in Symbols. - Added `sm` interpolator to print nicely. - Make use of nestedMap where possible. - Add IdentityDenotTransformer as a convencience class
* Changed PostTyperTransformer schemeMartin Odersky2014-07-177-153/+79
| | | | | | | | | | | | 1) We now always generate companion objects for classes. This is done in mini-phase "companions", which also assures that companion-modules appear after companion-classes. 2) PostTyperTransformers is gone; the part which normalizes trees has been rolled into TreeTransform and the part which reordered companion classes and modules is now in Companions. Note: Some tests were deisabled; should be re-enabled by Dmitry where needed.
* Fixed problem with installAfterMartin Odersky2014-07-171-2/+30
| | | | | | The problem is that when an installAfter completely replaces a previous denotation, a symbol or NamedType might still hang on to that denotation in the cache. We need to enforce that we switch to the new denotation. This is done by setting the replaced denotation's validFor field to Nowhere.
* Rename SignedType -> MethodicTypeMartin Odersky2014-07-174-11/+11
| | | | | ... for the common supertype of MethodType, PolyType, and ExprType. Signed was confusing.
* Added phase: SuperAccessorsMartin Odersky2014-07-1710-14/+639
| | | | | Rewrote SuperAccessors (more to be done; see comments), and added stuff here and there to make it work smoother.