From 6052e2462660afaa331635c3bf058a39f37fbc53 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Wed, 13 Dec 2023 15:09:23 +0100 Subject: [PATCH] K2: Adjust test data after PCLA implementation [red-to-red] ^KT-59791 In Progress --- .../builderInference/issues/kt43710.fir.kt | 2 +- .../builderInference/issues/kt52838a.fir.kt | 4 +- .../builderInference/issues/kt52838c.fir.kt | 4 +- .../builderInference/issues/kt54664.fir.kt | 4 +- .../builderInference/issues/kt55056.fir.kt | 6 +- .../builderInference/issues/kt56949.fir.kt | 6 +- .../builderInference/issues/kt59426.fir.kt | 2 +- .../builderInference/issues/kt59798.fir.kt | 27 ---- .../tests/builderInference/issues/kt59798.kt | 1 + .../builderInference/issues/kt63648.fir.kt | 2 +- .../builderInference/issues/kt63841.fir.kt | 10 +- .../namedFunAsLastExpressionInBlock.fir.kt | 2 +- ...ulProvideDelegateLeadsToRedGetValue.fir.kt | 2 +- .../complexInference.fir.kt | 4 +- .../implicitArguments/fromSuperClasses.fir.kt | 4 +- .../fromSuperClassesLocal.fir.kt | 4 +- .../fromSuperClassesLocalInsideInner.fir.kt | 4 +- .../fromSuperClassesTransitive.fir.kt | 2 +- .../constraints/violating.fir.kt | 4 +- .../errorOnStubReceiver.fir.kt | 21 --- .../errorOnStubReceiver.fir.txt | 4 +- .../builderInference/errorOnStubReceiver.kt | 1 + .../kt47986Default.fir.diag.txt | 2 + .../builderInference/kt47986Default.fir.kt | 2 +- .../kt47986Disabled.fir.diag.txt | 2 + .../builderInference/kt47986Disabled.fir.kt | 2 +- .../builderInference/kt47986Enabled.fir.kt | 12 ++ .../builderInference/kt47986Enabled.kt | 1 - .../builderInference/kt47986_2.fir.diag.txt | 2 + .../builderInference/kt47986_2.fir.kt | 2 +- .../builderInference/kt47986_3.fir.diag.txt | 4 + .../builderInference/kt47986_3.fir.kt | 2 +- .../builderInference/kt47986_4.fir.kt | 13 ++ .../inference/builderInference/kt47986_4.kt | 1 - .../builderInference/kt51464.fir.diag.txt | 2 + .../inference/builderInference/kt51464.fir.kt | 2 +- .../stubTypes/capturedTypesId.fir.kt | 6 +- .../stubTypes/intersect.fir.kt | 4 +- .../stubTypes/memberScope.fir.kt | 144 +++++++++--------- .../stubTypes/nullability.fir.kt | 12 +- .../stubTypeReceiverRestriction.fir.kt | 46 +++--- ...stubTypeReceiverRestrictionDisabled.fir.kt | 28 ++-- .../diagnostics/tests/inference/kt6175.fir.kt | 2 +- .../returnAsLastStatementInLambda.fir.kt | 2 +- .../fieldPropertyOverloadsDisabled.fir.kt | 8 +- .../tests/j+k/selectMoreSpecific.fir.kt | 4 +- .../notConsideredMethod.fir.kt | 2 +- .../tests/typeParameters/kt42472.fir.kt | 2 +- .../buildListToUpperBound.fir.kt | 2 +- .../buildListToUpperBoundForbidden.fir.kt | 2 +- .../builderInference/unsafeAssignment.fir.kt | 6 +- .../unsafeAssignmentExtra.fir.kt | 4 +- .../unsafeAssignmentExtra.fir.txt | 54 +++---- .../upperBoundViolation.fir.diag.txt | 4 +- .../upperBoundViolation.fir.kt | 6 +- .../upperBoundViolation.fir.txt | 2 +- ...extensionWithNonValuableConstraints.fir.kt | 2 +- .../coroutines/inference/kt35684.fir.kt | 2 +- .../inference/stubCallOnVariable.fir.txt | 6 +- .../suspendCallsWrongUpperBound.fir.kt | 2 +- .../p-1/neg/2.1.fir.kt | 12 +- .../p-1/neg/2.3.fir.kt | 8 +- .../p-1/neg/2.4.fir.kt | 12 +- 63 files changed, 272 insertions(+), 281 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/builderInference/issues/kt59798.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inference/builderInference/kt47986Enabled.fir.kt create mode 100644 compiler/testData/diagnostics/tests/inference/builderInference/kt47986_4.fir.kt diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt43710.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt43710.fir.kt index 6dee4794c10..0da8b6ea361 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt43710.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt43710.fir.kt @@ -4,7 +4,7 @@ fun test() { val buildee = build { setTypeVariable(TargetType()) - letForTypeVariable { it.extensionProduceConcreteType() } + letForTypeVariable { it.extensionProduceConcreteType() } } // 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/kt52838a.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt52838a.fir.kt index aab51a0fc70..66cbc4513fa 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt52838a.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt52838a.fir.kt @@ -2,14 +2,14 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { this as DerivedBuildee<*, *> getTypeVariableA() getTypeVariableB() } // 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/kt52838c.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt52838c.fir.kt index ce356f538f1..b8fcc1013f6 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt52838c.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt52838c.fir.kt @@ -2,13 +2,13 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { this as DerivedBuildee<*> 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/kt54664.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt54664.fir.kt index 3ec10d5b4b3..a58b2402dff 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt54664.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt54664.fir.kt @@ -4,11 +4,11 @@ fun test() { val buildee = build { setTypeVariable(TargetType()) - consumeDifferentTypeCallable(this::getTypeVariable) + consumeDifferentTypeCallable(this::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) + checkExactType>(buildee) } diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt55056.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt55056.fir.kt index a757b0af710..5eb2dfe1742 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt55056.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt55056.fir.kt @@ -2,10 +2,10 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { setTypeVariable(TargetType()) - consumeDifferentType(extensionReplaceOutProjectedTypeVariable(DifferentType())) - } + consumeDifferentType(extensionReplaceOutProjectedTypeVariable(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/kt56949.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt56949.fir.kt index fe7f591a639..362f03a39ef 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt56949.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt56949.fir.kt @@ -2,10 +2,10 @@ // CHECK_TYPE_WITH_EXACT fun test() { - val buildee = build { + val buildee = build { setTypeVariable(TargetType()) - consumeDifferentTypeSubtype(getTypeVariable()) - } + consumeDifferentTypeSubtype(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) diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt59426.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt59426.fir.kt index 045ee1d902d..69e2f9d7079 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt59426.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt59426.fir.kt @@ -4,7 +4,7 @@ fun test() { val buildee = build { setTypeVariable(DifferentType()) - 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/kt59798.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt59798.fir.kt deleted file mode 100644 index 93d2888f2cd..00000000000 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt59798.fir.kt +++ /dev/null @@ -1,27 +0,0 @@ -// ISSUE: KT-59798 -// CHECK_TYPE_WITH_EXACT - -fun test() { - val buildee = build { - setTypeVariable(TargetType()) - getTypeVariable().let {} - } - // 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 } - fun getTypeVariable(): TV = storage - private var storage: TV = null!! -} - -fun build(instructions: Buildee.() -> Unit): Buildee { - return Buildee().apply(instructions) -} diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt59798.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt59798.kt index 9ae052bb96e..dfd4492178b 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt59798.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt59798.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // ISSUE: KT-59798 // CHECK_TYPE_WITH_EXACT diff --git a/compiler/testData/diagnostics/tests/builderInference/issues/kt63648.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt63648.fir.kt index 860d8996bd6..d2507aa832f 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt63648.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt63648.fir.kt @@ -4,7 +4,7 @@ fun test() { val buildee = build { setTypeVariable(TargetType()) - getTypeVariable().consumeDifferentTypeReceiver() + getTypeVariable().consumeDifferentTypeReceiver() } // 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/kt63841.fir.kt b/compiler/testData/diagnostics/tests/builderInference/issues/kt63841.fir.kt index 961c038a65a..b1601b2803d 100644 --- a/compiler/testData/diagnostics/tests/builderInference/issues/kt63841.fir.kt +++ b/compiler/testData/diagnostics/tests/builderInference/issues/kt63841.fir.kt @@ -8,7 +8,7 @@ fun test() { val targetTypeBuildee = build { var variable = getTypeVariable() variable = TargetType() - variable.targetTypeMemberFunction() + variable.targetTypeMemberFunction() } // 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 @@ -26,15 +26,15 @@ fun test() { val anyBuildee = build { var variable = getTypeVariable() variable = TargetType() - variable.targetTypeMemberFunction() - variable = DifferentType() + variable.targetTypeMemberFunction() + variable = DifferentType() variable.targetTypeMemberFunction() variable = TargetType() - variable.targetTypeMemberFunction() + variable.targetTypeMemberFunction() } // 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>(anyBuildee) + checkExactType>(anyBuildee) } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt index 2ec7658277c..551f4556516 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt @@ -5,7 +5,7 @@ fun foo(block: () -> (() -> Int)) {} fun test() { val x = fun named1(x: Int): Int { return 1 } - x checkType { _>() } + x checkType { _<Function1>() } foo { fun named2(): Int {return 1} } foo({ fun named3() = 1 }) diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/successfulProvideDelegateLeadsToRedGetValue.fir.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/successfulProvideDelegateLeadsToRedGetValue.fir.kt index df7d206548f..b30940eed45 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/successfulProvideDelegateLeadsToRedGetValue.fir.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/successfulProvideDelegateLeadsToRedGetValue.fir.kt @@ -1,6 +1,6 @@ // ISSUE: KT-61077 -val test: Int by materializeDelegate() +val test: Int by materializeDelegate() fun materializeDelegate(): Box = TODO() diff --git a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt index 02e6cc54665..b5f82bbbe3c 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/destructuringInLambdas/complexInference.fir.kt @@ -31,8 +31,8 @@ fun bar(aInstance: A, bInstance: B) { foo(bInstance) { (a, b), (c, d) -> - a checkType { _() } - b checkType { _() } + a checkType { _<Int>() } + b checkType { _<String>() } c checkType { _() } d checkType { _() } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt index 958109f0e95..c5baa30032b 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClasses.fir.kt @@ -20,7 +20,7 @@ class A : Outer() { fun foo() { Derived().foo() checkType { _.Inner>() } - Derived().baz() checkType { _>() } + Derived().baz() checkType { _<Map>() } A.B().bar() checkType { _.Inner>() } - A.B().x() checkType { _>() } + A.B().x() checkType { _<Map>() } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt index f25e01526a3..ceef743772a 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocal.fir.kt @@ -42,7 +42,7 @@ fun test() { x = foobar() x().foo().a() checkType { _>() } - x().bar() checkType { _>() } + x().bar() checkType { _<A>() } x = foobar() @@ -50,5 +50,5 @@ fun test() { y = noParameters() y().foo().a() checkType { _>() } - y().bar() checkType { _>() } + y().bar() checkType { _<A>() } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt index d5ceb9abc81..18a0377d681 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesLocalInsideInner.fir.kt @@ -43,7 +43,7 @@ class Outer { x = foobar() x().foo().a() checkType { _>() } - x().bar() checkType { _>() } + x().bar() checkType { _<A>() } x = foobar() x = z.foobar() @@ -52,7 +52,7 @@ class Outer { y = noParameters() y().foo().a() checkType { _>() } - y().bar() checkType { _>() } + y().bar() checkType { _<A>() } } } } diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt index aa61d6e6633..e8d3b878b02 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/implicitArguments/fromSuperClassesTransitive.fir.kt @@ -15,5 +15,5 @@ class Derived : BaseDerived2() { fun foo() { Derived().foo() checkType { _.Inner>() } - Derived().baz() checkType { _>() } + Derived().baz() checkType { _<Map>() } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.fir.kt index 5d0a8aa932f..4713c3dc21c 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.fir.kt @@ -15,7 +15,7 @@ fun main() { } buildList { add(3) - val x: String = get(0) + val x: String = get(0) } buildList { add("3") @@ -28,6 +28,6 @@ fun main() { } buildList { add("") - val x: StringBuilder = get(0) + val x: StringBuilder = get(0) } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.fir.kt deleted file mode 100644 index 9be037847f2..00000000000 --- a/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -// WITH_STDLIB -// FIR_DUMP -// SKIP_TXT - -fun Any?.test() {} - -class Bar { - fun test() {} -} - -fun main() { - - buildList { - add(Bar()) - this.get(0).test() // resolved to Any?.test - } - buildList { - add(Bar()) - this.get(0).test() // resolved to Bar.test - } -} diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.fir.txt b/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.fir.txt index 12059f13c5b..19786568096 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.fir.txt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.fir.txt @@ -1,4 +1,4 @@ -FILE: errorOnStubReceiver.fir.kt +FILE: errorOnStubReceiver.kt public final fun R|kotlin/Any?|.test(): R|kotlin/Unit| { } public final class Bar : R|kotlin/Any| { @@ -13,7 +13,7 @@ FILE: errorOnStubReceiver.fir.kt public final fun main(): R|kotlin/Unit| { R|kotlin/collections/buildList|( = buildList@fun R|kotlin/collections/MutableList|.(): R|kotlin/Unit| { this@R|special/anonymous|.R|SubstitutionOverride|(R|/Bar.Bar|()) - this@R|special/anonymous|.R|SubstitutionOverride|(Int(0)).R|/test#|() + this@R|special/anonymous|.R|SubstitutionOverride|(Int(0)).R|/test#|() } ) R|kotlin/collections/buildList|( = buildList@fun R|kotlin/collections/MutableList|.(): R|kotlin/Unit| { diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt b/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt index 38e5002a960..80b8a1eadf3 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // WITH_STDLIB // FIR_DUMP // SKIP_TXT diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Default.fir.diag.txt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Default.fir.diag.txt index 12e619611be..5ae672ecfb3 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Default.fir.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Default.fir.diag.txt @@ -1 +1,3 @@ /kt47986Default.fir.kt:(175,183): error: Not enough information to infer type argument for 'K'. + +/kt47986Default.fir.kt:(194,197): error: Not enough information to infer type argument for 'K'. diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Default.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Default.fir.kt index dd4c7d432e0..f2f55c31c08 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Default.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Default.fir.kt @@ -7,6 +7,6 @@ fun Foo.bar(x: Int = 1) {} fun main() { val x = buildFoo { - bar() + bar() } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Disabled.fir.diag.txt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Disabled.fir.diag.txt index 13c2fa68694..2a81b3ccc94 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Disabled.fir.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Disabled.fir.diag.txt @@ -1 +1,3 @@ /kt47986Disabled.fir.kt:(249,257): error: Not enough information to infer type argument for 'K'. + +/kt47986Disabled.fir.kt:(268,271): error: Not enough information to infer type argument for 'K'. diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Disabled.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Disabled.fir.kt index d895b2cd999..fc447ce5358 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Disabled.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Disabled.fir.kt @@ -8,6 +8,6 @@ fun Foo.bar(x: Int = 1) {} fun main() { val x = buildFoo { - bar() + bar() } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Enabled.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Enabled.fir.kt new file mode 100644 index 00000000000..eb4951a7b8c --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Enabled.fir.kt @@ -0,0 +1,12 @@ +// !LANGUAGE: +ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound +class Foo + +fun buildFoo(builderAction: Foo.() -> Unit): Foo = Foo() + +fun Foo.bar(x: Int = 1) {} + +fun main() { + val x = buildFoo { + bar() + } +} diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Enabled.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Enabled.kt index f83115cf0f8..98cd6209f7b 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Enabled.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986Enabled.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // !LANGUAGE: +ForbidInferringPostponedTypeVariableIntoDeclaredUpperBound class Foo diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_2.fir.diag.txt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_2.fir.diag.txt index 0c9c93e33e8..eeb0eb129a8 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_2.fir.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_2.fir.diag.txt @@ -1 +1,3 @@ /kt47986_2.fir.kt:(187,195): error: Not enough information to infer type argument for 'K'. + +/kt47986_2.fir.kt:(234,237): error: Not enough information to infer type argument for 'L'. diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_2.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_2.fir.kt index ab50575f175..0492f7bbc5d 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_2.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_2.fir.kt @@ -9,6 +9,6 @@ fun id(x: K) = x fun main() { val x = buildFoo { // can't infer - val y = id(::bar) + val y = id(::bar) } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_3.fir.diag.txt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_3.fir.diag.txt index 6fb7b472791..1cfb5373eca 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_3.fir.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_3.fir.diag.txt @@ -1 +1,5 @@ /kt47986_3.fir.kt:(181,189): error: Not enough information to infer type argument for 'K'. + +/kt47986_3.fir.kt:(200,203): error: Not enough information to infer type argument for 'K'. + +/kt47986_3.fir.kt:(200,203): error: Not enough information to infer type argument for 'N'. diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_3.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_3.fir.kt index cc409ec258a..c64445d1224 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_3.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_3.fir.kt @@ -7,6 +7,6 @@ fun Foo.bar(x: Int = 1) {} fun main() { val x = buildFoo { - bar() + bar() } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_4.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_4.fir.kt new file mode 100644 index 00000000000..e3e7482f6bf --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_4.fir.kt @@ -0,0 +1,13 @@ +class Foo + +fun buildFoo(builderAction: Foo.() -> Unit): Foo = Foo() + +class Bar + +fun , N: Bar> Foo.bar(x: Int = 1) {} + +fun main() { + val x = buildFoo { + bar() + } +} diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_4.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_4.kt index 9c56154d65a..7b6e21402f7 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_4.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt47986_4.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL class Foo fun buildFoo(builderAction: Foo.() -> Unit): Foo = Foo() diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt51464.fir.diag.txt b/compiler/testData/diagnostics/tests/inference/builderInference/kt51464.fir.diag.txt index f488b20113c..5129a8a3afb 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt51464.fir.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt51464.fir.diag.txt @@ -1 +1,3 @@ /kt51464.fir.kt:(298,307): error: Not enough information to infer type argument for 'R'. + +/kt51464.fir.kt:(310,316): error: Not enough information to infer type argument for 'T'. diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/kt51464.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/kt51464.fir.kt index d22eb57c03d..96fe7a878d3 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/kt51464.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/kt51464.fir.kt @@ -9,5 +9,5 @@ fun Flow.transform(transform: FlowCollector.(T) -> Unit): Flow = fun f() { fun doEmit(collector: FlowCollector) {} - flowOf(1).transform { doEmit(this) } + flowOf(1).transform { doEmit(this) } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/capturedTypesId.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/capturedTypesId.fir.kt index 772c869896b..864a955ca0a 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/capturedTypesId.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/capturedTypesId.fir.kt @@ -19,13 +19,13 @@ fun capture(x: Inv): K = null as K fun id(x: I): I = null as I fun main() { - build { + build { emit("") // K is fixed into CapturedType(out NotFixed: TypeVariable(R) - capture(id(getOut())) // unexpected TYPE_MISMATCH (KT-63996) + capture(id(getOut())) // unexpected TYPE_MISMATCH (KT-63996) // capture(getOut()) // OK!!! Unit - } + } build { emit("") // K is fixed into CapturedType(out NotFixed: TypeVariable(R) diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.fir.kt index 20fbfebaec0..a7513e9aecf 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.fir.kt @@ -31,7 +31,7 @@ fun intersect(vararg x: In): E = null as E fun test() { val ret = build { emit("1") - intersect(getIn(), getIn()) + intersect(getIn(), getIn()) intersect(getIn(), Test.foo(getIn())) intersect(Test.foo(getIn()), Test.foo(getIn())) intersect(Test.foo(getIn()), getIn()) @@ -46,4 +46,4 @@ fun test() { } "" } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt index 752eace55bf..6b841d1f52e 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt @@ -17,58 +17,58 @@ fun Any.test() {} fun Any?.test2() {} fun test() { - val ret1 = build { + val ret1 = build { emit(1) emit(null) - get()?.test() - get()?.test2() - get().test2() - get()?.hashCode() - get()?.equals(1) + get()?.test() + get()?.test2() + get().test2() + get()?.hashCode() + get()?.equals(1) // there is `String?.equals` extension - get().equals("") - } - val ret2 = build { + get().equals("") + } + val ret2 = build { emit(1) emit(null) - get()?.test() - get()?.test2() - get().test2() - get()?.hashCode() - get()?.equals(1) + get()?.test() + get()?.test2() + get().test2() + get()?.hashCode() + get()?.equals(1) val x = get() - x?.hashCode() - x?.equals(1) - x.equals("") - } - val ret3 = build { + x?.hashCode() + x?.equals(1) + x.equals("") + } + val ret3 = build { emit(1) emit(null) - get()?.test() - get()?.test2() - get().test2() - get()?.hashCode() - get()?.equals(1) + get()?.test() + get()?.test2() + get().test2() + get()?.hashCode() + get()?.equals(1) val x = get() - x?.hashCode() - x?.equals(1) + x?.hashCode() + x?.equals(1) if (get() == null) {} if (get() === null) {} if (x != null) { - x?.hashCode() - x?.equals(1) - x.equals("") - x.hashCode() - x.toString() - x.test() - x?.test2() - x.test2() + x?.hashCode() + x?.equals(1) + x.equals("") + x.hashCode() + x.toString() + x.test() + x?.test2() + x.test2() } "" - } + } val ret4 = build { emit(1) emit(null) @@ -104,7 +104,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.test() + x.test() } "" @@ -144,44 +144,44 @@ fun test() { emit(null) val x = get() if (x === null) { - x.test() + x.test() } "" } - val ret408 = build { + val ret408 = build { emit(1) emit(null) val x = get() - x.test() + x.test() "" - } - val ret41 = build { + } + val ret41 = build { emit(1) emit(null) - get()?.test() - get()?.test2() - get().test2() - get()?.hashCode() - get()?.equals(1) + get()?.test() + get()?.test2() + get().test2() + get()?.hashCode() + get()?.equals(1) val x = get() - x?.hashCode() - x?.equals(1) + x?.hashCode() + x?.equals(1) if (get() == null) {} if (get() === null) {} if (x == null) { - x?.hashCode() + x?.hashCode() } if (x == null) { - x?.equals(1) + x?.equals(1) } if (x == null) { - x?.test2() + x?.test2() } if (x == null) { @@ -189,15 +189,15 @@ fun test() { } if (x === null) { - x?.hashCode() + x?.hashCode() } if (x === null) { - x?.equals(1) + x?.equals(1) } if (x === null) { - x?.test2() + x?.test2() } if (x === null) { @@ -205,7 +205,7 @@ fun test() { } "" - } + } val ret5 = build { emit(1) emit(null) @@ -239,7 +239,7 @@ fun test() { emit(null) val x = get() if (x == null) { - x.test() + x.test() } "" } @@ -276,39 +276,39 @@ fun test() { emit(null) val x = get() if (x === null) { - x.test() + x.test() } "" } - val ret508 = build { + val ret508 = build { emit(1) emit(null) val x = get() - x.test() + x.test() "" - } - val ret51 = build { + } + val ret51 = build { emit(1) emit(null) - get()?.test() - get()?.test2() - get().test2() - get()?.hashCode() - get()?.equals(1) + get()?.test() + get()?.test2() + get().test2() + get()?.hashCode() + get()?.equals(1) val x = get() - x?.hashCode() - x?.equals(1) + x?.hashCode() + x?.equals(1) if (get() == null) {} if (get() === null) {} if (x == null) { - x?.hashCode() - x?.equals(1) - x?.test2() + x?.hashCode() + x?.equals(1) + x?.test2() x.test2() } "" - } + } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.fir.kt index 133ad7932b0..76a8231be0e 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.fir.kt @@ -25,27 +25,27 @@ fun build4(x: R2, block: TestInterface.() -> Unit): R1 = TODO( fun test(a: String?) { val ret1 = build { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" } val ret2 = build2 { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" } val ret3 = build3 { emit(1) - get()?.equals("") + get()?.equals("") val x = get() - x?.equals("") + x?.equals("") x ?: 1 x!! "" diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt index d32e0210022..34f385d81a6 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestriction.fir.kt @@ -9,9 +9,9 @@ fun use(p: Any?) {} fun test1() { a { - this.get(0).extension() - use(this.get(0)::extension) - use(it::extension) + this.get(0).extension() + use(this.get(0)::extension) + use(it::extension) } } @@ -19,19 +19,19 @@ fun test1() { fun test2() { a { val v = this.get(0) - v.extension() - use(v::extension) - use(it::extension) + v.extension() + use(v::extension) + use(it::extension) } } fun test3() { operator fun T.getValue(thisRef: Any?, prop: Any?): T = this a { - val v by this.get(0) - v.extension() - use(v::extension) - use(it::extension) + val v by this.get(0) + v.extension() + use(v::extension) + use(it::extension) } } @@ -41,10 +41,10 @@ fun test4() { operator fun T.provideDelegate(thisRef: Any?, prop: Any?): Box = Box(this) operator fun Box.getValue(thisRef: Any?, prop: Any?): T = this.t a { - val v by this.get(0) - v.extension() - use(v::extension) - use(it::extension) + val v by this.get(0) + v.extension() + use(v::extension) + use(it::extension) } } @@ -53,20 +53,20 @@ fun b(lambda: R.(List) -> Unit) {} fun test5() { operator fun T.invoke(): T = this - b { - extension() - this().extension() - use(::extension) + b { + extension() + this().extension() + use(::extension) } } val T.genericLambda: T.((T) -> Unit) -> Unit get() = {} fun test6() { - b { - extension() - genericLambda { } - genericLambda { it.extension() } - use(::extension) + b { + extension() + genericLambda { } + genericLambda { it.extension() } + use(::extension) } } diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt index 4bd4c5e5a68..6e53c868631 100644 --- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/stubTypeReceiverRestrictionDisabled.fir.kt @@ -10,8 +10,8 @@ fun use(p: Any?) {} fun test1() { a { - this.get(0).extension() - use(this.get(0)::extension) + this.get(0).extension() + use(this.get(0)::extension) use(it::extension) } } @@ -20,8 +20,8 @@ fun test1() { fun test2() { a { val v = this.get(0) - v.extension() - use(v::extension) + v.extension() + use(v::extension) use(it::extension) } } @@ -29,9 +29,9 @@ fun test2() { fun test3() { operator fun T.getValue(thisRef: Any?, prop: Any?): T = this a { - val v by this.get(0) - v.extension() - use(v::extension) + val v by this.get(0) + v.extension() + use(v::extension) use(it::extension) } } @@ -42,9 +42,9 @@ fun test4() { operator fun T.provideDelegate(thisRef: Any?, prop: Any?): Box = Box(this) operator fun Box.getValue(thisRef: Any?, prop: Any?): T = this.t a { - val v by this.get(0) - v.extension() - use(v::extension) + val v by this.get(0) + v.extension() + use(v::extension) use(it::extension) } } @@ -56,7 +56,7 @@ fun test5() { operator fun T.invoke(): T = this b { extension() - this().extension() + this().extension() use(::extension) } } @@ -65,9 +65,9 @@ val T.genericLambda: T.((T) -> Unit) -> Unit get() = {} fun test6() { b { - extension() - genericLambda { } - genericLambda { it.extension() } + extension() + genericLambda { } + genericLambda { it.extension() } use(::extension) } } diff --git a/compiler/testData/diagnostics/tests/inference/kt6175.fir.kt b/compiler/testData/diagnostics/tests/inference/kt6175.fir.kt index d0fc6987f7a..2ff9aa3de41 100644 --- a/compiler/testData/diagnostics/tests/inference/kt6175.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/kt6175.fir.kt @@ -45,4 +45,4 @@ fun test4() { } } -fun fail(): Nothing = throw Exception() +fun fail(): Nothing = throw Exception() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/nothingType/returnAsLastStatementInLambda.fir.kt b/compiler/testData/diagnostics/tests/inference/nothingType/returnAsLastStatementInLambda.fir.kt index dd9b4bd9ba8..0099990b30b 100644 --- a/compiler/testData/diagnostics/tests/inference/nothingType/returnAsLastStatementInLambda.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/nothingType/returnAsLastStatementInLambda.fir.kt @@ -33,7 +33,7 @@ fun foo() { val dates3 = myRun { when { else -> return@myRun buildList { - add(4) + add(4) } } } diff --git a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt index 3da90b0530a..d8b635549fb 100644 --- a/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/properties/fieldPropertyOverloadsDisabled.fir.kt @@ -20,9 +20,9 @@ public abstract class CollectionWithSize implements java.util.Collection // FILE: main.kt fun main(c: CollectionWithSize) { - CompressionType.ZIP.name checkType { _() } - c.size checkType { _() } + CompressionType.ZIP.name checkType { _<Double>() } + c.size checkType { _<String>() } - CompressionType.ZIP::name checkType { _>() } - c::size checkType { _>() } + CompressionType.ZIP::name checkType { _<kotlin.reflect.KProperty0>() } + c::size checkType { _<kotlin.reflect.KProperty0>() } } diff --git a/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt b/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt index e0f2838b9a2..3198327332c 100644 --- a/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/selectMoreSpecific.fir.kt @@ -11,6 +11,6 @@ public class A { // FILE: main.kt fun foo(a: A) { - a.foo() checkType { _() } - A.bar() checkType { _() } + a.foo() checkType { _<String>() } + A.bar() checkType { _<String>() } } diff --git a/compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.fir.kt b/compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.fir.kt index 88b6690bb22..b9509073d89 100644 --- a/compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.fir.kt +++ b/compiler/testData/diagnostics/tests/testWithModifiedMockJdk/notConsideredMethod.fir.kt @@ -7,7 +7,7 @@ interface A : MutableCollection { } fun foo(x: MutableCollection, y: Collection, z: A) { - x.nonExistingMethod(1).checkType { _() } + x.nonExistingMethod(1).checkType { _<String>() } y.nonExistingMethod("") z.nonExistingMethod("") } diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/kt42472.fir.kt index 048a1e7f0af..ff481912628 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/buildListToUpperBound.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.fir.kt index d41665a4dbf..8fcc42992c6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBound.fir.kt @@ -4,7 +4,7 @@ fun box(): String { buildList { - val foo = { first() } + val foo = { first() } add(0, foo) } return "OK" diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.fir.kt index 940e3b75847..76be3d55acd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListToUpperBoundForbidden.fir.kt @@ -4,7 +4,7 @@ fun box(): String { buildList { - val foo = { first() } + val foo = { first() } add(0, foo) } return "OK" diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt index 71050a0f9a8..bb12aec873a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt @@ -7,10 +7,10 @@ fun myBuilder(block: Foo.() -> Unit) : Foo = Foo().apply(bloc fun main(arg: Any) { val x = 57 - val value = myBuilder { + val value = myBuilder { doSmthng("one ") run { a; this }.a = 10 - a += 1 + a += 1 this.a = 57 this.(a) = 57 a = x @@ -19,6 +19,6 @@ fun main(arg: Any) { if (arg is String) { a = arg } - } + } println(value.a?.count { it in 'l' .. 'q' }) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.kt index 5cb4a041fc5..a8d80979a6c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.kt @@ -62,8 +62,8 @@ fun main(arg: Any, condition: Boolean) { // See KT-54664 val value3 = myBuilder { accept("") - a = 45 - bar(::a) + a = 45 + bar(::a) } fun baz(t: Int) {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.txt index 0de1e0aafa6..441c5703c07 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.txt @@ -28,84 +28,84 @@ FILE: unsafeAssignmentExtra.fir.kt } public final fun main(arg: R|kotlin/Any|, condition: R|kotlin/Boolean|): R|kotlin/Unit| { lval value: R|Foo| = R|/myBuilder|( = myBuilder@fun R|Foo|.(): R|kotlin/Unit| { - this@R|special/anonymous|.R|SubstitutionOverride|>|.R|SubstitutionOverride|(Int(0), Int(123)) + this@R|special/anonymous|.R|SubstitutionOverride|>|.R|SubstitutionOverride|(Int(0), Int(123)) Unit - this@R|special/anonymous|.R|SubstitutionOverride| = Int(45) + this@R|special/anonymous|.R|SubstitutionOverride| = Int(45) { - lval : R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride| - this@R|special/anonymous|.R|SubstitutionOverride| = R|/|.#() + lval : R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride| + this@R|special/anonymous|.R|SubstitutionOverride| = R|/|.#() R|/| } - R|/bar|(::R|SubstitutionOverride|) + R|/bar|(::R|SubstitutionOverride|) when () { - (this@R|special/anonymous|.R|SubstitutionOverride| is R|kotlin/Int|) -> { - this@R|special/anonymous|.R|SubstitutionOverride| = Int(67) + (this@R|special/anonymous|.R|SubstitutionOverride| is R|kotlin/Int|) -> { + this@R|special/anonymous|.R|SubstitutionOverride| = Int(67) { - lval : R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride| - this@R|special/anonymous|.R|SubstitutionOverride| = R|/|.#() + lval : R|kotlin/Int| = this@R|special/anonymous|.R|SubstitutionOverride| + this@R|special/anonymous|.R|SubstitutionOverride| = R|/|.#() R|/| } - R|/bar|(::R|SubstitutionOverride|) + R|/bar|(::R|SubstitutionOverride|) } } when (R|/condition|) { ==($subj$, Boolean(true)) -> { - this@R|special/anonymous|.R|SubstitutionOverride| = Int(87) + this@R|special/anonymous|.R|SubstitutionOverride| = Int(87) } ==($subj$, Boolean(false)) -> { - this@R|special/anonymous|.R|SubstitutionOverride| = Int(65) + this@R|special/anonymous|.R|SubstitutionOverride| = Int(65) } } - lval x: by this@R|special/anonymous|.R|SubstitutionOverride| + lval x: by this@R|special/anonymous|.R|SubstitutionOverride| this@R|special/anonymous|.R|/change|( = change@fun R|Foo|.(): R|kotlin/Unit| { - this@R|special/anonymous|.R|SubstitutionOverride| = Int(99) + this@R|special/anonymous|.R|SubstitutionOverride| = Int(99) } ) } ) lval value2: R|Foo| = R|/myBuilder|( = myBuilder@fun R|Foo|.(): R|kotlin/Unit| { this@R|special/anonymous|.R|SubstitutionOverride|(String()) - this@R|special/anonymous|.R|SubstitutionOverride| = Int(45) + this@R|special/anonymous|.R|SubstitutionOverride| = Int(45) when (R|/condition|) { ==($subj$, Boolean(true)) -> { - this@R|special/anonymous|.R|SubstitutionOverride| = Int(87) + this@R|special/anonymous|.R|SubstitutionOverride| = Int(87) } ==($subj$, Boolean(false)) -> { - this@R|special/anonymous|.R|SubstitutionOverride| = Int(65) + this@R|special/anonymous|.R|SubstitutionOverride| = Int(65) } } this@R|special/anonymous|.R|/change|( = change@fun R|Foo|.(): R|kotlin/Unit| { - this@R|special/anonymous|.R|SubstitutionOverride| = Int(99) + this@R|special/anonymous|.R|SubstitutionOverride| = Int(99) } ) when () { - (this@R|special/anonymous|.R|SubstitutionOverride| is R|kotlin/Int|) -> { - this@R|special/anonymous|.R|SubstitutionOverride| = Int(67) + (this@R|special/anonymous|.R|SubstitutionOverride| is R|kotlin/Int|) -> { + this@R|special/anonymous|.R|SubstitutionOverride| = Int(67) } } } ) - lval value3: R|Foo| = R|/myBuilder#|( = myBuilder@fun R|Foo|.(): R|kotlin/Unit| { + lval value3: R|Foo| = R|/myBuilder|( = myBuilder@fun R|Foo|.(): R|kotlin/Unit| { this@R|special/anonymous|.R|SubstitutionOverride|(String()) - this@R|special/anonymous|.R|SubstitutionOverride| = Int(45) - R|/bar|(::R|SubstitutionOverride|) + this@R|special/anonymous|.R|SubstitutionOverride| = Int(45) + R|/bar#|(::#) } ) local final fun baz(t: R|kotlin/Int|): R|kotlin/Unit| { } - lval value4: R|Foo & java/io/Serializable)>| = R|/myBuilder#| & java/io/Serializable)|>( = myBuilder@fun R|Foo & java/io/Serializable)>|.(): R|kotlin/Unit| { + lval value4: R|Foo & java/io/Serializable)>| = R|/myBuilder| & java/io/Serializable)|>( = myBuilder@fun R|Foo & java/io/Serializable)>|.(): R|kotlin/Unit| { this@R|special/anonymous|.R|SubstitutionOverride|(String()) - this@R|special/anonymous|.R|SubstitutionOverride| = Int(45) - this@R|special/anonymous|.R|SubstitutionOverride|>|.R|SubstitutionOverride|(Int(0), Int(123)) + this@R|special/anonymous|.R|SubstitutionOverride & java/io/Serializable)|>| = Int(45) + this@R|special/anonymous|.R|SubstitutionOverride & java/io/Serializable)>|>|.R|SubstitutionOverride|(Int(0), Int(123)) Unit - R|/baz|(this@R|special/anonymous|.R|SubstitutionOverride|) + R|/baz/baz>#|(this@R|special/anonymous|.R|SubstitutionOverride & java/io/Serializable)|>|) } ) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.diag.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.diag.txt index 85dd7cd9988..a747a3a97b9 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.diag.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.diag.txt @@ -1 +1,3 @@ -/upperBoundViolation.fir.kt:(150,260): error: New inference error [NewConstraintError at Incorporate TypeVariable(E) <: kotlin/Number from Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call from position Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call: kotlin/String printGenericNumber(t: T) = println("Number is $t") fun main() { - buildList { // inferred into MutableList + buildList { // inferred into MutableList add("Boom") - printGenericNumber(this[0]) - } + printGenericNumber(this[0]) + } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.txt index 178c1a165b0..2cf1d8d2ce8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.txt @@ -5,7 +5,7 @@ FILE: upperBoundViolation.fir.kt public final fun main(): 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|/printGenericNumber|(this@R|special/anonymous|.R|SubstitutionOverride|(Int(0))) + R|/printGenericNumber#|<>(this@R|special/anonymous|.R|SubstitutionOverride|(Int(0))) } ) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.fir.kt index e2af7d4371a..d87eb58965b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.fir.kt @@ -52,7 +52,7 @@ val test6 = generate { val test7 = generate { yield("baz") - genericExtension() + genericExtension() } val test8 = generate { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.fir.kt index a8933940d5d..9719ca24198 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.fir.kt @@ -12,7 +12,7 @@ fun test_1() { } fun test_2() { - sequence { + sequence { yield(materialize()) } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/stubCallOnVariable.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/stubCallOnVariable.fir.txt index 2d1370151d6..97828fcba31 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/stubCallOnVariable.fir.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/stubCallOnVariable.fir.txt @@ -22,9 +22,9 @@ FILE: stubCallOnVariable.kt ^ R|/it|.R|kotlin/text/toInt|() } ) - this@R|special/anonymous|.R|SubstitutionOverride|( = serialize@fun (it: R|kotlin/Int|): R|kotlin/Any?| { - lval i: R|kotlin/Int| = R|/it| - ^ (R|/i| as R|kotlin/Any|).R|kotlin/Any.toString|() + this@R|special/anonymous|.R|SubstitutionOverride|( = serialize@fun (it: ): R|kotlin/Any?| { + lval i: = R|/it| + ^ R|/i|.R|kotlin/toString|() } ) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWrongUpperBound.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWrongUpperBound.fir.kt index b58604aa740..90f7a9cb13c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWrongUpperBound.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/suspendCallsWrongUpperBound.fir.kt @@ -7,6 +7,6 @@ class Controller { fun generate(g: suspend Controller.() -> Unit): S = TODO() -val test = generate { +val test = generate { yield("foo") } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt index 94dd1a02dc7..ea58a9483a0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.1.fir.kt @@ -12,10 +12,10 @@ // TESTCASE NUMBER: 1 fun case_1() { - 0l checkType { check() } - 10000000000000l checkType { check() } - 0X000Af10cDl checkType { check() } - 0x0_0l checkType { check() } - 0b100_000_111_111l checkType { check() } - 0b0l checkType { check() } + 0l checkType { check<Long>() } + 10000000000000l checkType { check<Long>() } + 0X000Af10cDl checkType { check<Long>() } + 0x0_0l checkType { check<Long>() } + 0b100_000_111_111l checkType { check<Long>() } + 0b0l checkType { check<Long>() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt index 6e5a0e0f987..50bfbd5891a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.fir.kt @@ -115,8 +115,8 @@ fun case_6() { checkSubtype(-100000000000000000000000000000000) checkSubtype(-100000000000000000000000000000000) checkSubtype(-100000000000000000000000000000000) - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check<Byte>() } + -100000000000000000000000000000000 checkType { check<Short>() } + -100000000000000000000000000000000 checkType { check<Int>() } + -100000000000000000000000000000000 checkType { check<Long>() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt index 50d2b10e5a3..3966ec4b4b8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.fir.kt @@ -13,23 +13,23 @@ // TESTCASE NUMBER: 1 fun case_1() { checkSubtype(-9223372036854775808L) - -9223372036854775808L checkType { check() } + -9223372036854775808L checkType { check<Long>() } checkSubtype(9223372036854775808L) - 9223372036854775808L checkType { check() } + 9223372036854775808L checkType { check<Long>() } } // TESTCASE NUMBER: 2 fun case_2() { checkSubtype(100000000000000000000000000000000L) - 100000000000000000000000000000000L checkType { check() } + 100000000000000000000000000000000L checkType { check<Long>() } checkSubtype(100000000000000000000000000000000l) - 100000000000000000000000000000000l checkType { check() } + 100000000000000000000000000000000l checkType { check<Long>() } checkSubtype(-100000000000000000000000000000000L) - -100000000000000000000000000000000L checkType { check() } + -100000000000000000000000000000000L checkType { check<Long>() } checkSubtype(-100000000000000000000000000000000l) - -100000000000000000000000000000000l checkType { check() } + -100000000000000000000000000000000l checkType { check<Long>() } }