提交 e0a8e9a6 编写于 作者: V Victor Petukhov

Do updating calls for all nested builder inference sessions including at the same level

上级 999d1f98
......@@ -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 {
......@@ -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
......
// !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"
}
\ No newline at end of file
......@@ -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 {
......@@ -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 {
......@@ -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");
......@@ -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");
......@@ -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");
......@@ -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");
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册