summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-03-06 14:34:23 +0000
committerPaul Phillips <paulp@improving.org>2011-03-06 14:34:23 +0000
commit64660068dd89813c7c7a09db1e783177ac31f158 (patch)
tree7190751d612160c48b1ca5c772929110db772f3e
parentbc9a3475f308e78de193e4072f11e2edb7f7a72b (diff)
downloadscala-64660068dd89813c7c7a09db1e783177ac31f158.tar.gz
scala-64660068dd89813c7c7a09db1e783177ac31f158.tar.bz2
scala-64660068dd89813c7c7a09db1e783177ac31f158.zip
Another corner involving generic signatures and...
Another corner involving generic signatures and java interop flushed out by seth tisue. Keep that detector fired up seth or the rebel alliance will surely be crushed. (In fact, I nominate you to write a test suite!) Closes #4317, no review.
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala9
-rw-r--r--test/files/pos/bug4317/J_2.java3
-rw-r--r--test/files/pos/bug4317/S_1.scala3
3 files changed, 13 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index dcc6ab044c..dad422a4a9 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -326,8 +326,13 @@ abstract class Erasure extends AddInterfaces
val paramString = if (toplevel) tparams map paramSig mkString ("<", "", ">") else ""
paramString + jsig(restpe)
case MethodType(params, restpe) =>
- "("+(params map (_.tpe) map jsig).mkString+")"+
- (if (restpe.typeSymbol == UnitClass || sym0.isConstructor) VOID_TAG.toString else jsig(restpe))
+ val ressym = restpe.typeSymbol
+ "(%s)%s".format(
+ params map (x => jsig(x.tpe)) mkString,
+ if (ressym == UnitClass || sym0.isConstructor) VOID_TAG
+ else if (isValueClass(ressym)) abbrvTag(ressym)
+ else jsig(restpe)
+ )
case RefinedType(parent :: _, decls) =>
jsig(parent)
case ClassInfoType(parents, _, _) =>
diff --git a/test/files/pos/bug4317/J_2.java b/test/files/pos/bug4317/J_2.java
new file mode 100644
index 0000000000..fc8f7ec476
--- /dev/null
+++ b/test/files/pos/bug4317/J_2.java
@@ -0,0 +1,3 @@
+class J_2 {
+ int bar() { return S_1.foo(String.class) ; }
+} \ No newline at end of file
diff --git a/test/files/pos/bug4317/S_1.scala b/test/files/pos/bug4317/S_1.scala
new file mode 100644
index 0000000000..9f368ee484
--- /dev/null
+++ b/test/files/pos/bug4317/S_1.scala
@@ -0,0 +1,3 @@
+object S_1 {
+ def foo(x: Class[_ <: AnyRef]) = 0
+}