diff --git a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt index 3309e5c2967..1a555d6cd77 100644 --- a/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt +++ b/compiler/frontend/cfg/src/org/jetbrains/kotlin/cfg/ControlFlowInformationProviderImpl.kt @@ -780,7 +780,8 @@ class ControlFlowInformationProviderImpl private constructor( if (functionDescriptor.isExpect || functionDescriptor.isActual || functionDescriptor.isEffectivelyExternal() || - !diagnosticSuppressor.shouldReportUnusedParameter(variableDescriptor, trace.bindingContext) + !diagnosticSuppressor.shouldReportUnusedParameter(variableDescriptor, trace.bindingContext) || + !diagnosticSuppressor.shouldReportUnusedParameter(variableDescriptor) ) return when (val owner = element.parent.parent) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/PlatformDiagnosticSuppressor.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/PlatformDiagnosticSuppressor.kt index a11e02802c1..a18f9a0ca9e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/PlatformDiagnosticSuppressor.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/PlatformDiagnosticSuppressor.kt @@ -25,11 +25,15 @@ import org.jetbrains.kotlin.resolve.BindingContext @DefaultImplementation(PlatformDiagnosticSuppressor.Default::class) interface PlatformDiagnosticSuppressor : PlatformSpecificExtension{ - fun shouldReportUnusedParameter(parameter: VariableDescriptor, bindingContext: BindingContext): Boolean + // Function without binding context is kept for binary compatibility + // Diagnostic should be suppressed if any of two overloads return false + fun shouldReportUnusedParameter(parameter: VariableDescriptor): Boolean + fun shouldReportUnusedParameter(parameter: VariableDescriptor, bindingContext: BindingContext): Boolean = true fun shouldReportNoBody(descriptor: CallableMemberDescriptor): Boolean object Default : PlatformDiagnosticSuppressor { + override fun shouldReportUnusedParameter(parameter: VariableDescriptor): Boolean = true override fun shouldReportUnusedParameter(parameter: VariableDescriptor, bindingContext: BindingContext): Boolean = true override fun shouldReportNoBody(descriptor: CallableMemberDescriptor): Boolean = true @@ -40,6 +44,9 @@ class CompositePlatformDiagnosticSuppressor(private val suppressors: List