diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFirTestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFirTestdataTestGenerated.java index 3e7edeb4812..00cf7555b65 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFirTestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFirTestdataTestGenerated.java @@ -6999,6 +6999,12 @@ public class DiagnosticCompilerTestFirTestdataTestGenerated extends AbstractDiag runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/stringConstructors.kt"); } + @Test + @TestMetadata("TypeVariablesInWrappedSamCall.kt") + public void testTypeVariablesInWrappedSamCall() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt"); + } + @Test @TestMetadata("TypesEligibleForSimpleVisit.kt") public void testTypesEligibleForSimpleVisit() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated.java index fd63a1f2294..fe6b55b4cde 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated.java @@ -6999,6 +6999,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/stringConstructors.kt"); } + @Test + @TestMetadata("TypeVariablesInWrappedSamCall.kt") + public void testTypeVariablesInWrappedSamCall() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt"); + } + @Test @TestMetadata("TypesEligibleForSimpleVisit.kt") public void testTypesEligibleForSimpleVisit() throws Exception { diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.fir.txt new file mode 100644 index 00000000000..c4659c1db52 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.fir.txt @@ -0,0 +1,25 @@ +FILE: TypeVariablesInWrappedSamCall.kt + public final fun main(): R|kotlin/Unit| { + lval flag: R|kotlin/Boolean| = Boolean(true) + R|/consumeTicker#|(R|/select|(when () { + R|/flag| -> { + Null(null) + } + else -> { + select@fun (num: ): R|kotlin/Unit| { + R|/num|.#() + } + + } + } + , Null(null))) + } + public final fun select(a: R|T|, b: R|T|): R|T| { + ^select R|/a| + } + public final fun consumeTicker(ticker: R|Ticker?|): R|kotlin/Unit| { + } + public abstract fun interface Ticker : R|kotlin/Any| { + public abstract fun tick(num: R|kotlin/Int|): R|kotlin/Unit| + + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt new file mode 100644 index 00000000000..d5a8d3d611c --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt @@ -0,0 +1,16 @@ +// ISSUE: KT-56409 + +fun main() { + val flag = true + consumeTicker( + select(if (flag) null else { num -> num.dec() }, null) + ) +} + +fun select(a: T, b: T): T = a + +fun consumeTicker(ticker: Ticker?) {} + +fun interface Ticker { + fun tick(num: Int) +} diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsTestGenerated.java index 75bc92e9299..fd2d9cd05a4 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsTestGenerated.java @@ -6999,6 +6999,12 @@ public class FirLightTreeDiagnosticsTestGenerated extends AbstractFirLightTreeDi runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/stringConstructors.kt"); } + @Test + @TestMetadata("TypeVariablesInWrappedSamCall.kt") + public void testTypeVariablesInWrappedSamCall() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt"); + } + @Test @TestMetadata("TypesEligibleForSimpleVisit.kt") public void testTypesEligibleForSimpleVisit() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiDiagnosticTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiDiagnosticTestGenerated.java index 8631c17192f..e215467653f 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiDiagnosticTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiDiagnosticTestGenerated.java @@ -6999,6 +6999,12 @@ public class FirPsiDiagnosticTestGenerated extends AbstractFirPsiDiagnosticTest runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/stringConstructors.kt"); } + @Test + @TestMetadata("TypeVariablesInWrappedSamCall.kt") + public void testTypeVariablesInWrappedSamCall() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/TypeVariablesInWrappedSamCall.kt"); + } + @Test @TestMetadata("TypesEligibleForSimpleVisit.kt") public void testTypesEligibleForSimpleVisit() throws Exception {