FIC: Support conversions for suspend functions
This commit is contained in:
+5
@@ -7833,6 +7833,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
|||||||
public void testSeveralConversionsForFunInterface() throws Exception {
|
public void testSeveralConversionsForFunInterface() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/funInterface/severalConversionsForFunInterface.kt");
|
runTest("compiler/testData/diagnostics/tests/funInterface/severalConversionsForFunInterface.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("suspendFunInterfaceConversion.kt")
|
||||||
|
public void testSuspendFunInterfaceConversion() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/funInterface/suspendFunInterfaceConversion.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
||||||
|
|||||||
+1
-1
@@ -129,7 +129,7 @@ public class SingleAbstractMethodUtils {
|
|||||||
|
|
||||||
return FunctionTypesKt.createFunctionType(
|
return FunctionTypesKt.createFunctionType(
|
||||||
DescriptorUtilsKt.getBuiltIns(function), Annotations.Companion.getEMPTY(),
|
DescriptorUtilsKt.getBuiltIns(function), Annotations.Companion.getEMPTY(),
|
||||||
receiverType, parameterTypes, parameterNames, returnType
|
receiverType, parameterTypes, parameterNames, returnType, function.isSuspend()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// !LANGUAGE: +NewInference +SamConversionForKotlinFunctions +SamConversionPerArgument +FunctionInterfaceConversion
|
||||||
|
// !DIAGNOSTICS: -UNUSED_PARAMETER -NOTHING_TO_INLINE
|
||||||
|
|
||||||
|
fun interface SuspendRunnable {
|
||||||
|
suspend fun invoke()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun run(r: SuspendRunnable) {}
|
||||||
|
|
||||||
|
suspend fun bar() {}
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
run(::bar)
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public suspend fun bar(): kotlin.Unit
|
||||||
|
public fun run(/*0*/ r: SuspendRunnable): kotlin.Unit
|
||||||
|
public fun test(): kotlin.Unit
|
||||||
|
|
||||||
|
public interface SuspendRunnable {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract suspend fun invoke(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -7915,6 +7915,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
public void testSeveralConversionsForFunInterface() throws Exception {
|
public void testSeveralConversionsForFunInterface() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/funInterface/severalConversionsForFunInterface.kt");
|
runTest("compiler/testData/diagnostics/tests/funInterface/severalConversionsForFunInterface.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("suspendFunInterfaceConversion.kt")
|
||||||
|
public void testSuspendFunInterfaceConversion() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/funInterface/suspendFunInterfaceConversion.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
||||||
|
|||||||
Generated
+5
@@ -7910,6 +7910,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
public void testSeveralConversionsForFunInterface() throws Exception {
|
public void testSeveralConversionsForFunInterface() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/funInterface/severalConversionsForFunInterface.kt");
|
runTest("compiler/testData/diagnostics/tests/funInterface/severalConversionsForFunInterface.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("suspendFunInterfaceConversion.kt")
|
||||||
|
public void testSuspendFunInterfaceConversion() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/funInterface/suspendFunInterfaceConversion.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
@TestMetadata("compiler/testData/diagnostics/tests/functionAsExpression")
|
||||||
|
|||||||
Reference in New Issue
Block a user