summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/Printers.scala
Commit message (Collapse)AuthorAgeFilesLines
* SI-10097 Error if no non-implicit case class paramSom Snytt2016-12-141-1/+1
| | | | | | | | | | Case class must have a non-implicit param list. Error early, error often. Also update spec to say that class implicitly gets a non-implicit parameter section if it doesn't have one, and that a case class must have one.
* Refactor triple quote quotingSom Snytt2016-06-161-15/+15
| | | | | | | | To quote a triple quote, only quote one quote. Refactors the code for legibility. Adds test for other inline cruft like control chars.
* Avoid triple-quoting triple quotesSom Snytt2016-06-161-1/+1
| | | | | | The boolean test for triples was inadvertently flipped. Adds test for pretty printed multiline strings
* SD-70 Don't share footnotes across multiple calls to universe.showRawLukas Rytz2016-01-191-25/+23
| | | | | | | | | Before this commit, multiple invocations of universe.showRaw used a shared weak map that caches footnotes. If the two printed objects have equal components printed as footnotes, e.g., an equal TypeRef, the result of the second invocation depends on whether the object has been collected (and removed from the weak map) or not. See https://github.com/scala/scala-dev/issues/70#issuecomment-171701671
* Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-181-13/+13
| | | | | | | | | | - 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-2/+2
| | | | ... replaced by hasPackageFlag, hasSymbolIn, getterIn, setterIn.
* SI-9057 - fix `showCode` to put backticks around names including dotsJan Bessai2015-01-071-1/+2
| | | | | | | Missing backticks cause the parser to treat names as paths, which is obviously invalid. A unit test is included.
* SI-8875 showCode should print all class constructor modifiers.Antoine Gourlay2014-10-241-1/+1
| | | | | showCode used to print nothing when the only modifier was a change in visibility scope (i.e. no flags but privateWithin is set).
* TypeTree printing modified (SI-8447)VladimirNik2014-05-091-14/+27
|
* SI-8386 fixedVladimirNik2014-03-111-2/+3
|
* printOwners support added to Printers; whitespaces removedVladimirNik2014-02-201-23/+26
|
* move methods for typechecked trees processing to TreeInfoVladimirNik2014-02-201-3/+3
|
* CodePrinter: TypedTreePrinter merged with ParsedTreePrinterVladimirNik2014-02-201-123/+89
|
* lazy vals printing fixed for typechecked treesVladimirNik2014-02-201-10/+12
|
* printers flag processing improvements: printRootPkg flag fixed, comments to ↵VladimirNik2014-02-201-12/+23
| | | | flags metadata printing added
* Attributed val/var processing for syntactics (SI-8180)VladimirNik2014-02-201-26/+136
| | | | | | TypedTreesPrinter added changes based on pull request comments: print root packages flag; tests for syntactics; SyntacticEmptyTypeTree added to Printers
* Merge remote-tracking branch 'origin/master' into topic/palladium0Eugene Burmako2014-02-161-4/+7
|\ | | | | | | | | | | | | | | Conflicts: src/compiler/scala/reflect/macros/compiler/Resolvers.scala src/compiler/scala/reflect/macros/contexts/Typers.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/reflect/scala/reflect/api/BuildUtils.scala
| * Merge pull request #3397 from xeno-by/ticket/5920Jason Zaugg2014-02-161-0/+3
| |\ | | | | | | SI-5920 enables default and named args in macros
| | * introduces -Yshow-symownersEugene Burmako2014-02-101-23/+26
| | | | | | | | | | | | | | | | | | This facility, along with -Yshow-syms, has proven to be very useful when debugging problems caused by corrupt owner chains when hacking on named/default argument transformation.
| * | Move null check case higher to avoid NPEDenys Shabalin2014-02-091-27/+27
| |/ | | | | | | Also use sym.isErrorneous instead of manual name check.
* | some renamingsEugene Burmako2014-02-151-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It’s almost 1am, so I’m only scratching the surface, mechanistically applying the renames that I’ve written down in my notebook: * typeSignature => info * declarations => decls * nme/tpnme => termNames/typeNames * paramss => paramLists * allOverriddenSymbols => overrides Some explanation is in order so that I don’t get crucified :) 1) No information loss happens when abbreviating `typeSignature` and `declarations`. We already have contractions in a number of our public APIs (e.g. `typeParams`), and I think it’s fine to shorten words as long as people can understand the shortened versions without a background in scalac. 2) I agree with Simon that `nme` and `tpnme` are cryptic. I think it would be thoughtful of us to provide newcomers with better names. To offset the increase in mouthfulness, I’ve moved `MethodSymbol.isConstructor` to `Symbol.isConstructor`, which covers the most popular use case for nme’s. 3) I also agree that putting `paramss` is a lot to ask of our users. The double-“s” convention is very neat, but let’s admit that it’s just weird for the newcomers. I think `paramLists` is a good compromise here. 4) `allOverriddenSymbols` is my personal complaint. I think it’s a mouthful and a shorter name would be a much better fit for the public API.
* | SI-6931 cleans up the position APIEugene Burmako2014-02-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I have finally overcome my fear of positions and got to cleaning up its public interface. Apparently it isn’t so bad, since there’s a sane core of methods (thanks to whoever wrote the comments to internal#Position): 1) Checks to distinguish offsets, opaque ranges and transparent ranges 2) Essentials that inclide start, point, end and source 3) Factories that create new positions based on existing ones It looks like methods from the 3rd group are exactly what we’ve been looking for in SI-6931, so we have nothing to add in this commit.
* | adds showDeclaration(sym: Symbol): StringEugene Burmako2014-02-141-23/+28
|/ | | | | | As per Paul’s request, this commit exposes Symbol.defString, although in a different way to ensure consistency with our other prettyprinting facilities provided in the reflection API.
* Problem with EOL in tests for Printers is fixedVladimirNik2014-01-171-5/+7
|
* toCode renamed to showCodeVladimirNik2014-01-131-1/+1
|
* Code cleanup based on pull request commentsVladimirNik2014-01-071-65/+56
|
* Annotated trees processing is modifiedVladimirNik2014-01-071-22/+17
| | | | | 1. Problem with multiple parameter lists in annotations is resolved 2. Tests for Annotated trees are added
* Printers code refactoring and cleanupVladimirNik2014-01-051-251/+188
|
* toCode is added to PrintersVladimirNik2014-01-051-0/+615
| | | | | | 1. Printers API is updated (def toCode) 2. ParsedTreePrinter is added to internal.Printers. ParsedTreePrinter generates the code for passed unattributed trees. Generated code can be later compiled by scalac retaining the same meaning.
* val showOuterTests is removedVladimirNik2014-01-011-6/+0
| | | | val showOuterTests wasn't used in Printers
* Variance annotations printingVladimirNik2014-01-011-0/+5
| | | | def printTypeParams is modified. Tests are updated.
* SI-6762 rename emptyValDef to noSelfType.Paul Phillips2013-09-271-2/+2
| | | | | Looks like emptyValDef.isEmpty was already changed to return false, so now all that's left is a name which means something.
* Merge remote-tracking branch 'scala/2.10.x'Grzegorz Kossakowski2013-08-291-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the merge, the test/run/t7733 started to fail on Jenkins. I tried to reproduce it locally but I couldn't so I think it's system dependent failure. Per @retronym's suggestion I moved it to pending to not block the whole merge. Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala src/compiler/scala/tools/nsc/typechecker/Macros.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/util/MsilClassPath.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/reflect/scala/reflect/internal/ClassfileConstants.scala src/reflect/scala/reflect/internal/Importers.scala src/reflect/scala/reflect/internal/Trees.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala test/files/run/macro-duplicate/Impls_Macros_1.scala test/files/run/t6392b.check test/files/run/t7331c.check
| * showRaw now prints symbols of def treesEugene Burmako2013-08-101-0/+2
| | | | | | | | A very useful addition that came in handy when hacking macro annotations
| * [nomaster] Revert "introduces global.pendingSuperCall"Eugene Burmako2013-02-051-3/+1
| | | | | | | | | | | | | | | | 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
* | Absolutized paths involving the scala package.Paul Phillips2013-05-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confusing, now-it-happens now-it-doesn't mysteries lurk in the darkness. When scala packages are declared like this: package scala.collection.mutable Then paths relative to scala can easily be broken via the unlucky presence of an empty (or nonempty) directory. Example: // a.scala package scala.foo class Bar { new util.Random } % scalac ./a.scala % mkdir util % scalac ./a.scala ./a.scala:4: error: type Random is not a member of package util new util.Random ^ one error found There are two ways to play defense against this: - don't use relative paths; okay sometimes, less so others - don't "opt out" of the scala package This commit mostly pursues the latter, with occasional doses of the former. I created a scratch directory containing these empty directories: actors annotation ant api asm beans cmd collection compat concurrent control convert docutil dtd duration event factory forkjoin generic hashing immutable impl include internal io logging macros man1 matching math meta model mutable nsc parallel parsing partest persistent process pull ref reflect reify remote runtime scalap scheduler script swing sys text threadpool tools transform unchecked util xml I stopped when I could compile the main src directories even with all those empties on my classpath.
* | Simplify type bounds.Paul Phillips2013-04-201-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I started out looking to limit the noise from empty type bounds, i.e. the endless repetition of class A[T >: _root_.scala.Nothing <: _root_.scala.Any] This led me to be reminded of all the unnecessary and in fact damaging overreaches which are performed during parsing. Why should a type parameter for which no bounds are specified be immediately encoded with this giant tree: TypeBounds( Select(Select(Ident(nme.ROOTPKG), tpnme.scala_), tpnme.Nothing), Select(Select(Ident(nme.ROOTPKG), tpnme.scala_), tpnme.Any) ) ...which must then be manually recognized as empty type bounds? Truly, this is madness. - It deftly eliminates the possibility of recognizing whether the user wrote "class A[T]" or "class A[T >: Nothing]" or "class A[T <: Any]" or specified both bounds. The fact that these work out the same internally does not imply the information should be exterminated even before parsing completes. - It burdens everyone who must recognize type bounds trees, such as this author - It is far less efficient than the obvious encoding - It offers literally no advantage whatsoever Encode empty type bounds as TypeBounds(EmptyTree, EmptyTree) What could be simpler.
* | SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlagSom Snytt2013-03-271-2/+2
| | | | | | | | | | | | | | This commit shortens expressions of the form `if (settings.debug.value)` to `if (settings.debug)` for various settings. Rarely, the setting is supplied as a method argument. The conversion is not employed in simple definitions where the Boolean type would have to be specified.
* | Overhauled local/getter/setter name logic.Paul Phillips2013-03-251-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sifted through extraneous methods trying to find consistency, consolidating and deprecating as I went. The original motivation for all this was the restoration of LOCAL_SUFFIX to originalName, because: It looks like in an attempt to make originalName print consistently with decodedName, I went a little too far and stripped invisible trailing spaces from originalName. This meant outer fields would have an originalName of '$outer' instead of '$outer ', which in turn could have caused them to be mis-recognized as outer accessors, because the logic of outerSource hinges upon "originalName == nme.OUTER". I don't know if this affected anything - I noticed it by inspection, improbably enough. Deprecated originalName - original, compared to what? - in favor of unexpandedName, which has a more obvious complement. Introduced string_== for the many spots where people have given up and are comparing string representations of names. A light dusting of types is still better than nothing. Editoral note: LOCAL_SUFFIX is the worst. Significant trailing whitespace! It's a time bomb.
* | Name boolean arguments in src/reflect.Jason Zaugg2013-03-051-4/+4
| |
* | More explicit empty paren lists in method calls.Jason Zaugg2013-02-241-6/+6
| |
* | Banish needless semicolons.Jason Zaugg2013-02-241-2/+2
| |
* | Merge pull request #1812 from scalamacros/topic/showrawposEugene Burmako2012-12-301-3/+4
|\ \ | | | | | | showRaw can now print positions
| * | showRaw can now print positionsEugene Burmako2012-12-251-3/+4
| | |
* | | Changes tree pretty printer to use shorter name constructorsDen Shabalin2012-12-251-1/+1
|/ /
* | Merge branch 'merge-wip-into-2.10.x' into merge-2.10-into-masterPaul Phillips2012-12-111-2/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'merge-2.10.wip-x' into merge-2.10.x-masterPaul Phillips2012-11-231-2/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * merge-2.10.wip-x: (24 commits) SI-6023 reify abstract vals Removing controversial `either` method from Futures API. SI-6695 Test case for fixed Array match bug adds comments to standard attachments SI-6673 fixes macro problems with eta expansions Restore the opimization apparently lost after merge. SI-6624 set info of case pattern binder to help find case field accessors Scaladoc update for collection.mutable.MultiMap SI-6663: don't ignore type parameter on selectDynamic invocation SI-6551: don't insert apply call in polymorphic expression. SI-6634 Fixes data corruption issue in ListBuffer#remove Fixes SI-6628, Revert "Fix for view isEmpty." SI-6661 - Remove obsolete implicit parameter of scala.concurrent.promise method Fixes SI-6150 - backport to 2.10.x branch. SI-5330, SI-6014 deal with existential self-type Fixes SI-6559 - StringContext not using passed in escape function. SI-6648 copyAttrs must preserve TypeTree#wasEmpty Fix raw string interpolator: string parts which were after the first argument were still escaped sane printing of renamed imports SI-6440 Address regressions around MissingRequirementError ... Conflicts: src/library/scala/collection/generic/IndexedSeqFactory.scala src/library/scala/collection/mutable/ListBuffer.scala src/reflect/scala/reflect/internal/Symbols.scala src/reflect/scala/reflect/internal/Types.scala test/files/run/t6150.scala