summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
Commit message (Collapse)AuthorAgeFilesLines
* Javadoc: fix problems in community buildJakob Odersky2016-08-131-0/+8
| | | | | | | - fix initialization NPE in doc headers - fix assertion errors for java fields - ignore comments when deciding where to put interface methods - consider DocDefs when checking for constructors
* Merge commit 'ec05aeb' into topic/merge-2.10.xJason Zaugg2014-05-081-0/+10
|\
| * SI-8479 Fix constructor default args under scaladocJason Zaugg2014-04-071-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `DocDef` node hid the `DefDef` constructor from the scrutinee of the namer when determining if the class had constructor defaults or not. The current pattern for fixing these bugs is to delegate the check to `TreeInfo`, and account for the wrapper `DocDef` node. I've followed that pattern, but expressed my feelings about this approach in a TODO comment. Before this patch, the enclosed test failed with: error: not enough arguments for constructor SparkContext: (master: String, appName: String)SparkContext
* | SI-7335 Don't import Predef._ in Predef.scalaJason Zaugg2013-04-081-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for this was foiled by the introduction of DeprecatedPredef in c26a8db0. This didn't cause any harm, but in any case this commit restores the intended state of affairs. The change is visible only through logging; no test case is included. qbin/scalac -Ydebug -Ylog:all src/library/scala/Predef.scala -Ystop-after:typer 2>&1 | grep -i "Omitted import of Predef" [log namer] Omitted import of Predef._ for Predef.scala [log typer] Omitted import of Predef._ for Predef.scala A redundant override of `firstDefinesClassOrObject` is also removed. Maybe we can remove the special case altogether?
* | Boxing cleanup: erasure, post-erasure, value classes.Paul Phillips2013-02-201-0/+59
| | | | | | | | | | | | | | | | | | | | | | Introduces extractors for value class trees. Puts them to work to make the value class tree manipulations believable. Eliminated some boxing code in erasure which had been marked "maybe subsumed by posterasure?" after deciding that it had been subsumed by posterasure. Added some same-bytecode tests involving value class boxing (actually the lack thereof.)
* | Remove code from compiler central.Paul Phillips2012-11-201-5/+0
| | | | | | | | | | All those old-timey methods whose melodies have become unfashionable.
* | Revert "Commenting out unused members."Paul Phillips2012-11-191-3/+3
| | | | | | | | This reverts commit 951fc3a486.
* | Commenting out unused members.Paul Phillips2012-11-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+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
|
* Revised restrictions for value classes and unversal traitsMartin Odersky2012-10-031-7/+0
| | | | | | | | | and brought compiler in line with them. One thing we can accept IMO are nested classes (nested objects are still a problem). In fact, it makes no sense to exclude nested classes from value classes but not from universal traits. A class nested in universal trait will becomes a class nested in a value class by inheritance. Note that the reflection library already contains a universal trait with a nested class (IndexedSeqLike), so we should accept them if we can.
* Eliminate breaking relative names in source.Paul Phillips2012-09-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* 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 ```
* A boatload of work on Symbols and Flags.Paul Phillips2012-04-051-1/+1
| | | | | | | Finally my dream of orderliness is within sight. It's all pretty self-explanatory. More polymorphism, more immutable identity, more invariants.
* All steps of value class proposal implemented. Most restrictions are now ↵Martin Odersky2012-02-131-3/+3
| | | | enforced. Super calls and specialized still missing.
* intermediate work towards a new starr for value classes.Martin Odersky2012-02-031-0/+7
|
* inline method expansion codeMartin Odersky2012-01-291-0/+4
|
* Adding some Sets/Maps to perRunCaches, and elim...Paul Phillips2011-07-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Adding some Sets/Maps to perRunCaches, and eliminating ambiguously named imports. Did a tour of the compiler adding a few longer-lived mutable structures to the per-run cache clearing mechanism. Some of these were not a big threat, but there is (almost) literally no cost to tracking them and the fewer mutable structures which are created "lone wolf style" the easier it is to spot the one playing by his own rules. While I was at it I followed through on long held ambition to eliminate the importing of highly ambiguous names like "Map" and "HashSet" from the mutable and immutable packages. I didn't quite manage elimination but it's pretty close. Something potentially as pernicious which I didn't do much about is this import: import scala.collection._ Imagine coming across that one on lines 407 and 474 of a 1271 file. That's not cool. Some poor future programmer will be on line 1100 and use "Map[A, B]" in some function and only after the product has shipped will it be discovered that the signature is wrong and the rocket will now be crashing into the mountainside straightaway. No review.
* Refactored reflection into reflect.api and refl...Martin Odersky2011-07-111-0/+45
| | | | | | Refactored reflection into reflect.api and reflect.internal. Severed the last remaining dependency on reflect.generic. Review by extempore.
* And the remainder of the scala.reflect refactor...Paul Phillips2011-05-161-387/+0
| | | | | | And the remainder of the scala.reflect refactoring (think of it like a "balloon payment") no review.
* Made -Yno-predef work again, also in the repl.Paul Phillips2011-05-071-25/+32
| | | | | | | do I import" code to notice _root_.scala.Predef too. Moved some of the overly specialized, called-only-once functions in treeInfo inside the one function which needs them. References #1931. No review.
* lazy val calls shouldn't be included in pure ex...Hubert Plociniczak2011-02-241-1/+1
| | | | | | | lazy val calls shouldn't be included in pure expressions in general. closes 4047. fixed also bug in optimizer (was eliminating a.foo call in the test). review by dragos
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* introduce NullaryMethodType to disambiguate Pol...Adriaan Moors2011-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce NullaryMethodType to disambiguate PolyType motivation: given `def foo[T]: (T, T)` and `type Foo[T] = (T, T)`, `foo.info` and `TypeRef(_, Foo, Nil).normalize` are both `PolyType(List(T), Pair[T, T])` uncurry has been relying on an ugly hack to distinguish these cases based on ad-hoc kind inference without this distinction, the type alias's info (a type function) would be transformed to `PolyType(List(T), MethodType(Nil, Pair[T, T]))` anonymous type functions are being used more often (see #2741, #4017, #4079, #3443, #3106), which makes a proper treatment of PolyTypes more pressing change to type representation: PolyType(Nil, tp) -> NullaryMethodType(tp) PolyType(tps, tp) -> PolyType(tps, NullaryMethodType(tp)) (if the polytype denoted a polymorphic nullary method) PolyType(Nil, tp) is now invalid the kind of a PolyType is * iff its resulttype is a NullaryMethodType or a MethodType (i.e., it's a polymorphic value) in all other cases a PolyType now denotes a type constructor NullaryMethodType is eliminated during uncurry pickling: for backwards compatibility, a NullaryMethodType(tp) is still pickled as a PolyType(Nil, tp), unpickling rewrites pre-2.9-pickled PolyTypes according to the expected kind of the unpickled type (similar to what we used to do in uncurry) a pickled PolyType(Nil, restpe) is unpickled to NullaryMethodType(restpe) a pickled PolyType(tps, restpe) is unpickled to PolyType(tps, NullaryMethodType(restpe)) when the type is expected to have kind * the rewrite probably isn't complete, but was validated by compiling against the old scalacheck jar (which has plenty of polymorphic nullary methods) nevertheless, this commit includes a new scalacheck jar summary of the refactoring: * PolyType(List(), tp) or PolyType(Nil, tp) or PolyType(parms, tp) if params.isEmpty ==> NullaryMethodType(tp) * whenever there was a case PolyType(tps, tp) (irrespective of tps isEmpty), now need to consider the case PolyType(tps, NullaryMethodType(tp)); just add a case NullaryMethodType(tp), since usually: - there already is a PolyType case that recurses on the result type, - the polytype case applied to empty and non-empty type parameter lists alike * tp.resultType, where tp was assumed to be a PolyType that represents a polymorphic nullary method type before, tp == PolyType(tps, res), now tp == PolyType(tps, NullaryMethodType(res)) * got bitten again (last time was dependent-method types refactoring) by a TypeMap not being the identity when dropNonConstraintAnnotations is true (despite having an identity apply method). Since asSeenFrom is skipped when isTrivial, the annotations aren't dropped. The cps plugin relies on asSeenFrom dropping these annotations for trivial types though. Therefore, NullaryMethodType pretends to never be trivial. Better fix(?) in AsSeenFromMap: `if(tp.isTrivial) dropNonContraintAnnotations(tp) else ...` TODO: scalap and eclipse review by odersky, rytz
* Investigating what can be done about our 2000 o...Paul Phillips2010-12-311-2/+7
| | | | | | | | | | Investigating what can be done about our 2000 or so closures created via by-name calls takes me through uncurry with a mop. Sifting through compiler generated classfiles I am horrified at one example of decadent closure creation perpetrated by a certain extempore. CompilerCommand goes from 28 classfiles to 16 and manages to get smaller anyway anyway. Some people just can't be trusted with closures. No review.
* More elimination of avoidable calls to List#len...Paul Phillips2010-12-211-1/+1
| | | | | More elimination of avoidable calls to List#length. No review.
* It's a big one!Paul Phillips2010-12-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TermName and TypeName are exposed throughout the compiler based on what kind of name a given abstraction ought to have. (There remain places where one needs to create a name without knowing yet what it will be, and those will always be Names.) The nme object in the compiler now holds only term names. To reference a known type name, use tpnme: nme.List == ("List": TermName) tpnme.List == ("List": TypeName) The contents of nme and tpname are defined in traits, many of which are shared, so if a name should exist only as a Type and not a Term, it should be defined in CompilerTypeNames, but otherwise in CompilerTermNames or CompilerCommonNames. This is partially complete but I'm sure there are still many shared which should pick a side. Usage of .toTermName and .toTypeName is strongly discouraged. After the dust has settled, there will be very few places where it will make sense to hop between namespaces like that. There are some implicits to smooth everything out, most of which should be removable eventually. // these two are in no hurry to go anywhere String => TermName String => TypeName // but not String => Name: def view in the compiler is no longer implicit // these two are temporary, and can log when they kick off to help us flush // out remaining issues of "name migration" Name => TermName Name => TypeName There is more work to be done before we're properly protected from naming errors, but I will not allow another eight hour tragedy to befall lukas or anyone else! Review by rytz. (Formality.)
* Determined that half a dozen ways of checking f...Paul Phillips2010-11-041-44/+40
| | | | | | | | | | | Determined that half a dozen ways of checking for varargs and by-name-ness in param lists exceeded the legal limit. Also assessed that names which are only used as type names would be a lot easier to deal with if we created them as type names up front. Performed the changes implied by the preceding along with a partial cleanup on TreeInfo which one can see hasn't had a good look in a long time. (And still hasn't.) No review.
* One more mr.Paul Phillips2010-11-021-4/+1
| | | | | | | | This performs some Name related organization: putting similar name machinery in the same place, renaming some things to be consistent with the other things, giving some names to naked strings, beating back the creeping "if (forMSIL)" tests into class polymorphism, etc. No review.
* One of those annoying patches for which I apolo...Paul Phillips2010-11-021-3/+3
| | | | | | | | | | One of those annoying patches for which I apologize in advance. It's a step toward a better world. Almost all the changes herein are simple transformations of "x hasFlag FOO" to "x.isFoo", with the remainder minor cleanups. It's too big to review, so let's say no review: but I'm still all ears for input on the issues mostly outlined in HasFlags.scala.
* Encapsulating name strings in StdNames and elim...Paul Phillips2010-10-111-6/+4
| | | | | | Encapsulating name strings in StdNames and eliminating misc duplication. No review.
* Close #3835, review by extemporeLukas Rytz2010-09-141-1/+1
|
* Correct fix for see #3726.Lukas Rytz2010-08-111-0/+7
|
* close #7226.Lukas Rytz2010-08-091-2/+0
|
* Fail more gracefully on > 22 case class paramet...Paul Phillips2010-07-021-0/+6
| | | | | | Fail more gracefully on > 22 case class parameters. Closes #3631, no review.
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* Fixed bug in update method visibility which cau...Paul Phillips2010-04-211-14/+17
| | | | | | | Fixed bug in update method visibility which caused x += y not to find x's update method when defined generically. Closes #3278. Already reviewed by odersky.
* fix bootstrap library build. review by oderskyLukas Rytz2010-04-201-6/+7
|
* lifted out core compiler data structures into r...Martin Odersky2010-02-011-1/+1
| | | | | | lifted out core compiler data structures into reflect.generic package. Made Unpickler work on generic data.
* A compact tree printer, for primitives like mys...Paul Phillips2010-01-301-0/+17
| | | | | | | | | A compact tree printer, for primitives like myself who do all their debugging in the console and need extraneous information filtered out. New option: -Ycompact-trees. Supply that in conjunction with -Xprint:all and suddenly the output is a (relative) masterpiece of concision. Review by anyone who is game to review such a thing. Community?
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* Finally completed the incredibly tedious task o...Paul Phillips2009-11-181-9/+0
| | | | | | Finally completed the incredibly tedious task of removing the lower case primitive aliases from Predef. Had to rebuild msil.jar along the way.
* fix cyclic reference errors in scaladoc.Lukas Rytz2009-11-041-7/+7
|
* new classpaths.Lukas Rytz2009-10-261-5/+6
|
* Fix and test case for #2512, plus lots of time ...Paul Phillips2009-10-251-1/+1
| | | | | | | | Fix and test case for #2512, plus lots of time expended tuning HashSet starting sizes and growth rate, with almost nothing to show for it (but I did determine that "shadowed" is constructed identically something like 10,000 times, so there is probably a cache to be had there.)
* Another warning for -Xstrict-warnings.Paul Phillips2009-10-221-1/+12
| | | | | | | beloved try/catch blocks which swallow all comers. Realized that two warnings are already one too many to combine under a single option, and broke them out into individual options.
* Removed long dead AST Node Sequence.Paul Phillips2009-10-151-1/+0
| | | | | | | | detritus from regular expression patterns, but Star still depends on REGPATmode existing -- nothing checks for that mode specifically, but not having it set causes failure. So it is renamed to STARmode.
* new starr, with some changes to varargs handling.Martin Odersky2009-09-171-2/+4
|
* switch to unnested packages.Martin Odersky2009-07-241-2/+3
|
* Fix and post/neg test cases for #1878.Paul Phillips2009-07-181-0/+12
|