aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle return in tailcalls.Martin Odersky2014-09-121-18/+22
| | | | | Avoids characterizing the "from" link in a return as a tail call reference.
* Phase name change of explicitOuter.Martin Odersky2014-09-121-3/+1
|
* Erasure should keep prefixes in TermRefsMartin Odersky2014-09-121-17/+10
| | | | | Bring TermRefs in line with TypeRefs. Prefixes need to be kept so that termrefs can be re-loaded in subsequent runs.
* tpd.TreeOps#select creates non member syms after erasure.Martin Odersky2014-09-101-1/+2
| | | | | | | | | | | | | | | | | | Without this patch, ast.TreeInfo does not compile wfter next commit "Erasure should keep prefixes in TermRefs". The reason is that outer path genertion generates a data race between - an outer accessor created in ExplicitOuter - a copy of the accessor created in ElimByName in a TreeTypeMap copy. The patch avoids the data race by using a fixed symbol for the new TermRef generated in outer.path during erasure. But the fix seems ad-hoc. We should try to attack the problem at the root in TypeTreeMap. The root problem seems to be that TypeTreeMap generates a copy of symbols whnMemere the copies of the symbols give the same named type as the originals. We can either label the copied symbols so that any types created from them become instances of WithNonMemberSym (which probably should be renamed then). Or else we have a "linear" version of TreeMap that overrides sym denotations instead of creating new symbols.
* Keep inherited names through erasureMartin Odersky2014-09-101-3/+12
| | | | | If the original name in a selection is a inherited name, the erased name should also be one.
* Make isVolatile a SymUtil method.Martin Odersky2014-09-102-2/+4
|
* Fix class decls in TypeTypeMapMartin Odersky2014-09-102-4/+23
| | | | | | If definitions in a class are substituted by TreeTypeMap, the new symbols have to show up in the `decls` scope of the class instead of the old ones.
* Keep SuperTypes around after erasure.Martin Odersky2014-09-102-4/+4
| | | | | The reason is that otherwise the non-private member super.x gets merged with the private member this.x and that causes a double binding violation.
* Fixes to TreeCheckerMartin Odersky2014-09-101-3/+3
| | | | | 1) One phase too many was checked for postconditions. 2) Class members did not have their owners checked because index was not called on them.
* Move explicit outer after pattern matchingMartin Odersky2014-09-062-2/+8
| | | | | But allow pattern matching to provide outer accessors when needed using with ensureOuterAccessors.
* Make foreach/exsists into tree infix methodsMartin Odersky2014-09-063-19/+19
| | | | | foreachSubTree and existsSubTree are now infix methods. Streamlines their use somewhat.
* Generalize phase postcondition checking.Martin Odersky2014-09-064-38/+49
| | | | | | | Have a general way how a phase can establish a postcondition which will be checked each time a later phase is tree-checked. Moves erasure constraints from TreeChecker to Erasure's post condition.
* Better tests and more fixes for ExplicitOuterMartin Odersky2014-09-064-22/+58
| | | | | | Now also testing that after erasure no outer this exists. Tests suit now includes calls to local classes and methods which need an outer pointer, as well as passing an outer pointer along a secondary constructor.
* Rename OuterAccessors to ExplicitOuterMartin Odersky2014-09-064-14/+23
| | | | Better to keep the old name for easy cross-referencing with Scala 2.
* Bring back blockescapes test...Martin Odersky2014-09-061-3/+0
| | | | ... by reverting a premature optimization in Erasure.
* Harden construction of i"..." stringsMartin Odersky2014-09-051-4/+9
| | | | | | | Catch exceptions and embed into string instead of passing exception on. Reason: i"" strings are for diagnostic output but may cause exceptions such as CyclicReferences, stale symbols and so on. We never want to crash the program with such an exception.
* CyclicError messages now go to printerMartin Odersky2014-09-052-1/+6
| | | | Have a configurable printer to which cyclic error messages are sent.
* Fix a bug in unpicklerMartin Odersky2014-09-051-1/+1
| | | | Module roots were mis-characterized, which meant that module symbols were loaded twice.
* Partially reverting of 08c6eacaMartin Odersky2014-09-052-9/+17
| | | | | | | | | | | | | | | Partial revert of 08c6eaca "this type is a term ref to the source module". The problem with doing this is that it introduces spurious outer references. An inner module that contains self referenves always needs the directly enclosing class. The revert avoids this dependency by making ThisTypes always point to TypeRefs. Several other changes were necessary to make the builds pass: TypeRefs had to get prefixes after erasure so that they can be reloaded. Symbols of such typerefs had to be retrieved without forcing a denotation. One test (blockescapes.scala) fails and is moved to pending, awaiting further resolution. Also two other new tests in pending which currently fail (and have failed before).
* Enclosing class skips classes from inSuperCall definitionsMartin Odersky2014-09-041-3/+7
| | | | | Syntactically enclosing class is not accessible from such definitions, so should be skipped.
* Move crash diagnostics from TreeChecker to ReTyper.Martin Odersky2014-09-042-5/+9
| | | | | If there's a crash, we always want to see where the retyper was, not just for tree checking.
* Add inSuperCall mode and flag.Martin Odersky2014-09-049-22/+33
| | | | | Needed to keep a record of definitions in supercall arguments. These may not see the enclosing class.
* Completed outer paths.Martin Odersky2014-09-017-49/+98
| | | | | | | Outer paths, parameters and arguments are inserted in erasure, using methods provided by OuterAccessors. Also fixed a stupid bug in Erasure#constant
* Allow more leniency in time travel.Martin Odersky2014-09-014-23/+51
| | | | | Makes the method pioneered in elidablePrefix more general. Also applies it to accessWithin.
* Ensure in FirstTransform that all This references are explicit.Martin Odersky2014-09-011-2/+8
| | | | | | | A this reference hide in a self ident, and be subsequently missed when deciding on whether outer accessors are needed and computing outer paths. We do this normalization directly after Typer, because during typer the ident should rest available for hyperlinking.
* Added OuterAccessor flag.Martin Odersky2014-09-012-32/+33
| | | | Also regorganized flags a bit to better use available slots.
* Add outer parameters in constructor calls.Martin Odersky2014-08-313-3/+41
| | | | | 1) Constructors of inner classes get outer parameters 2) Outer arguments are passed as needed.
* New phase: outerAccessorsMartin Odersky2014-08-313-3/+169
| | | | | | | | The new phase replaces attachOuter. It creates outer accessors where needed but does not yet define outer parameters or pass outer arguments. It should run before pattern matcher, so that pattern matcher can access the outer fields of scrutinees.
* Types of This trees are promoted during retyping.Martin Odersky2014-08-313-2/+5
| | | | | | | | | Failing to do this leads to problems when retyping the This of nested classes with the same name (e.g. nested anonymous classes as they appear in t0453.scala). RefinedPrinter was changed to avoid sugaring of anonymous classes when uniqid is set (that was essential to track down the problem).
* Fix to elidable prefix.Martin Odersky2014-08-312-12/+26
| | | | | | The previous condition was too weak. The fix revealed a problem where an "undefined symbol" error was thrown when reading an alias annotation in the unpickler. The exception is now suppressed, the comment explains why.
* Avoid reloading NonMemberSyms.Martin Odersky2014-08-311-2/+4
| | | | Non member symbols should not be reloaded in any case.
* Generalize equivalentThisTypesMartin Odersky2014-08-311-13/+10
| | | | | | | | | | | | // We treat two prefixes A.this, B.this as equivalent if // A's selftype derives from B and B's selftype derives from A. It makes sense to apply this principle to comparing this types in general, and not only when being the prefix of a named type. Not doing so revealed a problem in retyping Applications.scala after outerAccessors. There two type applications of the same class had as prefixes (1) Applications.this, (2) Typer.this & Applications.this. Typer and Applications match the principle, so the prefixes should be regarded as equivalent. Why this manifested itself only after outerAccessors is an unsolved puzzle.
* Moving an assertion from erasure to TreeChecker.Martin Odersky2014-08-304-15/+19
| | | | The move caught an illegal erased type in a SelectFromType node.
* Ensure that after erasure all types are erased.Martin Odersky2014-08-306-20/+57
| | | | | Defines a predicate isErasedTypes and checks that all tree types and their widened underlying types are erased.
* Eliminate Ident/Select types in FirstTransformMartin Odersky2014-08-301-3/+15
| | | | | | Ident, Select, SelectFromTypeTrees denoting types should be eliminated at some point. FirstTransform seems to be the logical place because it already eliminates other forms of type trees.
* Function and multi-array type methods get implicit contexts.Martin Odersky2014-08-301-4/+4
| | | | | | | Otherwise the context captured by Definitions applies. And that one leads to illegal types being constructed after erasure. We should think how we can better avoid the trap of captured contexts here.
* Shorten "if denotation is current the symbol" to "currentSymbol".Martin Odersky2014-08-293-7/+22
| | | | And make its usage more systematic on all substitutions where it makes sense.
* Avoid cyclic reference errors in ShowScalaMartin Odersky2014-08-293-6/+7
| | | | | | | | | This is done by predicating some shortcuts on tp.symbol.isStatic where tp is a NamedType with the condition tp.denotationIsCurrent, i.e. we avoid forcing the denotation. This safe because the branches taken on isStatic are optimizations. This commit contains the minimum set of changes to make showScala pass.
* Added todo commentMartin Odersky2014-08-291-1/+1
|
* Fixes to erasure to make -Ycheck:all work.Martin Odersky2014-08-2810-86/+151
| | | | | | | | Main change: Introduce JavaArrayType as a new type constructor for Java erased array. Translate all methods of Array class during erasure to primitive operations on arrays. Some other small fixes for more localized problems.
* Better error diadnostics in TreeChecker.Martin Odersky2014-08-281-1/+5
| | | | On type error, show the source line where the failure occured.
* Avoid writing ExprTypes in result types of DefDefsMartin Odersky2014-08-281-2/+4
|
* Enabling primitive operations in ReTyperMartin Odersky2014-08-283-7/+17
| | | | | | | The idea is that primitive operations do not have a symbol, but when applied have directly a MethodType. Such operations will be generated in Erasure for array ops. The patch allows retyping of such operations.
* Disable enclding in retyping.Martin Odersky2014-08-282-2/+6
| | | | | We would like to be able to define unencoded symbolic names in trees computed by the compiler. The patch avoids their accidental encoding.
* Fix in underlyingClassRefMartin Odersky2014-08-281-1/+21
| | | | Made implementation conform to doc comment.
* Fixes in TypeTestsCastMartin Odersky2014-08-281-5/+9
| | | | | 1) qualifier class was wrongly computed 2) Case where test or cast argument is primitive was not fully handled.
* Make ThisTypes take TypeRefs instead of ClassSymbolsMartin Odersky2014-08-2714-66/+64
| | | | | This avoids stale symbol errors and does not need the somewhat unsystematic symbol rebinding of the last commit.
* Rebinding ThisTypesMartin Odersky2014-08-275-8/+23
| | | | | | | | | | | ThisTypes do escape. It seems that Scala 2 pickling produces ThisTypes that refer to base classes of the class being compiled. If the base class is in a separate compilation unit, this can lead to a stale class symbol in the ThisType. We solve this here by rebinding the class symbol in the ThisType. We should also explore the alternative: class ThisType(tref: TypeRef) ... That would do the rebinding as part of the generation denotation resolution mechanism.
* thisType of a module class is a term ref to the source module.Martin Odersky2014-08-264-13/+27
| | | | | | | | Module classes now always get the sourceModule term ref as their this type. We would like to eliminate ThisType() of a module class completely, as this hangs on to a symbol which might become stale for globally accessible modules. This commit is the first step. It contains the change to thisType and the necessary fixes to make the test suite pass.
* Fixes to erasureMartin Odersky2014-08-256-63/+60
| | | | | | | | | | Makes erasure pass the test suite. Erasure is not yet turned turned on by default, because TestNonCyclic fails with a stale symbol error. The problem is that This types are coupled to Symbols and therefore don't reload. This is a problem is This types refer to static symbols that get recompiled. We either have to drop using This types for static references, or redefine thme so that can be reloaded.