Introduce HTML redenred version for compatibility warning
This commit is contained in:
+2
-2
@@ -69,8 +69,8 @@ class CallableReferenceCandidate(
|
||||
override val resultingApplicability = getResultApplicability(diagnostics)
|
||||
|
||||
override fun addCompatibilityWarning(other: Candidate) {
|
||||
if (this !== other) {
|
||||
mutableDiagnostics.add(CompatibilityWarning())
|
||||
if (this !== other && other is CallableReferenceCandidate) {
|
||||
mutableDiagnostics.add(CompatibilityWarning(other.candidate))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ class CallableReferenceResolver(
|
||||
diagnosticsHolder.addDiagnosticIfNotNull(diagnostic)
|
||||
chosenCandidate.diagnostics.forEach {
|
||||
val transformedDiagnostic = when (it) {
|
||||
is CompatibilityWarning -> CompatibilityWarningOnArgument(argument)
|
||||
is CompatibilityWarning -> CompatibilityWarningOnArgument(argument, it.candidate)
|
||||
is LowerPriorityToPreserveCompatibility -> return@forEach
|
||||
else -> it
|
||||
}
|
||||
|
||||
+5
-2
@@ -250,13 +250,16 @@ class CandidateChosenUsingOverloadResolutionByLambdaAnnotation : KotlinCallDiagn
|
||||
}
|
||||
}
|
||||
|
||||
class CompatibilityWarning : KotlinCallDiagnostic(RESOLVED) {
|
||||
class CompatibilityWarning(val candidate: CallableDescriptor) : KotlinCallDiagnostic(RESOLVED) {
|
||||
override fun report(reporter: DiagnosticReporter) {
|
||||
reporter.onCall(this)
|
||||
}
|
||||
}
|
||||
|
||||
class CompatibilityWarningOnArgument(val argument: CallableReferenceKotlinCallArgument) : KotlinCallDiagnostic(RESOLVED) {
|
||||
class CompatibilityWarningOnArgument(
|
||||
val argument: CallableReferenceKotlinCallArgument,
|
||||
val candidate: CallableDescriptor
|
||||
) : KotlinCallDiagnostic(RESOLVED) {
|
||||
override fun report(reporter: DiagnosticReporter) {
|
||||
reporter.onCallArgument(argument, this)
|
||||
}
|
||||
|
||||
+2
-2
@@ -166,8 +166,8 @@ class KotlinResolutionCandidate(
|
||||
}
|
||||
|
||||
override fun addCompatibilityWarning(other: Candidate) {
|
||||
if (this !== other) {
|
||||
addDiagnostic(CompatibilityWarning())
|
||||
if (this !== other && other is KotlinResolutionCandidate) {
|
||||
addDiagnostic(CompatibilityWarning(other.resolvedCall.candidateDescriptor))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user