Added check for extra and missing upper bounds in alternative signatures.

This commit is contained in:
Evgeny Gerashchenko
2012-06-21 18:48:20 +04:00
parent e59120f002
commit ee1f1f3d56
7 changed files with 58 additions and 4 deletions
@@ -296,14 +296,18 @@ class AlternativeSignatureData {
else {
JetTypeConstraint constraint =
findTypeParameterConstraint(altFunDeclaration, pd.getName(), upperBoundIndex);
assert constraint != null; // TODO fail more properly
JetTypeReference boundTypeReference = constraint.getBoundTypeReference();
assert boundTypeReference != null;
altTypeElement = boundTypeReference.getTypeElement();
if (constraint == null) {
fail("Upper bound #%d for type parameter %s is missing", upperBoundIndex, pd.getName());
}
//noinspection ConstantConditions
altTypeElement = constraint.getBoundTypeReference().getTypeElement();
}
altParamDescriptor.addUpperBound(computeType(altTypeElement, upperBound));
upperBoundIndex++;
}
if (findTypeParameterConstraint(altFunDeclaration, pd.getName(), upperBoundIndex) != null) {
fail("Extra upper bound #%d for type parameter %s", upperBoundIndex, pd.getName());
}
altParamDescriptor.setInitialized();
altTypeParameters.add(altParamDescriptor);