Positioning strategy used in "conflicting upper bounds" error messages

This commit is contained in:
Pavel V. Talanov
2014-04-07 17:38:57 +04:00
parent 94270e3486
commit 26452c845c
2 changed files with 6 additions and 9 deletions
@@ -184,8 +184,10 @@ public interface Errors {
DiagnosticFactory1<JetTypeReference, JetType> FINAL_UPPER_BOUND = DiagnosticFactory1.create(WARNING);
DiagnosticFactory1<JetTypeReference, JetType> FINAL_CLASS_OBJECT_UPPER_BOUND = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, TypeParameterDescriptor> CONFLICTING_UPPER_BOUNDS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, TypeParameterDescriptor> CONFLICTING_CLASS_OBJECT_UPPER_BOUNDS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiNameIdentifierOwner, TypeParameterDescriptor> CONFLICTING_UPPER_BOUNDS =
DiagnosticFactory1.create(ERROR, NAME_IDENTIFIER);
DiagnosticFactory1<PsiNameIdentifierOwner, TypeParameterDescriptor> CONFLICTING_CLASS_OBJECT_UPPER_BOUNDS
= DiagnosticFactory1.create(ERROR, NAME_IDENTIFIER);
DiagnosticFactory2<JetSimpleNameExpression, JetTypeConstraint, JetTypeParameterListOwner> NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER =
DiagnosticFactory2.create(ERROR);
@@ -702,18 +702,13 @@ public class DescriptorResolver {
@NotNull TypeParameterDescriptor parameter,
@NotNull JetTypeParameter typeParameter
) {
PsiElement nameIdentifier = typeParameter.getNameIdentifier();
if (KotlinBuiltIns.getInstance().isNothing(parameter.getUpperBoundsAsType())) {
if (nameIdentifier != null) {
trace.report(CONFLICTING_UPPER_BOUNDS.on(nameIdentifier, parameter));
}
trace.report(CONFLICTING_UPPER_BOUNDS.on(typeParameter, parameter));
}
JetType classObjectType = parameter.getClassObjectType();
if (classObjectType != null && KotlinBuiltIns.getInstance().isNothing(classObjectType)) {
if (nameIdentifier != null) {
trace.report(CONFLICTING_CLASS_OBJECT_UPPER_BOUNDS.on(nameIdentifier, parameter));
}
trace.report(CONFLICTING_CLASS_OBJECT_UPPER_BOUNDS.on(typeParameter, parameter));
}
}