From 26452c845cbd3d7efeb44391471bae7e894ad8ae Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Mon, 7 Apr 2014 17:38:57 +0400 Subject: [PATCH] Positioning strategy used in "conflicting upper bounds" error messages --- .../src/org/jetbrains/jet/lang/diagnostics/Errors.java | 6 ++++-- .../jetbrains/jet/lang/resolve/DescriptorResolver.java | 9 ++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java index 9c7ae04181d..34f9878e35c 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java @@ -184,8 +184,10 @@ public interface Errors { DiagnosticFactory1 FINAL_UPPER_BOUND = DiagnosticFactory1.create(WARNING); DiagnosticFactory1 FINAL_CLASS_OBJECT_UPPER_BOUND = DiagnosticFactory1.create(ERROR); - DiagnosticFactory1 CONFLICTING_UPPER_BOUNDS = DiagnosticFactory1.create(ERROR); - DiagnosticFactory1 CONFLICTING_CLASS_OBJECT_UPPER_BOUNDS = DiagnosticFactory1.create(ERROR); + DiagnosticFactory1 CONFLICTING_UPPER_BOUNDS = + DiagnosticFactory1.create(ERROR, NAME_IDENTIFIER); + DiagnosticFactory1 CONFLICTING_CLASS_OBJECT_UPPER_BOUNDS + = DiagnosticFactory1.create(ERROR, NAME_IDENTIFIER); DiagnosticFactory2 NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER = DiagnosticFactory2.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java index 497736f6bd5..d1e51c3ec5a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java @@ -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)); } }