// 3) newCommon is neither, in which case we'll generate a new TInstance
// We know that we can't have both #1 and #2, because that would imply [old] common == inputClass,
// which has already been handled.
TClass newCommon = resolver.commonTClass(common, inputClass);
if (newCommon == null)
throw new OverloadException(overload + ": couldn't find common types for " + inputSet
+ " with " + inputs);
if (newCommon == inputClass) { // case #2
common = newCommon;
commonInst = inputInstance;
}
else if (newCommon != common) { // case #3
common = newCommon;
commonInst = null;
}
// else if (newCommon = common), we don't need this because there's nothing to do in this case
}
}
if (common == null) {
if (!inputSet.isPicking())
return MString.VARCHAR.instance(0, nullable); // Unknown type and callee doesn't care.
throw new OverloadException("couldn't resolve type for " + inputSet + " with " + inputs);
}
return (commonInst == null)
? common.instance(nullable)
: commonInst;
}