summaryrefslogtreecommitdiff
path: root/src/reflect
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #1665 from paulp/issue/6687Adriaan Moors2012-11-251-1/+1
|\ | | | | Fix for SI-6687, wrong isVar logic.
| * Fix for SI-6687, wrong isVar logic.Paul Phillips2012-11-241-1/+1
| | | | | | | | | | Fields which back lazy vals need to be excluded via !isLazy lest isVar return true.
* | Merge remote-tracking branch 'origin/2.10.0-wip' into merge-2.10.wip-xPaul Phillips2012-11-235-39/+106
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # By Jason Zaugg (8) and others # Via Adriaan Moors (6) and Josh Suereth (5) * origin/2.10.0-wip: Removing controversial `either` method from Futures API. SI-6624 set info of case pattern binder to help find case field accessors Fixes SI-6628, Revert "Fix for view isEmpty." SI-6661 - Remove obsolete implicit parameter of scala.concurrent.promise method 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 Update comment. SI-6646 `ident` or Ident is always new binding. SI-6440 Address regressions around MissingRequirementError Refine the message and triggering of MissingRequirementError. SI-6640 Better reporting of deficient classpaths. SI-6644 Account for varargs in extmethod forwarder SI-6646 Fix regression in for desugaring. Update tools/epfl-publish
| * Merge pull request #1607 from retronym/ticket/6640Josh Suereth2012-11-193-21/+31
| |\ | | | | | | SI-6640 Better reporting of deficient classpaths.
| | * SI-6440 Address regressions around MissingRequirementErrorJason Zaugg2012-11-133-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Go back to using globalError to report when a stub's info is referenced, and only throw the MissingRequirementError when compilation really must abort due to having a StubTermSymbol in a place where a StubClassSymbol would have been a better choice. This situation arises when an entire package is missing from the classpath, as was the case in the reported bug. Adds `StoreReporterDirectTest`, which buffers messages issued during compilation for more structured interrogation. Use this in two test for manifests -- these tests were using a crude means of grepping compiler console output to focus on the relevant output, but this approach was insufficient with the new multi-line error message emitted as part of this change. Also used that base test class to add two new tests: one for the reported error (package missing), and another for a simpler error (class missing). The latter test shows how stub symbols allow code to compile if it doesn't the subset of signatures in some type that refer to a missing class. Gave the INFO/WARNING/ERROR members of Reporter sensible toString implementations; they inherit from Enumeration#Value in an unusual manner (why?) that means the built in toString of Enumeration printed `Severity@0`.
| | * Refine the message and triggering of MissingRequirementError.Jason Zaugg2012-11-103-3/+15
| | | | | | | | | | | | | | | | | | | | | - To force a failure of the stub, call a new method `failIfStub` rather than `info`. - Offer a broader range of potential root causes in the error message.
| | * SI-6640 Better reporting of deficient classpaths.Jason Zaugg2012-11-103-20/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a55788e, StubSymbols were introduced to fail-slow when the classpath was deficient. This allowed compilation to succeed in cases when one didn't actually use the part of class A which referred to some missing class B. But a few problems were introduced. Firstly, when the deferred error eventually happened, it was signalled with abort(msg), rather than through a thrown MissingRequirementError. The latter is desirable, as it doesn't lead to printing a stack trace. Second, the actual error message changed, and no longer included the name of the class file that refers to the missing class. Finally, it seems that we can end up with a stub term symbol in a situation where a class symbol is desired. An assertion in the constructor of ThisType throws trips when calling .isClass, before the useful error message from StubSymbol can be emitted. This commit addresses these points, and rewords the error a little to be more accessible. The last point is the most fragile in this arrangement, there might be some whack-a-mole required to find other places that also need this. I don't see a clean solution for this, but am open to suggestions. We should really build a facility in partest to delete specified classfiles between groups in separate compilation tests, in order to have tests for this. I'll work on that as a followup. For now, here's the result of my manual testing: [info] Set current project to default-821d14 (in build file:/Users/jason/code/scratch1/) > compile [info] Compiling 1 Scala source to /Users/jason/code/scratch1/target/scala-2.10/classes... [error] [error] while compiling: /Users/jason/code/scratch1/test.scala [error] during phase: typer [error] library version: version 2.10.0-RC2 [error] compiler version: version 2.10.0-RC2 ... [error] last tree to typer: Ident(SwingWorker) [error] symbol: <none> (flags: ) [error] symbol definition: <none> [error] symbol owners: [error] context owners: object Test -> package <empty> ... [error] uncaught exception during compilation: java.lang.AssertionError [trace] Stack trace suppressed: run last compile:compile for the full output. [error] (compile:compile) java.lang.AssertionError: assertion failed: value actors [error] Total time: 2 s, completed Nov 10, 2012 3:18:34 PM > > set scalaHome := Some(file("/Users/jason/code/scala/build/pack")) [info] Defining *:scala-home [info] The new value will be used by no settings or tasks. [info] Reapplying settings... [info] Set current project to default-821d14 (in build file:/Users/jason/code/scratch1/) ^[compile [info] Compiling 1 Scala source to /Users/jason/code/scratch1/target/scala-2.10/classes... [error] /Users/jason/code/scratch1/test.scala:4: A signature in SwingWorker.class refers to term actors in package scala which is missing from the classpath. [error] object Test extends SwingWorker [error] ^ [error] one error found [error] (compile:compile) Compilation failed [error] Total time: 2 s, completed Nov 10, 2012 3:18:45 PM
| * | Merge pull request #1615 from retronym/ticket/6648Adriaan Moors2012-11-161-0/+13
| |\ \ | | | | | | | | SI-6648 copyAttrs must preserve TypeTree#wasEmpty
| | * | SI-6648 copyAttrs must preserve TypeTree#wasEmptyJason Zaugg2012-11-141-0/+13
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This field tracks whether the type is an inferred on, subject to removal in `resetAttrs`, or an explicit type, which must remain. In ae5ff662, `ResetAttrs` was modified to duplicate trees, rather than mutate trees in place. But the tree copier didn't pass `wasEmpty` on to the new tree, which in turn meant that the subsequent typing run on the tree would not re-infer the types. If the type refers to a local class, e.g. the anonymous function in the enclosed test case, the reference to the old symbol would persist. This commit overrides `copyAttrs` in TypeTree to copy `wasEmpty`. We might consider representing this as a tree attachment, but this would need to be validated for the performance impact.
| * | Update comment.Jason Zaugg2012-11-131-1/+2
| | |
| * | SI-6646 `ident` or Ident is always new binding.Jason Zaugg2012-11-131-25/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous commit regressed in these cases: // no withFilter for (X <- List("A single ident is always a pattern")) println(X) for (`x` <- List("A single ident is always a pattern")) println(`x`) At the top level of the LHS of a <-, such identifiers represent new bindings, not stable identifier patterns.
| * | SI-6646 Fix regression in for desugaring.Jason Zaugg2012-11-101-18/+27
| |/ | | | | | | | | | | The early check in the parser of pattern irrefutability, added in c82ecab, failed to consider InitCaps and `backquoted` identifiers.
* | Merge pull request #1645 from scalamacros/ticket/6673Josh Suereth2012-11-211-0/+17
|\ \ | | | | | | SI-6673 fixes macro problems with eta expansions
| * | adds comments to standard attachmentsEugene Burmako2012-11-181-0/+15
| | |
| * | SI-6673 fixes macro problems with eta expansionsEugene Burmako2012-11-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Eta expansions previously caused the typer to disable macros. That was done in order to detect eta expansion of macro defs and show the user an appropriate error message. Macros were disabled because to find out whether we're expanding a macro def, we need to get its symbol, and to get a symbol of something we need to typecheck that something. However typechecking automatically expands macros, so, unless we disable macros, after a typecheck we won't be able to analyze macro occurrences anymore. Unfortunately this solution has a fatal flaw. By disabling macros we not only prevent the eta-expandee from macro expanding, but also all the subtrees of that eta-expandee (see SI-6673). This commit adds a mechanism for fine-grained control over macro expansion. Now it's possible to prohibit only the node, but not its children from macro expanding.
* | | Merge pull request #1624 from adriaanm/paulp-issue/5330-2.10.xAdriaan Moors2012-11-161-3/+15
|\ \ \ | | | | | | | | SI-5330, SI-6014 deal with existential self-type
| * | | SI-5330, SI-6014 deal with existential self-typeAdriaan Moors2012-11-141-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has been broken since https://github.com/scala/scala/commit/b7b81ca2#L0L567. The existential rash is treated in a similar manner as in fc24db4c. Conceptually, the fix would be `def selfTypeSkolemized = widen.skolemizeExistential.narrow`, but simply widening before narrowing achieves the same thing. Since we're in existential voodoo territory, let's go for the minimal fix: replacing `this.narrow` by `widen.narrow`. -- Original patch by @retronym in #1074, refined by @paulp to only perform widen.narrow incantation if there are existentials present in the widened type, as narrowing is expensive when the type is not a singleton. The result is that compiling the entirety of quick, that code path is hit only 143 times. All the other calls hit .narrow directly as before. It looks like the definition of negligible in the diff of -Ystatistics when compiling src/library/scala/collection: < #symbols : 306315 --- > #symbols : 306320 12c13 < #unique types : 293859 --- > #unique types : 293865 I'm assuming based on the 2/1000ths of a percent increase in symbol and type creation that wall clock is manageable, but I didn't measure it.
* | | | Merge pull request #1612 from scalamacros/topic/showrawEugene Burmako2012-11-151-2/+5
|\ \ \ \ | |/ / / |/| | | sane printing of renamed imports
| * | | sane printing of renamed importsEugene Burmako2012-11-131-2/+5
| |/ / | | | | | | | | | | | | Having a select named "foo" with an underlying symbol named "bar" and trying to make sense of all that by prettyprinting is very confusing
* | | Merge pull request #1585 from retronym/ticket/6539-2Eugene Burmako2012-11-143-0/+20
|\ \ \ | | | | | | | | SI-6539 Annotation for methods unfit for post-typer ASTs
| * | | Refine @compileTimeOnlyJason Zaugg2012-11-082-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't default the message, and show it exclusively. - Fix cut-and-pasto in the @since tag - Be tolerant if the annotaion class is missing, as seems to have been the case compiling the continuations plugin. - s/\t/ / in the test file to show the errors are positioned correctly. - Use defensive getOrElse
| * | | SI-6539 Annotation for methods unfit for post-typer ASTsJason Zaugg2012-11-063-0/+20
| |/ / | | | | | | | | | | | | | | | | | | | | | Motivated by the `.value` method in the SBT task-syntax branch, which should only be called within the context of the argument to a setting initialization macro. The facility is akin to a fatal deprecation.
* | | Merge pull request #1583 from dragos/issue/fix-6616Adriaan Moors2012-11-133-0/+9
|\ \ \ | |/ / |/| | SI-6616 Check that unsafe operations are only called on the presentation...
| * | SI-6616 Check that unsafe operations are only called on the presentation ↵Iulian Dragos2012-11-063-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | compiler thread. The method that checks the actual constraint is @elidable, expecting it to be used for nightly builds but stripped-off in release builds. This way we don't lose any performance, but 'fail-fast' in IDE nightlies. This assumes that release builds will have at least `-Xelide-below ASSERTION`, but this pull request does not do that.
* | | Merge branch '2.10.0-wip' into merge-2.10.0Josh Suereth2012-11-0590-333/+480
|\ \ \ | |/ / |/| / | |/
| * Merge pull request #1566 from densh/topic/asSeenFrom-exampleJosh Suereth2012-11-041-4/+20
| |\ | | | | | | Fixes example in Type.asSeenFrom
| | * Fixes example in Type.asSeenFromDen Shabalin2012-11-031-4/+20
| | | | | | | | | | | | | | | | | | It was written in some form of non-executable pseudo-code before and that might be quite confusing for people who are not familiar with scala reflection.
| * | Merge pull request #1559 from heathermiller/copyright-updateJosh Suereth2012-11-0455-56/+55
| |\ \ | | |/ | |/| Updated copyright dates throughout compiler and stdlib for upcoming release
| | * Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-0255-56/+55
| | |
| * | SI-6562 Fix crash with class nested in @inline methodJason Zaugg2012-11-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | e6b4204604 moved access widenings from ExplicitOuter to SuperAccessors to reflect them in pickled signatures so that the inliner can take advantage of them under separate compilation. The followup discussion [1] determined that this wasn't the right solution: while it enabled new separate compilation inlinings, it failed to widen access of outer pointers and hence prevented certain inlinings. A better solution was proposed: modify the inliner to know that access widening is guaranteed to have happened in ExplicitOuter for any field accessed by an @inline-d method body, rather than relying solely on the pickled types. But this hasn't happened yet. In the meantime 07f94297 / #1121 reinstated the access widening to SuperAccessors, but took a slightly different approach, using `Symbol#enclMethod` rather than `closestEnclMethod`. That deviation triggers SI-6562. This commit goes back to `closestEnclMethod`. [1] https://groups.google.com/forum/#!topic/scala-internals/iPkMCygzws4
| * | SI-6132 Revisited, cleaned-up, links fixed, spelling errors fixed, rewordingsHeather Miller2012-11-0226-194/+227
| | |
| * | Labeling scala.reflect and scala.reflect.macros experimental in the API docsHeather Miller2012-11-0237-56/+162
| | | | | | | | | | | | | | | - Added the labels across scala.reflect and scala.reflect.macros - Added the styling in template.css that is used by all labels
| * | Remove implementation details from Position (they are still under ↵Hubert Plociniczak2012-11-021-29/+2
| |/ | | | | | | reflection.internal). It probably needs more cleanup of the api wrt to ranges etc but let's leave it for later
| * SI-6556 no assert for surprising ctor result typeMartin Odersky2012-10-301-1/+13
| | | | | | | | | | | | | | Previous fix to value classes uncovered some questionable cases in the backend where result types of constructor signatures are surprising. It's not a big deal because these types will be ignored afterwards anyway. But the method uncovered some questionable situations which we should follow up on. However, breaking 2.9 code because of this is way too harsh. That's why the asserts were converted to warnings. review by @paulp, @adriaanm
* | Merge remote-tracking branch 'origin/2.10.0-wip' into merge-2.10.0-wipPaul Phillips2012-10-313-118/+120
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # By Jason Zaugg (5) and others # Via Josh Suereth (5) and others * origin/2.10.0-wip: Use Typed rather than .setType Wider use and a new variant of typedPos. SI-6575 Plug inference leak of AbstractPartialFun Disabled generation of _1, _2, etc. methods. SI-6526 Additional test case. Fix SI-6552, regression with self types. avoid single-art assert where harmful in duration-tck Fix for SI-6537, inaccurate unchecked warning. SI-6526 Tail call elimination should descend deeper. Changes Tree and Type members from vals to defs. Fixes SI-6170: issue with dragging scaladoc splitter over central iframe
| * Fix SI-6552, regression with self types.Paul Phillips2012-10-211-3/+5
| | | | | | | | | | | | | | | | | | In 6eb55d4b7a we put in a remedy for an old issue SI-4560 which had accumulated a number of sketchy partial remedies which carried no tests to illustrate their necessity. Looks like at least one of those was doing something useful. Here's to reversion-reversion. This reverts commit c8bdf199, which itself reverted cb4fd6582.
| * Changes Tree and Type members from vals to defs.Paul Phillips2012-10-132-115/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Explanatory email: The reflection API defines a great many abstract vals. I would like these all to be defs. I'm sending a pull request to that end. Reasons: for starters, they should default to being defs. It's a decision to use vals for which one should have to supply reasons. The reason for THAT is that defs can be implemented with vals, but not vice versa. Why does this matter? I can't find my long writing on the subject of TypeRef. In short, we waste a huge amount of memory on its fields, because given the way TypeRef is defined, each one demands a pre, a sym, and an args. Except that somewhere between 1/3 and 1/2 have prefix "NoPrefix", and somewhere between 1/3 and 1/2 have args "Nil". We know it at creation time, but we give every typeref the whole field anyway. At present there's no way to fix this which has acceptable performance - i.e. custom subclasses save us lots of memory, but are too much slower for having to use an extractor - but there's no reason we should have to choose, and I fully expect to fix it eventually. Let's not make that fix into a breaking change by abstractly defining "pre" and "args" as field-requiring vals.
* | Incorporated changes suggested in code reviewHubert Plociniczak2012-10-181-24/+19
| |
* | Closes SI-6358. Move accessor generation for lazy vals to typers.Hubert Plociniczak2012-10-181-6/+12
|/ | | | | | | | | | | | | Until now lazy accessors were handled somehow special because their symbol was created in typers but the corresponding tree was only added in Refchecks. This irregularity caused serious problems for value classes. Also it now looks just better when lazy value is treated in a similar way as other fields. I needed to adapt reifier so that it handles the new implementation correctly. Previously it had to recreate lazy val only by removing defdef and renaming. Now we basically need to recreate lazy val from scratch. There is one minor change to cps plugin but that is still fine because lazy vals were never really part of the transformation. Some range positions needed to be fixed manually. We could do it at the creation time but that would require a lot more "if (symbol.isLazy)" conditions for MethodSyntheis and Symbol/Tree creation and would just unnecessary complicate api. If someone has a better idea, please speak up. Range positions changes were necessary because previously accessors were created at refchecks and they weren't checked by validator (even though they were wrong). This commit removes lazy val implementation restriction introduced for 2.10.0. (cherry-picked from 981424b)
* JavaUniverseVlad Ureche2012-10-111-2/+1
|
* Moved @contentDiagram in SymbolsVlad Ureche2012-10-111-2/+2
|
* Adds lots of new documentation for TypeTags, Mirrors, Universes and moreHeather Miller2012-10-1119-342/+621
| | | | | Additionally includes improvements, formatting fixes, and link additions and fixes.
* runtime.JavaUniverse - put ungrouped members at the topVlad Ureche2012-10-112-2/+4
|
* Forgotten annotation in AnnotationsVlad Ureche2012-10-111-1/+1
|
* Diagram tweakingVlad Ureche2012-10-1113-7/+29
| | | | blocked by SI-6511
* Grouping for reflection and macrosVlad Ureche2012-10-1124-251/+1046
| | | | and warning cleanup
* fixes a typoEugene Burmako2012-10-111-1/+1
|
* scala.reflect.api.Symbols documentationVlad Ureche2012-10-111-50/+330
| | | | Oh those pretty groups, u gotta luv'em...
* Symbols docs cleanup, mostly moved to guideingoem2012-10-111-198/+32
|
* scala.reflect.api.Position documentationVlad Ureche2012-10-113-61/+50
|