diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2010-09-23 15:51:13 +0000 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2010-09-23 15:51:13 +0000 |
commit | 43babf744b90aa8d1ca08d58c71e51b48bd6f731 (patch) | |
tree | a49dda6ad6e18cec86167d0879f53749920e0348 | |
parent | a3aa8993d2ed9314206c1fbd2d5b56879f91bb0f (diff) | |
download | scala-43babf744b90aa8d1ca08d58c71e51b48bd6f731.tar.gz scala-43babf744b90aa8d1ca08d58c71e51b48bd6f731.tar.bz2 scala-43babf744b90aa8d1ca08d58c71e51b48bd6f731.zip |
closes #3800.
appliedType goes under annotations.
removed some dead code in isSubtypeHK0.
review by rytz
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t3800.scala | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index a82f292ed2..07d63d62d2 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -2656,6 +2656,7 @@ A type's typeSymbol should never be inspected directly. case RefinedType(parents, decls) => RefinedType(parents map (appliedType(_, args)), decls) // MO to AM: please check case TypeBounds(lo, hi) => TypeBounds(appliedType(lo, args), appliedType(hi, args)) case tv@TypeVar(_, constr) => tv.applyArgs(args) + case AnnotatedType(annots, underlying, self) => AnnotatedType(annots, appliedType(underlying, args), self) case ErrorType => tycon case WildcardType => tycon // needed for neg/t0226 case _ => abort(debugString(tycon)) @@ -4398,11 +4399,10 @@ A type's typeSymbol should never be inspected directly. || tp2.typeSymbol == AnyClass // @M Any and Nothing are super-type resp. subtype of every well-kinded type || // @M! normalize reduces higher-kinded case to PolyType's - ((tp1.normalize, tp2.normalize) match { + ((tp1.normalize.withoutAnnotations , tp2.normalize.withoutAnnotations) match { case (PolyType(tparams1, res1), PolyType(tparams2, res2)) => // @assume tp1.isHigherKinded && tp2.isHigherKinded (as they were both normalized to PolyType) tparams1.length == tparams2.length && { - if (tparams1.isEmpty) res1 <:< res2 // fast-path: monomorphic nullary method type - else if (tparams1.head.owner.isMethod) { // fast-path: polymorphic method type -- type params cannot be captured + if (tparams1.head.owner.isMethod) { // fast-path: polymorphic method type -- type params cannot be captured (tparams1 corresponds tparams2)((p1, p2) => p2.info.substSym(tparams2, tparams1) <:< p1.info) && res1 <:< res2.substSym(tparams2, tparams1) } else { // normalized higher-kinded type @@ -4421,7 +4421,7 @@ A type's typeSymbol should never be inspected directly. // val tpsFresh = tparams1 map (_.cloneSymbol) // for (tpFresh <- tpsFresh) tpFresh.setInfo(tpFresh.info.substSym(tparams1, tpsFresh)) } - } + } && annotationsConform(tp1.normalize, tp2.normalize) case (_, _) => false // @assume !tp1.isHigherKinded || !tp2.isHigherKinded // --> thus, cannot be subtypes (Any/Nothing has already been checked) })) diff --git a/test/files/pos/t3800.scala b/test/files/pos/t3800.scala new file mode 100644 index 0000000000..796eb268c5 --- /dev/null +++ b/test/files/pos/t3800.scala @@ -0,0 +1,6 @@ +class meh extends StaticAnnotation + +class ALike[C] +abstract class AFactory[CC[x] <: ALike[CC[x]]] { + def aCompanion : AFactory[CC @meh] +}
\ No newline at end of file |