diff --git a/compiler/fir/resolve/testData/diagnostics/callableReferences/sam.kt b/compiler/fir/resolve/testData/diagnostics/callableReferences/sam.kt new file mode 100644 index 00000000000..64ee64950f2 --- /dev/null +++ b/compiler/fir/resolve/testData/diagnostics/callableReferences/sam.kt @@ -0,0 +1,14 @@ +interface MySam { + fun run(x: String): Int +} + +class A { + fun bar(x: String): Int {} +} + +fun foo(x: MySam) {} + +fun main() { + val a = A() + foo(a::bar) +} diff --git a/compiler/fir/resolve/testData/diagnostics/callableReferences/sam.txt b/compiler/fir/resolve/testData/diagnostics/callableReferences/sam.txt new file mode 100644 index 00000000000..23b64359bae --- /dev/null +++ b/compiler/fir/resolve/testData/diagnostics/callableReferences/sam.txt @@ -0,0 +1,20 @@ +FILE: sam.kt + public abstract interface MySam : R|kotlin/Any| { + public abstract fun run(x: R|kotlin/String|): R|kotlin/Int| + + } + public final class A : R|kotlin/Any| { + public constructor(): R|A| { + super() + } + + public final fun bar(x: R|kotlin/String|): R|kotlin/Int| { + } + + } + public final fun foo(x: R|MySam|): R|kotlin/Unit| { + } + public final fun main(): R|kotlin/Unit| { + lval a: R|A| = R|/A.A|() + R|/foo|(R|/a|::R|/A.bar|) + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index be9a6057b09..2a5593cacec 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -100,6 +100,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/resolve/testData/diagnostics/callableReferences/properties.kt"); } + @TestMetadata("sam.kt") + public void testSam() throws Exception { + runTest("compiler/fir/resolve/testData/diagnostics/callableReferences/sam.kt"); + } + @TestMetadata("simpleClassReceiver.kt") public void testSimpleClassReceiver() throws Exception { runTest("compiler/fir/resolve/testData/diagnostics/callableReferences/simpleClassReceiver.kt");