diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-01-31 21:09:24 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-01-24 23:01:20 +0300 |
commit | 8b87327d4a3e8145c5716ec4883c497d86739281 (patch) | |
tree | dcbe3893d3e2cff2c784d7622a413f520bf41ad0 /src/reflect/scala/reflect/internal/transform/Transforms.scala | |
parent | f22ddce265e8622e95f5e9cab4d38168bf2c3bf8 (diff) | |
download | scala-8b87327d4a3e8145c5716ec4883c497d86739281.tar.gz scala-8b87327d4a3e8145c5716ec4883c497d86739281.tar.bz2 scala-8b87327d4a3e8145c5716ec4883c497d86739281.zip |
SI-6411 reflection is now aware of posterasure
The `transformedType` method, which is used to bring Scala types to Java
world, was written in pre-valueclass times. Therefore, this method only
called transforms from erasure, uncurry and refChecks.
Now runtime reflection becomes aware of posterasure and as a consequence
methods, which have value classes in their signatures, can be called
without having to wrap them in catch-a-crash clause.
Another facet to this fix was the realization that value classes need
to be unwrapped, e.g. C(2) needs to be transformed to just 2, when they
are used naked in method signatures (i.e. `c` in `def foo(c: C)` needs
to be unwrapped, whereas `cs: List[C]`, `cs: C*` and even `cs: Array[C]`
do not).
Diffstat (limited to 'src/reflect/scala/reflect/internal/transform/Transforms.scala')
-rw-r--r-- | src/reflect/scala/reflect/internal/transform/Transforms.scala | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/transform/Transforms.scala b/src/reflect/scala/reflect/internal/transform/Transforms.scala index fa185db22f..296ccde443 100644 --- a/src/reflect/scala/reflect/internal/transform/Transforms.scala +++ b/src/reflect/scala/reflect/internal/transform/Transforms.scala @@ -26,17 +26,20 @@ trait Transforms { self: SymbolTable => private val refChecksLazy = new Lazy(new { val global: Transforms.this.type = self } with RefChecks) private val uncurryLazy = new Lazy(new { val global: Transforms.this.type = self } with UnCurry) private val erasureLazy = new Lazy(new { val global: Transforms.this.type = self } with Erasure) + private val postErasureLazy = new Lazy(new { val global: Transforms.this.type = self } with PostErasure) def refChecks = refChecksLazy.force def uncurry = uncurryLazy.force def erasure = erasureLazy.force + def postErasure = postErasureLazy.force def transformedType(sym: Symbol) = - erasure.transformInfo(sym, - uncurry.transformInfo(sym, - refChecks.transformInfo(sym, sym.info))) + postErasure.transformInfo(sym, + erasure.transformInfo(sym, + uncurry.transformInfo(sym, + refChecks.transformInfo(sym, sym.info)))) def transformedType(tpe: Type) = - erasure.scalaErasure(uncurry.uncurry(tpe)) + postErasure.elimErasedValueType(erasure.scalaErasure(uncurry.uncurry(tpe))) } |