summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-09-17 15:09:11 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-09-17 15:09:11 +0200
commit40c388aa948807d893837937c6fdaa313c556f8f (patch)
tree8503c8756d8d169520fb62d91872b1d101ef0d23
parent564ea863e6da9a0a5b778a4aefe6108f4745cab5 (diff)
downloadscala-40c388aa948807d893837937c6fdaa313c556f8f.tar.gz
scala-40c388aa948807d893837937c6fdaa313c556f8f.tar.bz2
scala-40c388aa948807d893837937c6fdaa313c556f8f.zip
Reflection no longer produces faux existentials
Because of using plain ExistentialType factory of a case class typeToScala sometimes returned existentials with empty quantifieds. Changing ExistentialType to newExistentialType, which simply returns the underlying types if params are empty, fixed the problem.
-rw-r--r--src/reflect/scala/reflect/runtime/JavaMirrors.scala2
-rw-r--r--test/files/run/reflection-java-crtp.check2
-rw-r--r--test/files/run/reflection-java-crtp.scala2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/reflect/scala/reflect/runtime/JavaMirrors.scala b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
index 08f3922758..8ea371f2d2 100644
--- a/src/reflect/scala/reflect/runtime/JavaMirrors.scala
+++ b/src/reflect/scala/reflect/runtime/JavaMirrors.scala
@@ -1028,7 +1028,7 @@ trait JavaMirrors extends internal.SymbolTable with api.JavaUniverse { thisUnive
val pre = sym.owner.thisType
val args0 = japplied.getActualTypeArguments
val (args, bounds) = targsToScala(pre.typeSymbol, args0.toList)
- ExistentialType(bounds, typeRef(pre, sym, args))
+ newExistentialType(bounds, typeRef(pre, sym, args))
case jarr: GenericArrayType =>
arrayType(typeToScala(jarr.getGenericComponentType))
case jtvar: jTypeVariable[_] =>
diff --git a/test/files/run/reflection-java-crtp.check b/test/files/run/reflection-java-crtp.check
index 0f30b453c0..9fd305a7af 100644
--- a/test/files/run/reflection-java-crtp.check
+++ b/test/files/run/reflection-java-crtp.check
@@ -14,7 +14,7 @@ scala> // make sure that the E's in Enum<E extends Enum<E>> are represented
scala> val e1 = enum.typeParams(0).asType
e1: reflect.runtime.universe.TypeSymbol = type E
-scala> val TypeBounds(_, ExistentialType(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _))))) = e1.typeSignature
+scala> val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.typeSignature
e2: reflect.runtime.universe.TypeSymbol = type E
scala> println(e1 eq e2)
diff --git a/test/files/run/reflection-java-crtp.scala b/test/files/run/reflection-java-crtp.scala
index 87c7972d87..1b08b3c6bb 100644
--- a/test/files/run/reflection-java-crtp.scala
+++ b/test/files/run/reflection-java-crtp.scala
@@ -7,7 +7,7 @@ object Test extends ReplTest {
val enum = typeOf[SimpleEnumeration].baseClasses(1).asClass
// make sure that the E's in Enum<E extends Enum<E>> are represented by the same symbol
val e1 = enum.typeParams(0).asType
- val TypeBounds(_, ExistentialType(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _))))) = e1.typeSignature
+ val TypeBounds(_, TypeRef(_, _, List(TypeRef(_, e2: TypeSymbol, _)))) = e1.typeSignature
println(e1 eq e2)
"""