summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | Merge pull request #991 from adriaanm/ticket-5958Paul Phillips2012-07-281-0/+15
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-5958 This deserves a stable type
| * | | | | | | SI-5958 This deserves a stable typeAdriaan Moors2012-07-261-0/+15
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `this` (or the self variable) passed as an actual argument to a method should receive a singleton type when computing the method's resultType this is necessary if the method's type depends on that argument
* | | | / / / Closed 6029 ...Martin Odersky2012-07-281-0/+3
| |_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | ... in a less nice way than I would like. Essentially, we mask type errors at later stages that arise from comparing existentials and skolems because we know that they are not tracked correctly through all tree transformations. Never mind that all these types are going erased anyway shortly afterwards. It does not smell nice. But as I write in the comment, maybe the best way out is to avoid skolems altogether. Such a change by far exceeds the scope of this pull request however.
* | | | | | Improve unchecked warnings a lot.Paul Phillips2012-07-276-6/+116
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't warn on "uncheckable" type patterns if they can be statically guaranteed, regardless of their runtime checkability. This covers patterns like Seq[Any] and lots more. Review by @adriaanm.
* | | | | Merge pull request #976 from adriaanm/ticket-4440bAdriaan Moors2012-07-253-0/+33
|\ \ \ \ \ | |/ / / / |/| | | | SI-4440 workaround: avoid outer accessor that'll vanish
| * | | | SI-4440 workaround: avoid outer accessor that'll vanishAdriaan Moors2012-07-233-0/+33
| |/ / / | | | | | | | | | | | | | | | | | | | | outer accessors of final classes are dropped in constructors apply some foresight in explicit outer and replace those doomed outer checks by `true` (since this is unfortunate, we generate an unchecked warning)
* | | | Merge pull request #966 from paulp/issue/6117Adriaan Moors2012-07-241-0/+19
|\ \ \ \ | |_|_|/ |/| | | SI-6117 regression involving import ambiguity.
| * | | Fix SI-6117, regression involving import ambiguity.Paul Phillips2012-07-211-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Today I learned that foo.member("bar") != foo.member("bar") if bar is overloaded, because each lookup of an overloaded member creates a new symbol (with equivalent OverloadedTypes.) How should symbols be compared so these do not appear unequal? Is there a method which unpacks the alternatives and compares them individually? It seems likely there are additional bugs which arise from not covering this case. Since this bug is in the context of importing, if the prefixes are identical then I can compare the names instead of the symbols and this issue goes away. But for the rest of the time during which one might encounter overloaded symbols, that would be a very lossy operation, since the overloaded symbol might be encoding any subset of the members with that name. There are lots of references to "OverloadedSymbol" in the comments of various methods in Types, but no such class is visible in the history. If we had such a thing, we could refine its equals method to recognize equivalent overloads. Review by @odersky.
* | | | Merge pull request #974 from adriaanm/repull-unchecked-hkAdriaan Moors2012-07-244-1/+29
|\ \ \ \ | | | | | | | | | | Improve unchecked warnings.
| * | | | Improve unchecked warnings.Paul Phillips2012-07-234-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | Spurious test was not good. Better test avoids suppressing some legitimate warnings. Review by @moors.
* | | | | Merge pull request #979 from adriaanm/ticket-6111Adriaan Moors2012-07-244-8/+30
|\ \ \ \ \ | |_|_|_|/ |/| | | | SI-6111 accept single-subpattern unapply pattern
| * | | | SI-6111 accept single-subpattern unapply patternAdriaan Moors2012-07-234-8/+30
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An extractor pattern `X(p)` should type check for any `X.unapply`/`X.unapplySeq` that returns an `Option[_]` -- previously we were confused about the case where it was an `Option[(T1, ... , Tn)]`. In this case, the expected type for the pattern `p` is simply `(T1, ... , Tn)`. While I was at it, tried to clean up unapplyTypeList and friends (by replacing them by extractorFormalTypes). From the spec: 8.1.8 ExtractorPatterns An extractor pattern x(p1, ..., pn) where n ≥ 0 is of the same syntactic form as a constructor pattern. However, instead of a case class, the stable identifier x denotes an object which has a member method named unapply or unapplySeq that matches the pattern. An unapply method in an object x matches the pattern x(p1, ..., pn) if it takes exactly one argument and one of the following applies: n = 0 and unapply’s result type is Boolean. n = 1 and unapply’s result type is Option[T], for some type T. the (only) argument pattern p1 is typed in turn with expected type T n > 1 and unapply’s result type is Option[(T1, ..., Tn)], for some types T1, ..., Tn. the argument patterns p1, ..., pn are typed in turn with expected types T1, ..., Tn
* / | | SI-4881 infer variance from formals, then resultMartin Odersky2012-07-232-4/+32
|/ / / | | | | | | | | | | | | | | | | | | | | | Changed behavior so that when determining the target variance of a method parameter, the variance in formals comes first. If variance is still undecided by that, the variance in the result type is used as a secondary criterion. (This is also done when determining prototype type params.)
* | | Merge pull request #964 from odersky/ticket/6090Adriaan Moors2012-07-231-0/+6
|\ \ \ | |/ / |/| | SI-6090 correct rewriting of overloaded value class ==
| * | SI-6090Martin Odersky2012-07-211-0/+6
| | | | | | | | | | | | Sharpens the test so that only Object_== and Object_!= methods on valueclasses may be rewritten in posterasure, whereas user-defined methods are not rewritten.
* | | SI-6089 test file for pt2Adriaan Moors2012-07-221-0/+18
| |/ |/| | | | | test that matchEnd that's an argument of || that's in tail position is in tail position
* | Merge pull request #958 from adriaanm/ticket-1832Josh Suereth2012-07-211-0/+8
|\ \ | |/ |/| SI-1832 consistent symbols in casedef's pattern&body
| * SI-1832 consistent symbols in casedef's pattern&bodyAdriaan Moors2012-07-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | the only change to typedBind in this commit (beyond refactoring to keep my eyes from bleeding), is explained by the added comment: have to imperatively set the symbol for this bind to keep it in sync with the symbols used in the body of a case when type checking a case we imperatively update the symbols in the body of the case those symbols are bound by the symbols in the Binds in the pattern of the case, so, if we set the symbols in the case body, but not in the patterns, then re-type check the casedef (for a second try in typedApply for example -- SI-1832), we are no longer in sync: the body has symbols set that do not appear in the patterns since body1 is not necessarily equal to body, we must return a copied tree, but we must still mutate the original bind
* | Merge pull request #954 from odersky/optimize/outerAdriaan Moors2012-07-201-0/+26
|\ \ | | | | | | Removes redundant outers
| * | Removes redundant outersMartin Odersky2012-07-201-0/+26
| | | | | | | | | | | | | | | | | | Widens the criterion when outer fields can be omitted. It used to be that sub- and superclass had to be enclosed by the same outer class. Only in that case was the outer field of the class omitted. We now omit if subclass is contained in an outer class that is itself a subclass of the superclasses outer class. See test case "outertest.scala" for an example.
* | | Merge pull request #924 from hubertp/2.10.x-issue/5385Adriaan Moors2012-07-205-4/+34
|\ \ \ | | | | | | | | Fix for SI-5385.
| * | | Fix for SI-5385.Paul Phillips2012-07-175-4/+34
| | | | | | | | | | | | | | | | | | | | Nodes which hit EOF with no whitespace afterward had wrong position.
* | | | Merge pull request #948 from gkossakowski/target-1.6Lukas Rytz2012-07-201-2/+4
|\ \ \ \ | | | | | | | | | | Deprecate all JVM 1.5 targets and make 1.6 default.
| * | | | Deprecate all JVM 1.5 targets and make 1.6 default.Grzegorz Kossakowski2012-07-191-2/+4
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a check if deprecated target is being used. I put that check into `checkDeprecatedSettings`. I tried to invent some general mechanism for deprecating choices in ChoiceSetting but I gave up eventually. It wasn't worth it the complexity. Also, with current approach I'm able to provide nice, customized deprecation warning. Make `jvm-1.6` a default backend. Altered test for SI-5957 because it crashes the backend. However, the problem is not with backend but with symbol creation. We get two different symbols with the same internal name and both are used in trees that reach GenASM. See SI-6109 for details. Review by @magarciaEPFL and @paulp.
* | | | Merge pull request #894 from axel22/topic/static-annot-cherry-2.10.xLukas Rytz2012-07-203-0/+309
|\ \ \ \ | | | | | | | | | | Implement @static annotation on singleton object fields.
| * | | | WIP add private/lazy checks and a few tests.Aleksandar2012-07-193-1/+62
| | | | |
| * | | | Implement @static annotation on singleton object fields.Aleksandar Prokopec2012-07-183-0/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces the `@static` annotation on fields of static singleton objects. A static singleton object is a top-level singleton object or an object nested within a static singleton object. The field annotated with `@static` is generated as a true static field in the companion class of the object. The initialization of the field is done in the static initializer of the companion class, instead of the object itself. Here's an example. This: object Foo { @static val FIELD = 123 } class Foo generates : object Foo { def FIELD(): Int = Foo.FIELD } class Foo { <static> val FIELD = 123 } The accessor in `object Foo` is changed to return the static field in `class Foo` (the companion class is generated if it is not already present, and the same is done for getters if `FIELD` is a `var`). Furthermore, all the callsites to accessor `Foo.FIELD` are rewritten to access the static field directly. It is illegal to annotate a field in the singleton object as `@static` if there is already a member of the same name in `class Foo`. This allows better Java interoperability with frameworks which rely on static fields being present in the class. The `AtomicReferenceFieldUpdater`s are one such example. Instead of having a Java base class holding the `volatile` mutable field `f` and a static field containing a reference to the `AtomicReferenceFieldUpdater` that mutates `f` atomically, and extending this Java base class from Scala, we can now simply do: object Foo { @static val arfu = AtomicReferenceUpdater.newUpdater( classOf[Foo], classOf[String], "f" ) } class Foo { @volatile var f = null import Foo._ def CAS(ov: String, nv: String) = arfu.compareAndSet(this, null, "") } In summary, this commit introduces the following: - adds the `@static` annotation - for objects without a companion class and `@static` members, creates a companion class (this is done in `CleanUp`) - checks for conflicting names and if `@static` is used on static singleton object member - creates the `static` field in the companion class for `@static` members - moves the field initialization from the companion object to the static initializer of the class (the initialization of `@static` members is bypassed in the `Constructors` phase, and added to static ctors in `CleanUp`) - all callsites to the accessors of `@static` are rewritten to access the static fields directly (this is done in `GenICode`) - getters and setters to `@static` fields access the static field directly, and the field in the singleton object is not emitted (this is done in `GenICode`) - changes in `GenJVM`, `GenASM` - now computing local var indices in static initializers as well - this was an oversight before, now is necessary Future work: allow the `@static` annotation on methods as well - this will be added in a future commit. Review by @odersky, @dragos, @paulp, @heathermiller.
* | | | | Merge pull request #956 from phaller/topic/sip14-critical-fix-awaitJosh Suereth2012-07-201-1/+10
|\ \ \ \ \ | | | | | | | | | | | | SIP-14 - Fix critical Java compatibility issue in scala.concurrent.Await
| * | | | | SIP-14 - Fix critical Java compatibility issue in scala.concurrent.Awaitphaller2012-07-201-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | Patch contributed by @viktorklang
* | | | | | Merge pull request #941 from adriaanm/ticket-6104Adriaan Moors2012-07-202-0/+9
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-6104 support This pattern
| * | | | | | SI-6104 support This patternAdriaan Moors2012-07-182-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This(name) is treated just like Ident(name) apparently this pattern was used in 2.9 code, though I'm not sure it's spec'ed
* | | | | | | Merge pull request #925 from VladUreche/issue/scaladocAdriaan Moors2012-07-2052-120/+1170
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix a bunch of scaladoc issues: SI-3314 SI-4888 SI-5235 SI-5558 SI-4324 SI-5780 SI-4887 SI-3695 SI-4224 SI-4497 SI-5079 SI-6073 SI-5533 SI-5784
| * | | | | | | SI-5784 Scaladoc: Type templatesVlad Ureche2012-07-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | @template and @documentable are now synomims.
| * | | | | | | Scaladoc: GroupsVlad Ureche2012-07-192-0/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Group class members based on their semantic relationship. To do this: - @group on members, only need to do it for the non-overridden members - -groups flag passes to scaladoc, groups="on" in ant - @groupdesc Group Group Description to add descriptions - @groupname Group New name for group - @groupprio Group <int> (lower is better) See test/scaladoc/run/groups.scala for a top-to-bottom example
| * | | | | | | SI-5784 Scaladoc: {Abstract,Alias} type templatesVlad Ureche2012-07-175-1/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally scaladoc won't generate template pages for anything other than packages, classes, traits and objects. But using the @template annotation on {abstract,alias} types, they get their own page and take part as full members in the diagrams. Furthermore, when looking for the companion object, if a value of type T is in scope, T will be taken as the companion object (even though it might be a class) All templates, including types are listed on the left navigation pane, so now adding @template to String can get scaladoc to generate (a no-comments) page for java.lang.String. The {abstract, alias} type icons need to be updated -- I just took the class icons and added a small x to them -- but they shoud be something else (maybe an underscore?)i TO USE THIS PATCH: <pre> /** @contentDiagram */ // tells scaladoc to create a diagram of the // templates contained in trait Base trait Base { /** @template */ // tells scaladoc to create a page for Foo type T < Foo trait Foo { def foo: Int } } /** @contentDiagram */ trait Api extends Base { /** @template */ override type T <: FooApi trait FooApi extends Foo { def bar: String } } </pre>
| * | | | | | | Scaladoc: Refactoring the entitiesVlad Ureche2012-07-164-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for SI-5784. This commit has been checked with tools/scaladoc-compare and the only difference is that the containing entities in the index are not duplicate anymore, which solves yet another bug we did not know about. :)
| * | | | | | | SI-5533 Skip scaladoc packages from documentationVlad Ureche2012-07-163-9/+38
| | | | | | | |
| * | | | | | | Scaladoc: updated type class descriptionsVlad Ureche2012-07-163-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The known type class descriptions give you a humanly-understandable explanation for [T: TypeClass] in the implicit conversions. For example [T: Integral] will tell you that T must be an integral type such as Integer and co. Now that the reflection dust settled, I can actually add the test to make sure the well-known type classes are intercepted and explanations are given instead of the usual "the type T is context-bounded by TypeClass"
| * | | | | | | SI-3695 SI-4224 SI-4497 SI-5079 scaladoc linksVlad Ureche2012-07-165-4/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the ability to link to members, classes and objects in scaladoc. The links can now be either qualified names or relative names, they both work. See the test/scaladoc/resources/links.scala for a usage example. Also introduced -no-link-warnings scaladoc flag, in case the build output gets swamped with link warnings.
| * | | | | | | SI-4887 Link existentials in scaladocVlad Ureche2012-07-164-1/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on an inital patch by Nada Amin. Rewrote some of the code to compress it a bit. Also fixed a problem that was affecting the prefix printing for typerefs: type parameter and existentials won't get prefixes. While I can imagine cases where you'd want to see where they come from, you can always hover over them and see their origin. Also added support for pretty-printing ThisTypes, SuperTypes and SingleTypes (with links)
| * | | | | | | SI-4360 Adds prefixes to scaladocVlad Ureche2012-07-168-13/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a long-standing issue in scaladoc: It was unable to disambiguate between entries with the same name. One example is: immutable.Seq: trait Seq[+A] extends Iterable[A] with Seq[A] ... What's that? Seq extends Seq? No, immutable.Seq extends collection.Seq, but scaladoc was unable to show that. Now it does, depending on the template you're in. Prefixes are relative and can go back: -scala.collection.Seq has subclasses *immutable.Seq* and *mutable.Seq* -scala.immutable.Seq extends *collection.Seq* Unfortunately the price we pay for this is high, a 20% slowdown in scaladoc. This is why there is a new flag called -no-prefixes that disables the prefixes in front of types. Btw, it also fixes the notorious "booleanValue: This member is added by an implicit conversion from Boolean to Boolean ...". That's now java.lang.Boolean, so it becomes clear. Conflicts: src/compiler/scala/tools/nsc/doc/model/diagram/DiagramFactory.scala
| * | | | | | | Scaladoc: workaround for untypical Map usecasesVlad Ureche2012-07-162-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SI-3448 partial fix: This enables a workaround for the fact that Map takes two type params while $Coll takes only one. But it doesn't fix the problem though, as there's one more piece missing from the puzzle - we need to adjust the `Coll`s in {immutable, mutable, concurrent}.Map to something that makes sense for the usecase. And that's not possible. But I'm committing this nevertheless, maybe other projects can benefit from it. And for SI-3448, the solution lies in automatic usecase generation, whenever that will be ready.
| * | | | | | | SI-4324 Scaladoc case class argument curryingVlad Ureche2012-07-162-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | case class C(i: Int)(b: Boolean) would appear uncurried in scaladoc: case class C(i: Int, b: Boolean)
| * | | | | | | SI-5558 Package object members indexingVlad Ureche2012-07-162-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug was fixed by the model upgrade in c11427c1. Test case confirmation.
| * | | | | | | SI-5965 Scaladoc crashVlad Ureche2012-07-162-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug was fixed by the model upgrade in c11427c1. Test case confirmation.
| * | | | | | | Scaladoc: Inherited templates in diagramsVlad Ureche2012-07-164-3/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to SI-3314, where we started showing inherited templates that were normally not documented. This patch corrects a problem in parentTypes that was preventing inherited templates from being displayed in diagrams. Also renamed: PackageDiagram => ContentDiagram ClassDiagram => InheritanceDiagram which should have been done much earlier
| * | | | | | | SI-3314 SI-4888 Scaladoc: Relative type prefixesVlad Ureche2012-07-1612-98/+272
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And adds support for linking to class members, only usable from the model factory now, so no links to members from the doc comment yet, sorry. But it fixes the Enumeration problem once and for all! Also corrected the inTpl for members obtained by implicit conversions, so they're in the correct template and the comment variable expansion is done from the correct (but different) template. Review by @kzys.
| * | | | | | | SI-5235 Correct usecase variable expansionVlad Ureche2012-07-162-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug is related to a couple of other annoyances, also fixed: - usecases without type params were crashing scaladoc due to a change in the PolyTypes class (not allowing empty tparams list) - properly getting rid of backticks (even if the link is not valid) - correct linking for usecases with $Coll = `immutable.Seq` (the symbol searching algorithm was too of restrictive, now we search the entire ownerchain - and the empty package at the end) - give a warning if the type lookup fails - finally, added a $Coll variable to List, for some reason it wasn't there and we were getting immutable.Seq as the result of use cases.
* | | | | | | | Merge pull request #936 from scalamacros/ticket/5999Adriaan Moors2012-07-2032-35/+180
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | SI-5999 consistent behavior for c.reify and c.universe.reify
| * | | | | | | SI-5999 a real fix to the packageless problemEugene Burmako2012-07-209-5/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After a discussion on a reflection meeting on Jul 17 we concluded that we should split staticModule into staticModule and staticPackage to remove the ambiguity between packageless objects and packageless packages (more in the comments in the body of the commit). The motivation is verbosely outlined in the comments, but the bottom line is that Scala allows packages and packageless objects to have the same name within the same program. Therefore at times we need to disambiguate, hence the introduction of the staticPackage method. As of such staticModule no longer works for packages. In the same fashion staticPackage doesn't work for modules. This is done to ensure robustness of reification. I would like to do the same for getModule in Definitions, but we have to maintain backward compatibility. That's why I retained the old behavior, but replaced getModule invocations with getPackage where appropriate to be in line with staticModule and staticPackage. Another important thing that follows from the discussion is that both staticClass and staticModule prefer parent packages over parent objects in cases of ambiguity. Say, if we have the following snippet of code: object B { class C } next to package B { class C } then staticClass("B.C") will never even consider a C inside the object B. This is how scalac operates, so we decided to be consistent here. Finally reification logic got changed to distinguish between staticModule and staticPackage, and to allow for the fact that staticClass and staticModule prefer parent packages to parent objects.