summaryrefslogtreecommitdiff
path: root/src/reflect
Commit message (Collapse)AuthorAgeFilesLines
...
| * | SI-7439 Avoid NPE in `isMonomorphicType` with stub symbols.Jason Zaugg2013-06-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `originalInfo` can return null for stub symbols; deal with that as we used to before a regression in 016bc3db. After this change, we can once again delete A_1.class and still compile code instantiating B_1. (A_1 is only referred to in a method signature of B_1 which is not called from our code.) scala> new B_1 warning: Class A_1 not found - continuing with a stub. res0: B_1 = B_1@5284b8f9 In practice, this situation arises when someone uses a third party class that was compiled against other libraries not avaialable on the current compilation classpath.
* | | Merge branch '2.10.x' into topic/merge-v2.10.2-RC1-35-ga54d86b-to-masterJason Zaugg2013-06-102-10/+5
|\ \ \ | | | | | | | | | | | | | | | | Conflicts: src/partest/scala/tools/partest/DirectTest.scala
| * \ \ Merge pull request #2629 from retronym/ticket/7558Paul Phillips2013-06-081-1/+1
| |\ \ \ | | | | | | | | | | SI-7558 Fix capture of free local vars in toolbox compiler
| | * | | SI-7558 Fix capture of free local vars in toolbox compilerJason Zaugg2013-06-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | It was creating an `ObjectRef[<notype>]` because of a small bug in `capturedVariableType`.
| * | | | Merge pull request #2626 from retronym/ticket/7556Adriaan Moors2013-06-051-9/+4
| |\ \ \ \ | | |/ / / | |/| | | SI-7556 Fix runtime reflection involving ScalaLongSignature
| | * | | SI-7556 Fix runtime reflection involving ScalaLongSignatureJason Zaugg2013-06-051-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scala type information is stored in classfiles in encoded in a String in the ScalaSignature annotation. When it is too big for a single String, it is split into an array of Strings in a different annotation, ScalaLongSignature. The enclosed test, with a class containing 3000 methods, uses the latter. It exposes a bug in the way runtime reflection decodes that data. It must concatentate and *then* decode, rather that the other way around.
* | | | | Eliminate needless Options.Paul Phillips2013-06-086-41/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many of our core types have dedicated sentinels which serve perfectly to communicate "no value", even more perfectly than None. Saving a billion allocations is gravy.
* | | | | Merge pull request #2622 from scalamacros/pullrequest/paradisePaul Phillips2013-06-073-42/+51
|\ \ \ \ \ | |_|_|/ / |/| | | | Backport from paradise/macros
| * | | | unifies handling of T's in various analyses of Foo[T]'sEugene Burmako2013-06-072-39/+47
| | | | |
| * | | | fixes a crash on a degenerate macro definitionEugene Burmako2013-06-071-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previous version of the MacroImplReference extractor didn't take into the account the fact that RefTree.qualifier.symbol can be null (and it can be null if RefTree is an Ident, because then qualifier is an EmptyTree). This led to NPEs for really weird macro defs that refer to local methods as their corresponding macro impls. Now I check for this corner case, and the stuff now longer crashes. This was wrong; this is how I fixed it; the world is now a better place.
* | | | | Merge pull request #2582 from paulp/pr/SubstTypeMapAdriaan Moors2013-06-052-4/+14
|\ \ \ \ \ | | | | | | | | | | | | Cache the most recently created SubstTypeMap.
| * | | | | Cache the most recently created SubstTypeMap.Paul Phillips2013-05-222-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I discovered that a 1-element cache for SubstTypeMaps gave a 75-90% hit rate.
* | | | | | Merge pull request #2605 from JamesIry/weak_hashset_uniquesGrzegorz Kossakowski2013-06-043-50/+414
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7149 Use a WeakHashSet for type uniqueness
| * | | | | | Modify perRunCaches to not leak WeakReferencesJames Iry2013-06-041-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | perRunCaches was using a HashMap of WeakReferences which meant it would accumulate WeakReferences over time. This commit uses a WeakHashSet instead so that the references are cleaned up.
| * | | | | | SI-7149 Use a WeakHashSet for type uniquenessJames Iry2013-06-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently type uniqueness is done via a HashSet[Type], but that means the Types live through an entire compile session, even ones that are used once. The result is a huge amount of unnecessarily retained memory. This commit uses a WeakHashSet instead so that Types and their WeakReferences are cleaned up when no longer in use.
| * | | | | | SI-7150 Replace scala.reflect.internal.WeakHashSetJames Iry2013-06-041-38/+409
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces scala.reflect.internal.WeakHashSet with a version that * extends the mutable.Set trait * doesn't leak WeakReferences * is unit tested
* | | | | | | Merge branch 'pr/merge-2.10.2' into masterPaul Phillips2013-06-042-8/+23
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * pr/merge-2.10.2: SI-7375 ClassTag for value class aliases SI-7507 Fix lookup of private[this] member in presence of self type. SI-7532 Fix regression in Java inner classfile reader SI-7517 Fix higher kinded type inference regression SI-7516 Revert "SI-7234 Make named args play nice w. depmet types" A test case for a recent LUB progression. SI-7421 remove unneeded extra-attachement in maven deploy SI-7486 Regressions in implicit search. SI-7509 Avoid crasher as erronous args flow through NamesDefaults SI-6138 Centralize and refine detection of `getClass` calls SI-7497 Fix scala.util.Properties.isMac SI-7473 Bad for expr crashes postfix Increase build.number to 2.10.3 SI-7391 Always use ForkJoin in Scala actors on ... ... Java 6 and above (except when the porperty actors.enableForkJoin says otherwise) Reimplementing much of the DefaultPromise methods Optimizations: 1) Avoiding to call 'synchronized' in tryComplete and in tryAwait 2) Implementing blocking by using an optimized latch so no blocking ops for non-blockers 3) Reducing method size of isCompleted to be cheaper to inline 4) 'result' to use Try.get instead of patmat c.typeCheck(silent = true) now suppresses ambiguous errors Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/reflect/macros/contexts/Typers.scala src/compiler/scala/reflect/reify/package.scala src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/library/scala/concurrent/impl/Promise.scala src/reflect/scala/reflect/internal/Types.scala
| * \ \ \ \ \ \ Merge remote-tracking branch 'origin/2.10.2' into pr/mergePaul Phillips2013-06-031-4/+3
| |\ \ \ \ \ \ \ | | |_|_|_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/2.10.2: SI-7532 Fix regression in Java inner classfile reader SI-7517 Fix higher kinded type inference regression SI-7516 Revert "SI-7234 Make named args play nice w. depmet types" SI-7486 Regressions in implicit search. SI-7509 Avoid crasher as erronous args flow through NamesDefaults
| | * | | | | | SI-7517 Fix higher kinded type inference regressionJason Zaugg2013-05-301-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Discovered in 2.10.2-RC1 - Ostensibly regressed in 7e52fb910b, which conceptually reverted part of 0cde930b so that (mutable) TypeVars don't use structural equality. - But, does *not* fail if 7e52fb910b is cherry-picked directly after 0cde930b, suggesting that it shone a light on a behaviour change in some other commit in between the two. - Indeed, the true regression came in https://github.com/scala/scala/commit/e5da30b843#L5L3176 - A targeted revert of e5da30b843 is undesirable, as we'd like SI-6846 to stay fixed What's happening here? In the enclosed test case, higher kinded type inference explores two possibilities: Composed.this.Split[A] K[[T]A[B[T]]] // `Split[A]` dealiased The difference in the flow of type inference can be seen from the diff below. Notice how now we no longer register `?K.addBound(Composed.this.Split)`, we instead only register `?K.addBound(K)` ```patch --- sandbox/old.log 2013-05-30 00:27:34.000000000 +0200 +++ sandbox/new.log 2013-05-30 00:28:28.000000000 +0200 @@ -1,55 +1,114 @@ ?K.unifyFull(Composed.this.Split[A]) ?K.unifySpecific(Composed.this.Split[A]) - ?K.addBound(Composed.this.Split) ?B.unifyFull(T) ?B.unifySpecific(T) `-> false ?B.unifyFull(Any) ?B.unifySpecific(Any) `-> false `-> false ?K.unifySpecific(L[[T]A[B[T]]]) - ?K.addBound(L) ?B.unifyFull(B[T]) ?B.unifySpecific(B[T]) ?B.addBound(B) `-> true ?B.unifyFull(B[T]) ?B.unifySpecific(B[T]) ?B.addBound(B) `-> true ?B.unifyFull(B[T]) ?B.unifySpecific(B[T]) ?B.addBound(B) `-> true ?B.unifyFull(B[T]) ?B.unifySpecific(B[T]) ?B.addBound(B) `-> true + ?K.addBound(L) `-> true ?K.unifyFull(Composed.this.Split[A]) ?K.unifySpecific(Composed.this.Split[A]) - ?K.addBound(Composed.this.Split) ?B.unifyFull(x) ?B.unifySpecific(x) `-> false `-> false ?K.unifySpecific(L[[T]A[B[T]]]) + ?B.unifyFull(B[T]) + ?B.unifySpecific(B[T]) + ?B.addBound(B) + `-> true + ?B.unifyFull(B[T]) + ?B.unifySpecific(B[T]) + ?B.addBound(B) + `-> true + ?B.unifyFull(B[T]) + ?B.unifySpecific(B[T]) + ?B.addBound(B) + `-> true + ?B.unifyFull(B[T]) + ?B.unifySpecific(B[T]) + ?B.addBound(B) + `-> true ?K.addBound(L) + `-> true +?K.unifyFull(Composed.this.Split[A]) + ?K.unifySpecific(Composed.this.Split[A]) + ?B.unifyFull(T) + ?B.unifySpecific(T) + `-> false + ?B.unifyFull(Any) + ?B.unifySpecific(Any) + `-> false + `-> false + ?K.unifySpecific(L[[T]A[B[T]]]) ?B.unifyFull(B[T]) ?B.unifySpecific(B[T]) ?B.addBound(B) `-> true ?B.unifyFull(B[T]) ?B.unifySpecific(B[T]) ?B.addBound(B) `-> true ?B.unifyFull(B[T]) ?B.unifySpecific(B[T]) ?B.addBound(B) `-> true ?B.unifyFull(B[T]) ?B.unifySpecific(B[T]) ?B.addBound(B) `-> true + ?K.addBound(L) + `-> true +?K.unifyFull(Composed.this.Split[A]) + ?K.unifySpecific(Composed.this.Split[A]) + ?B.unifyFull(x) + ?B.unifySpecific(x) + `-> false + `-> false + ?K.unifySpecific(L[[T]A[B[T]]]) + ?B.unifyFull(B[T]) + ?B.unifySpecific(B[T]) + ?B.addBound(B) + `-> true + ?B.unifyFull(B[T]) + ?B.unifySpecific(B[T]) + ?B.addBound(B) + `-> true + ?B.unifyFull(B[T]) + ?B.unifySpecific(B[T]) + ?B.addBound(B) + `-> true + ?B.unifyFull(B[T]) + ?B.unifySpecific(B[T]) + ?B.addBound(B) + `-> true + ?K.addBound(L) + `-> true +?K.unifyFull(L[A]) + ?K.unifySpecific(L[A]) + ?K.addBound(L) + `-> true +?K.unifyFull(L[A]) + ?K.unifySpecific(L[A]) + ?K.addBound(L) `-> true ```
| * | | | | | | SI-7507 Fix lookup of private[this] member in presence of self type.Jason Zaugg2013-05-311-2/+10
| | |_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the following code: trait Cake extends Slice trait Slice { self: Cake => // must have self type that extends `Slice` private[this] val bippy = () // must be private[this] locally(bippy) } `ThisType(<Slice>)`.findMember(bippy)` excluded the private local member on the grounds that the first class in the base type sequence, `Cake`, was not contained in `Slice`. scala> val thisType = typeOf[Slice].typeSymbol.thisType thisType: $r.intp.global.Type = Slice.this.type scala> thisType.baseClasses res6: List[$r.intp.global.Symbol] = List(trait Cake, trait Slice, class Object, class Any) This commit changes `findMember` to use the symbol of the `ThisType`, rather than the first base class, as the location of the selection.
| * | | | | | SI-6138 Centralize and refine detection of `getClass` callsJason Zaugg2013-05-231-2/+10
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `getClass` is special cased in the compiler; this is described in in the comments on `Definitions.Any_getClass`. Part of this happens in `Typer#stabilize`. This was trying to determine if an Ident or Select node was a call to `getClass` by merits of the name of the tree's symbol and by checking that the its type (if it was a MethodType or PolyType) had no parameters in the primary parameter list. Overloaded user defined `getClass` methods confused this check. In the enclosed test case, the tree `definitions.this.getClass` had an `OverloadedType`, and such types always report an empty list of `params`. This commit: - changes `stabilize` to use `isGetClass`, rather than the homebrew check - changes `isGetClass` to consider a `Set[Symbol]` containing all `getClass` variants. This moves some similar code from `Erasure` to `Definitions` - keeps a fast negative path in `isGetClass` based on the symbol's name
| * | | | | Merge pull request #2536 from adriaanm/ticket-7359Adriaan Moors2013-05-171-6/+11
| |\ \ \ \ \ | | | | | | | | | | | | | | [backport #1727] SI-7359 cyclic nested java class
| | * | | | | [backport #1727] SI-7359 cyclic nested java classAdriaan Moors2013-05-161-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original commit message (from 54a84a36d5): SI-6548 reflection correctly enters jinners When completing Java classes, runtime reflection enumerates their fields, methods, constructors and inner classes, loads them and enters them into either the instance part (ClassSymbol) or the static part (ModuleSymbol). However unlike fields, methods and constructors, inner classes don't need to be entered explicitly - they are entered implicitly when being loaded. This patch fixes the double-enter problem, make sure that enter-on-load uses the correct owner, and also hardens jclassAsScala against double enters that can occur in a different scenario.
| * | | | | | [nomaster] unbreaks test.bcEugene Burmako2013-05-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The optimizer behaves unexpectedly smartly, stripping off unused private methods. Unfortunately, sometimes private methods might be compiled down to public Java methods, so stripping them off might lead to binary incompatibilities. This particular commit recovers from this problem caused by https://github.com/scala/scala/commit/5e715396af.
* | | | | | | Revert "SI-7517 type constructors too eagerly normalized."Paul Phillips2013-06-033-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 14534c693d2eb6acafaf8244c14b5643388fbd67. It turns out this approach was breaking the working variations in the submitted test case even as it was unbreaking the unworking one, but I never managed to uncomment them. Fortunately retronym's test case was not so lackadaisical.
* | | | | | | Merge pull request #2597 from paulp/issue/7520Paul Phillips2013-06-032-33/+86
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7520 bug in subtyping.
| * | | | | | | SI-7520 bug in subtyping.Paul Phillips2013-05-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | isSubType, if given two SingleTypes, would check =:= and stop there. It is necessary to continue with weakening the left hand side, because (for instance) the singleton type on the left hand side could be a refinement class carrying parents which are themselves single or constant types.
| * | | | | | | Eliminated the shared logic.Paul Phillips2013-05-311-32/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gave isSubType and isSameType a more closely parallel structure to reduce both current and future duplication.
| * | | | | | | New method typeRelationPreCheck.Paul Phillips2013-05-311-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Utilizes TriState from previous commit. Consolidates code which had been duplicated across isSubType and isSameType.
| * | | | | | | Add a TriState value class.Paul Phillips2013-05-311-0/+26
| | |_|/ / / / | |/| | | | | | | | | | | | | | | | | | | Sometimes true and false aren't enough.
* | | | | | | Merge pull request #2615 from paulp/issue/7517Paul Phillips2013-06-033-25/+10
|\ \ \ \ \ \ \ | |_|_|_|_|/ / |/| | | | | | SI-7517 type constructors too eagerly normalized.
| * | | | | | SI-7517 type constructors too eagerly normalized.Paul Phillips2013-05-313-25/+10
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I think 403eadd0f1 was largely a symptomatic remedy (not that we shouldn't harden against such outcomes) and that this commit gets closer to the root causes. The unanticipated change to test/files/run/t6113.check is like a cry of support from the jury box. -Foo[[X](Int, X)] +Foo[AnyRef{type l[X] = (Int, X)}#l] We should continue to look at calls to normalize with grave suspicion.
* | | | | | Merge pull request #2577 from scalamacros/pullrequest/paradiseEugene Burmako2013-06-0311-356/+466
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | Backport from paradise/macros
| * | | | | more refactoring and explanations in importersEugene Burmako2013-06-021-48/+54
| | | | | |
| * | | | | changes some definitions to use Symbol.mapEugene Burmako2013-05-281-25/+25
| | | | | |
| * | | | | refactors macro compilationEugene Burmako2013-05-287-4/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upgrades the way that macro defs are compiled by factoring out most of the logic in typedMacroBody and related errors in ContextErrors into an standalone cake. This leads to tighter cohesion and better code reuse as the cake is isolated from the rest of the compiler and is much easier to evolve than just a method body. Increased convenience of coding macro compilation allowed me to further clarify the implementation of the macro engine (e.g. take a look at Validators.scala) and to easily implement additional features, namely: 1) Parameters and return type of macro implementations can now be plain c.Tree's instead of previously mandatory c.Expr's. This makes macros more lightweight as there are a lot of situations when one doesn't need to splice macro params (the only motivation to use exprs over trees). Also as we're on the verge of having quasiquotes in trunk, there soon will be no reason to use exprs at all, since quasiquotes can splice everything. 2) Macro implementations can now be defined in bundles, standalone cakes built around a macro context: http://docs.scala-lang.org/overviews/macros/bundles.html. This further reduces boilerplate by simplifying implementations complex macros due to the fact that macro programmers no longer need to play path-dependent games to use helpers.
| * | | | | refactors importersEugene Burmako2013-05-281-318/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces better names, factors out recreation of symbols, trees, types and completes into separate methods, so that they can be overridden in specialized importers. The original motivation for this refactoring was to support JIT compilation of macros, but I think that most of the introduced improvements to code quality will be useful in trunk.
| * | | | | macro engine refactoringEugene Burmako2013-05-281-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Macro impl bindings now store more information in signatures. Previously it was a flattened List[Int] corresponding to flattened paramss, now it's List[List[Int]] to preserve the lengths of parameter lists. Also now we distinguish between c.Expr parameters and others. Previously actual and reference macro signatures were represented as tuples of vparamss, rets, and sometimes tparams. Now they are all abstracted behind MacroImplSig. Finally this patch provides better error messages in cases of argsc <-> paramsc and argc <-> paramc mismatches.
| * | | | | less magic in fast track macrosEugene Burmako2013-05-273-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have a mechanism to declare not implemented macros, let's put it to good use by reducing the amount of magic applied to fast track.
* | | | | | Merge pull request #2592 from paulp/issue/7088Paul Phillips2013-05-311-1/+5
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | SI-7088 Array crasher in erasure.
| * | | | | SI-7088 Array crasher in erasure.Paul Phillips2013-05-271-1/+5
| |/ / / / | | | | | | | | | | | | | | | | | | | | The usual business where half our pattern matches are missing half the necessary cases.
* / / / / Make all numeric coercions explicit.Paul Phillips2013-05-277-11/+14
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimistically, this is preparation for a day when we don't let numeric types drift with the winds. Even without the optimism it's a good idea. It flushed out an undocumented change in the math package object relative to the methods being forwarded (a type is widened from what is returned in java) so I documented the intentionality of it. Managing type coercions manually is a bit tedious, no doubt, but it's not tedious enough to warrant abandoning type safety just because java did it.
* | | | Print raw types correctly.Paul Phillips2013-05-261-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "For convenience, these are usable as stub implementations" bit has generated surprisingly few angry letters, but I noticed today it blows it on raw types. Or, used to blow it. /** As seen from class Sub, the missing signatures are as follows. * For convenience, these are usable as stub implementations. * (First one before this commitw as 'def raw(x$1: M_1)' */ def raw(x$1: M_1[_ <: String]): Unit = ??? def raw(x$1: Any): Unit = ???
* | | | Merge pull request #2585 from paulp/pr/concision-contributionPaul Phillips2013-05-2612-125/+119
|\ \ \ \ | | | | | | | | | | Concision contribution.
| * | | | Concision contribution.Paul Phillips2013-05-2312-117/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
| * | | | Avoid caching different types in TypeSymbol.Paul Phillips2013-05-231-8/+14
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Try to prevent TypeSymbols from caching a different typeref for tpe_* and typeConstructor if the symbol is monomorphic. I find this undesirable: scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor res0: Boolean = true scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor res1: Boolean = false
* | | | Merge pull request #2574 from paulp/issue/3425Paul Phillips2013-05-241-8/+15
|\ \ \ \ | |/ / / |/| | | SI-3425 erasure crash with refinement members.
| * | | SI-3425 erasure crash with refinement members.Paul Phillips2013-05-211-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Checking that a refinement class symbol does not override any symbols does mean it will have to be invoke reflectively; but the converse is not true. It can override other symbols and still have to be called reflectively, because the overridden symbols may also be defined in refinement classes. scala> class Foo { type R1 <: { def x: Any } ; type R2 <: R1 { def x: Int } } defined class Foo scala> typeOf[Foo].member(TypeName("R2")).info.member("x": TermName).overrideChain res1: List[$r.intp.global.Symbol] = List(method x, method x) scala> res1 filterNot (_.owner.isRefinementClass) res2: List[$r.intp.global.Symbol] = List() And checking that "owner.info decl name == this" only works if name is not overloaded. So the logic is all in "isOnlyRefinementMember" now, and let's hope that suffices for a while.
* | | | Merge pull request #2568 from scalamacros/topic/abstractfile-classloaderEugene Burmako2013-05-223-1/+248
|\ \ \ \ | |/ / / |/| | | Moves AbstractFileClassLoader to scala-reflect.jar
| * | | Moves AbstractFileClassLoader to scala-reflect.jarEugene Burmako2013-05-203-1/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Its string name was used in ReflectionUtils and became broken after repl got factored out. This hints that that classloader belongs to where it is used, i.e. to scala-reflect.jar. Moreover AbstractFile is defined in scala-reflect.jar, so it's only logical to also define a derived classloader in scala-reflect.jar.