diff --git a/tools/intellij-plugin/src/diagnostics/ContextualParametersChecker.kt b/tools/intellij-plugin/src/diagnostics/ContextualParametersChecker.kt index f63c90ca9..3a2b1ceef 100644 --- a/tools/intellij-plugin/src/diagnostics/ContextualParametersChecker.kt +++ b/tools/intellij-plugin/src/diagnostics/ContextualParametersChecker.kt @@ -22,7 +22,6 @@ import net.mamoe.mirai.console.compiler.common.resolve.ResolveContextKind import net.mamoe.mirai.console.compiler.common.resolve.resolveContextKinds import net.mamoe.mirai.console.intellij.resolve.bodyCalls import net.mamoe.mirai.console.intellij.resolve.resolveStringConstantValues -import net.mamoe.mirai.console.intellij.resolve.valueParametersWithArguments import net.mamoe.mirai.console.intellij.util.RequirementHelper import net.mamoe.mirai.console.intellij.util.RequirementParser import org.jetbrains.kotlin.descriptors.DeclarationDescriptor @@ -50,8 +49,10 @@ class ContextualParametersChecker : DeclarationChecker { val calls = declaration.bodyCalls(context.bindingContext) ?: return for ((call, _) in calls) { - for ((parameter, argument) in call.valueParametersWithArguments()) { - checkArgument(parameter, argument, context) + for ((parameter, resolvedArgument) in call.valueArguments) { + for (valueArgument in resolvedArgument.arguments) { + checkArgument(parameter, valueArgument, context) + } } } } diff --git a/tools/intellij-plugin/src/resolve/resolveIdea.kt b/tools/intellij-plugin/src/resolve/resolveIdea.kt index 45de4d9e6..e7387995b 100644 --- a/tools/intellij-plugin/src/resolve/resolveIdea.kt +++ b/tools/intellij-plugin/src/resolve/resolveIdea.kt @@ -16,7 +16,6 @@ import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.refactoring.fqName.fqName -import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName import org.jetbrains.kotlin.idea.references.KtSimpleNameReference import org.jetbrains.kotlin.idea.references.resolveToDescriptors import org.jetbrains.kotlin.incremental.components.NoLookupLocation @@ -28,7 +27,6 @@ import org.jetbrains.kotlin.psi.psiUtil.referenceExpression import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.calls.callUtil.getCall import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall -import org.jetbrains.kotlin.resolve.calls.callUtil.getCalleeExpressionIfAny import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.constants.ArrayValue import org.jetbrains.kotlin.resolve.constants.ConstantValue @@ -203,10 +201,6 @@ fun KtElement.resolveAllCallsWithElement( } } -fun ResolvedCall<*>.valueParametersWithArguments(): List> { - return this.valueParameters.zip(this.valueArgumentsByIndex?.mapNotNull { it.arguments.firstOrNull() }.orEmpty()) -} - fun ValueArgument.resolveStringConstantValues(bindingContext: BindingContext): Sequence? { return this.getArgumentExpression()?.resolveStringConstantValues(bindingContext) }