From 5190ff97332570e5268a881717679b39c0a05287 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 27 Nov 2019 18:00:58 +0300 Subject: [PATCH] [FIR-TEST] Add test with SAM conversion in constructor call --- .../problems/samConversionInConstructorCall.kt | 17 +++++++++++++++++ .../problems/samConversionInConstructorCall.txt | 7 +++++++ .../kotlin/fir/FirDiagnosticsTestGenerated.java | 5 +++++ 3 files changed, 29 insertions(+) create mode 100644 compiler/fir/resolve/testData/resolve/problems/samConversionInConstructorCall.kt create mode 100644 compiler/fir/resolve/testData/resolve/problems/samConversionInConstructorCall.txt diff --git a/compiler/fir/resolve/testData/resolve/problems/samConversionInConstructorCall.kt b/compiler/fir/resolve/testData/resolve/problems/samConversionInConstructorCall.kt new file mode 100644 index 00000000000..d69a4ea4181 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/problems/samConversionInConstructorCall.kt @@ -0,0 +1,17 @@ +// FILE: Condition.java + +public interface Condition { + boolean value(boolean t); +} + +// FILE: Foo.java + +public class Foo { + public Foo(Condition filter) {} +} + +// FILE: main.kt + +fun test() { + Foo { it } +} diff --git a/compiler/fir/resolve/testData/resolve/problems/samConversionInConstructorCall.txt b/compiler/fir/resolve/testData/resolve/problems/samConversionInConstructorCall.txt new file mode 100644 index 00000000000..f6022e0acd6 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/problems/samConversionInConstructorCall.txt @@ -0,0 +1,7 @@ +FILE: main.kt + public final fun test(): R|kotlin/Unit| { + #( = Foo@fun (): { + # + } + ) + } 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 f292e706df9..04ce660cba7 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -913,6 +913,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/resolve/testData/resolve/problems/receiverWithCapturedType.kt"); } + @TestMetadata("samConversionInConstructorCall.kt") + public void testSamConversionInConstructorCall() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/problems/samConversionInConstructorCall.kt"); + } + @TestMetadata("syntheticsVsNormalProperties.kt") public void testSyntheticsVsNormalProperties() throws Exception { runTest("compiler/fir/resolve/testData/resolve/problems/syntheticsVsNormalProperties.kt");