diff options
author | Martin Odersky <odersky@gmail.com> | 2009-12-17 17:40:21 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-12-17 17:40:21 +0000 |
commit | 88683ede7df66a276835319d4d580f605420fa01 (patch) | |
tree | 6df1fa3927c09322598f9802b08ca8d0d462beeb /src | |
parent | d8ef68e6a18862ac18cd304274feb0b310dd545c (diff) | |
download | scala-88683ede7df66a276835319d4d580f605420fa01.tar.gz scala-88683ede7df66a276835319d4d580f605420fa01.tar.bz2 scala-88683ede7df66a276835319d4d580f605420fa01.zip |
Closed #2795. review by dubochet.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 10 | ||||
-rw-r--r-- | src/library/scala/reflect/ClassManifest.scala | 4 | ||||
-rw-r--r-- | src/library/scala/reflect/Manifest.scala | 4 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 2bd296b65d..34b98a8945 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -725,13 +725,14 @@ self: Analyzer => def manifestFactoryCall(constructor: String, tparg: Type, args: Tree*): Tree = if (args contains EmptyTree) EmptyTree else typedPos(tree.pos.focus) { + util.trace("manif fact ")( Apply( TypeApply( Select(gen.mkAttributedRef(if (full) FullManifestModule else PartialManifestModule), constructor), List(TypeTree(tparg)) ), args.toList - ) + )) } /** Creates a tree representing one of the singleton manifests.*/ @@ -770,10 +771,13 @@ self: Analyzer => EmptyTree // todo: change to existential parameter manifest else if (sym.isTypeParameterOrSkolem) EmptyTree // a manifest should have been found by normal searchImplicit - else + else { + val era = erasure.erasure(tp1) + val base = tp1.baseType(era.typeSymbol) manifestFactoryCall( "abstractType", tp, - findSubManifest(pre) :: Literal(sym.name.toString) :: findManifest(tp1.bounds.hi) :: (args map findSubManifest): _*) + findSubManifest(pre) :: Literal(sym.name.toString) :: gen.mkClassOf(base) :: (args map findSubManifest): _*) + } } else { EmptyTree // a manifest should have been found by normal searchImplicit } diff --git a/src/library/scala/reflect/ClassManifest.scala b/src/library/scala/reflect/ClassManifest.scala index 81c36fffcb..c8637166ee 100644 --- a/src/library/scala/reflect/ClassManifest.scala +++ b/src/library/scala/reflect/ClassManifest.scala @@ -207,9 +207,9 @@ object ClassManifest { /** ClassManifest for the abstract type `prefix # name'. `upperBound' is not * strictly necessary as it could be obtained by reflection. It was * added so that erasure can be calculated without reflection. */ - def abstractType[T](prefix: OptManifest[_], name: String, upperBound: ClassManifest[_], args: OptManifest[_]*): ClassManifest[T] = + def abstractType[T](prefix: OptManifest[_], name: String, clazz: Predef.Class[_], args: OptManifest[_]*): ClassManifest[T] = new (ClassManifest[T] @serializable) { - def erasure = upperBound.erasure + def erasure = clazz override val typeArguments = args.toList override def toString = prefix.toString+"#"+name+argString } diff --git a/src/library/scala/reflect/Manifest.scala b/src/library/scala/reflect/Manifest.scala index f425473459..9dba30911d 100644 --- a/src/library/scala/reflect/Manifest.scala +++ b/src/library/scala/reflect/Manifest.scala @@ -218,9 +218,9 @@ object Manifest { /** Manifest for the abstract type `prefix # name'. `upperBound' is not * strictly necessary as it could be obtained by reflection. It was * added so that erasure can be calculated without reflection. */ - def abstractType[T](prefix: Manifest[_], name: String, upperBound: Manifest[_], args: Manifest[_]*): Manifest[T] = + def abstractType[T](prefix: Manifest[_], name: String, clazz: Predef.Class[_], args: Manifest[_]*): Manifest[T] = new (Manifest[T] @serializable) { - def erasure = upperBound.erasure + def erasure = clazz override val typeArguments = args.toList override def toString = prefix.toString+"#"+name+argString } |