From f03c134d4ece7e584bcb87970efad200b04bf5f1 Mon Sep 17 00:00:00 2001 From: Frederik Haselmeier Date: Fri, 6 Feb 2026 11:09:28 +0100 Subject: [PATCH] [kotlin] KTIJ-35873 adjusted tests after removing liftShorter weigher Many weigher tests used to explicitly expect the shorter element to be the very next element, but this is no longer the case. GitOrigin-RevId: 6c3b1a41f27947aba8ee28ad5784f70212cffb2f --- .../completion/testData/basic/common/when/enumInEmptyWhen.kt | 2 +- .../completion/testData/basic/common/when/enumInWhen.kt | 2 +- .../testData/basic/common/when/enumInWhenWithPackage.kt | 2 +- .../testData/basic/common/when/nestedSealedClassInWhen.kt | 2 +- .../basic/common/when/nestedSealedClassInWhenWithPackage.kt | 2 +- .../testData/basic/common/when/nullableEnumInWhen.kt | 2 +- .../testData/weighers/basic/DoNotPreferNullForNonNullable.kt | 4 +++- .../testData/weighers/basic/DoNotPreferNullForNonNullable2.kt | 4 +++- .../kotlin/completion/testData/weighers/basic/KeywordsLast.kt | 3 ++- .../completion/testData/weighers/basic/PreferThisWithLabel.kt | 4 +++- .../basic/contextualReturn/noReturnType/BeginOfNestedBlock.kt | 2 +- .../contextualReturn/noReturnType/BeginOfTopLevelBlock.kt | 2 +- .../basic/contextualReturn/noReturnType/EndOfTopLevelBlock.kt | 2 +- .../basic/contextualReturn/noReturnType/ForWithBody.kt | 2 +- .../basic/contextualReturn/noReturnType/ForWithoutBody.kt | 2 +- .../contextualReturn/withReturnType/BeginOfNestedBlock.kt | 2 +- .../contextualReturn/withReturnType/BeginOfTopLevelBlock.kt | 2 +- .../basic/contextualReturn/withReturnType/ForWithBody.kt | 2 +- .../basic/contextualReturn/withReturnType/ForWithoutBody.kt | 2 +- .../basic/expectedType/returnFromFunctionQualifiedSelector.kt | 2 +- 20 files changed, 27 insertions(+), 20 deletions(-) diff --git a/plugins/kotlin/completion/testData/basic/common/when/enumInEmptyWhen.kt b/plugins/kotlin/completion/testData/basic/common/when/enumInEmptyWhen.kt index cd60d5cd72dd..42cf5434524e 100644 --- a/plugins/kotlin/completion/testData/basic/common/when/enumInEmptyWhen.kt +++ b/plugins/kotlin/completion/testData/basic/common/when/enumInEmptyWhen.kt @@ -12,8 +12,8 @@ fun foo(e: ENUM) { // WITH_ORDER // EXIST: ENUM.AAAA -// EXIST: ENUM // EXIST: ENUM.BBBB // EXIST: ENUM.CCCC // EXIST: { lookupString: "else -> "} +// EXIST: ENUM // FIR_COMPARISON diff --git a/plugins/kotlin/completion/testData/basic/common/when/enumInWhen.kt b/plugins/kotlin/completion/testData/basic/common/when/enumInWhen.kt index 13f811ecce44..86c179e372fa 100644 --- a/plugins/kotlin/completion/testData/basic/common/when/enumInWhen.kt +++ b/plugins/kotlin/completion/testData/basic/common/when/enumInWhen.kt @@ -13,6 +13,6 @@ fun foo(e: ENUM) { // WITH_ORDER // EXIST: ENUM.BBBB -// EXIST: ENUM // EXIST: { lookupString: "else -> "} +// EXIST: ENUM // FIR_COMPARISON diff --git a/plugins/kotlin/completion/testData/basic/common/when/enumInWhenWithPackage.kt b/plugins/kotlin/completion/testData/basic/common/when/enumInWhenWithPackage.kt index a448e1d95534..f09d0552c205 100644 --- a/plugins/kotlin/completion/testData/basic/common/when/enumInWhenWithPackage.kt +++ b/plugins/kotlin/completion/testData/basic/common/when/enumInWhenWithPackage.kt @@ -14,9 +14,9 @@ fun foo(e: ENUM) { // WITH_ORDER // EXIST: ENUM.AAAA -// EXIST: ENUM // EXIST: ENUM.BBBB // EXIST: ENUM.CCCC // EXIST: { lookupString: "else -> "} +// EXIST: ENUM // EXIST: a. // FIR_COMPARISON diff --git a/plugins/kotlin/completion/testData/basic/common/when/nestedSealedClassInWhen.kt b/plugins/kotlin/completion/testData/basic/common/when/nestedSealedClassInWhen.kt index 218ef09a2e64..5fbde38d5f26 100644 --- a/plugins/kotlin/completion/testData/basic/common/when/nestedSealedClassInWhen.kt +++ b/plugins/kotlin/completion/testData/basic/common/when/nestedSealedClassInWhen.kt @@ -15,7 +15,7 @@ fun foo(e: SEALED) { // WITH_ORDER // EXIST: is SEALED.AAAA // EXIST: SEALED.BBBB -// EXIST: SEALED // EXIST: is SEALED.CCCC // EXIST: { lookupString: "else -> "} +// EXIST: SEALED // FIR_COMPARISON diff --git a/plugins/kotlin/completion/testData/basic/common/when/nestedSealedClassInWhenWithPackage.kt b/plugins/kotlin/completion/testData/basic/common/when/nestedSealedClassInWhenWithPackage.kt index 7ace68393e1a..2d96ee5e0af8 100644 --- a/plugins/kotlin/completion/testData/basic/common/when/nestedSealedClassInWhenWithPackage.kt +++ b/plugins/kotlin/completion/testData/basic/common/when/nestedSealedClassInWhenWithPackage.kt @@ -17,8 +17,8 @@ fun foo(e: SEALED) { // WITH_ORDER // EXIST: is SEALED.AAAA // EXIST: SEALED.BBBB -// EXIST: SEALED // EXIST: is SEALED.CCCC // EXIST: { lookupString: "else -> "} +// EXIST: SEALED // EXIST: a. // FIR_COMPARISON diff --git a/plugins/kotlin/completion/testData/basic/common/when/nullableEnumInWhen.kt b/plugins/kotlin/completion/testData/basic/common/when/nullableEnumInWhen.kt index 30a8168e5bd8..b146a094b388 100644 --- a/plugins/kotlin/completion/testData/basic/common/when/nullableEnumInWhen.kt +++ b/plugins/kotlin/completion/testData/basic/common/when/nullableEnumInWhen.kt @@ -12,9 +12,9 @@ fun foo(e: ENUM?) { // WITH_ORDER // EXIST: ENUM.AAAA -// EXIST: ENUM // EXIST: ENUM.BBBB // EXIST: ENUM.CCCC // EXIST: null // EXIST: { lookupString: "else -> "} +// EXIST: ENUM // FIR_COMPARISON diff --git a/plugins/kotlin/completion/testData/weighers/basic/DoNotPreferNullForNonNullable.kt b/plugins/kotlin/completion/testData/weighers/basic/DoNotPreferNullForNonNullable.kt index 7582571576d9..a3f2bfc9f17e 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/DoNotPreferNullForNonNullable.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/DoNotPreferNullForNonNullable.kt @@ -10,4 +10,6 @@ fun bar() { } // ORDER: nullNotNull -// ORDER: null \ No newline at end of file +// ORDER: null +// this works for K2 but null is even further down +// IGNORE_K2 \ No newline at end of file diff --git a/plugins/kotlin/completion/testData/weighers/basic/DoNotPreferNullForNonNullable2.kt b/plugins/kotlin/completion/testData/weighers/basic/DoNotPreferNullForNonNullable2.kt index 96c6611d9992..fe950683820f 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/DoNotPreferNullForNonNullable2.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/DoNotPreferNullForNonNullable2.kt @@ -10,4 +10,6 @@ fun bar() { } // ORDER: nullNullable -// ORDER: null \ No newline at end of file +// ORDER: null +// this works for K2 but null is even further down +// IGNORE_K2 \ No newline at end of file diff --git a/plugins/kotlin/completion/testData/weighers/basic/KeywordsLast.kt b/plugins/kotlin/completion/testData/weighers/basic/KeywordsLast.kt index 885fcbed742d..9b909b3cd8b1 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/KeywordsLast.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/KeywordsLast.kt @@ -5,4 +5,5 @@ fun main(variables: Array) { va } -// ORDER: values, val, variables, var \ No newline at end of file +// ORDER: values, variables, val, var +// IGNORE_K1 \ No newline at end of file diff --git a/plugins/kotlin/completion/testData/weighers/basic/PreferThisWithLabel.kt b/plugins/kotlin/completion/testData/weighers/basic/PreferThisWithLabel.kt index 8d098cb143e1..df5c8817eb8a 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/PreferThisWithLabel.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/PreferThisWithLabel.kt @@ -10,4 +10,6 @@ class Test { } // ORDER: this@Test -// ORDER: this \ No newline at end of file +// ORDER: thisOther +// ORDER: this +// IGNORE_K1 \ No newline at end of file diff --git a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfNestedBlock.kt b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfNestedBlock.kt index 626fce520a17..a3a9eae3139e 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfNestedBlock.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfNestedBlock.kt @@ -10,4 +10,4 @@ fun usage() { } // ORDER: returnFun -// ORDER: return +// return should appear after, but does not have to be the very next element diff --git a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfTopLevelBlock.kt b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfTopLevelBlock.kt index 6ebb19188ceb..146790a7a1fe 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfTopLevelBlock.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/BeginOfTopLevelBlock.kt @@ -8,4 +8,4 @@ fun usage() { } // ORDER: returnFun -// ORDER: return +// return should appear after, but does not have to be the very next element diff --git a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/EndOfTopLevelBlock.kt b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/EndOfTopLevelBlock.kt index a2dbb65affda..b39db9efba14 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/EndOfTopLevelBlock.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/EndOfTopLevelBlock.kt @@ -7,4 +7,4 @@ fun usage() { } // ORDER: returnFun -// ORDER: return +// return should appear after, but does not have to be the very next element \ No newline at end of file diff --git a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithBody.kt b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithBody.kt index 78f5333ceefe..3cc62028d21b 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithBody.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithBody.kt @@ -9,4 +9,4 @@ fun usage() { } // ORDER: returnFun -// ORDER: return +// return should appear after, but does not have to be the very next element diff --git a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithoutBody.kt b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithoutBody.kt index e868417b9e56..9387fb28aee4 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithoutBody.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/noReturnType/ForWithoutBody.kt @@ -7,4 +7,4 @@ fun usage() { } // ORDER: returnFun -// ORDER: return +// return should appear after, but does not have to be the very next element diff --git a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfNestedBlock.kt b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfNestedBlock.kt index b697c30d281c..3eebeb3d3560 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfNestedBlock.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfNestedBlock.kt @@ -12,4 +12,4 @@ fun usage(): Int { } // ORDER: returnFun -// ORDER: return +// return should appear after, but does not have to be the very next element diff --git a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfTopLevelBlock.kt b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfTopLevelBlock.kt index d7460c64f06c..45e4a56f279f 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfTopLevelBlock.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/BeginOfTopLevelBlock.kt @@ -8,4 +8,4 @@ fun usage(): Int { } // ORDER: returnFun -// ORDER: return +// return should appear after, but does not have to be the very next element \ No newline at end of file diff --git a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithBody.kt b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithBody.kt index 6b3423a9a18e..cf03a862c71f 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithBody.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithBody.kt @@ -11,4 +11,4 @@ fun usage(): Int { } // ORDER: returnFun -// ORDER: return +// return should appear after, but does not have to be the very next element diff --git a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithoutBody.kt b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithoutBody.kt index 39b890e23af6..c00f7fa5b60f 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithoutBody.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/contextualReturn/withReturnType/ForWithoutBody.kt @@ -9,4 +9,4 @@ fun usage(): Int { } // ORDER: returnFun -// ORDER: return +// return should appear after, but does not have to be the very next element diff --git a/plugins/kotlin/completion/testData/weighers/basic/expectedType/returnFromFunctionQualifiedSelector.kt b/plugins/kotlin/completion/testData/weighers/basic/expectedType/returnFromFunctionQualifiedSelector.kt index 6313c1809930..2037d1060bc7 100644 --- a/plugins/kotlin/completion/testData/weighers/basic/expectedType/returnFromFunctionQualifiedSelector.kt +++ b/plugins/kotlin/completion/testData/weighers/basic/expectedType/returnFromFunctionQualifiedSelector.kt @@ -15,4 +15,4 @@ fun test(): Int { return x. } -//ORDER: d, foo, f \ No newline at end of file +//ORDER: d, foo \ No newline at end of file