summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/TreeGen.scala
Commit message (Collapse)AuthorAgeFilesLines
* Double-checked locking for modules.Adriaan Moors2016-08-291-20/+1
| | | | Inline `mkSynchronizedCheck`, whose abstraction obscured rather than clarified.
* [refactor] lazy val expansion in mixins/lazyvalsAdriaan Moors2016-08-291-9/+8
| | | | Towards expanding lazy vals and modules during fields phase.
* Fields phaseAdriaan Moors2016-08-111-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One step towards teasing apart the mixin phase, making each phase that adds members to traits responsible for mixing in those members into subclasses of said traits. Another design tenet is to not emit symbols or trees only to later remove them. Therefore, we model a val in a trait as its accessor. The underlying field is an implementation detail. It must be mixed into subclasses, but has no business in a trait (an interface). Also trying to reduce tree creation by changing less in subtrees during tree transforms. A lot of nice fixes fall out from this rework: - Correct bridges and more precise generic signatures for mixed in accessors, since they are now created before erasure. - Correct enclosing method attribute for classes nested in trait fields. Trait fields are now created as MethodSymbol (no longer TermSymbol). This symbol shows up in the `originalOwner` chain of a class declared within the field initializer. This promoted the field getter to being the enclosing method of the nested class, which it is not (the EnclosingMethod attribute is a source-level property). - Signature inference is now more similar between vals and defs - No more field for constant-typed vals, or mixed in accessors for subclasses. A constant val can be fully implemented in a trait. TODO: - give same treatment to trait lazy vals (only accessors, no fields) - remove support for presuper vals in traits (they don't have the right init semantics in traits anyway) - lambdalift should emit accessors for captured vals in traits, not a field Assorted notes from the full git history before squashing below. Unit-typed vals: don't suppress field it affects the memory model -- even a write of unit to a field is relevant... unit-typed lazy vals should never receive a field this need was unmasked by test/files/run/t7843-jsr223-service.scala, which no longer printed the output expected from the `0 to 10 foreach` Use getter.referenced to track traitsetter reify's toolbox compiler changes the name of the trait that owns the accessor between fields and constructors (`$` suffix), so that the trait setter cannot be found when doing mkAssign in constructors this could be solved by creating the mkAssign tree immediately during fields anyway, first experiment: use `referenced` now that fields runs closer to the constructors phase (I tried this before and something broke) Infer result type for `val`s, like we do for `def`s The lack of result type inference caused pos/t6780 to fail in the new field encoding for traits, as there is no separate accessor, and method synthesis computes the type signature based on the ValDef tree. This caused a cyclic error in implicit search, because now the implicit val's result type was not inferred from the super member, and inferring it from the RHS would cause implicit search to consider the member in question, so that a cycle is detected and type checking fails... Regardless of the new encoding, we should consistently infer result types for `def`s and `val`s. Removed test/files/run/t4287inferredMethodTypes.scala and test/files/presentation/t4287c, since they were relying on inferring argument types from "overridden" constructors in a test for range positions of default arguments. Constructors don't override, so that was a mis-feature of -Yinfer-argument-types. Had to slightly refactor test/files/presentation/doc, as it was relying on scalac inferring a big intersection type to approximate the anonymous class that's instantiated for `override lazy val analyzer`. Now that we infer `Global` as the expected type based on the overridden val, we make `getComment` private in navigating between good old Skylla and Charybdis. I'm not sure why we need this restriction for anonymous classes though; only structural calls are restricted in the way that we're trying to avoid. The old behavior is maintained nder -Xsource:2.11. Tests: - test/files/{pos,neg}/val_infer.scala - test/files/neg/val_sig_infer_match.scala - test/files/neg/val_sig_infer_struct.scala need NMT when inferring sig for accessor Q: why are we calling valDefSig and not methodSig? A: traits use defs for vals, but still use valDefSig... keep accessor and field info in synch
* Merge pull request #5296 from retronym/ticket/SD-186Lukas Rytz2016-07-221-1/+1
|\ | | | | SD-186 Fix positions in trait method bytecode
| * SD-186 Fix positions in trait method bytecodeJason Zaugg2016-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Concrete, non private methods in traits are translated into a static method with an explicit `$this` parameter. After this translation, the references to `$this` (subistuted for `this` in user written code) where being positioned at the position of the method, which makes debugging unpleasant. This commit leaves the `Ident($this)` trees unpositioned. This is analagous to what we do in the body of extension methods, which is the other user of `ThisSubstitutor`. It would be more correct to copy the position of each `This` tree over to the substituted tree. That would let us set a breakpoint on a line that _only_ contained `this`. But in 99% of cases users won't be able to spot the difference, so I've opted for the tried and tested approach here.
* | SD-120 Non FunctionN lambdas should not be universally serializableJason Zaugg2016-07-221-8/+10
|/ | | | | | | | Instead, we follow the example set by javac, and predicate serializability of bot anon-class and invokedynamic-based lambdas on whether or not the SAM type extends java.io.Serializable. Fixes https://github.com/scala/scala-dev/issues/120
* Emit trait method bodies in staticsJason Zaugg2016-06-281-1/+2
| | | | | | | | | | | | | | | | | | | | And use this as the target of the default methods or statically resolved super or $init calls. The call-site change is predicated on `-Yuse-trait-statics` as a stepping stone for experimentation / bootstrapping. I have performed this transformation in the backend, rather than trying to reflect this in the view from Scala symbols + ASTs. We also need to add an restriction related to invokespecial to Java parents: to support a super call to one of these to implement a super accessor, the interface must be listed as a direct parent of the class. The static method names has a trailing $ added to avoid duplicate name and signature errors in classfiles.
* Drop local suffix in lambda impl method nameJason Zaugg2016-06-021-1/+1
|
* Treat self parameter as non-null in the optimizerLukas Rytz2016-06-011-1/+1
|
* Lambda impl methods static and more stably namedJason Zaugg2016-06-011-3/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The body of lambdas is compiled into a synthetic method in the enclosing class. Previously, this method was a public virtual method named `fully$qualified$Class$$anonfun$n`. For lambdas that didn't capture a `this` reference, a static method was used. This commit changes two aspects. Firstly, all lambda impl methods are now emitted static. An extra parameter is added to those that require a this reference. This is an improvement as it: - allows, shorter, more readable names for the lambda impl method - avoids pollution of the vtable of the class. Note that javac uses private instance methods, rather than public static methods. If we followed its lead, we would be unable to support important use cases in our inliner Secondly, the name of the enclosing method has been included in the name of the lambda impl method to improve debuggability and to improve serialization compatibility. The serialization improvement comes from the way that fresh names for the impl methods are allocated: adding or removing lambdas in methods not named "foo" won't change the numbering of the `anonfun$foo$n` impl methods from methods named "foo". This is in line with user expectations about anonymous class and lambda serialization stability. Brian Goetz has described this tricky area well in: http://cr.openjdk.java.net/~briangoetz/eg-attachments/lambda-serialization.html This commit doesn't go as far a Javac, we don't use the hash of the lambda type info, param names, etc to map to a lambda impl method name. As such, we are more prone to the type-1 and -2 failures described there. However, our Scala 2.11.8 has similar characteristics, so we aren't going backwards. Special case in the naming: Use "new" rather than "<init>" for constructor enclosed lambdas, as javac does. I have also changed the way that "delambdafy target" methods are identifed. Rather than relying on the naming convention, I have switched to using a symbol attachment. The assumption is that we only need to identify them from within the same compilation unit. This means we can distinguish impl metbods for expanded functions (ones called from an `apply` method of an ahead-of-time expanded anonfun class), from those that truly end up as targets for lambda metafactory. Only the latter are translated to static methods in this patch.
* Bring back AbstractFunction parentAdriaan Moors2016-03-301-1/+5
| | | | | Jason points out we still need it for bytecode efficiency, due to mixin forwarders.
* LMF cannot instantiate SAM of trait with non-trait superclassAdriaan Moors2016-03-291-5/+1
| | | | | | | | | | | | Also, drop AbstractFunction for parent of anonymous subclass of function type that must have its class spun up at compile time (rather than at linkage time by LambdaMetaFactory). This revealed an old problem with typedTemplate, in which parent types may be normalized at the level of trees, while this change does not get propagated to the class's info in time for the constructor to be located when we type check the primary constructor.
* Treat `Function` literals uniformly, expecting SAM or FunctionN.Adriaan Moors2016-03-261-30/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They both compile to INDY/MetaLambdaFactory, except when they occur in a constructor call. (TODO: can we lift the ctor arg expression to a method and avoid statically synthesizing anonymous subclass altogether?) Typers: - no longer synthesize SAMs -- *adapt* a Function literal to the expected (SAM/FunctionN) type - Deal with polymorphic/existential sams (relevant tests: pos/t8310, pos/t5099.scala, pos/t4869.scala) We know where to find the result type, as all Function nodes have a FunctionN-shaped type during erasure. (Including function literals targeting a SAM type -- the sam type is tracked as the *expected* type.) Lift restriction on sam types being class types. It's enough that they dealias to one, like regular instance creation expressions. Contexts: - No longer need encl method hack for return in sam. Erasure: - erasure preserves SAM type for function nodes - Normalize sam to erased function type during erasure, otherwise we may box the function body from `$anonfun(args)` to `{$anonfun(args); ()}` because the expected type for the body is now `Object`, and thus `Unit` does not conform. Delambdafy: - must set static flag before calling createBoxingBridgeMethod - Refactored `createBoxingBridgeMethod` to wrap my head around boxing, reworked it to generalize from FunctionN's boxing needs to arbitrary LMF targets. Other refactorings: ThisReferringMethodsTraverser, TreeGen.
* Set the scene for Sammy.Adriaan Moors2016-03-261-4/+4
| | | | | | | | Go beyond refactoring and introduce some hooks and patch some holes that will become acute when we set Sammy loose. Expanding sam requires class as first parent: `addObjectParent`. (Tested in pos/sam_ctor_arg.scala, coming next.)
* Refactoring. Sweep Sammy's backyard.Adriaan Moors2016-03-261-14/+32
|
* New trait encoding: use default methods, jettison impl classesJason Zaugg2016-03-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, concrete methods in traits were encoded with "trait implementation classes". - Such a trait would compile to two class files - the trait interface, a Java interface, and - the implementation class, containing "trait implementation methods" - trait implementation methods are static methods has an explicit self parameter. - some methods don't require addition of an interface method, such as private methods. Calls to these directly call the implementation method - classes that mixin a trait install "trait forwarders", which implement the abstract method in the interface by forwarding to the trait implementation method. The new encoding: - no longer emits trait implementation classes or trait implementation methods. - instead, concrete methods are simply retained in the interface, as JVM 8 default interface methods (the JVM spec changes in [JSR-335](http://download.oracle.com/otndocs/jcp/lambda-0_9_3-fr-eval-spec/index.html) pave the way) - use `invokespecial` to call private or particular super implementations of a method (rather `invokestatic`) - in cases when we `invokespecial` to a method in an indirect ancestor, we add that ancestor redundantly as a direct parent. We are investigating alternatives approaches here. - we still emit trait fowrarders, although we are [investigating](https://github.com/scala/scala-dev/issues/98) ways to only do this when the JVM would be unable to resolve the correct method using its rules for default method resolution. Here's an example: ``` trait T { println("T") def m1 = m2 private def m2 = "m2" } trait U extends T { println("T") override def m1 = super[T].m1 } class C extends U { println("C") def test = m1 } ``` The old and new encodings are displayed and diffed here: https://gist.github.com/retronym/f174d23f859f0e053580 Some notes in the implementation: - No need to filter members from class decls at all in AddInterfaces (although we do have to trigger side effecting info transformers) - We can now emit an EnclosingMethod attribute for classes nested in private trait methods - Created a factory method for an AST shape that is used in a number of places to symbolically bind to a particular super method without needed to specify the qualifier of the `Super` tree (which is too limiting, as it only allows you to refer to direct parents.) - I also found a similar tree shape created in Delambdafy, that is better expressed with an existing tree creation factory method, mkSuperInit.
* Desugar module var and accessor in refchecks/lazyvalsJason Zaugg2015-10-081-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than leaving it until mixin. The broader motivation is to simplify the mixin phase of the compiler before we get rid of implementatation classes in favour of using JDK8 default interface methods. The current code in mixin is used for both lazy val and modules, and puts the "slow path" code that uses the monitor into a dedicated method (`moduleName$lzyCompute`). I tracked this back to a3d4d17b77. I can't tell from that commit whether the performance sensititivity was related to modules or lazy vals, from the commit message I'd say the latter. As the initialization code for a module is just a constructor call, rather than an arbitraryly large chunk of code for a lazy initializer, this commit opts to inline the `lzycompute` method. During refchecks, mixin module accessors are added to classes, so that mixed in and defined modules are translated uniformly. Trait owned modules get an accessor method with an empty body (that shares the module symbol), but no module var. Defer synthesis of the double checked locking idiom to the lazyvals phase, which gets us a step closer to a unified translation of modules and lazy vals. I had to change the `atOwner` methods to to avoid using the non-existent module class of a module accessor method as the current owner. This fixes a latent bug. Without this change, retypechecking of the module accessor method during erasure crashes with an accessibility error selecting the module var. In the process, I've tweaked a tree generation utility method to wvoid synthesizing redundant blocks in module desugaring.
* Merge remote-tracking branch 'origin/2.11.x' into 2.12.xSeth Tisue2015-09-081-1/+1
| | | | | | | | only trivial merge conflicts here. not dealing with PR #4333 in this merge because there is a substantial conflict there -- so that's why I stopped at 63daba33ae99471175e9d7b20792324615f5999b for now
* Fix 25 typos (s)Janek Bogucki2015-07-061-1/+1
|
* exposes additional TreeGen methodsEugene Burmako2014-02-151-1/+1
| | | | Agains, this is something that's needed for async.
* moves analyzer.ImportType into scala.reflect.internalEugene Burmako2014-01-211-1/+1
| | | | | This cute little type is necessary for importers to work correctly. I wonder how we could overlook its existence for almost 2 years.
* Refactor away duplication between -Ydelambdafy:{inline,method}Jason Zaugg2013-11-231-0/+40
|
* change intermidiate representation of for loop enumeratorsDen Shabalin2013-11-121-10/+0
| | | | | | Encode values into real trees rather than non-tree case classes. This is needed for re-usability of desugaring code between quasiquotes and parser.
* 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.
* move mkNew from tools.nsc.ast.TreeGen to reflect.internal.TreeGenDen Shabalin2013-09-051-36/+0
| | | | This is needed for quasiquotes to implement SyntacticNew combinator.
* moves template creation logic from nsc to reflectDen Shabalin2013-07-081-2/+1
| | | | | This routine is going to be necessary in scala-reflect.jar to support ClassDef construction/deconstruction in the upcoming quasiquote patch.
* moves TreeBuilder into the parserDen Shabalin2013-07-081-0/+48
| | | | | | | | | | | | | | This is the first of the two patches to the parser necessary for quasiquotes to function. This one moves TreeBuilder from Global to the internals of the Parsers, so that quasiquotes will be able to override it later to support some corner cases arising from splicing (see the subsequent quasiquote commit for more details). Surprisingly enough, almost noone used TreeBuilder outside the parser, and it was necessary to move just a couple of methods to TreeGen to satisfy broken dependencies.
* Set scene for Predef.$scope's demise.Jason Zaugg2013-06-201-5/+14
| | | | | | | | | | | When there's no Predef.$scope but xml is being used, the compiler aliases scala.xml.TopScope to $scope. There must be a scala.xml package when xml literals were parsed. For compatibility with the old library, which relied on $scope being in scope, synthesize a `import scala.xml.{TopScope => $scope}` when xml is needed, but there's no Predef.$scope and the old library is detected (scala.xml.TopScope exists).
* Remove -Xcheck-null setting.Paul Phillips2013-03-131-13/+0
| | | | | | | | | | Maybe this was useful in some way; but no way I ever saw. I have comments which tell me this is exposed in the IDE so I left a stub. I also removed mkCheckInit. That probably sounds like it's related to -Xcheckinit. Guess again, guy-who-thinks-names-mean-things. It was only used by -Xcheck-null.
* Removed -Ynotnull setting.Paul Phillips2013-03-131-10/+11
| | | | | | | | | | It never worked and it would periodically jump out and bite someone. Slash and burn so new plants can take root. Eliminated NotNullType and NotNullClass, internal elements. Removed notNull method on Type, which no longer has a purpose. Retained 'def isNotNull' because there are types which are known by construction not to be null (ThisType, ConstantType as long as the constant isn't null, etc.) and that's still useful to know.
* Merge branch '2.10.x'Adriaan Moors2013-01-161-0/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/doc/Settings.scala src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala src/compiler/scala/tools/nsc/matching/Patterns.scala src/compiler/scala/tools/nsc/transform/UnCurry.scala src/compiler/scala/tools/nsc/typechecker/Infer.scala src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/reflect/scala/reflect/internal/settings/MutableSettings.scala src/reflect/scala/reflect/runtime/Settings.scala src/swing/scala/swing/SwingActor.scala src/swing/scala/swing/SwingWorker.scala test/files/run/t6955.scala
| * clean up synthesizePartialFunctionAdriaan Moors2013-01-101-0/+5
| | | | | | | | | | | | | | | | | | implement the following review comments by @retronym: - [x] Please clothe this naked assert. - [x] Use match to dissect targs and check isFullyDefined. - [x] Instead of `targs.head`/`targs.last`, use `val argTp :: resTp :: Nil = targs`. - [x] Add a quasi-quote-style comment for `apply`. - [x] Factor out mkCastPreservingAnnotations.
* | Cleanup in module var creation.Paul Phillips2012-12-121-19/+1
| | | | | | | | | | | | | | | | | | | | | | | | When all the logic in a method is for symbol creation, and then at the last minute it throws on a hastily zipped ValDef, it's really not a tree generation method, it's a symbol creation method. Eliminated redundancy and overgeneralization; marked some bits for further de-duplication. Did my best with my limited archeological skills to document what is supposed to be happening in eliminateModuleDefs.
* | Merge branch 'merge-wip-into-2.10.x' into merge-2.10-into-masterPaul Phillips2012-12-111-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * more ListOfNil => NilEugene Burmako2012-12-061-1/+1
| | | | | | | | | | | | Even more trees (together with Apply nodes produced by templateParents and New nodes produced by New in TreeBuilders) now distinguish nullary argument list from empty argument list.
* | Remove Name -> TermName implicit.Paul Phillips2012-12-011-2/+2
| | | | | | | | And simplify the name implicits.
* | Remove code from compiler central.Paul Phillips2012-11-201-94/+0
| | | | | | | | | | All those old-timey methods whose melodies have become unfashionable.
* | Revert "Commenting out unused members."Paul Phillips2012-11-191-85/+85
| | | | | | | | This reverts commit 951fc3a486.
* | Commenting out unused members.Paul Phillips2012-11-191-85/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I want to get this commit into the history because the tests pass here, which demonstrates that every commented out method is not only unnecessary internally but has zero test coverage. Since I know (based on the occasional source code comment, or more often based on knowing something about other source bases) that some of these can't be removed without breaking other things, I want to at least record a snapshot of the identities of all these unused and untested methods. This commit will be reverted; then there will be another commit which removes the subset of these methods which I believe to be removable. The remainder are in great need of tests which exercise the interfaces upon which other repositories depend.
* | Removed unused imports.Paul Phillips2012-11-061-1/+0
| | | | | | | | | | | | | | | | | | A dizzying number of unused imports, limited to files in src/compiler. I especially like that the unused import option (not quite ready for checkin itself) finds places where feature implicits have been imported which are no longer necessary, e.g. this commit includes half a dozen removals of "import scala.language.implicitConversions".
* | 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 remote-tracking branch 'origin/2.10.x' into merge-210Paul Phillips2012-09-151-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Hardening specialization and others.Paul Phillips2012-08-311-4/+4
| | | | | | | | | | | | | | 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.
* | Don't synthesize trees with overloaded calls.Paul Phillips2012-08-311-1/+4
| | | | | | | | | | | | Finding call sites where we would generate (and get away with) an overloaded constructor call after overloading resolution is already done.
* | Merge remote-tracking branch 'origin/2.10.x' into merge-210Paul Phillips2012-08-171-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # By Eugene Burmako (12) and others # Via Paul Phillips (4) and others * origin/2.10.x: Fixes SI-6236. Fixes SI-6189. Hunting down eliminable :: allocations. Absolutize tools.nsc => scala.tools.nsc. more cleanup for typedMacroBody shaves more than 150 lines off typedMacroBody Optimization in SubstMap. removes dead code pull request feedback more macro cleanup further cleanup of transformTypeTagEvidenceParams macroImplSigs => macroImplSig Dominik's comments on api.Mirrors phaseId(currentPeriod) >= erasurePhase.id materializeImplicit and implicitsOfExpectedType cleanup of reflection- and macro-related stuff adds the `skipPackage` attribute to Scaladoc Fixes backend crash due to incorrect consumedTypes Fix SI-6208. mutable.Queue now returns mutable.Queue for collection methods rather than MutableList.
| * Hunting down eliminable :: allocations.Paul Phillips2012-08-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch '2.10.x'Adriaan Moors2012-08-081-5/+3
|\| | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/ast/TreeGen.scala src/compiler/scala/tools/nsc/settings/AestheticSettings.scala