summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala10
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala3
-rwxr-xr-xtest/files/pos/t0227.scala31
3 files changed, 40 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 25c34bcce8..0754313be3 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -1320,9 +1320,13 @@ trait Types {
sym.isModuleClass || sym == AllClass || isValueClass(sym) || super.isNotNull
// @M: propagate actual type params (args) to `tp', by replacing formal type parameters with actual ones
- def transform(tp: Type): Type =
- tp.asSeenFrom(pre, sym.owner).instantiateTypeParams(sym.typeParams, argsMaybeDummy)
+ def transform(tp: Type): Type = {
+ val args = argsMaybeDummy
+ if (args.length == sym.typeParams.length)
+ tp.asSeenFrom(pre, sym.owner).instantiateTypeParams(sym.typeParams, argsMaybeDummy)
+ else { assert(args exists (_.isError)); tp }
// @M TODO maybe we shouldn't instantiate type params if isHigherKinded -- probably needed for partial type application though
+ }
//@M! use appliedType on the polytype that represents the bounds (or if aliastype, the rhs)
def transformInfo(tp: Type): Type =
@@ -3552,7 +3556,7 @@ A type's typeSymbol should never be inspected directly.
else {
def lubBounds(bnds: List[TypeBounds]): TypeBounds =
mkTypeBounds(glb(bnds map (_.lo), depth-1), lub(bnds map (_.hi), depth-1))
- recycle(proto.owner.newAbstractType(proto.pos, proto.name))
+ recycle(lubRefined.typeSymbol.newAbstractType(proto.pos, proto.name))
.setInfo(lubBounds(symtypes map (_.bounds)))
}
}
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index 53d02d4569..4c61981c9d 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -162,7 +162,8 @@ abstract class Pickler extends SubComponent {
putType(lo); putType(hi)
case RefinedType(parents, decls) =>
val rclazz = tp.typeSymbol
- assert(decls.elements forall (_.owner == rclazz))
+ for (m <- decls.elements)
+ if (m.owner != rclazz) assert(false, "bad refinement member "+m+" of "+tp+", owner = "+m.owner)
putSymbol(rclazz); putTypes(parents); putSymbols(decls.toList)
case ClassInfoType(parents, decls, clazz) =>
putSymbol(clazz); putTypes(parents); putSymbols(decls.toList)
diff --git a/test/files/pos/t0227.scala b/test/files/pos/t0227.scala
new file mode 100755
index 0000000000..a52a9798fc
--- /dev/null
+++ b/test/files/pos/t0227.scala
@@ -0,0 +1,31 @@
+final class Settings {
+ def f[T](a_args: T*): List[T] = Nil
+}
+
+abstract class Factory {
+ type libraryType <: Base
+
+ final def apply(settings: Settings): libraryType = error("bla")
+}
+
+abstract class Base {
+ val settings: Settings
+
+ protected val demands: List[Factory] = Nil
+}
+
+class SA(val settings: Settings) extends Base {
+ override val demands = List(
+ SD
+ ) ::: settings.f(
+ SC
+ )
+}
+
+object SC extends Factory {
+ type libraryType = Base
+}
+
+object SD extends Factory {
+ type libraryType = SA
+}