Do updating calls for all nested builder inference sessions including at the same level
This commit is contained in:
+6
@@ -17065,6 +17065,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt")
|
||||
public void testTopDownCompletionWithThreeBuilderInferenceCallsSameLevel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topDownCompletionWithTwoBuilderInferenceCalls.kt")
|
||||
public void testTopDownCompletionWithTwoBuilderInferenceCalls() throws Exception {
|
||||
|
||||
+5
-3
@@ -53,11 +53,11 @@ class BuilderInferenceSession(
|
||||
) : ManyCandidatesResolver<CallableDescriptor>(
|
||||
psiCallResolver, postponedArgumentsAnalyzer, kotlinConstraintSystemCompleter, callComponents, builtIns
|
||||
) {
|
||||
var nestedBuilderInferenceSession: BuilderInferenceSession? = null
|
||||
private var nestedBuilderInferenceSessions: MutableSet<BuilderInferenceSession> = mutableSetOf()
|
||||
|
||||
init {
|
||||
if (topLevelCallContext.inferenceSession is BuilderInferenceSession) {
|
||||
topLevelCallContext.inferenceSession.nestedBuilderInferenceSession = this
|
||||
topLevelCallContext.inferenceSession.nestedBuilderInferenceSessions.add(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,9 @@ class BuilderInferenceSession(
|
||||
|
||||
updateCalls(lambda, resultingSubstitutor, commonSystem.errors)
|
||||
|
||||
nestedBuilderInferenceSession?.updateAllCalls(substitutor, commonSystem, lambda)
|
||||
for (nestedSession in nestedBuilderInferenceSessions) {
|
||||
nestedSession.updateAllCalls(substitutor, commonSystem, lambda)
|
||||
}
|
||||
}
|
||||
|
||||
override fun shouldCompleteResolvedSubAtomsOf(resolvedCallAtom: ResolvedCallAtom) = true
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -EXPERIMENTAL_IS_NOT_ENABLED
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
class A1<T> {
|
||||
fun <BT1> builder1(@BuilderInference configure: A2<BT1>.() -> Unit) {}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
class A2<A2_BT1> {
|
||||
fun <BT2> builder2(@BuilderInference configure: A3<A2_BT1, BT2>.() -> Unit) {}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
class A3<A3_BT1, A3_BT2> {
|
||||
fun <BT3> builder3(@BuilderInference configure: A4<A3_BT1, A3_BT2, BT3>.() -> Unit) {}
|
||||
}
|
||||
|
||||
class A4<A3_BT1, A3_BT2, A3_BT3> {
|
||||
fun resolver(x: A3_BT3) {}
|
||||
}
|
||||
|
||||
fun foo(x: A1<String>) {
|
||||
x.builder1<String> {
|
||||
builder2<String> {
|
||||
builder3 {
|
||||
resolver("")
|
||||
}
|
||||
builder3 {
|
||||
resolver("")
|
||||
}
|
||||
}
|
||||
builder2<String> {
|
||||
builder3 {
|
||||
resolver("")
|
||||
}
|
||||
builder3 {
|
||||
resolver("")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo(A1())
|
||||
return "OK"
|
||||
}
|
||||
+6
@@ -17065,6 +17065,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt")
|
||||
public void testTopDownCompletionWithThreeBuilderInferenceCallsSameLevel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topDownCompletionWithTwoBuilderInferenceCalls.kt")
|
||||
public void testTopDownCompletionWithTwoBuilderInferenceCalls() throws Exception {
|
||||
|
||||
+6
@@ -17065,6 +17065,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt")
|
||||
public void testTopDownCompletionWithThreeBuilderInferenceCallsSameLevel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("topDownCompletionWithTwoBuilderInferenceCalls.kt")
|
||||
public void testTopDownCompletionWithTwoBuilderInferenceCalls() throws Exception {
|
||||
|
||||
+5
@@ -14132,6 +14132,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt")
|
||||
public void testTopDownCompletionWithThreeBuilderInferenceCallsSameLevel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithTwoBuilderInferenceCalls.kt")
|
||||
public void testTopDownCompletionWithTwoBuilderInferenceCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithTwoBuilderInferenceCalls.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -12416,6 +12416,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt")
|
||||
public void testTopDownCompletionWithThreeBuilderInferenceCallsSameLevel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithTwoBuilderInferenceCalls.kt")
|
||||
public void testTopDownCompletionWithTwoBuilderInferenceCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithTwoBuilderInferenceCalls.kt");
|
||||
|
||||
Generated
+5
@@ -11837,6 +11837,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt")
|
||||
public void testTopDownCompletionWithThreeBuilderInferenceCallsSameLevel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithTwoBuilderInferenceCalls.kt")
|
||||
public void testTopDownCompletionWithTwoBuilderInferenceCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithTwoBuilderInferenceCalls.kt");
|
||||
|
||||
Generated
+5
@@ -11902,6 +11902,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt")
|
||||
public void testTopDownCompletionWithThreeBuilderInferenceCallsSameLevel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithTwoBuilderInferenceCalls.kt")
|
||||
public void testTopDownCompletionWithTwoBuilderInferenceCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithTwoBuilderInferenceCalls.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -6308,6 +6308,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt")
|
||||
public void testTopDownCompletionWithThreeBuilderInferenceCallsSameLevel() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithThreeBuilderInferenceCallsSameLevel.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topDownCompletionWithTwoBuilderInferenceCalls.kt")
|
||||
public void testTopDownCompletionWithTwoBuilderInferenceCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inference/builderInference/topDownCompletionWithTwoBuilderInferenceCalls.kt");
|
||||
|
||||
Reference in New Issue
Block a user