From b9019d3de115006a4cfc0d82327ba0c1f57e7f43 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 13 Dec 2023 15:08:19 +0100 Subject: [PATCH] K2: Adjust test data after PCLA implementation [red-to-green] ^KT-59791 In Progress --- .../builderInference.descriptors.txt | 42 ------------------- .../resolveCall/builderInference.txt | 4 +- .../builderInference/ifInBuildMap.fir.txt | 4 +- .../builderInference/ifInBuildMap.kt | 4 +- .../cli/jvm/builderInferenceErrors.out | 5 +-- .../box/builderInference/issues/kt49160a.kt | 2 +- .../box/builderInference/issues/kt49160b.kt | 2 +- .../box/builderInference/issues/kt49160c.kt | 2 +- .../box/builderInference/issues/kt49160d.kt | 2 +- .../box/builderInference/issues/kt49160e.kt | 2 +- .../box/builderInference/issues/kt50453.kt | 2 +- .../box/builderInference/issues/kt52838b.kt | 6 ++- .../issues/kt52838c.jvm_abi.txt | 13 ++++++ .../box/builderInference/issues/kt52838c.kt | 6 ++- .../box/builderInference/issues/kt53639.kt | 2 +- .../box/builderInference/issues/kt54400a.kt | 2 +- .../box/builderInference/issues/kt54400b.kt | 2 +- .../box/builderInference/issues/kt54400c.kt | 2 +- .../box/builderInference/issues/kt57707.kt | 2 +- .../box/builderInference/issues/kt57709.kt | 3 +- .../box/builderInference/issues/kt57834.kt | 2 +- .../box/builderInference/issues/kt60291a.kt | 2 +- .../box/builderInference/issues/kt60291b.kt | 2 +- .../box/builderInference/issues/kt60291c.kt | 2 +- .../box/builderInference/issues/kt61310.kt | 1 - .../box/builderInference/issues/kt63733.kt | 2 +- .../box/builderInference/issues/kt63840a.kt | 2 +- .../box/builderInference/issues/kt63840b.kt | 2 +- .../box/builderInference/issues/kt63840c.kt | 2 +- ...allyResolvedCallInReturnArgumentNonLast.kt | 2 - ...allyResolvedCallInReturnArgumentNonUnit.kt | 2 - .../builderInference/issues/kt49160a.fir.kt | 4 +- .../builderInference/issues/kt49160b.fir.kt | 4 +- .../builderInference/issues/kt49160c.fir.kt | 4 +- .../builderInference/issues/kt49160d.fir.kt | 4 +- .../builderInference/issues/kt49160e.fir.kt | 8 ++-- .../builderInference/issues/kt50453.fir.kt | 2 +- .../builderInference/issues/kt52838b.fir.kt | 4 +- .../builderInference/issues/kt53639.fir.kt | 4 +- .../builderInference/issues/kt54400a.fir.kt | 4 +- .../builderInference/issues/kt54400b.fir.kt | 4 +- .../builderInference/issues/kt54400c.fir.kt | 4 +- .../builderInference/issues/kt54664.fir.kt | 2 +- .../builderInference/issues/kt55057.fir.kt | 6 +-- .../builderInference/issues/kt57707.fir.kt | 4 +- .../builderInference/issues/kt57709.fir.kt | 2 +- .../builderInference/issues/kt57834.fir.kt | 2 +- .../builderInference/issues/kt60291a.fir.kt | 29 +++++++++++++ .../tests/builderInference/issues/kt60291a.kt | 1 - .../builderInference/issues/kt60291b.fir.kt | 26 ++++++++++++ .../tests/builderInference/issues/kt60291b.kt | 1 - .../builderInference/issues/kt60291c.fir.kt | 27 ++++++++++++ .../tests/builderInference/issues/kt60291c.kt | 1 - .../builderInference/issues/kt61310.fir.kt | 30 ------------- .../tests/builderInference/issues/kt61310.kt | 1 + .../builderInference/issues/kt63733.fir.kt | 4 +- .../builderInference/issues/kt63840a.fir.kt | 4 +- .../builderInference/issues/kt63840b.fir.kt | 4 +- .../builderInference/issues/kt63840c.fir.kt | 4 +- .../InsideNestedBuilderInferenceLambda.fir.kt | 8 ++-- ...leNothingNullLiteralMaterializeCase.fir.kt | 2 +- ...erParametersLastStatementReturnCase.fir.kt | 4 +- .../inference/builderInference/kt49828.fir.kt | 42 +++++++++---------- .../inference/builderInference/kt49829.fir.kt | 12 ++++++ .../inference/builderInference/kt49829.kt | 1 - .../tests/typeParameters/kt42472.fir.kt | 2 +- .../buildListToUpperBoundInLazy.fir.kt | 12 +++--- ...uildListToUpperBoundInLazyForbidden.fir.kt | 12 +++--- .../inconsistentTypeInference.fir.diag.txt | 1 - .../inconsistentTypeInference.fir.kt | 4 +- .../inconsistentTypeInference.fir.txt | 4 +- .../inconsistentTypeInference2.fir.diag.txt | 1 - .../inconsistentTypeInference2.fir.kt | 4 +- .../inconsistentTypeInference2.fir.txt | 4 +- 74 files changed, 232 insertions(+), 205 deletions(-) delete mode 100644 analysis/analysis-api/testData/components/callResolver/resolveCall/builderInference.descriptors.txt create mode 100644 compiler/testData/codegen/box/builderInference/issues/kt52838c.jvm_abi.txt create mode 100644 compiler/testData/diagnostics/tests/builderInference/issues/kt60291a.fir.kt create mode 100644 compiler/testData/diagnostics/tests/builderInference/issues/kt60291b.fir.kt create mode 100644 compiler/testData/diagnostics/tests/builderInference/issues/kt60291c.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/builderInference/issues/kt61310.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inference/builderInference/kt49829.fir.kt delete mode 100644 compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.diag.txt delete mode 100644 compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.diag.txt diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/builderInference.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/builderInference.descriptors.txt deleted file mode 100644 index e0689f657a3..00000000000 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/builderInference.descriptors.txt +++ /dev/null @@ -1,42 +0,0 @@ -KtSuccessCallInfo: - call = KtSimpleFunctionCall: - isImplicitInvoke = false - partiallyAppliedSymbol = KtPartiallyAppliedSymbol: - dispatchReceiver = KtImplicitReceiverValue: - symbol = KtReceiverParameterSymbol: - annotationsList: [] - origin: SOURCE - owningCallableSymbol: KtAnonymousFunctionSymbol(/) - type: KtUsualClassType: - annotationsList: [] - ownTypeArguments: [ - KtUsualClassType: - annotationsList: [] - ownTypeArguments: [] - type: kotlin/String - ] - type: test/Target - type = test.Target - extensionReceiver = null - signature = KtFunctionLikeSignature: - receiverType = null - returnType = kotlin.Unit - symbol = test/Target.add(: test.Target, t: T): kotlin.Unit - valueParameters = [ - KtVariableLikeSignature: - name = t - receiverType = null - returnType = kotlin.String - symbol = t: T - callableIdIfNonLocal = null - ] - callableIdIfNonLocal = test/Target.add - typeArgumentsMapping = {} - argumentMapping = { - s -> (KtVariableLikeSignature: - name = t - receiverType = null - returnType = kotlin.String - symbol = t: T - callableIdIfNonLocal = null) - } \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/builderInference.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/builderInference.txt index 49558f39f18..2dc6622e4da 100644 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/builderInference.txt +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/builderInference.txt @@ -26,7 +26,7 @@ KtSuccessCallInfo: KtVariableLikeSignature: name = t receiverType = null - returnType = T + returnType = kotlin.String symbol = t: T callableIdIfNonLocal = null ] @@ -36,7 +36,7 @@ KtSuccessCallInfo: s -> (KtVariableLikeSignature: name = t receiverType = null - returnType = T + returnType = kotlin.String symbol = t: T callableIdIfNonLocal = null) } diff --git a/compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.fir.txt b/compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.fir.txt index c3a4e3980c7..632fefad3b2 100644 --- a/compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.fir.txt @@ -1,12 +1,12 @@ FILE: ifInBuildMap.kt public final fun main(): R|kotlin/Unit| { - R|kotlin/collections/buildMap#|( = buildMap@fun R|kotlin/collections/MutableMap|.(): R|kotlin/Unit| { + R|kotlin/collections/buildMap|( = buildMap@fun R|kotlin/collections/MutableMap|.(): R|kotlin/Unit| { when () { Boolean(true) -> { R|kotlin/io/println|(String(test)) } else -> { - this@R|special/anonymous|.R|SubstitutionOverride|(String(foo), String(bar)) + this@R|special/anonymous|.R|SubstitutionOverride|(String(foo), String(bar)) } } diff --git a/compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.kt b/compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.kt index 49573748f7c..b8c4ebc2474 100644 --- a/compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.kt +++ b/compiler/fir/analysis-tests/testData/resolve/inference/builderInference/ifInBuildMap.kt @@ -2,11 +2,11 @@ // ISSUE: KT-51143 fun main() { - buildMap { + buildMap { if (true) { println("test") } else { put("foo", "bar") } - } + } } diff --git a/compiler/testData/cli/jvm/builderInferenceErrors.out b/compiler/testData/cli/jvm/builderInferenceErrors.out index 1fbd7504fb0..d86bac9de59 100644 --- a/compiler/testData/cli/jvm/builderInferenceErrors.out +++ b/compiler/testData/cli/jvm/builderInferenceErrors.out @@ -1,4 +1 @@ -compiler/testData/cli/jvm/builderInferenceErrors.kt:6:9: error: overload resolution ambiguity between candidates: [@InlineOnly() fun println(message: Any?): Unit, @InlineOnly() fun println(message: Boolean): Unit, @InlineOnly() fun println(message: Byte): Unit, ...] - println(secondParameter) - ^ -COMPILATION_ERROR +OK diff --git a/compiler/testData/codegen/box/builderInference/issues/kt49160a.kt b/compiler/testData/codegen/box/builderInference/issues/kt49160a.kt index a1099e93910..36fc2b6ce2e 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt49160a.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt49160a.kt @@ -1,7 +1,7 @@ // ISSUE: KT-49160 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt49160b.kt b/compiler/testData/codegen/box/builderInference/issues/kt49160b.kt index 4f2c901977b..cb791af1e72 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt49160b.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt49160b.kt @@ -1,7 +1,7 @@ // ISSUE: KT-49160 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt49160c.kt b/compiler/testData/codegen/box/builderInference/issues/kt49160c.kt index 3fa3a6d498f..8fc692cf1ab 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt49160c.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt49160c.kt @@ -1,7 +1,7 @@ // ISSUE: KT-49160 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt49160d.kt b/compiler/testData/codegen/box/builderInference/issues/kt49160d.kt index 2e3e46c418d..e0727502479 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt49160d.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt49160d.kt @@ -1,7 +1,7 @@ // ISSUE: KT-49160 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt49160e.kt b/compiler/testData/codegen/box/builderInference/issues/kt49160e.kt index fa7521720bc..6b103165193 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt49160e.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt49160e.kt @@ -1,7 +1,7 @@ // ISSUE: KT-49160 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt50453.kt b/compiler/testData/codegen/box/builderInference/issues/kt50453.kt index 8f4783573cd..11b7ece5f8b 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt50453.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt50453.kt @@ -1,7 +1,7 @@ // ISSUE: KT-50453 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt52838b.kt b/compiler/testData/codegen/box/builderInference/issues/kt52838b.kt index 75f793a5945..6479d58fe01 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt52838b.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt52838b.kt @@ -1,8 +1,10 @@ +// IGNORE_BACKEND_K1: ANY // ISSUE: KT-52838 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY -// REASON: red code (see corresponding diagnostic test) +// IGNORE_BACKEND_K2: WASM +// REASON: That still doesn't work properly with PCLA, but accidentally don't fails for other tests but WASM +// (see KT-52838 for tracking and same-named diagnostic test) fun box(): String { build { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt52838c.jvm_abi.txt b/compiler/testData/codegen/box/builderInference/issues/kt52838c.jvm_abi.txt new file mode 100644 index 00000000000..65821574277 --- /dev/null +++ b/compiler/testData/codegen/box/builderInference/issues/kt52838c.jvm_abi.txt @@ -0,0 +1,13 @@ +MODULE main + CLASS Kt52838cKt$box$1.class + Property: class.signature + K1 + Lkotlin/jvm/internal/Lambda;Lkotlin/jvm/functions/Function1;Lkotlin/Unit;>; + K2 + Lkotlin/jvm/internal/Lambda;Lkotlin/jvm/functions/Function1;Lkotlin/Unit;>; + METHOD invoke(LBuildee;)V + Property: method.signature + K1 + (LBuildee<+Ljava/lang/Object;>;)V + K2 + (LBuildee;)V diff --git a/compiler/testData/codegen/box/builderInference/issues/kt52838c.kt b/compiler/testData/codegen/box/builderInference/issues/kt52838c.kt index 234db24b4f3..ce28e2eb47c 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt52838c.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt52838c.kt @@ -1,7 +1,9 @@ // ISSUE: KT-52838 +// JVM_ABI_K1_K2_DIFF: KT-64738 -// IGNORE_BACKEND_K2: ANY -// REASON: red code (see corresponding diagnostic test) +// IGNORE_BACKEND_K2: WASM +// REASON: That still doesn't work properly with PCLA, but accidentally don't fails for other tests but WASM +// (see KT-52838 for tracking and same-named diagnostic test) fun box(): String { build { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt53639.kt b/compiler/testData/codegen/box/builderInference/issues/kt53639.kt index 592df4b1438..69898f18df6 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt53639.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt53639.kt @@ -1,7 +1,7 @@ // ISSUE: KT-53639 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt54400a.kt b/compiler/testData/codegen/box/builderInference/issues/kt54400a.kt index 4bba0b0b267..94b3db05663 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt54400a.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt54400a.kt @@ -1,7 +1,7 @@ // ISSUE: KT-54400 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt54400b.kt b/compiler/testData/codegen/box/builderInference/issues/kt54400b.kt index 8ded81226e7..a148afd8bc3 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt54400b.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt54400b.kt @@ -1,7 +1,7 @@ // ISSUE: KT-54400 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt54400c.kt b/compiler/testData/codegen/box/builderInference/issues/kt54400c.kt index fdd3ceca765..07305a97e9c 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt54400c.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt54400c.kt @@ -1,7 +1,7 @@ // ISSUE: KT-54400 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt57707.kt b/compiler/testData/codegen/box/builderInference/issues/kt57707.kt index 4b8fd916206..11b64779798 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt57707.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt57707.kt @@ -1,7 +1,7 @@ // ISSUE: KT-57707 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt57709.kt b/compiler/testData/codegen/box/builderInference/issues/kt57709.kt index bec781c7028..f945998f7cd 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt57709.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt57709.kt @@ -2,7 +2,8 @@ // WITH_STDLIB // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY +// TARGET_BACKEND: JVM // REASON: red code (see corresponding diagnostic test) var result = "" diff --git a/compiler/testData/codegen/box/builderInference/issues/kt57834.kt b/compiler/testData/codegen/box/builderInference/issues/kt57834.kt index 12a0563d0d5..1c830c3682d 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt57834.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt57834.kt @@ -1,7 +1,7 @@ // ISSUE: KT-57834 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt60291a.kt b/compiler/testData/codegen/box/builderInference/issues/kt60291a.kt index a702a190f15..e31afefde6e 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt60291a.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt60291a.kt @@ -2,7 +2,7 @@ // WITH_STDLIB // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt60291b.kt b/compiler/testData/codegen/box/builderInference/issues/kt60291b.kt index 5fb5a661b20..8d621824b57 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt60291b.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt60291b.kt @@ -1,7 +1,7 @@ // ISSUE: KT-60291 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt60291c.kt b/compiler/testData/codegen/box/builderInference/issues/kt60291c.kt index 1575e9efe3a..fcbe26080a0 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt60291c.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt60291c.kt @@ -1,7 +1,7 @@ // ISSUE: KT-60291 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt61310.kt b/compiler/testData/codegen/box/builderInference/issues/kt61310.kt index 6562ae7ef76..26dac4e6b92 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt61310.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt61310.kt @@ -1,7 +1,6 @@ // ISSUE: KT-61310 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND_K2: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt63733.kt b/compiler/testData/codegen/box/builderInference/issues/kt63733.kt index b917c1744fc..a500d09a8b5 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt63733.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt63733.kt @@ -1,7 +1,7 @@ // ISSUE: KT-63733 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun BoundedBuildee.setBoundedTypeVariable(arg: DifferentType) {} diff --git a/compiler/testData/codegen/box/builderInference/issues/kt63840a.kt b/compiler/testData/codegen/box/builderInference/issues/kt63840a.kt index 4aef087f788..76920d06a09 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt63840a.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt63840a.kt @@ -2,7 +2,7 @@ // WITH_STDLIB // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt63840b.kt b/compiler/testData/codegen/box/builderInference/issues/kt63840b.kt index 6a4c1a54bba..278737f4690 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt63840b.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt63840b.kt @@ -1,7 +1,7 @@ // ISSUE: KT-63840 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/builderInference/issues/kt63840c.kt b/compiler/testData/codegen/box/builderInference/issues/kt63840c.kt index e9fd45da643..f7bfd975fac 100644 --- a/compiler/testData/codegen/box/builderInference/issues/kt63840c.kt +++ b/compiler/testData/codegen/box/builderInference/issues/kt63840c.kt @@ -1,7 +1,7 @@ // ISSUE: KT-63840 // IGNORE_LIGHT_ANALYSIS -// IGNORE_BACKEND: ANY +// IGNORE_BACKEND_K1: ANY // REASON: red code (see corresponding diagnostic test) fun box(): String { diff --git a/compiler/testData/codegen/box/inference/builderInference/partiallyResolvedCallInReturnArgumentNonLast.kt b/compiler/testData/codegen/box/inference/builderInference/partiallyResolvedCallInReturnArgumentNonLast.kt index 676b6d592f6..001173a5a64 100644 --- a/compiler/testData/codegen/box/inference/builderInference/partiallyResolvedCallInReturnArgumentNonLast.kt +++ b/compiler/testData/codegen/box/inference/builderInference/partiallyResolvedCallInReturnArgumentNonLast.kt @@ -1,7 +1,5 @@ // WITH_STDLIB // TARGET_BACKEND: JVM -// IGNORE_BACKEND_K2: JVM_IR -// FIR status: KT-58742 class Out(val v: V) class Box { diff --git a/compiler/testData/codegen/box/inference/builderInference/partiallyResolvedCallInReturnArgumentNonUnit.kt b/compiler/testData/codegen/box/inference/builderInference/partiallyResolvedCallInReturnArgumentNonUnit.kt index 952269d8280..10b8b5a972f 100644 --- a/compiler/testData/codegen/box/inference/builderInference/partiallyResolvedCallInReturnArgumentNonUnit.kt +++ b/compiler/testData/codegen/box/inference/builderInference/partiallyResolvedCallInReturnArgumentNonUnit.kt @@ -1,7 +1,5 @@ // WITH_STDLIB // TARGET_BACKEND: JVM -// IGNORE_BACKEND_K2: JVM_IR -// FIR status: KT-58741 fun foo() = buildBox { diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160a.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160a.fir.kt index 493643a9d47..2ba210ed477 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160a.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160a.fir.kt @@ -2,7 +2,7 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val outerBuildee = build outerBuild@ { + val outerBuildee = build outerBuild@ { class LocalClass { fun localClassMember() { val innerBuildee = build innerBuild@ { @@ -17,7 +17,7 @@ fun test() { } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>(outerBuildee) + checkExactType>(outerBuildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160b.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160b.fir.kt index 9e45a3d3d77..2cabd9948d2 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160b.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160b.fir.kt @@ -2,7 +2,7 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val outerBuildee = build outerBuild@ { + val outerBuildee = build outerBuild@ { object { fun anonymousObjectMember() { val innerBuildee = build innerBuild@ { @@ -17,7 +17,7 @@ fun test() { } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>(outerBuildee) + checkExactType>(outerBuildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160c.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160c.fir.kt index 3e62da8c5f1..2b66b8fe2f7 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160c.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160c.fir.kt @@ -2,7 +2,7 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val outerBuildee = build outerBuild@ { + val outerBuildee = build outerBuild@ { fun localFunction() { val innerBuildee = build innerBuild@ { this@outerBuild.setTypeVariable(TargetType()) @@ -15,7 +15,7 @@ fun test() { } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>(outerBuildee) + checkExactType>(outerBuildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160d.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160d.fir.kt index eba034b5d3e..91e3140911c 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160d.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160d.fir.kt @@ -2,7 +2,7 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val outerBuildee = build outerBuild@ { + val outerBuildee = build outerBuild@ { val innerBuildee = build innerBuild@ { this@outerBuild.setTypeVariable(TargetType()) this@innerBuild.setTypeVariable(TargetType()) @@ -13,7 +13,7 @@ fun test() { } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>(outerBuildee) + checkExactType>(outerBuildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160e.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160e.fir.kt index bc07e6febb1..eea1cfe9fec 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt49160e.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt49160e.fir.kt @@ -2,8 +2,8 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val outerBuildee = build outerBuild@ { - val middleBuildee = build middleBuild@ { + val outerBuildee = build outerBuild@ { + val middleBuildee = build middleBuild@ { val innerBuildee = build innerBuild@ { this@outerBuild.setTypeVariable(TargetType()) this@middleBuild.setTypeVariable(TargetType()) @@ -15,11 +15,11 @@ fun test() { } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>(middleBuildee) + checkExactType>(middleBuildee) } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>(outerBuildee) + checkExactType>(outerBuildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt50453.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt50453.fir.kt index 76e1cfe9e9a..9136a144736 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt50453.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt50453.fir.kt @@ -4,7 +4,7 @@ fun test() { val buildee = build { setTypeVariable(TargetType()) - consume(getTypeVariable()) + consume(getTypeVariable()) } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt52838b.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt52838b.fir.kt index 3be9a0a7e98..b32e6ea28cf 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt52838b.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt52838b.fir.kt @@ -2,14 +2,14 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { this as DerivedBuildee<*> getTypeVariable() getTypeVariable() } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee<*>>(buildee) + checkExactType>(buildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt53639.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt53639.fir.kt index 9ca58ba7da3..d79f49cd6e3 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt53639.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt53639.fir.kt @@ -3,8 +3,8 @@ fun test() { val buildee = initializeAndBuild( - { build { setTypeVariable(TargetType()) } }, - { placeholderExtensionInvokeOnBuildee() }, + { build { setTypeVariable(TargetType()) } }, + { placeholderExtensionInvokeOnBuildee() }, ) // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt54400a.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt54400a.fir.kt index 5e4816d6194..4ece0f49ec1 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt54400a.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt54400a.fir.kt @@ -2,12 +2,12 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { typeVariableMutableProperty = "" } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>(buildee) + checkExactType>(buildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt54400b.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt54400b.fir.kt index 9e37b8906ad..8e8a02daf29 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt54400b.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt54400b.fir.kt @@ -2,12 +2,12 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { typeVariableMutableProperty = 42 } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>(buildee) + checkExactType>(buildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt54400c.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt54400c.fir.kt index f725c076192..7b74ab173ce 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt54400c.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt54400c.fir.kt @@ -2,12 +2,12 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { typeVariableMutableProperty = {} } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee<() -> Unit>>(buildee) + checkExactType Unit>>(buildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt54664.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt54664.fir.kt index a58b2402dff..751d747854d 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt54664.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt54664.fir.kt @@ -8,7 +8,7 @@ fun test() { } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType>(buildee) + checkExactType>(buildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt55057.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt55057.fir.kt index 6f2046fed21..e391fded45d 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt55057.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt55057.fir.kt @@ -11,13 +11,13 @@ fun Buildee.yieldWithoutAnnotation(value: ETV) {} fun Buildee.yieldWithAnnotation(t: ETV) {} fun test() { - val buildeeA = build { + val buildeeA = build { yieldWithoutAnnotation(materializeBuildee()) - yieldWithoutAnnotation(materializeBuildee()) + yieldWithoutAnnotation(materializeBuildee()) } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>>(buildeeA) + checkExactType>>(buildeeA) val buildeeB = build { yieldWithAnnotation(materializeBuildee()) diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt57707.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt57707.fir.kt index afa087e6efa..efd668d09ff 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt57707.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt57707.fir.kt @@ -2,10 +2,10 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { setTypeVariable(TargetType()) extensionSetOutProjectedTypeVariable(DifferentType()) - } + } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests checkExactType>(buildee) diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt57709.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt57709.fir.kt index 33deb02ab4a..7f12e96086a 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt57709.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt57709.fir.kt @@ -5,7 +5,7 @@ fun test() { val buildee = build { setTypeVariable(Any()) - consumeBuildeeReceiver() + consumeBuildeeReceiver() } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt57834.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt57834.fir.kt index 95ecbdf20bf..24b56e81984 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt57834.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt57834.fir.kt @@ -4,7 +4,7 @@ fun test() { val buildee = build { setTypeVariable(TargetType()) - consume(getTypeVariable()) + consume(getTypeVariable()) } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt60291a.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291a.fir.kt new file mode 100644 index 00000000000..1d1fb20b670 --- /dev/null +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291a.fir.kt @@ -0,0 +1,29 @@ +// ISSUE: KT-60291 +// CHECK_TYPE_WITH_EXACT +// WITH_STDLIB + +fun test() { + val buildee = selectBuildee( + build { setTypeVariable(TargetType()) }, + build {} + ) + // exact type equality check — turns unexpected compile-time behavior into red code + // considered to be non-user-reproducible code for the purposes of these tests + checkExactType>(buildee) +} + + + + +fun selectBuildee(vararg values: Buildee): Buildee = values.first() + +class TargetType + +class Buildee { + fun setTypeVariable(value: TV) { storage = value } + private var storage: TV = null!! +} + +fun build(instructions: Buildee.() -> Unit): Buildee { + return Buildee().apply(instructions) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt60291a.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291a.kt index d03397ece74..8477c928387 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt60291a.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291a.kt @@ -1,5 +1,4 @@ // ISSUE: KT-60291 -// FIR_IDENTICAL // CHECK_TYPE_WITH_EXACT // WITH_STDLIB diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt60291b.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291b.fir.kt new file mode 100644 index 00000000000..385a9dd2e7c --- /dev/null +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291b.fir.kt @@ -0,0 +1,26 @@ +// ISSUE: KT-60291 +// CHECK_TYPE_WITH_EXACT + +fun test() { + val buildee = if (true) + build { setTypeVariable(TargetType()) } + else + build {} + // exact type equality check — turns unexpected compile-time behavior into red code + // considered to be non-user-reproducible code for the purposes of these tests + checkExactType>(buildee) +} + + + + +class TargetType + +class Buildee { + fun setTypeVariable(value: TV) { storage = value } + private var storage: TV = null!! +} + +fun build(instructions: Buildee.() -> Unit): Buildee { + return Buildee().apply(instructions) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt60291b.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291b.kt index 6320ac3eabe..0179a242c2f 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt60291b.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291b.kt @@ -1,5 +1,4 @@ // ISSUE: KT-60291 -// FIR_IDENTICAL // CHECK_TYPE_WITH_EXACT fun test() { diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt60291c.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291c.fir.kt new file mode 100644 index 00000000000..d21082a4410 --- /dev/null +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291c.fir.kt @@ -0,0 +1,27 @@ +// ISSUE: KT-60291 +// CHECK_TYPE_WITH_EXACT + +fun test() { + val buildee = when ("") { + "true" -> build { setTypeVariable(TargetType()) } + "false" -> build {} + else -> Buildee() + } + // exact type equality check — turns unexpected compile-time behavior into red code + // considered to be non-user-reproducible code for the purposes of these tests + checkExactType>(buildee) +} + + + + +class TargetType + +class Buildee { + fun setTypeVariable(value: TV) { storage = value } + private var storage: TV = null!! +} + +fun build(instructions: Buildee.() -> Unit): Buildee { + return Buildee().apply(instructions) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt60291c.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291c.kt index 16ff6cbe300..3164082d6cc 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt60291c.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt60291c.kt @@ -1,5 +1,4 @@ // ISSUE: KT-60291 -// FIR_IDENTICAL // CHECK_TYPE_WITH_EXACT fun test() { diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt61310.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt61310.fir.kt deleted file mode 100644 index 346d4773b6f..00000000000 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt61310.fir.kt +++ /dev/null @@ -1,30 +0,0 @@ -// ISSUE: KT-61310 -// CHECK_TYPE_WITH_EXACT - -fun test() { - val buildee = build { - if (true) { - setTypeVariable(GenericBox()) - } else { - setTypeVariable(GenericBox()) - } - } - // exact type equality check — turns unexpected compile-time behavior into red code - // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>>(buildee) -} - - - - -class TargetType -class GenericBox - -class Buildee { - fun setTypeVariable(value: TV) { storage = value } - private var storage: TV = null!! -} - -fun build(instructions: Buildee.() -> Unit): Buildee { - return Buildee().apply(instructions) -} diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt61310.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt61310.kt index efa1c96e178..899a48e39a1 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt61310.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt61310.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // ISSUE: KT-61310 // CHECK_TYPE_WITH_EXACT diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt63733.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt63733.fir.kt index 00517c9ae0b..c7bad94ef15 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt63733.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt63733.fir.kt @@ -10,11 +10,11 @@ fun test() { } val buildee = boundedBuild { setBoundedTypeVariable(TargetType()) - setBoundedTypeVariable(DifferentType()) + setBoundedTypeVariable(DifferentType()) } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType>(; BoundedBuildee")!>buildee) + checkExactType>(buildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt63840a.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt63840a.fir.kt index adda3ffa730..79283de21f9 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt63840a.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt63840a.fir.kt @@ -3,12 +3,12 @@ // WITH_STDLIB fun test() { - val buildee = build { + val buildee = build { select( replaceTypeVariable(TargetType()), DifferentType() ) - } + } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests checkExactType>(buildee) diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt63840b.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt63840b.fir.kt index 598b3511415..b5641d28760 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt63840b.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt63840b.fir.kt @@ -2,12 +2,12 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { if (true) replaceTypeVariable(TargetType()) else DifferentType() - } + } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests checkExactType>(buildee) diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt63840c.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt63840c.fir.kt index 223c7a69324..e254c838b96 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt63840c.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt63840c.fir.kt @@ -2,12 +2,12 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { when { true -> replaceTypeVariable(TargetType()) else -> DifferentType() } - } + } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests checkExactType>(buildee) diff --git a/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/sourceSinkFeedContexts/InsideNestedBuilderInferenceLambda.fir.kt b/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/sourceSinkFeedContexts/InsideNestedBuilderInferenceLambda.fir.kt index c4633352301..3f4490d7c96 100644 --- a/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/sourceSinkFeedContexts/InsideNestedBuilderInferenceLambda.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/sourceSinkFeedContexts/InsideNestedBuilderInferenceLambda.fir.kt @@ -38,23 +38,23 @@ class Placeholder // test 1: PTV is in consuming position (yield-case) fun testYield() { val arg: UserKlass = UserKlass() - val buildee = build { + val buildee = build { nestedBuild { yield(arg) nestedYield(Placeholder()) } } - checkExactType<Buildee>(buildee) + checkExactType>(buildee) } // test 2: PTV is in producing position (materialize-case) fun testMaterialize() { fun consume(arg: UserKlass) {} - val buildee = build { + val buildee = build { nestedBuild { consume(materialize()) nestedYield(Placeholder()) } } - checkExactType<Buildee>(buildee) + checkExactType>(buildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/targetTypes/NullableNothingNullLiteralMaterializeCase.fir.kt b/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/targetTypes/NullableNothingNullLiteralMaterializeCase.fir.kt index cb61d49628d..bf8952beaf3 100644 --- a/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/targetTypes/NullableNothingNullLiteralMaterializeCase.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/targetTypes/NullableNothingNullLiteralMaterializeCase.fir.kt @@ -27,5 +27,5 @@ fun testMaterialize() { val buildee = build { shareTypeInfo(null, materialize()) } - checkExactType>(; Buildee")!>buildee) + checkExactType>(buildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/typeInfoSources/UnitReturnTypeOfBuilderParametersLastStatementReturnCase.fir.kt b/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/typeInfoSources/UnitReturnTypeOfBuilderParametersLastStatementReturnCase.fir.kt index df38568b57c..6a4e1abeff9 100644 --- a/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/typeInfoSources/UnitReturnTypeOfBuilderParametersLastStatementReturnCase.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/oneParameter/oneTypeVariable/oneTypeInfoOrigin/typeInfoSources/UnitReturnTypeOfBuilderParametersLastStatementReturnCase.fir.kt @@ -14,12 +14,12 @@ // PTV is returned as a last statement of the builder argument fun testLastStatementReturn() { - val buildee = build { + val buildee = build { materialize() } // exact type equality check — turns unexpected compile-time behavior into red code // considered to be non-user-reproducible code for the purposes of these tests - checkExactType<Buildee>(buildee) + checkExactType>(buildee) } /* REQUIRED DECLARATIONS */ diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.fir.kt index 599fa84d2de..319b50320d9 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt49828.fir.kt @@ -49,40 +49,40 @@ fun main() { add("one") val secondParameter = get(1) - println(secondParameter) // ERROR: [OVERLOAD_RESOLUTION_AMBIGUITY] Overload resolution ambiguity. All these functions match. + println(secondParameter) // ERROR: [OVERLOAD_RESOLUTION_AMBIGUITY] Overload resolution ambiguity. All these functions match. } val list2 = buildList { add("one") - println(get(1)) // ERROR: [OVERLOAD_RESOLUTION_AMBIGUITY] Overload resolution ambiguity. All these functions match. + println(get(1)) // ERROR: [OVERLOAD_RESOLUTION_AMBIGUITY] Overload resolution ambiguity. All these functions match. } val list3 = buildList { add("one") val secondParameter = Inv(get(1)) - foo(secondParameter) + foo(secondParameter) } val list4 = buildList { add("one") val secondParameter = get(1) - foo(Inv(secondParameter)) + foo(Inv(secondParameter)) } val list5 = buildList { add("one") - foo(Inv(get(1))) + foo(Inv(get(1))) } val list6 = buildList { add("one") - get(0).bar() + get(0).bar() } val list7 = buildList { add("one") with (get(0)) { - bar() + bar() } } val list71 = buildList { @@ -90,7 +90,7 @@ fun main() { with (get(0)) l1@ { with (listOf(1)) { - bar() + bar() } } } @@ -99,21 +99,21 @@ fun main() { with (get(0)) { with (listOf(1)) { - bar() + bar() } } } val list8 = buildList { add("one") - Inv(get(0)).foo2() + Inv(get(0)).foo2() } val list9 = buildList { add("one") with (get(0)) { with (Inv(this)) { - foo2() + foo2() } } } @@ -122,7 +122,7 @@ fun main() { with (get(0)) { with (Inv(this)) { - bar() + bar() } } } @@ -148,46 +148,46 @@ fun main() { val list13 = buildList { add("one") - foo000(get(0), 0f, get(0)) + foo000(get(0), 0f, get(0)) } val list14 = buildList { add("one") - foo0000(get(0), 0f, get(0)) + foo0000(get(0), 0f, get(0)) } val list17 = buildList l1@ { add("one") with (get(0)) { - foo0003(0f, this@l1.get(0)) + foo0003(0f, this@l1.get(0)) } } val list18 = buildList { add("one") - get(0).foo0003(0f, get(0)) + get(0).foo0003(0f, get(0)) } val map1 = buildMap { put(1, "one") - foo11(entries) + foo11(entries) } // There aren't specific errors below as casting value arguments doesn't make a resolve successful val list15 = buildList { add("one") - foo0001(get(0), 0f, get(0)) + foo0001(get(0), 0f, get(0)) } val list16 = buildList { add("one") - foo0002(get(0), 0f, get(0)) + foo0002(get(0), 0f, get(0)) } } @@ -211,13 +211,13 @@ fun test() { add("") with (get()) { with (listOf(1)) { - bar() + bar() } } }, { put(1, "one") - foo11(entries()) + foo11(entries()) } ) } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt49829.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt49829.fir.kt new file mode 100644 index 00000000000..16facc00c58 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt49829.fir.kt @@ -0,0 +1,12 @@ +// WITH_STDLIB +// ISSUE: KT-50293 + +fun main() { + val list = buildList { + add("one") + add("two") + + val secondParameter = get(1) + println(secondParameter as String) + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt49829.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt49829.kt index d428168c8e1..6d603289ca1 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt49829.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt49829.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // WITH_STDLIB // ISSUE: KT-50293 diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt index ff481912628..0b0da110d5e 100644 --- a/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt +++ b/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt @@ -7,6 +7,6 @@ fun interface ReadOnlyProperty { } class Problem { - val variable: Int by delegate() // delegate returns `ReadOnlyProperty` + val variable: Int by delegate() // delegate returns `ReadOnlyProperty` fun delegate() = null as ReadOnlyProperty } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazy.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazy.fir.kt index 8c7e67e0b8b..7804ca04474 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazy.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazy.fir.kt @@ -28,11 +28,11 @@ internal class TowerDataElementsForName2() { } internal class TowerDataElementsForName3() { - val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { + val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { @OptIn(ExperimentalStdlibApi::class) - buildList l1@ { + buildList l1@ { for (i in lastIndex downTo 0) { - val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { + val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { @OptIn(ExperimentalStdlibApi::class) buildList { for (i in lastIndex downTo 0) { @@ -40,15 +40,15 @@ internal class TowerDataElementsForName3() { this@l1.add("") } } - } + } } } - } + } } internal class TowerDataElementsForName4() { @OptIn(ExperimentalStdlibApi::class) - val reversedFilteredLocalScopes = buildList l1@ { + val reversedFilteredLocalScopes = buildList l1@ { class Foo { val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { @OptIn(ExperimentalStdlibApi::class) diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazyForbidden.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazyForbidden.fir.kt index 19c1ce18113..d8657762618 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazyForbidden.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundInLazyForbidden.fir.kt @@ -28,11 +28,11 @@ internal class TowerDataElementsForName2() { } internal class TowerDataElementsForName3() { - val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { + val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { @OptIn(ExperimentalStdlibApi::class) - buildList l1@ { + buildList l1@ { for (i in lastIndex downTo 0) { - val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { + val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { @OptIn(ExperimentalStdlibApi::class) buildList { for (i in lastIndex downTo 0) { @@ -40,15 +40,15 @@ internal class TowerDataElementsForName3() { this@l1.add("") } } - } + } } } - } + } } internal class TowerDataElementsForName4() { @OptIn(ExperimentalStdlibApi::class) - val reversedFilteredLocalScopes = buildList l1@ { + val reversedFilteredLocalScopes = buildList l1@ { class Foo { val reversedFilteredLocalScopes by lazy(LazyThreadSafetyMode.NONE) { @OptIn(ExperimentalStdlibApi::class) diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.diag.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.diag.txt deleted file mode 100644 index d582fb5e955..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/inconsistentTypeInference.fir.kt:(62,127): error: New inference error [NewConstraintError at Incorporate kotlin/collections/MutableList <: kotlin/collections/Collection from Incorporated builder inference constraint kotlin/collections/MutableList <: kotlin/collections/Collection from Receiver this@R|special/anonymous| into some call from position Incorporated builder inference constraint kotlin/collections/MutableList <: kotlin/collections/Collection from Receiver this@R|special/anonymous| into some call: kotlin/String buildList { + buildList { add("Boom") println(plus(1)[0]) - } + } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.txt index 9db449a5b2f..c8df77b2848 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.txt @@ -1,8 +1,8 @@ FILE: inconsistentTypeInference.fir.kt public final fun foo(): R|kotlin/Unit| { - R|kotlin/collections/buildList#|( = buildList@fun R|kotlin/collections/MutableList|.(): R|kotlin/Unit| { + R|kotlin/collections/buildList|( = buildList@fun R|kotlin/collections/MutableList|.(): R|kotlin/Unit| { this@R|special/anonymous|.R|SubstitutionOverride|(String(Boom)) - R|kotlin/io/println|(this@R|special/anonymous|.R|kotlin/collections/plus|(Int(1)).R|SubstitutionOverride|(Int(0))) + R|kotlin/io/println|(this@R|special/anonymous|.R|kotlin/collections/plus| & java/io/Serializable)|>(Int(1)).R|SubstitutionOverride & java/io/Serializable)|>|(Int(0))) } ) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.diag.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.diag.txt deleted file mode 100644 index deadcadf12d..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/inconsistentTypeInference2.fir.kt:(62,132): error: New inference error [NewConstraintError at Incorporate kotlin/collections/MutableList <: kotlin/collections/Collection from Incorporated builder inference constraint kotlin/collections/MutableList <: kotlin/collections/Collection from Receiver this@R|special/anonymous| into some call from position Incorporated builder inference constraint kotlin/collections/MutableList <: kotlin/collections/Collection from Receiver this@R|special/anonymous| into some call: kotlin/String buildList { + buildList { add("Boom") println(this.plus(1)[0]) - } + } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.txt index 160d14f56e2..feb87c70726 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.txt @@ -1,8 +1,8 @@ FILE: inconsistentTypeInference2.fir.kt public final fun bar(): R|kotlin/Unit| { - R|kotlin/collections/buildList#|( = buildList@fun R|kotlin/collections/MutableList|.(): R|kotlin/Unit| { + R|kotlin/collections/buildList|( = buildList@fun R|kotlin/collections/MutableList|.(): R|kotlin/Unit| { this@R|special/anonymous|.R|SubstitutionOverride|(String(Boom)) - R|kotlin/io/println|(this@R|special/anonymous|.R|kotlin/collections/plus|(Int(1)).R|SubstitutionOverride|(Int(0))) + R|kotlin/io/println|(this@R|special/anonymous|.R|kotlin/collections/plus| & java/io/Serializable)|>(Int(1)).R|SubstitutionOverride & java/io/Serializable)|>|(Int(0))) } ) }