Deprecate PlatformDiagnosticSuppressors::shouldReportUnusedParameter with one parameter
This commit is contained in:
committed by
teamcity
parent
dc4aa8c15e
commit
1dc0b054ed
+1
@@ -778,6 +778,7 @@ class ControlFlowInformationProviderImpl private constructor(
|
||||
private fun processUnusedParameter(ctxt: VariableUseContext, element: KtParameter, variableDescriptor: VariableDescriptor) {
|
||||
val functionDescriptor = variableDescriptor.containingDeclaration as FunctionDescriptor
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
if (functionDescriptor.isExpect || functionDescriptor.isActual ||
|
||||
functionDescriptor.isEffectivelyExternal() ||
|
||||
!diagnosticSuppressor.shouldReportUnusedParameter(variableDescriptor, trace.bindingContext) ||
|
||||
|
||||
+7
-3
@@ -27,13 +27,13 @@ import org.jetbrains.kotlin.resolve.BindingContext
|
||||
interface PlatformDiagnosticSuppressor : PlatformSpecificExtension<PlatformDiagnosticSuppressor>{
|
||||
// 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
|
||||
@Deprecated("Use shouldReportUnusedParameter with bindingContext parameter")
|
||||
fun shouldReportUnusedParameter(parameter: VariableDescriptor): Boolean = true
|
||||
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
|
||||
@@ -44,8 +44,12 @@ class CompositePlatformDiagnosticSuppressor(private val suppressors: List<Platfo
|
||||
override fun shouldReportUnusedParameter(parameter: VariableDescriptor, bindingContext: BindingContext): Boolean =
|
||||
suppressors.all { it.shouldReportUnusedParameter(parameter, bindingContext) }
|
||||
|
||||
@Deprecated("Use shouldReportUnusedParameter with bindingContext parameter")
|
||||
override fun shouldReportUnusedParameter(parameter: VariableDescriptor): Boolean =
|
||||
suppressors.all { it.shouldReportUnusedParameter(parameter) }
|
||||
suppressors.all {
|
||||
@Suppress("DEPRECATION")
|
||||
it.shouldReportUnusedParameter(parameter)
|
||||
}
|
||||
|
||||
override fun shouldReportNoBody(descriptor: CallableMemberDescriptor): Boolean =
|
||||
suppressors.all { it.shouldReportNoBody(descriptor) }
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.name.JsStandardClassIds
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.checkers.PlatformDiagnosticSuppressor
|
||||
|
||||
private val nativeAnnotations = JsStandardClassIds.Annotations.nativeAnnotations.map { it.asSingleFqName() }
|
||||
@@ -35,7 +36,8 @@ private fun DeclarationDescriptor.isLexicallyInsideJsNative(): Boolean {
|
||||
}
|
||||
|
||||
object JsNativeDiagnosticSuppressor : PlatformDiagnosticSuppressor {
|
||||
override fun shouldReportUnusedParameter(parameter: VariableDescriptor): Boolean = !parameter.isLexicallyInsideJsNative()
|
||||
override fun shouldReportUnusedParameter(parameter: VariableDescriptor, bindingContext: BindingContext): Boolean =
|
||||
!parameter.isLexicallyInsideJsNative()
|
||||
|
||||
override fun shouldReportNoBody(descriptor: CallableMemberDescriptor): Boolean = !descriptor.isLexicallyInsideJsNative()
|
||||
}
|
||||
|
||||
@@ -25,8 +25,5 @@ object WasmDiagnosticSuppressor : PlatformDiagnosticSuppressor {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun shouldReportUnusedParameter(parameter: VariableDescriptor): Boolean =
|
||||
true
|
||||
|
||||
override fun shouldReportNoBody(descriptor: CallableMemberDescriptor): Boolean = true
|
||||
}
|
||||
Reference in New Issue
Block a user