summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2010-03-29 12:53:07 +0000
committerMartin Odersky <odersky@gmail.com>2010-03-29 12:53:07 +0000
commit97515089566b5f138d3a5cb73769d54178d210d4 (patch)
tree547121bced007c255017d36f3cd21966624aaac3
parent83c817f84c7268a1ba729f8e0ef90336906bfc58 (diff)
downloadscala-97515089566b5f138d3a5cb73769d54178d210d4.tar.gz
scala-97515089566b5f138d3a5cb73769d54178d210d4.tar.bz2
scala-97515089566b5f138d3a5cb73769d54178d210d4.zip
Closes #2386 by requiring class manifests for a...
Closes #2386 by requiring class manifests for an array element type if a class manifaest for the array type is demanded. Review by dubochet.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala3
-rw-r--r--test/files/neg/t2386.check4
-rw-r--r--test/files/neg/t2386.scala3
3 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index ab933227fb..c83fd1bcb2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -784,6 +784,7 @@ self: Analyzer =>
inferImplicit(tree, appliedType(manifestClass.typeConstructor, List(tp)), true, false, context).tree
def findSubManifest(tp: Type) = findManifest(tp, if (full) FullManifestClass else OptManifestClass)
+ def findElemManifest(tp: Type) = findManifest(tp, if (full) FullManifestClass else PartialManifestClass)
def mot(tp0: Type): Tree = {
val tp1 = tp0.normalize
@@ -800,7 +801,7 @@ self: Analyzer =>
} else if (sym == RepeatedParamClass || sym == ByNameParamClass) {
EmptyTree
} else if (sym == ArrayClass && args.length == 1) {
- manifestFactoryCall("arrayType", args.head, findSubManifest(args.head))
+ manifestFactoryCall("arrayType", args.head, findElemManifest(args.head))
} else if (sym.isClass) {
val suffix = gen.mkClassOf(tp1) :: (args map findSubManifest)
manifestFactoryCall(
diff --git a/test/files/neg/t2386.check b/test/files/neg/t2386.check
new file mode 100644
index 0000000000..2caa46c731
--- /dev/null
+++ b/test/files/neg/t2386.check
@@ -0,0 +1,4 @@
+t2386.scala:2: error: could not find implicit value for evidence parameter of type scala.reflect.ClassManifest[Array[_ >: java.lang.String with Int]]
+ val a = Array(Array(1, 2), Array("a","b"))
+ ^
+one error found
diff --git a/test/files/neg/t2386.scala b/test/files/neg/t2386.scala
new file mode 100644
index 0000000000..56146cc5c3
--- /dev/null
+++ b/test/files/neg/t2386.scala
@@ -0,0 +1,3 @@
+object Test {
+ val a = Array(Array(1, 2), Array("a","b"))
+}