summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/Trees.scala
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-181-7/+0
| | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* Deprecations: Use of isPackage, hasSymbol, getter, setter...Simon Ochsenreither2015-03-261-1/+1
| | | | ... replaced by hasPackageFlag, hasSymbolIn, getterIn, setterIn.
* Fix typo in brutallyResetAttrs commentRobertZK2015-03-181-1/+1
|
* SI-8369 resetAttrs now correctly accounts for skolemsEugene Burmako2014-03-071-1/+2
| | | | | resetAttrs (née resetLocalAttrs) has been oblivious to existence of skolems. Not anymore, which prevents us from reverting to the untyper nightmare.
* SI-8316 SI-8318 SI-8248 reintroduces resetAllAttrsEugene Burmako2014-02-201-3/+13
| | | | | | | | | | | Unfortunately, due to the aforementioned bugs we have to delay our triumph over resetAllAttrs. Therefore, I'm rolling back the internal changes to scalac introduced in https://github.com/scala/scala/pull/3485. Our public reflection API interface in Scala 2.11 is still going to contain only resetLocalAttrs, but both the reifier and the label typechecker are too heavily addicted to resetAllAttrs to do away with it right now.
* additional class tags for reflection APIEugene Burmako2014-02-141-0/+2
| | | | | | | | | Introduces a test that iterates all abstract types in reflection API and makes sure that every one of them has an associated class tag. After being introduced, the test has immediately failed exposing the lack of tags for TreeCopier, Mirror and RuntimeClass, which has been subsequently fixed in this commit.
* renames resetLocalAttrs to resetAttrsEugene Burmako2014-02-071-1/+1
| | | | | Now when resetAllAttrs is gone, we can use a shorter name for the one and only resetLocalAttrs.
* SI-8248 kills resetAllAttrsEugene Burmako2014-02-071-26/+27
| | | | | Noone uses it anymore, so I'm rushing to remove it, so that it no longer can trick people into using it.
* further limits discoverability of resetAttrsEugene Burmako2014-02-071-3/+1
| | | | | | | | | | | | | | This commit removes resetAllAttrs from the public reflection API. This method was previously deprecated, but on a second thought that doesn't do it justice. People should be aware that resetAllAttrs is just wrong, and if they have code that uses it, this code should be rewritten immediately without beating around the bush with deprecations. There's a source-compatible way of achieving that (resetLocalAttrs), so that shouldn't bring much trouble. Secondly, resetAllAttrs in compiler internals becomes deprecated. In subsequent commits I'm going to rewrite the only two locations in the compiler that uses it, and then I think we can remove it from the compiler as well.
* Don't trace the low-level details of ResetAttrs under -YdebugJason Zaugg2014-01-171-1/+3
| | | | | | This need for this output is highly situational and since we've starting using this resettter in case classes and names/defaults, it is polluting our consoles.
* Removing unused code.Paul Phillips2013-10-021-3/+0
| | | | | | | Most of this was revealed via -Xlint with a flag which assumes closed world. I can't see how to check the assumes-closed-world code in without it being an ordeal. I'll leave it in a branch in case anyone wants to finish the long slog to the merge.
* SI-6762 rename emptyValDef to noSelfType.Paul Phillips2013-09-271-1/+1
| | | | | Looks like emptyValDef.isEmpty was already changed to return false, so now all that's left is a name which means something.
* No longer crash on NoSymbol.owner.Paul Phillips2013-08-191-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically calling NoSymbol.owner has crashed the compiler. With this commit, NoSymbol owns itself. This is consistent with the way ownership chains are handled elsewhere in the compiler (e.g. NoContext.owner is NoContext, NoSymbol.enclClass is NoSymbol, and so on) and frees every call site which handles symbols from having to perform precondition tests against NoSymbol. Since calling NoSymbol.owner sometimes (not always) indicates a bug which we'd like to catch sooner than later, I have introduced a couple more methods for selected call sites. def owner: Symbol // NoSymbol.owner is self, log if -Xdev def safeOwner: Symbol // NoSymbol.owner is self, ignore def assertOwner: Symbol // NoSymbol.owner is fatal The idea is that everyone can call sym.owner without undue anxiety or paranoid null-like tests. When compiling under -Xdev calls to `owner` are logged with a stack trace, so any call sites for which that is an expected occurrence should call safeOwner instead to communicate the intention and stay out of the log. Conversely, any call site where crashing on the owner call was a desirable behavior can opt into calling assertOwner. This commit also includes all the safeOwner calls necessary to give us a silent log when compiling scala.
* moves template creation logic from nsc to reflectDen Shabalin2013-07-081-74/+3
| | | | | This routine is going to be necessary in scala-reflect.jar to support ClassDef construction/deconstruction in the upcoming quasiquote patch.
* Cleanup of crash output.Paul Phillips2013-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I finally ran across the assert (or one of them) which produces such voluminous output that it scares the cattle. When you see "decls" in an assert, run. After silencing that, I extended the journey into quieting the default crash message down, way down. I assume this will be met only with sighs of relief. And then most challenging of all for some reason, I convinced it to only print the information once. Volume of crash data generated when reproducing the fsc bug shown below: Before this commit 1158 lines After this commit 27 lines Pretty sure there's more information in the 27 lines. To reproduce the crash: fsc src/library/scala/collection/immutable/IntMap.scala fsc src/library/scala/collection/immutable/IntMap.scala The first compile succeeds quietly; the second throws warnings out of the gate, then crashes. And the "after" output: error: Cannot create static reference to method equals because object GenMapLike$class has no source module error: fatal error: while compiling: /scala/trunk/src/library/scala/collection/immutable/IntMap.scala during phase: globalPhase=mixin, enteringPhase=cleanup library version: version 2.11.0-20130606-052937-392858b4f6 compiler version: version 2.11.0-20130606-055515-1856bec71b reconstructed args: -d /tmp last tree to typer: Ident(key$2) tree position: line 377 of /scala/trunk/src/library/scala/collection/immutable/IntMap.scala tree tpe: Int symbol: value key$2 (flags: <param> <synthetic>) symbol definition: key$2: Int (a TermSymbol) symbol package: scala.collection.immutable symbol owners: value key$2 -> constructor IntMap$$anonfun$unionWith$2 -> anonymous class anonfun$unionWith$2 call site: object IntMap$Nil in package immutable in package immutable == Source file context for tree position == 374 } 375 case (IntMap.Tip(key, value), x) => x.updateWith[S](key, value, (x, y) => f(key, y, x)) 376 case (x, IntMap.Tip(key, value)) => x.updateWith[S](key, value, (x, y) => f(key, x, y)) 377 case (IntMap.Nil, x) => x 378 case (x, IntMap.Nil) => x 379 } 380
* Eliminate a bunch of -Xlint warnings.Paul Phillips2013-03-121-3/+2
| | | | | | Mostly unused private code, unused imports, and points where an extra pair of parentheses is necessary for scalac to have confidence in our intentions.
* Disentangled RangePositions from interactive.Paul Phillips2013-03-041-18/+0
| | | | | | | This is a stepping stone to having range positions all the time, as well as to modularizing the presentation compiler. It does not enable range positions by default, only places them smoewhere where they can be.
* Merge branch 2.10.1 into masterAdriaan Moors2013-02-271-6/+47
|\ | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/ast/Trees.scala src/library/scala/concurrent/impl/ExecutionContextImpl.scala
| * adds some comments to resetAttrsEugene Burmako2013-02-261-5/+41
| |
| * resetAttrs now always erases This.tpeEugene Burmako2013-02-171-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | The symbol of This, if it points to a package class, isn't touched, just as usual, so that our Select(Select(Select(...))) => This(...) optimization works fine with attr reset. However the tpe is now erased, so that subsequent reflective compilation doesn't spuriously fail when seeing that some subtrees of a tree being compiled are typed. Erasing the tpe doesn't pose even a tiniest problem, because, as it can be seen in typedThis, type is trivially reconstructed from the symbol.
| * [nomaster] Revert "refactors handling of parent types"Eugene Burmako2013-02-051-12/+6
| | | | | | | | | | | | | | | | This reverts commit 40063b0009d55ed527bf1625d99a168a8faa4124. Conflicts: src/compiler/scala/tools/nsc/ast/parser/Parsers.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala
| * [nomaster] Revert "introduces global.pendingSuperCall"Eugene Burmako2013-02-051-15/+8
| | | | | | | | | | | | | | | | This reverts commit 0ebf72b9498108e67c2133c6522c436af50a18e8. Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala src/reflect/scala/reflect/internal/Trees.scala
| * [nomaster] Revert "DummyTree => CannotHaveAttrs"Eugene Burmako2013-02-051-1/+1
| | | | | | | | | | | | | | This reverts commit 838cbe623c142b7005446793948097f679219fe3. Conflicts: src/reflect/scala/reflect/api/Trees.scala
| * SI-6595, lost modifiers in early defs.Paul Phillips2013-01-301-1/+1
| | | | | | | | | | | | | | | | [backport] Saw this by accident; the trees created for early defs would wholesale replace the modifiers with PRESUPER rather than combining them. FINAL was lost that way, as would be any other modifiers which might be valid there.
* | Banish needless semicolons.Jason Zaugg2013-02-241-1/+1
| |
* | Eliminating var-like setter tpe_= on Tree.Paul Phillips2012-12-191-5/+2
| | | | | | | | | | | | | | | | | | Deprecated tpe_= on Tree, which is redundant with and less useful than setType. To provide a small layer of insulation from the direct nulling out of mutable fields used to signal the typer, added def clearType() which is merely tree.tpe = null but is shamefaced about the null and var-settings parts like a respectable method should be.
* | Merge pull request #1749 from paulp/pr/6595Paul Phillips2012-12-121-1/+1
|\ \ | | | | | | Fix for SI-6595, lost modifiers in early defs.
| * | Fix for SI-6595, lost modifiers in early defs.Paul Phillips2012-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | Saw this by accident; the trees created for early defs would wholesale replace the modifiers with PRESUPER rather than combining them. FINAL was lost that way, as would be any other modifiers which might be valid there.
* | | Merge branch 'merge-wip-into-2.10.x' into merge-2.10-into-masterPaul Phillips2012-12-111-8/+21
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * merge-wip-into-2.10.x: (44 commits) Cleanups of reifyBoundTerm and reifyBoundType SI-5841 reification of renamed imports Share the empty LinkedList between first0/last0. SI-4922 Show default in Scaladoc for generic methods. SI-6614 Test case for fixed ArrayStack misconduct. SI-6690 Release reference to last dequeued element. SI-5789 Use the ReplTest framework in the test SI-5789 Checks in the right version of the test SI-5789 Removes assertion about implclass flag in Mixin.scala SI-6766 Makes the -Pcontinuations:enable flag a project specific preference more ListOfNil => Nil DummyTree => CannotHaveAttrs evicts assert(false) from the compiler introduces global.pendingSuperCall refactors handling of parent types unifies approaches to call analysis in TreeInfo TypeApply + Select and their type-level twins SI-6696 removes "helper" tree factory methods SI-6766 Create a continuations project in eclipse Now the test suite runs MIMA for compatibility testing. ... Conflicts: src/compiler/scala/reflect/reify/codegen/GenUtils.scala src/compiler/scala/tools/nsc/ast/Trees.scala src/compiler/scala/tools/nsc/backend/icode/GenICode.scala src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/eclipse/scala-compiler/.classpath src/eclipse/scalap/.classpath src/reflect/scala/reflect/internal/StdNames.scala src/reflect/scala/reflect/internal/TreeInfo.scala
| * DummyTree => CannotHaveAttrsEugene Burmako2012-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This looks like a much more specific name than a generic "dummy" prefix. CannotHaveAttrs also doesn't imply that an implementing tree should satisfy some bigger contract. EmptyTree and emptyValDef are very unlike each other, so there's no point in trying to unify them. Also DummyTree.isEmpty is no longer automatically true. The notion of trees not having positions and types by design (i.e. EmptyTree + empty TypeTrees + emptyValDef + the new pendingSuperCall) is quite different from the notion of an empty tree in a sense of a tree being a null object (i.e. EmptyTree + empty TypeTrees).
| * introduces global.pendingSuperCallEugene Burmako2012-12-061-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Similarly to global.emptyValDef, which is a dummy that stands for an empty self-type, this commit introduces global.pendingSuperCall, which stands for a yet-to-be-filled-in call to a superclass constructor. pendingSuperCall is emitted by Parsers.template, treated specially by Typers.typedParentType and replaced with a real superclass ctor call by Typers.typedTemplate. To avoid copy/paste, this commit also factors out and unifies dumminess of EmptyTree, emptyValDef and pendingSuperCall - they all don't have a position and actively refuse to gain one, same story for tpe.
| * refactors handling of parent typesEugene Burmako2012-12-061-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment parser does too much w.r.t handling of parent types. It checks whether a parent can have value arguments or not and more importantly, it synthesizes constructors and super calls. This approach is fundamentally incompatible with upcoming type macros. Take for example the following two snippets of code: `class C extends A(2)` `class D extends A(2) with B(3)` In the first snippet, `A` might be a type macro, therefore the super call `A.super(2)` eagerly emitted by the parser might be meaningless. In the second snippet parser will report an error despite that `B` might be a type macro which expands into a trait. Unfortunately we cannot simply augment the parser with the `isTypeMacro` check. This is because to find out whether an identifier refers to a type macro, one needs to perform a typecheck, which the parser cannot do. Therefore we need a deep change in how parent types and constructors are processed by the compiler, which is implemented in this commit.
* | Merge branch 'merge-2.10-wip' into merge-2.10Paul Phillips2012-12-051-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * merge-2.10-wip: Fixing OSGi distribution. Fix for rangepos crasher. SI-6685 fixes error handling in typedApply Test cases for SI-5726, SI-5733, SI-6320, SI-6551, SI-6722. Asserts about Tree qualifiers. Fix for SI-6731, dropped trees in selectDynamic. neg test added SI-5753 macros cannot be loaded when inherited from a class or a trait Take advantage of the margin stripping interpolator. Adds a margin stripping string interpolator. SI-6718 fixes a volatile test Mark pattern matcher synthetics as SYNTHETIC. Set symbol flags at creation. Fix for SI-6687, wrong isVar logic. Fix for SI-6706, Symbol breakage under GC. findEntry implementation code more concise and DRYer. Fix for SI-6357, cycle with value classes. Refactoring of adaptMethod SI-6677 Insert required cast in `new qual.foo.T` Conflicts: src/compiler/scala/tools/nsc/transform/Erasure.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/reflect/scala/reflect/internal/SymbolTable.scala src/reflect/scala/reflect/internal/util/package.scala test/files/neg/gadts1.check
| * Asserts about Tree qualifiers.Paul Phillips2012-11-291-1/+1
| | | | | | | | | | Encoding recent revelations about certain tree invariants in the form of asserts.
* | Merge commit 'refs/pull/1574/head' into merge-210Paul Phillips2012-11-051-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'refs/pull/1574/head': (24 commits) Fixing issue where OSGi bundles weren't getting used for distribution. Fixes example in Type.asSeenFrom Fix for SI-6600, regression with ScalaNumber. SI-6562 Fix crash with class nested in @inline method Brings copyrights in Scaladoc footer and manpage up-to-date, from 2011/12 to 2013 Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013 SI-6606 Drops new icons in, replaces abstract types placeholder icons SI-6132 Revisited, cleaned-up, links fixed, spelling errors fixed, rewordings Labeling scala.reflect and scala.reflect.macros experimental in the API docs Typo-fix in scala.concurrent.Future, thanks to @pavelpavlov Remove implementation details from Position (they are still under reflection.internal). It probably needs more cleanup of the api wrt to ranges etc but let's leave it for later SI-6399 Adds API docs for Any and AnyVal Removing actors-migration from main repository so it can live on elsewhere. Fix for SI-6597, implicit case class crasher. SI-6578 Harden against synthetics being added more than once. SI-6556 no assert for surprising ctor result type Removing actors-migration from main repository so it can live on elsewhere. Fixes SI-6500 by making erasure more regular. Modification to SI-6534 patch. Fixes SI-6559 - StringContext not using passed in escape function. ... Conflicts: src/actors-migration/scala/actors/migration/StashingActor.scala src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala src/compiler/scala/tools/nsc/settings/AestheticSettings.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/library/scala/Application.scala src/library/scala/collection/immutable/GenIterable.scala.disabled src/library/scala/collection/immutable/GenMap.scala.disabled src/library/scala/collection/immutable/GenSeq.scala.disabled src/library/scala/collection/immutable/GenSet.scala.disabled src/library/scala/collection/immutable/GenTraversable.scala.disabled src/library/scala/collection/mutable/GenIterable.scala.disabled src/library/scala/collection/mutable/GenMap.scala.disabled src/library/scala/collection/mutable/GenSeq.scala.disabled src/library/scala/collection/mutable/GenSet.scala.disabled src/library/scala/collection/mutable/GenTraversable.scala.disabled src/library/scala/collection/parallel/immutable/ParNumericRange.scala.disabled
| * Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
| |
* | Renamed hasSymbol to hasSymbolField.Paul Phillips2012-10-031-1/+1
| | | | | | | | | | | | | | | | Suggestion by retronym that the obvious implementation of "hasSymbol" be called "hasSymbol" reminded me we have a method called "hasSymbol" which does not have that implementation, and which has burned us already with subtle bugginess. I think that "hasSymbolField" is self-documenting.
* | Merge branch '2.10.x' into masterPaul Phillips2012-09-191-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 2.10.x: (51 commits) improved/fixed reflection docs based on comments Fixes SI-6354: improved error messages for Dynamic signature mismatches. Add RedBlackTree tests for take/drop/slice. Retain Ordering in drop/take/slice signatures. test case closes SI-5770 clarify caveats of App trait Remove `@static` annotation from the library. New starr that does not depend on `@static`. improved reflection documentation pull request feedback SI-5692 better error message SI-5942 toolboxes now reset front ends SI-6287 fixes synthetic symbol clashes in toolbox Revert "Implement @static annotation on singleton object fields." Revert "WIP add private/lazy checks and a few tests." Revert "Fixes SI-6189." Revert "Fixes SI-6236." Revert "Fix SI-4581." Revert "Fix SI-6294." refactors java reflection tests ... Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala src/partest/scala/tools/partest/package.scala src/reflect/scala/reflect/internal/Trees.scala
| * More relative path elimination.Paul Phillips2012-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some names I missed in 55b609458fd . How one might know when one is done: mkdir scratch && cd scratch mkdir annotation beans collection compat concurrent io \ math parallel ref reflect runtime scala sys testing \ text tools util xml scalac $(find ../src/library -name '*.scala') Until recently that would fail with about a billion errors. When it compiles, that's when you're done. And that's where this commit takes us, for src/library at least.
| * SI-6373 removes Trees#ApplyDynamic from the APIEugene Burmako2012-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | Introduced by erasure - therefore it can be seen neither by macros, nor by runtime reflection. Despite never being pickled, ApplyDynamic is supported by unpickler so I couldn't move it exclusively to scala-compiler.jar. Figuring out the mysterious reason for pickling ApplyDynamic is left to future work.
* | Merge remote-tracking branch 'origin/2.10.x' into merge-210Paul Phillips2012-09-151-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/2.10.x: (68 commits) Eliminate breaking relative names in source. "Hot fix" for broken build. Fix SI-4813 - Clone doesn't work on LinkedList. Made 'def clone()' consistent with parens everywhere. accommodates pull request feedback SI-6310 redeploys the starr SI-6310 AbsTypeTag => WeakTypeTag SI-6323 outlaws free types from TypeTag SI-6323 prohibits reflection against free types improvements for reification of free symbols removes build.newFreeExistential SI-6359 Deep prohibition of templates in value class Fixes SI-6259. Unable to use typeOf in super call of top-level object. Fixes binary repo push for new typesafe repo layouts. Better error message for pattern arity errors. Rescued TreeBuilder from the parser. Pending test for SI-3943 Test case for a bug fixed in M7. Fix for SI-6367, exponential time in inference. SI-6306 Remove incorrect eta-expansion optimization in Uncurry ... Conflicts: src/compiler/scala/tools/nsc/transform/AddInterfaces.scala src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
| * Eliminate breaking relative names in source.Paul Phillips2012-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These things are killing me. Constructions like package scala.foo.bar.baz import foo.Other DO NOT WORK in general. Such files are not really in the "scala" package, because it is not declared package scala package foo.bar.baz And there is a second problem: using a relative path name means compilation will fail in the presence of a directory of the same name, e.g. % mkdir reflect % scalac src/reflect/scala/reflect/internal/util/Position.scala src/reflect/scala/reflect/internal/util/Position.scala:9: error: object ClassTag is not a member of package reflect import reflect.ClassTag ^ src/reflect/scala/reflect/internal/util/Position.scala:10: error: object base is not a member of package reflect import reflect.base.Attachments ^ As a rule, do not use relative package paths unless you have explicitly imported the path to which you think you are relative. Better yet, don't use them at all. Unfortunately they mostly work because scala variously thinks everything scala.* is in the scala package and/or because you usually aren't bootstrapping and it falls through to an existing version of the class already on the classpath. Making the paths explicit is not a complete solution - in particular, we remain enormously vulnerable to any directory or package called "scala" which isn't ours - but it greatly limts the severity of the problem.
| * Minor cleanups of code/comments related to value classesJason Zaugg2012-09-101-3/+3
| |
* | Hardening specialization and others.Paul Phillips2012-08-311-1/+1
|/ | | | | | | Cleaned up some logic which has become unreasonably circuitous over time. Gave "mkSuperSelect" an accurate name (it's now "mkSuperInitCall".) Put in better logging for spotting OverloadedTypes which should not be.
* Optimizations to SymTree and transformMartin Odersky2012-08-201-1/+1
| | | | | | | Two optimizations: (1) Make SymTree a class rather than a trait to allow faster access to symbol (2) Split itransform into several smaller methods and order cases according to expected frequency.
* Hunting down eliminable :: allocations.Paul Phillips2012-08-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With this commit, the number of :: allocations logged in total after individually compiling each scala file in src/compiler drops from 190,766,642 to 170,679,925. Twenty million fewer colon-colons in the world, it's a start. For some heavily used lists like List(List()) I made vals so we can reuse the same one every time, e.g. val ListOfNil = List(Nil) The modifications in this patch were informed by logging call frequency to List.apply and examining the heaviest users. >> Origins tag 'listApply' logged 3041128 calls from 318 distinguished sources. 1497759 scala.reflect.internal.Definitions$ValueClassDefinitions$class.ScalaValueClasses(Definitions.scala:149) 173737 scala.reflect.internal.Symbols$Symbol.alternatives(Symbols.scala:1525) 148642 scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:306) 141676 scala.tools.nsc.transform.SpecializeTypes$$anonfun$scala$tools$nsc$transform$SpecializeTypes$$specializedOn$3.apply(SpecializeTypes.scala:114) 69049 scala.tools.nsc.transform.LazyVals$LazyValues$$anonfun$1.apply(LazyVals.scala:79) 62854 scala.tools.nsc.transform.SpecializeTypes.specializedTypeVars(SpecializeTypes.scala:427) 54781 scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:293) 54486 scala.reflect.internal.Symbols$Symbol.newSyntheticValueParams(Symbols.scala:334) 53843 scala.tools.nsc.backend.icode.Opcodes$opcodes$CZJUMP.<init>(Opcodes.scala:562) ... etc.
* cleanup of reflection- and macro-related stuffEugene Burmako2012-08-151-4/+1
| | | | | | mostly removes [Eugene] marks that I left back then and reviews related code some of those tokens got left in place, because I don't know to how fix them without imposing risks on 2.10.0
* update and normalize copyright noticeAdriaan Moors2012-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are the regexp replacements performed: Sxcala -> Scala Copyright (\d*) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*)(,?) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*) Scala Solutions and LAMP/EPFL -> Copyright $1-2012 Scala Solutions and LAMP/EPFL \(C\) (\d*)-(\d*) LAMP/EPFL -> (C) $1-2012 LAMP/EPFL Copyright \(c\) (\d*)-(\d*)(.*?)EPFL -> Copyright (c) $1-2012$3EPFL The last one was needed for two HTML-ified copyright notices. Here's the summarized diff: Created using ``` git diff -w | grep ^- | sort | uniq | mate git diff -w | grep ^+ | sort | uniq | mate ``` ``` - <div id="footer">Scala programming documentation. Copyright (c) 2003-2011 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> - copyright.string=Copyright 2002-2011, LAMP/EPFL - <meta name="Copyright" content="(C) 2002-2011 LAMP/EPFL"/> - * Copyright 2002-2011 LAMP/EPFL - * Copyright 2004-2011 LAMP/EPFL - * Copyright 2005 LAMP/EPFL - * Copyright 2005-2011 LAMP/EPFL - * Copyright 2006-2011 LAMP/EPFL - * Copyright 2007 LAMP/EPFL - * Copyright 2007-2011 LAMP/EPFL - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL - * Copyright 2009-2011 Scxala Solutions and LAMP/EPFL - * Copyright 2010-2011 LAMP/EPFL - * Copyright 2012 LAMP/EPFL -# Copyright 2002-2011, LAMP/EPFL -* Copyright 2005-2011 LAMP/EPFL -/* NSC -- new Scala compiler -- Copyright 2007-2011 LAMP/EPFL */ -rem # Copyright 2002-2011, LAMP/EPFL ``` ``` + <div id="footer">Scala programming documentation. Copyright (c) 2003-2012 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> + copyright.string=Copyright 2002-2012 LAMP/EPFL + <meta name="Copyright" content="(C) 2002-2012 LAMP/EPFL"/> + * Copyright 2002-2012 LAMP/EPFL + * Copyright 2004-2012 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL + * Copyright 2010-2012 LAMP/EPFL + * Copyright 2011-2012 LAMP/EPFL +# Copyright 2002-2012 LAMP/EPFL +* Copyright 2005-2012 LAMP/EPFL +/* NSC -- new Scala compiler -- Copyright 2007-2012 LAMP/EPFL */ +rem # Copyright 2002-2012 LAMP/EPFL ```
* Fixed SI-5603. Early definitions now get transparent positions.Hubert Plociniczak2012-07-301-6/+7
| | | | | | This includes a fix for a minor problem described in #594 - ensureNonOverlapping still focuses on default position when outside of early defs. Review by @dragos, @odersky.
* The new reflectionEugene Burmako2012-06-081-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A must read: "SIP: Scala Reflection": https://docs.google.com/document/d/1Z1VhhNPplbUpaZPIYdc0_EUv5RiGQ2X4oqp0i-vz1qw/edit Highlights: * Architecture has undergone a dramatic rehash. * Universes and mirrors are now separate entities: universes host reflection artifacts (trees, symbols, types, etc), mirrors abstract loading of those artifacts (e.g. JavaMirror loads stuff using a classloader and annotation unpickler, while GlobalMirror uses internal compiler classreader to achieve the same goal). * No static reflection mirror is imposed on the user. One is free to choose between lightweight mirrors and full-blown classloader-based mirror (read below). * Public reflection API is split into scala.reflect.base and scala.reflect.api. The former represents a minimalistic snapshot that is exactly enough to build reified trees and types. To build, but not to analyze - everything smart (for example, getting a type signature) is implemented in scala.reflect.api. * Both reflection domains have their own universe: scala.reflect.basis and scala.reflect.runtime.universe. The former is super lightweight and doesn't involve any classloaders, while the latter represents a stripped down compiler. * Classloader problems from 2.10.0-M3 are solved. * Exprs and type tags are now bound to a mirror upon creation. * However there is an easy way to migrate exprs and type tags between mirrors and even between universes. * This means that no classloader is imposed on the user of type tags and exprs. If one doesn't like a classloader that's there (associated with tag's mirror), one can create a custom mirror and migrate the tag or the expr to it. * There is a shortcut that works in most cases. Requesting a type tag from a full-blown universe will create that tag in a mirror that corresponds to the callsite classloader aka `getClass.getClassLoader`. This imposes no obligations on the programmer, since Type construction is lazy, so one can always migrate a tag into a different mirror. Migration notes for 2.10.0-M3 users: * Incantations in Predef are gone, some of them have moved to scala.reflect. * Everything path-dependent requires implicit prefix (for example, to refer to a type tag, you need to explicitly specify the universe it belongs to, e.g. reflect.basis.TypeTag or reflect.runtime.universe.TypeTag). * ArrayTags have been removed, ConcreteTypeTag have been renamed to TypeTags, TypeTags have been renamed to AbsTypeTags. Look for the reasoning in the nearby children of this commit. Why not in this commit? Scroll this message to the very bottom to find out the reason. * Some of the functions have been renamed or moved around. The rule of thumb is to look for anything non-trivial in scala.reflect.api. Some of tree build utils have been moved to Universe.build. * staticModule and staticClass have been moved from universes to mirrors * ClassTag.erasure => ClassTag.runtimeClass * For the sake of purity, type tags no longer have erasures. Use multiple context bounds (e.g. def foo[T: ru.TypeTag : ClassTag](...) = ...) if you're interested in having both erasures and types for type parameters. * reify now rolls back macro applications. * Runtime evaluation is now explicit, requires import scala.tools.reflect.Eval and scala-compiler.jar on the classpath. * Macro context now has separate universe and mirror fields. * Most of the useful stuff is declared in c.universe, so be sure to change your "import c.universe._" to "import c.mirror._". * Due to the changes in expressions and type tags, their regular factories are now really difficult to use. We acknowledge that macro users need to frequently create exprs and tags, so we added old-style factories to context. Bottom line: almost always prepend Expr(...)/TypeTag(...) with "c.". * Expr.eval has been renamed to Expr.splice. * Expr.value no longer splices (it can still be used to express cross-stage path-dependent types as specified in SIP-16). * c.reifyTree now has a mirror parameter that lets one customize the initial mirror the resulting Expr will be bound to. If you provide EmptyTree, then the reifier will automatically pick a reasonable mirror (callsite classloader mirror for a full-blown universe and rootMirror for a basis universe). Bottom line: this parameter should be EmptyTree in 99% of cases. * c.reifyErasure => c.reifyRuntimeClass. Known issues: * API is really raw, need your feedback. * All reflection artifacts are now represented by abstract types. This means that pattern matching against them will emit unchecked warnings. Adriaan is working on a patch that will fix that. WARNING, FELLOW CODE EXPLORER! You have entered a turbulence zone. For this commit and its nearby parents and children tests are not guaranteed to work. Things get back to normal only after the "repairs the tests after the refactoring spree" commit. Why so weird? These twentish changesets were once parts of a humongous blob, which spanned 1200 files and 15 kLOC. I did my best to split up the blob, so that the individual parts of the code compile and make sense in isolation. However doing the same for tests would be too much work.