From 75ecba5a4afdef5218c22b18fb6b0ad3abfbd735 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 29 Feb 2024 13:35:44 +0100 Subject: [PATCH] Tests/PCLA: extend the test for KT-55168 #KT-55168 As Designed --- .../builderInference/buildListRemoveAddInBranches.fir.kt | 8 ++++++++ .../builderInference/buildListRemoveAddInBranches.kt | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.fir.kt index c0b118ece0a..684c949d531 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.fir.kt @@ -6,3 +6,11 @@ fun foo(arg: Boolean) = buildList { add(42) } } + +fun bar(arg: Boolean) = buildList { + if (!arg) { + add(42) + } else { + removeLast() + } +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.kt index f3508b73608..3aaac04c719 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.kt @@ -6,3 +6,11 @@ fun foo(arg: Boolean) = buildList { add(42) } } + +fun bar(arg: Boolean) = buildList { + if (!arg) { + add(42) + } else { + removeLast() + } +}