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() + } +}