K1: report swallowed diagnostic about upper bound violation
#KT-55055 Fixed
This commit is contained in:
committed by
Space Team
parent
b148df15a9
commit
930237b60e
@@ -884,6 +884,7 @@ public interface Errors {
|
||||
DiagnosticFactory4<PsiElement, KotlinType, String, String, BuilderLambdaLabelingInfo> STUB_TYPE_IN_RECEIVER_CAUSES_AMBIGUITY = DiagnosticFactory4.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, Name, Name> BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory2<PsiElement, Name, Name> BUILDER_INFERENCE_STUB_RECEIVER = DiagnosticFactory2.create(ERROR);
|
||||
DiagnosticFactory4<KtElement, Name, Name, KotlinType, KotlinType> UPPER_BOUND_VIOLATION_IN_CONSTRAINT = DiagnosticFactory4.create(ERROR);
|
||||
|
||||
DiagnosticFactory1<PsiElement, Collection<? extends ResolvedCall<?>>> NONE_APPLICABLE = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory1<PsiElement, Collection<? extends ResolvedCall<?>>> CANNOT_COMPLETE_RESOLVE = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
+1
@@ -1006,6 +1006,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(STUB_TYPE_IN_RECEIVER_CAUSES_AMBIGUITY, "The type of a receiver hasn''t been inferred yet. To disambiguate this call, explicitly cast it to `{0}` if you want the builder''s type parameter(s) `{1}` to be inferred to `{2}`.", RENDER_TYPE, STRING, STRING, null);
|
||||
MAP.put(BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION, "Unstable inference behaviour with multiple lambdas. Please either specify the type argument for generic parameter `{0}` of `{1}` explicitly", TO_STRING, TO_STRING);
|
||||
MAP.put(BUILDER_INFERENCE_STUB_RECEIVER, "The type of a receiver hasn''t been inferred yet. Please specify type argument for generic parameter `{0}` of `{1}` explicitly", TO_STRING, TO_STRING);
|
||||
MAP.put(UPPER_BOUND_VIOLATION_IN_CONSTRAINT, "Upper bound violation for generic parameter `{0}` of `{1}`: {3} is not a subtype of {2}", TO_STRING, TO_STRING, RENDER_TYPE, RENDER_TYPE);
|
||||
MAP.put(NONE_APPLICABLE, "None of the following functions can be called with the arguments supplied: {0}", AMBIGUOUS_CALLS);
|
||||
MAP.put(CANNOT_COMPLETE_RESOLVE, "Cannot choose among the following candidates without completing type inference: {0}", AMBIGUOUS_CALLS);
|
||||
MAP.put(UNRESOLVED_REFERENCE_WRONG_RECEIVER, "Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: {0}", AMBIGUOUS_CALLS);
|
||||
|
||||
+14
-1
@@ -513,7 +513,20 @@ class DiagnosticReporterByTrackingStrategy(
|
||||
// some error reported later?
|
||||
}
|
||||
is CallableReferenceConstraintPosition<*> -> TODO()
|
||||
is DeclaredUpperBoundConstraintPosition<*> -> TODO()
|
||||
is DeclaredUpperBoundConstraintPosition<*> -> {
|
||||
val originalCall = (position as DeclaredUpperBoundConstraintPositionImpl).kotlinCall
|
||||
val typeParameterDescriptor = position.typeParameter
|
||||
val ownerDescriptor = typeParameterDescriptor.containingDeclaration
|
||||
trace.reportDiagnosticOnce(
|
||||
UPPER_BOUND_VIOLATION_IN_CONSTRAINT.on(
|
||||
(originalCall as PSIKotlinCall).psiCall.callElement,
|
||||
typeParameterDescriptor.name,
|
||||
ownerDescriptor.name,
|
||||
error.upperKotlinType,
|
||||
error.lowerKotlinType
|
||||
)
|
||||
)
|
||||
}
|
||||
is DelegatedPropertyConstraintPosition<*> -> {
|
||||
// DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, reported later
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user