Exclude reporting IMPLICIT_NOTHING_AS_TYPE_PARAMETER warning for suspend lambdas
^KT-36101 Fixed
This commit is contained in:
+2
-2
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.resolve.calls.checkers
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.builtins.isBuiltinFunctionalType
|
||||
import org.jetbrains.kotlin.builtins.isFunctionType
|
||||
import org.jetbrains.kotlin.builtins.isFunctionOrSuspendFunctionType
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.resolve.calls.SPECIAL_FUNCTION_NAMES
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
@@ -44,7 +44,7 @@ object ImplicitNothingAsTypeParameterCallChecker : CallChecker {
|
||||
return
|
||||
if (resultingDescriptor.name !in SPECIAL_FUNCTION_NAMES && resolvedCall.call.typeArguments.isEmpty()) {
|
||||
val lambdasFromArgumentsReturnTypes =
|
||||
resolvedCall.candidateDescriptor.valueParameters.filter { it.type.isFunctionType }
|
||||
resolvedCall.candidateDescriptor.valueParameters.filter { it.type.isFunctionOrSuspendFunctionType }
|
||||
.map { it.returnType?.arguments?.last()?.type }.toSet()
|
||||
val unsubstitutedReturnType = resultingDescriptor.original.returnType
|
||||
val expectedType = context.resolutionContext.expectedType
|
||||
|
||||
+10
@@ -101,3 +101,13 @@ fun test1() {
|
||||
fun test2() {
|
||||
errorCompletion.invoke(Exception("fail"))
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
foo {
|
||||
produceNothing()
|
||||
}
|
||||
}
|
||||
|
||||
fun produceNothing(): Nothing = TODO()
|
||||
|
||||
fun <R> foo(block: suspend String.() -> R) = null as R
|
||||
|
||||
+10
@@ -101,3 +101,13 @@ fun test1() {
|
||||
fun test2() {
|
||||
errorCompletion.invoke(Exception("fail"))
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
foo {
|
||||
produceNothing()
|
||||
}
|
||||
}
|
||||
|
||||
fun produceNothing(): Nothing = TODO()
|
||||
|
||||
fun <R> foo(block: suspend String.() -> R) = null as R
|
||||
|
||||
Reference in New Issue
Block a user