File tree 1 file changed +9
-2
lines changed
server/src/main/kotlin/org/javacs/kt/inlayhints 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument
30
30
import org.jetbrains.kotlin.resolve.calls.model.VarargValueArgument
31
31
import org.jetbrains.kotlin.resolve.calls.smartcasts.getKotlinTypeForComparison
32
32
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
33
+ import org.jetbrains.kotlin.resolve.calls.util.isSingleUnderscore
33
34
import org.jetbrains.kotlin.types.KotlinType
34
35
import org.jetbrains.kotlin.types.error.ErrorType
35
36
@@ -50,8 +51,14 @@ private fun PsiElement.determineType(ctx: BindingContext): KotlinType? =
50
51
} else null
51
52
}
52
53
is KtDestructuringDeclarationEntry -> {
53
- val resolvedCall = ctx[BindingContext .COMPONENT_RESOLVED_CALL , this ]
54
- resolvedCall?.resultingDescriptor?.returnType
54
+ // skip unused variable denoted by underscore
55
+ // https://kotlinlang.org/docs/destructuring-declarations.html#underscore-for-unused-variables
56
+ if (this .isSingleUnderscore) {
57
+ null
58
+ } else {
59
+ val resolvedCall = ctx[BindingContext .COMPONENT_RESOLVED_CALL , this ]
60
+ resolvedCall?.resultingDescriptor?.returnType
61
+ }
55
62
}
56
63
is KtProperty -> {
57
64
val type = this .getKotlinTypeForComparison(ctx)
You can’t perform that action at this time.
0 commit comments