summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-181-1/+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".
* deduplicate tuple tree creation codeDen Shabalin2013-11-121-1/+1
| | | | | | Previously tuple tree generation code has been implemented in three place: tree builder, tree gen, build utils. Now it's just defined once in tree gen.
* Removing unused code.Paul Phillips2013-10-021-18/+1
| | | | | | | 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.
* Reducing variation of tree creation methods.Paul Phillips2013-09-131-112/+5
| | | | | | | | | | | | | | | | | | | | | | | TreeDSL has no future - it was always a temporary measure waiting for something like quasiquotes to come along. In this commit I cull as much of it as I can, especially the delicate matter of creating new DefDefs and ValDefs, which I completely turn over to the old style creators. I unified all the symbol-based DefDef and ValDef creators under a single method, since it was yet another place where ctrl-C and ctrl-V were being punched with glee. Was beaten to the punch on adding copyTypeDef to fill out the *Def creators. Eliminated as many redundant positioning calls as I could find. If you are creating a DefTree tree based on a symbol, it will always have an atPos(sym.pos) { ... } wrapped around it. You don't need another one. All of this is motivated by positions work: positions are assigned in so many places and in such an ad hoc fashion that it is impossible to bring consistency to that without first bringing some consistency to tree creation.
* Corrects behavior of finalResultType.Paul Phillips2013-09-131-1/+1
| | | | | | | | | | | | The implementation had come to depend on finalResultType accidentally doing things beyond its charter - in particular, widening types. After hunting down and fixing the call sites depending on the bugs, I was able to rewrite the method to do only what it's supposed to do. I threw in a different way of writing it entirely to suggest how some correctness might be obtained in the future. It's a lot harder for a method written like this to break.
* Some general purpose methods.Paul Phillips2013-08-171-0/+1
| | | | Motivated by pattern matcher work, also useful elsewhere.
* DefDef.name is now TermName againEugene Burmako2013-08-101-1/+1
| | | | | Now when there's no hope left for type macros, it's reasonable to provide a more specific type for DefDef.name.
* Concision contribution.Paul Phillips2013-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | We have lots of core classes for which we need not go through the symbol to get the type: ObjectClass.tpe -> ObjectTpe AnyClass.tpe -> AnyTpe I updated everything to use the concise/direct version, and eliminated a bunch of noise where places were calling typeConstructor, erasedTypeRef, and other different-seeming methods only to always wind up with the same type they would have received from sym.tpe. There's only one Object type, before or after erasure, with or without type arguments. Calls to typeConstructor were especially damaging because (see previous commit) it had a tendency to cache a different type than the type one would find via other means. The two types would compare =:=, but possibly not == and definitely not eq. (I still don't understand what == is expected to do with types.)
* Name boolean arguments in src/compiler.Jason Zaugg2013-03-051-3/+3
| | | | | | | | | | What would you prefer? adaptToMemberWithArgs(tree, qual, name, mode, false, false) Or: adaptToMemberWithArgs(tree, qual, name, mode, reportAmbiguous = false, saveErrors = false)
* Normalized TRUE/FALSE trees in the pattern matcher.Paul Phillips2012-12-121-5/+0
| | | | | | There's no longer any need to maintain a distinction, as the tree sharing among literals which it is trying to avoid no longer takes place.
* Eliminated some sources of tree sharing.Paul Phillips2012-12-121-9/+11
| | | | | | | | | | | | | | | | | | | | | | Tracking shared trees led to various perpetrators, the simplest of which are addressed herein. More consideration will be required: we need to approach the problem with sufficient command to assure both that trees are only shared when safe (which might without architectural changes be "never") but also that we do not duplicate definition trees unless it is appropriate. Why do we care about tree sharing? Sometimes, a lot of the time even, you can get away with sharing trees - but that's also why it's responsible for all kinds of trouble. If the compiler would break obviously and immediately then we wouldn't be doing it. The danger of sharing is that one piece of an AST may undergo a transformation or mutation and an unrelated piece of the AST will be partially dragged into the change. The danger has become more urgent with the arrival of macros. The first step in preventing tree sharing mishaps is to reduce the amount the compiler does so whatever is left is a lot easier to see. As a happy accident, it will also fix bugs.
* Remove Name -> TermName implicit.Paul Phillips2012-12-011-1/+1
| | | | And simplify the name implicits.
* Remove code from compiler central.Paul Phillips2012-11-201-53/+4
| | | | | All those old-timey methods whose melodies have become unfashionable.
* Revert "Commenting out unused members."Paul Phillips2012-11-191-38/+38
| | | | This reverts commit 951fc3a486.
* Commenting out unused members.Paul Phillips2012-11-191-38/+38
| | | | | | | | | | | | | | | | | | 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".
* Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
|
* 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.
* Hunting down eliminable :: allocations.Paul Phillips2012-08-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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 ```
* Part II of the Lazy Vals Saga: Saving bitmap by the Three Musketeers: Byte, ↵Hubert Plociniczak2012-05-041-0/+6
| | | | Int and Long. And Boolean (hey, he also deserves some credit!).
* Various improvements to SIP 18 diagnostics. Made scala library and compiler ↵Martin Odersky2012-04-121-0/+1
| | | | feature clean.
* Less laborious type application.Paul Phillips2012-04-091-1/+1
| | | | | And eliminating redundancy. Reduced gratuitous usage of typeConstructor on symbols which don't have type parameters.
* splice in typed, dup'ed, trees for TRUE and FALSEAdriaan Moors2012-03-231-0/+5
| | | | | sharing trees is bad also, substing in untyped trees into typed outer trees is not good for your health
* Specialized NonLocalReturnControl.Paul Phillips2012-02-271-5/+3
| | | | From the extempore archive of already implemented things.
* Cleanup in aisle New.Paul Phillips2012-02-181-3/+3
| | | | More trees created more uniformly.
* Consolidated misc collections helper methods.Paul Phillips2012-01-051-1/+1
| | | | Streamlining some of our more common operations.
* Cleanups in TypeApply creation and casting.Paul Phillips2011-11-191-4/+1
| | | | | | | | | There's every hint that it's a requirement that a TypeApply have non-empty typeArgs, but testing for and handling the empty condition is done irregularly. Made a mkTypeApply which handles the isEmpty case (returning "fun" unchanged.) Also unified most of the variations of casts under one umbrella. Review by moors.
* misc fixes while working on virtualizing patter...Adriaan Moors2011-10-201-1/+1
| | | | | | | | misc fixes while working on virtualizing pattern matching not directly related to pattern matching, though review by extempore
* Misc smoothing of tree creation, no review.Paul Phillips2011-07-111-29/+12
|
* Triumph over various unsolved mysteries of the ...Paul Phillips2011-06-161-6/+0
| | | | | | | Triumph over various unsolved mysteries of the pattern matcher. More elimination of redundant ways of doing things. More allowing the typer to do its typing thing. No review.
* A few minor hashcode tidbits I had stored away ...Paul Phillips2011-01-271-8/+16
| | | | | | A few minor hashcode tidbits I had stored away from previous hashcoding, and some fixups in treedsl. No review.
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Integrating feedback from martin and iulian int...Paul Phillips2010-09-281-6/+4
| | | | | | Integrating feedback from martin and iulian into recent patches and prettifying checker output. No review.
* Fixed an ancient crasher in explicitouter invol...Paul Phillips2010-09-281-0/+1
| | | | | | Fixed an ancient crasher in explicitouter involving singleton self-types. Closes #266, review by odersky.
* Some progress on reviving TreeCheckers, plus a ...Paul Phillips2010-09-241-6/+3
| | | | | | | | Some progress on reviving TreeCheckers, plus a couple bugfixes and better error messages revealed by that progress. Also applied tiny increment in understanding to fixing up TreeDSL some more. The hand of martin guides from above, so no review.
* Mostly a setup commit.Paul Phillips2010-09-191-18/+97
| | | | | | | impressively tedious it is to work directly with the AST, so I picked up TreeDSL again and fleshed it out some more. And then I did a once over on SyntheticMethods beating out bits of duplication. No review.
* A crasher in the pattern matcher revealed a fla...Paul Phillips2010-07-011-9/+13
| | | | | | A crasher in the pattern matcher revealed a flaw in how equality comparisons were constructed. Closes #3570, no review.
* Changed the script runner mechanism to alchemiz...Paul Phillips2010-05-231-4/+4
| | | | | | | | Changed the script runner mechanism to alchemize from AST atoms rather than generating wrapper source, and fixed script position reporting. This patch does not include a discussed change to mark some positions as synthetic. Closes #3119, #3121. Review by milessabin.
* Swapped the order of the arguments to returning...Paul Phillips2010-05-151-1/+1
| | | | | | | | | | | Swapped the order of the arguments to returning to make it consistent with the way I've been using it for a long time. No review, how about a question for nobody in particular instead: can we put this in the library somewhere so I can stop looking around for it everywhere I go? It's really handy. def returning[T](x: T)(f: T => Unit): T = { f(x) ; x }
* Overhauled sequence length logic in the pattern...Paul Phillips2010-05-121-0/+1
| | | | | | | | Overhauled sequence length logic in the pattern matcher. Removes unnecessary boxing and a few varieties of wrongness. Closes #3395, #3150, #2958, #2945, #2187. No review.
* Fixes for #3126.Paul Phillips2010-03-061-4/+7
| | | | | | null, and thrown MatchErrors don't NPE trying to stringify null. No review.
* Fix for #2365.Paul Phillips2010-01-151-1/+4
| | | | | | | | | | | | | | a soft reference around cached classes so they do not interfere with garbage collection. There is a test case, but it is in pending because I spent longer trying to get it to fail under partest than I did writing the actual patch. If you would like to see the behavior which was corrected, go to test/pending/run/bug2365 and run that script with scalac built before and after this commit. Review by dubochet.
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* Cleanup of Cleanup.Paul Phillips2009-11-211-0/+4
| | | | | duplicated boxing code in the right location.
* Removed some duplicated functions.Paul Phillips2009-11-121-12/+1
|
* Breaking down the matcher's various Mix* classe...Paul Phillips2009-10-091-0/+2
| | | | | | Breaking down the matcher's various Mix* classes into direct expressions of condition/success/failure.
* 1) Removed a bunch of unnecessary calls to the ...Paul Phillips2009-10-081-6/+1
| | | | | | | 1) Removed a bunch of unnecessary calls to the typer. 2) Reworked exhaustiveness checking so I can tell what it's doing. 3) Cruft falls away left, right, and center.
* Yet further encapsulation in the pattern matcher.Paul Phillips2009-09-301-5/+6
| | | | | Added -Ypmat-debug setting.
* Equality tests emerging from the pattern matche...Paul Phillips2009-09-291-0/+7
| | | | | | Equality tests emerging from the pattern matcher should no longer involve unnecessary boxing.