K2: Fix internal error in FIR2IR caused by PCLA + String interpolation

There's an implicit contract in PCLA that the statement-level call
should be postponed iff it has something to be postponed inside.

And that contract didn't work well for string interpolation containing
some postponed calls.

Thus, we haven't run a completion results writing for them properly,
thus leaving type parameters (K from synthetic call) for expression
types instead of an inferred substituted type.

In this commit, the contract was reversed to explicitly enumerate
the cases when it's safe to resolve the candidate outside PCLA session.

See the comments at `mightBeAnalyzedAndCompletedIndependently`.

^KT-65341 Fixed
This commit is contained in:
Denis.Zharkov
2024-01-29 15:17:04 +01:00
committed by Space Team
parent 3ba8256b8d
commit 66d8f471d9
27 changed files with 346 additions and 147 deletions
@@ -1879,6 +1879,12 @@ public class FirWasmJsCodegenBoxTestGenerated extends AbstractFirWasmJsCodegenBo
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {
@@ -1879,6 +1879,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
runTest("compiler/testData/codegen/box/builderInference/pclaRootIsTrySyntheticCall.kt");
}
@Test
@TestMetadata("posptonedPCLACallInsideStringInterpolation.kt")
public void testPosptonedPCLACallInsideStringInterpolation() throws Exception {
runTest("compiler/testData/codegen/box/builderInference/posptonedPCLACallInsideStringInterpolation.kt");
}
@Test
@TestMetadata("receiverUsesOuterTVButReturnTypeIsProper.kt")
public void testReceiverUsesOuterTVButReturnTypeIsProper() throws Exception {