TypeArguments typeArguments = smte.getTypeArguments();
Declaration dec = smte.getDeclaration();
if (typeArguments instanceof Tree.InferredTypeArguments &&
dec instanceof Generic &&
!((Generic) dec).getTypeParameters().isEmpty()) {
ProducedTypedReference param = smte.getTargetParameter();
ProducedType paramType = smte.getParameterType();
if (paramType==null && param!=null) {
paramType = param.getFullType();
}
ProducedReference arg = getProducedReference(smte);
if (!smte.getStaticMethodReferencePrimary() &&
dec instanceof Functional &&
param!=null) {
Functional fun = (Functional) dec;
List<ParameterList> apls = fun.getParameterLists();
Declaration pdec = param.getDeclaration();
if (pdec instanceof Functional) {
Functional pfun = (Functional) pdec;
List<ParameterList> ppls = pfun.getParameterLists();
if (apls.isEmpty() || ppls.isEmpty()) {
return null; //TODO: to give a nicer error
}
else {
List<ProducedType> inferredTypes =
new ArrayList<ProducedType>();
List<Parameter> apl = apls.get(0).getParameters();
List<Parameter> ppl = ppls.get(0).getParameters();
for (TypeParameter tp: fun.getTypeParameters()) {
List<ProducedType> list =
new ArrayList<ProducedType>();
for (int i=0; i<apl.size() && i<ppl.size(); i++) {
Parameter ap = apl.get(i);
Parameter pp = ppl.get(i);
ProducedType type =
param.getTypedParameter(pp).getFullType();
ProducedType template =
arg.getTypedParameter(ap).getFullType();
ProducedType it =
inferTypeArg(tp, template, type,
true, false,