Type Type::resolveReferenceToBaseReferenceOnSuperArguments(const TypeContext &typeContext) const { TypeDefinition *c = typeContext.calleeType().typeDefinition(); Type t = *this; // Try to resolve on the generic arguments to the superclass. while (t.type() == TypeType::GenericVariable && c->canBeUsedToResolve(t.typeDefinition()) && t.genericVariableIndex() < c->superGenericArguments().size()) { Type tn = c->superGenericArguments()[t.genericVariableIndex()]; if (tn.type() == TypeType::GenericVariable && tn.genericVariableIndex() == t.genericVariableIndex() && tn.typeDefinition() == t.typeDefinition()) { break; } t = tn; } return t; }