diff options
author | Martin Odersky <odersky@gmail.com> | 2009-09-21 12:50:04 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-09-21 12:50:04 +0000 |
commit | d5b02c8652d7edbdfb0b5a02570d370d3bad299f (patch) | |
tree | f57063402f8a83cd3f7caf437afedbdb279be400 /src/compiler/scala/tools/nsc/typechecker/Implicits.scala | |
parent | ced5ee337f45d0209ec3e7c69a6e04e956257ec0 (diff) | |
download | scala-d5b02c8652d7edbdfb0b5a02570d370d3bad299f.tar.gz scala-d5b02c8652d7edbdfb0b5a02570d370d3bad299f.tar.bz2 scala-d5b02c8652d7edbdfb0b5a02570d370d3bad299f.zip |
new arrays are done.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index dbc90e569b..49e4b0758b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -602,14 +602,14 @@ self: Analyzer => private def manifestOfType(tp: Type, full: Boolean): Tree = { /** Creates a tree that calls the factory method called constructor in object reflect.Manifest */ - def manifestFactoryCall(constructor: String, args: Tree*): Tree = + def manifestFactoryCall(constructor: String, tparg: Type, args: Tree*): Tree = if (args contains EmptyTree) EmptyTree else typed { atPos(tree.pos.focus) { Apply( TypeApply( Select(gen.mkAttributedRef(if (full) FullManifestModule else PartialManifestModule), constructor), - List(TypeTree(tp)) + List(TypeTree(tparg)) ), args.toList ) @@ -623,7 +623,7 @@ self: Analyzer => def mot(tp0: Type): Tree = tp0.normalize match { case ThisType(_) | SingleType(_, _) => - manifestFactoryCall("singleType", gen.mkAttributedQualifier(tp0)) + manifestFactoryCall("singleType", tp, gen.mkAttributedQualifier(tp0)) case ConstantType(value) => manifestOfType(tp0.deconst, full) case TypeRef(pre, sym, args) => @@ -631,15 +631,17 @@ self: Analyzer => typed { atPos(tree.pos.focus) { Select(gen.mkAttributedRef(FullManifestModule), sym.name.toString) }} - } else if (sym.isClass) { + } else if (sym == ArrayClass && args.length == 1) { + manifestFactoryCall("arrayType", args.head, findSubManifest(args.head)) + } else if (sym.isClass) { val suffix = gen.mkClassOf(tp0) :: (args map findSubManifest) manifestFactoryCall( - "classType", + "classType", tp, (if ((pre eq NoPrefix) || pre.typeSymbol.isStaticOwner) suffix else findSubManifest(pre) :: suffix): _*) } else if (sym.isAbstractType && !sym.isTypeParameterOrSkolem && !sym.isExistential) { manifestFactoryCall( - "abstractType", + "abstractType", tp, findSubManifest(pre) :: Literal(sym.name.toString) :: findManifest(tp0.bounds.hi) :: (args map findSubManifest): _*) } else { EmptyTree // a manifest should have been found by normal searchImplicit @@ -647,7 +649,7 @@ self: Analyzer => case RefinedType(parents, decls) => // refinement is not generated yet if (parents.length == 1) findManifest(parents.head) - else manifestFactoryCall("intersectionType", parents map (findSubManifest(_)): _*) + else manifestFactoryCall("intersectionType", tp, parents map (findSubManifest(_)): _*) case ExistentialType(tparams, result) => mot(result) case _ => |