@@ -726,7 +726,7 @@ class Namer { typer: Typer =>
726
726
// the parent types are elaborated.
727
727
index(constr)
728
728
symbolOfTree(constr).ensureCompleted()
729
-
729
+
730
730
index(rest)(inClassContext(selfInfo))
731
731
732
732
val tparamAccessors = decls.filter(_ is TypeParamAccessor ).toList
@@ -807,20 +807,27 @@ class Namer { typer: Typer =>
807
807
lazy val schema = paramFn(WildcardType )
808
808
val site = sym.owner.thisType
809
809
((NoType : Type ) /: sym.owner.info.baseClasses.tail) { (tp, cls) =>
810
- val iRawInfo =
811
- cls.info.nonPrivateDecl(sym.name).matchingDenotation(site, schema).info
812
- val iInstInfo = iRawInfo match {
813
- case iRawInfo : PolyType =>
814
- if (iRawInfo.paramNames.length == typeParams.length)
815
- iRawInfo.instantiate(typeParams map (_.typeRef))
810
+ def instantiatedResType (info : Type , tparams : List [Symbol ], paramss : List [List [Symbol ]]): Type = info match {
811
+ case info : PolyType =>
812
+ if (info.paramNames.length == typeParams.length)
813
+ instantiatedResType(info.instantiate(tparams.map(_.typeRef)), Nil , paramss)
816
814
else NoType
815
+ case info : MethodType =>
816
+ paramss match {
817
+ case params :: paramss1 if info.paramNames.length == params.length =>
818
+ instantiatedResType(info.instantiate(params.map(_.termRef)), tparams, paramss1)
819
+ case _ =>
820
+ NoType
821
+ }
817
822
case _ =>
818
- if (typeParams .isEmpty) iRawInfo
823
+ if (tparams .isEmpty && paramss.isEmpty) info.widenExpr
819
824
else NoType
820
825
}
821
- val iResType = iInstInfo.finalResultType.asSeenFrom(site, cls)
826
+ val iRawInfo =
827
+ cls.info.nonPrivateDecl(sym.name).matchingDenotation(site, schema).info
828
+ val iResType = instantiatedResType(iRawInfo, typeParams, paramss).asSeenFrom(site, cls)
822
829
if (iResType.exists)
823
- typr.println(i " using inherited type for ${mdef.name}; raw: $iRawInfo, inst: $iInstInfo , inherited: $iResType" )
830
+ typr.println(i " using inherited type for ${mdef.name}; raw: $iRawInfo, inherited: $iResType" )
824
831
tp & iResType
825
832
}
826
833
}
0 commit comments