From 84dc28374c266078acb5c00cf2e0d43ebedc372b Mon Sep 17 00:00:00 2001 From: "victor.petukhov" Date: Mon, 24 Sep 2018 23:27:06 +0300 Subject: [PATCH] Add multilevel sections support and corresponding renaming --- .../tests-spec/testData/diagnostics/ReadMe.md | 8 +- .../linked/when-expression/p-11/neg/1.1.kt | 14 +- .../linked/when-expression/p-11/neg/1.2.kt | 8 +- .../linked/when-expression/p-11/neg/3.1.kt | 18 +- .../linked/when-expression/p-11/neg/6.1.kt | 32 +-- .../linked/when-expression/p-11/neg/7.1.kt | 18 +- .../linked/when-expression/p-11/neg/8.1.kt | 10 +- .../linked/when-expression/p-11/neg/8.2.kt | 22 +- .../linked/when-expression/p-11/neg/8.3.kt | 16 +- .../linked/when-expression/p-11/pos/1.1.kt | 12 +- .../linked/when-expression/p-11/pos/1.2.kt | 10 +- .../linked/when-expression/p-11/pos/1.3.kt | 18 +- .../linked/when-expression/p-11/pos/3.1.kt | 6 +- .../linked/when-expression/p-11/pos/6.1.kt | 28 +- .../linked/when-expression/p-11/pos/7.1.kt | 4 +- .../linked/when-expression/p-11/pos/8.1.kt | 8 +- .../linked/when-expression/p-11/pos/8.2.kt | 6 +- .../linked/when-expression/p-11/pos/8.3.kt | 28 +- .../linked/when-expression/p-2/pos/3.1.kt | 6 +- .../linked/when-expression/p-2/pos/3.2.kt | 2 +- .../linked/when-expression/p-3/neg/1.1.kt | 10 +- .../linked/when-expression/p-3/neg/2.1.kt | 10 +- .../linked/when-expression/p-3/neg/2.2.kt | 10 +- .../linked/when-expression/p-3/pos/1.1.kt | 256 +++++++++--------- .../linked/when-expression/p-3/pos/2.1.kt | 90 +++--- .../linked/when-expression/p-3/pos/2.2.kt | 2 +- .../linked/when-expression/p-3/pos/2.3.kt | 28 +- .../linked/when-expression/p-5/neg/1.1.kt | 12 +- .../linked/when-expression/p-5/pos/1.1.kt | 14 +- .../linked/when-expression/p-6/neg/1.1.kt | 10 +- .../linked/when-expression/p-6/pos/1.1.kt | 212 +++++++-------- .../linked/when-expression/p-7/neg/1.1.kt | 14 +- .../linked/when-expression/p-7/neg/1.2.kt | 8 +- .../linked/when-expression/p-7/neg/3.1.kt | 8 +- .../linked/when-expression/p-7/neg/3.2.kt | 20 +- .../linked/when-expression/p-7/neg/5.1.kt | 20 +- .../linked/when-expression/p-7/neg/5.2.kt | 10 +- .../linked/when-expression/p-7/neg/7.1.kt | 10 +- .../linked/when-expression/p-7/pos/1.1.kt | 18 +- .../linked/when-expression/p-7/pos/1.2.kt | 16 +- .../linked/when-expression/p-7/pos/1.3.kt | 18 +- .../linked/when-expression/p-7/pos/1.4.kt | 16 +- .../linked/when-expression/p-7/pos/3.1.kt | 16 +- .../linked/when-expression/p-7/pos/3.2.kt | 12 +- .../linked/when-expression/p-7/pos/5.1.kt | 172 ++++++------ .../linked/when-expression/p-7/pos/5.2.kt | 154 +++++------ .../linked/when-expression/p-7/pos/7.1.kt | 8 +- .../linked/when-expression/p-9/neg/1.1.kt | 44 +-- .../linked/when-expression/p-9/neg/1.2.kt | 18 +- .../linked/when-expression/p-9/neg/1.3.kt | 18 +- .../linked/when-expression/p-9/neg/1.4.kt | 38 +-- .../linked/when-expression/p-9/pos/1.1.kt | 42 +-- .../linked/when-expression/p-9/pos/1.2.kt | 18 +- .../linked/when-expression/p-9/pos/1.3.kt | 18 +- .../linked/when-expression/p-9/pos/1.4.kt | 38 +-- .../contracts/analysis/common/neg/1.kt | 2 +- .../contracts/analysis/common/pos/1.kt | 2 +- .../contracts/analysis/common/pos/2.kt | 2 +- .../controlFlow/initialization/neg/1.kt | 2 +- .../controlFlow/initialization/neg/2.kt | 2 +- .../controlFlow/initialization/neg/3.kt | 2 +- .../controlFlow/initialization/neg/4.kt | 2 +- .../controlFlow/initialization/neg/5.kt | 2 +- .../controlFlow/initialization/neg/6.kt | 2 +- .../controlFlow/initialization/pos/1.kt | 2 +- .../controlFlow/initialization/pos/2.kt | 2 +- .../controlFlow/initialization/pos/3.kt | 2 +- .../controlFlow/initialization/pos/4.kt | 2 +- .../controlFlow/initialization/pos/5.kt | 2 +- .../controlFlow/unreachableCode/neg/1.kt | 2 +- .../controlFlow/unreachableCode/pos/1.kt | 2 +- .../controlFlow/unreachableCode/pos/2.kt | 2 +- .../controlFlow/unreachableCode/pos/3.kt | 2 +- .../controlFlow/unreachableCode/pos/4.kt | 2 +- .../controlFlow/unreachableCode/pos/5.kt | 2 +- .../controlFlow/unreachableCode/pos/6.kt | 2 +- .../controlFlow/unreachableCode/pos/7.kt | 2 +- .../contracts/analysis/smartcasts/neg/1.kt | 2 +- .../contracts/analysis/smartcasts/neg/10.kt | 2 +- .../contracts/analysis/smartcasts/neg/11.kt | 2 +- .../contracts/analysis/smartcasts/neg/12.kt | 2 +- .../contracts/analysis/smartcasts/neg/13.kt | 2 +- .../contracts/analysis/smartcasts/neg/2.kt | 2 +- .../contracts/analysis/smartcasts/neg/3.kt | 2 +- .../contracts/analysis/smartcasts/neg/4.kt | 2 +- .../contracts/analysis/smartcasts/neg/5.kt | 2 +- .../contracts/analysis/smartcasts/neg/6.kt | 2 +- .../contracts/analysis/smartcasts/neg/7.kt | 2 +- .../contracts/analysis/smartcasts/neg/8.kt | 2 +- .../contracts/analysis/smartcasts/neg/9.kt | 2 +- .../contracts/analysis/smartcasts/pos/1.kt | 2 +- .../contracts/analysis/smartcasts/pos/10.kt | 2 +- .../contracts/analysis/smartcasts/pos/11.kt | 2 +- .../contracts/analysis/smartcasts/pos/2.kt | 2 +- .../contracts/analysis/smartcasts/pos/3.kt | 2 +- .../contracts/analysis/smartcasts/pos/4.kt | 2 +- .../contracts/analysis/smartcasts/pos/5.kt | 2 +- .../contracts/analysis/smartcasts/pos/6.kt | 2 +- .../contracts/analysis/smartcasts/pos/7.kt | 2 +- .../contracts/analysis/smartcasts/pos/8.kt | 2 +- .../contracts/analysis/smartcasts/pos/9.kt | 2 +- .../contractBuilder/common/neg/1.kt | 2 +- .../contractBuilder/common/neg/10.kt | 2 +- .../contractBuilder/common/neg/11.kt | 2 +- .../contractBuilder/common/neg/12.kt | 2 +- .../contractBuilder/common/neg/13.kt | 2 +- .../contractBuilder/common/neg/2.kt | 2 +- .../contractBuilder/common/neg/3.kt | 2 +- .../contractBuilder/common/neg/4.kt | 2 +- .../contractBuilder/common/neg/5.kt | 2 +- .../contractBuilder/common/neg/6.kt | 2 +- .../contractBuilder/common/neg/7.kt | 2 +- .../contractBuilder/common/neg/8.kt | 2 +- .../contractBuilder/common/neg/9.kt | 2 +- .../contractBuilder/common/pos/1.kt | 2 +- .../contractBuilder/common/pos/2.kt | 2 +- .../contractBuilder/common/pos/3.kt | 2 +- .../contractBuilder/common/pos/4.kt | 2 +- .../effects/callsInPlace/neg/1.kt | 2 +- .../effects/callsInPlace/pos/1.kt | 2 +- .../effects/callsInPlace/pos/2.kt | 2 +- .../effects/callsInPlace/pos/3.kt | 2 +- .../contractBuilder/effects/common/neg/1.kt | 2 +- .../contractBuilder/effects/returns/neg/1.kt | 2 +- .../contractBuilder/effects/returns/neg/2.kt | 2 +- .../contractBuilder/effects/returns/neg/3.kt | 2 +- .../contractBuilder/effects/returns/neg/4.kt | 2 +- .../contractBuilder/effects/returns/neg/5.kt | 2 +- .../contractBuilder/effects/returns/neg/6.kt | 2 +- .../contractBuilder/effects/returns/neg/7.kt | 2 +- .../contractBuilder/effects/returns/pos/1.kt | 2 +- .../contractBuilder/effects/returns/pos/2.kt | 2 +- .../contractBuilder/effects/returns/pos/3.kt | 2 +- .../declarations/contractFunction/neg/1.kt | 2 +- .../declarations/contractFunction/neg/2.kt | 2 +- .../declarations/contractFunction/pos/1.kt | 2 +- .../declarations/contractFunction/pos/2.kt | 2 +- .../validators/DiagnosticTestTypeValidator.kt | 4 +- .../validators/LinkedSpecTestValidator.kt | 27 +- .../validators/NotLinkedSpecTestValidator.kt | 12 +- 140 files changed, 946 insertions(+), 943 deletions(-) diff --git a/compiler/tests-spec/testData/diagnostics/ReadMe.md b/compiler/tests-spec/testData/diagnostics/ReadMe.md index 824e73947cf..1754e1136b7 100644 --- a/compiler/tests-spec/testData/diagnostics/ReadMe.md +++ b/compiler/tests-spec/testData/diagnostics/ReadMe.md @@ -35,7 +35,7 @@ A comment with meta information has the following format: /* KOTLIN SPEC TEST () - SECTION: + SECTIONS: PARAGRAPH: SENTENCE: [] NUMBER: @@ -47,7 +47,7 @@ Example: /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 2 SENTENCE: [3] When expression has two different forms: with bound value and without it. NUMBER: 1 @@ -93,7 +93,7 @@ During the test run, the following information is displayed for each test: ``` DIAGNOSTICS SPEC TEST -SECTION: (paragraph: ) +SECTIONS: (paragraph: ) SENTENCE : TEST NUMBER: TEST CASES: @@ -103,7 +103,7 @@ DIAGNOSTICS: | Example: ``` DIAGNOSTICS NEGATIVE SPEC TEST -SECTION: when-expression (paragraph: 3) +SECTIONS: when-expression (paragraph: 3) SENTENCE 1: TEST NUMBER: 1 NUMBER OF TEST CASES: 3 diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.1.kt index 8c03beec61a..ff5a2befda6 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 1 @@ -9,15 +9,15 @@ */ // CASE DESCRIPTION: Checking for not exhaustive 'when' (several branches). -fun case_1(value: Int): String = when { - value == 1 -> "" - value == 2 -> "" - value == 3 -> "" +fun case_1(value_1: Int): String = when { + value_1 == 1 -> "" + value_1 == 2 -> "" + value_1 == 3 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' (one branch). -fun case_2(value: Int): String = when { - value == 1 -> "" +fun case_2(value_1: Int): String = when { + value_1 == 1 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' (no branches). diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.2.kt index 0e03d9a76e7..5237be3d0d8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.2.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 2 @@ -11,16 +11,16 @@ */ // CASE DESCRIPTION: Checking for not exhaustive 'when' (several branches). -fun case_1(value: Int): String = when (value) { +fun case_1(value_1: Int): String = when (value_1) { 1 -> "" 2 -> "" 3 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' (one branch). -fun case_2(value: Int): String = when (value) { +fun case_2(value_1: Int): String = when (value_1) { 1 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' (no branches). -fun case_3(value: Int): Int = when (value) {} +fun case_3(value_1: Int): Int = when (value_1) {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/3.1.kt index e02416fb4ae..98a220b592f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/3.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [3] The bound expression is of type kotlin.Boolean and the conditions contain both: NUMBER: 1 @@ -11,22 +11,22 @@ */ // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Boolean value (with only true branch). -fun case_1(value: Boolean): String = when(value) { +fun case_1(value_1: Boolean): String = when(value_1) { true -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Boolean value (with only false branch). -fun case_2(value: Boolean): String = when(value) { +fun case_2(value_1: Boolean): String = when(value_1) { false -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Boolean value (no branches). -fun case_3(value: Boolean): Int = when(value) { } +fun case_3(value_1: Boolean): Int = when(value_1) { } // CASE DESCRIPTION: Checking for not exhaustive 'when' without bound value on the Boolean. -fun case_4(value: Boolean): String = when { - value == true -> "" - value == false -> "" +fun case_4(value_1: Boolean): String = when { + value_1 == true -> "" + value_1 == false -> "" } /* @@ -34,11 +34,11 @@ fun case_4(value: Boolean): String = when { DISCUSSION: maybe use const propagation here? ISSUES: KT-25265 */ -fun case_5(value: Boolean): String { +fun case_5(value_1: Boolean): String { val trueValue = true val falseValue = false - return when (value) { + return when (value_1) { trueValue -> "" falseValue -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt index 7ac7f2ed2fa..20ab970c73b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [6] The bound expression is of a sealed class type and all its possible subtypes are covered using type test conditions of this expression; NUMBER: 1 @@ -12,46 +12,46 @@ */ // CASE DESCRIPTION: Checking for not exhaustive 'when' on the sealed class (type checking). -fun case_1(value: _SealedClass): String = when(value) { +fun case_1(value_1: _SealedClass): String = when(value_1) { is _SealedChild1 -> "" is _SealedChild2 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the sealed class (type checking with enumeration). -fun case_2(value: _SealedClass): String = when(value) { +fun case_2(value_1: _SealedClass): String = when(value_1) { is _SealedChild1, is _SealedChild2 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the sealed class (type checking and equality with object). -fun case_3(value: _SealedClassMixed): String = when(value) { +fun case_3(value_1: _SealedClassMixed): String = when(value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" _SealedMixedChildObject1 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the sealed class (type checking and equality with object with enumeration). -fun case_4(value: _SealedClassMixed): String = when(value) { +fun case_4(value_1: _SealedClassMixed): String = when(value_1) { _SealedMixedChildObject1, is _SealedMixedChild2, is _SealedMixedChild1 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the sealed class (type checking). -fun case_5(value: _SealedClassMixed): String = when(value) { +fun case_5(value_1: _SealedClassMixed): String = when(value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" is _SealedMixedChild3 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the sealed class with several subtypes (no branches). -fun case_6(value: _SealedClassMixed): Int = when(value) { } +fun case_6(value_1: _SealedClassMixed): Int = when(value_1) { } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the sealed class with one subtype (no branches). -fun case_7(value: _SealedClassSingleWithObject): Int = when(value) { } +fun case_7(value_1: _SealedClassSingleWithObject): Int = when(value_1) { } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the empty sealed class (without subtypes). -fun case_8(value: _SealedClassEmpty): String = when (value) { } +fun case_8(value_1: _SealedClassEmpty): String = when (value_1) { } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the not sealed class. -fun case_9(value: Number): String = when (value) { +fun case_9(value_1: Number): String = when (value_1) { is Byte -> "" is Double -> "" is Float -> "" @@ -64,19 +64,19 @@ fun case_9(value: Number): String = when (value) { CASE DESCRIPTION: Checking for not exhaustive 'when' on the Any. DISCUSSION: maybe make exhaustive without else? */ -fun case_10(value: Any): String = when (value) { +fun case_10(value_1: Any): String = when (value_1) { is Any -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' without bound value on the Sealed class with all subtypes covered. -fun case_11(value: _SealedClass): String = when { - value is _SealedChild1 -> "" - value is _SealedChild2 -> "" - value is _SealedChild3 -> "" +fun case_11(value_1: _SealedClass): String = when { + value_1 is _SealedChild1 -> "" + value_1 is _SealedChild2 -> "" + value_1 is _SealedChild3 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the sealed class (type checking). -fun case_12(value: _SealedClassMixed): String = when(value) { +fun case_12(value_1: _SealedClassMixed): String = when(value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" is _SealedMixedChild3 -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt index 65eb6a4c4d1..0001763dc26 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [7] The bound expression is of an Enum classes type and all enumerated values are checked for equality using constant conditions; NUMBER: 1 @@ -12,37 +12,37 @@ */ // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum (not all values). -fun case_1(value: _EnumClass): String = when(value) { +fun case_1(value_1: _EnumClass): String = when(value_1) { _EnumClass.EAST -> "" _EnumClass.SOUTH -> "" _EnumClass.NORTH -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum (not all values with enumerations). -fun case_2(value: _EnumClass): String = when(value) { +fun case_2(value_1: _EnumClass): String = when(value_1) { _EnumClass.EAST, _EnumClass.SOUTH, _EnumClass.NORTH -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum (one branch). -fun case_3(value: _EnumClass): String = when(value) { +fun case_3(value_1: _EnumClass): String = when(value_1) { _EnumClass.EAST -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum with several values (no branches). -fun case_4(value: _EnumClass): String = when(value) { } +fun case_4(value_1: _EnumClass): String = when(value_1) { } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum with one value (no branches). -fun case_5(value: _EnumClassSingle): String = when(value) { } +fun case_5(value_1: _EnumClassSingle): String = when(value_1) { } /* CASE DESCRIPTION: Checking for not exhaustive 'when' with all Enum values covered, but using variable. DISCUSSION: maybe use const propagation here? ISSUES: KT-25265 */ -fun case_6(value: _EnumClass): String { +fun case_6(value_1: _EnumClass): String { val west = _EnumClass.WEST - return when (value) { + return when (value_1) { _EnumClass.EAST -> "" _EnumClass.SOUTH -> "" _EnumClass.NORTH -> "" @@ -51,4 +51,4 @@ fun case_6(value: _EnumClass): String { } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the empty enum class. -fun case_7(value: _EnumClassEmpty): String = when (value) { } +fun case_7(value_1: _EnumClassEmpty): String = when (value_1) { } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.1.kt index 987079a9709..ac63c9dad39 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.1.kt @@ -3,24 +3,24 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 - SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. + SENTENCE: [8] The bound expression is of a nullable type and one of the areas above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 1 DESCRIPTION: Checking for not exhaustive 'when' on the nullable Boolean. */ // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Boolean without null-check branch. -fun case_1(value: Boolean?): String = when(value) { +fun case_1(value_1: Boolean?): String = when(value_1) { true -> "" false -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Boolean with null-check branch, but all possible values not covered. -fun case_2(value: Boolean?): String = when(value) { +fun case_2(value_1: Boolean?): String = when(value_1) { true -> "" null -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Boolean without branches. -fun case_3(value: Boolean?): Int = when(value) { } +fun case_3(value_1: Boolean?): Int = when(value_1) { } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt index 3fd0fe144ef..d6170dbf258 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt @@ -4,22 +4,22 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 - SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. + SENTENCE: [8] The bound expression is of a nullable type and one of the areas above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 2 DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed classes (and several checks for not sealed). */ // CASE DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed class without null-check branch. -fun case_1(value: _SealedClass?): String = when(value) { +fun case_1(value_1: _SealedClass?): String = when(value_1) { is _SealedChild1 -> "" is _SealedChild2 -> "" is _SealedChild3 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed class with mixed checks (type and object check) and null-check branch. -fun case_2(value: _SealedClassMixed?): String = when(value) { +fun case_2(value_1: _SealedClassMixed?): String = when(value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" _SealedMixedChildObject1 -> "" @@ -27,12 +27,12 @@ fun case_2(value: _SealedClassMixed?): String = when(value } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed class with enumeration mixed checks (type and object check) and null-check branch. -fun case_3(value: _SealedClassMixed?): String = when(value) { +fun case_3(value_1: _SealedClassMixed?): String = when(value_1) { null, is _SealedMixedChild1, is _SealedMixedChild2, _SealedMixedChildObject1 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed class with all subtypes and objects covered without null-check branch. -fun case_4(value: _SealedClassMixed?): String = when(value) { +fun case_4(value_1: _SealedClassMixed?): String = when(value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" is _SealedMixedChild3 -> "" @@ -42,17 +42,17 @@ fun case_4(value: _SealedClassMixed?): String = when(value } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed class without null-check branch and all subtypes covered, but objects not covered. -fun case_5(value: _SealedClassMixed?): String = when(value) { +fun case_5(value_1: _SealedClassMixed?): String = when(value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" is _SealedMixedChild3 -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed class without branches. -fun case_6(value: _SealedClassMixed?): Int = when(value) {} +fun case_6(value_1: _SealedClassMixed?): Int = when(value_1) {} // CASE DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed class with null-check branch and all subtypes covered, but objects not covered. -fun case_7(value: _SealedClassMixed?): String = when(value) { +fun case_7(value_1: _SealedClassMixed?): String = when(value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2-> "" is _SealedMixedChild3 -> "" @@ -60,7 +60,7 @@ fun case_7(value: _SealedClassMixed?): String = when(value } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed class without null-check branch and only object covered. -fun case_8(value: _SealedClassMixed?): String = when(value) { +fun case_8(value_1: _SealedClassMixed?): String = when(value_1) { _SealedMixedChildObject1 -> "" } @@ -77,7 +77,7 @@ fun case_9(value: _SealedClassEmpty?): String = when (valu CASE DESCRIPTION: Checking for not exhaustive 'when' on the nullable Any. DISCUSSION: maybe make exhaustive without else? */ -fun case_10(value: Any?): String = when (value) { +fun case_10(value_1: Any?): String = when (value_1) { is Any -> "" null -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt index 3e5cdadabc9..415a7fb9c85 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt @@ -4,15 +4,15 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 - SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. + SENTENCE: [8] The bound expression is of a nullable type and one of the areas above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 3 DESCRIPTION: Checking for not exhaustive 'when' on the nullable enums. */ // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum class without null-check branch. -fun case_1(value: _EnumClass?): String = when(value) { +fun case_1(value_1: _EnumClass?): String = when(value_1) { _EnumClass.EAST -> "" _EnumClass.SOUTH -> "" _EnumClass.NORTH -> "" @@ -20,7 +20,7 @@ fun case_1(value: _EnumClass?): String = when(value) { } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum class with null-check branch, but all possible values not covered. -fun case_2(value: _EnumClass?): String = when(value) { +fun case_2(value_1: _EnumClass?): String = when(value_1) { _EnumClass.EAST -> "" _EnumClass.SOUTH -> "" _EnumClass.NORTH -> "" @@ -28,20 +28,20 @@ fun case_2(value: _EnumClass?): String = when(value) { } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum class with null-check branch, but all possible values not covered. -fun case_3(value: _EnumClass?): String = when(value) { +fun case_3(value_1: _EnumClass?): String = when(value_1) { _EnumClass.EAST, null, _EnumClass.SOUTH, _EnumClass.NORTH -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum class without branches. -fun case_4(value: _EnumClassSingle): Int = when(value) {} +fun case_4(value_1: _EnumClassSingle): Int = when(value_1) {} // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum class (with only one value) without null-check branch. -fun case_5(value: _EnumClassSingle?): String = when(value) { +fun case_5(value_1: _EnumClassSingle?): String = when(value_1) { _EnumClassSingle.EVERYTHING -> "" } // CASE DESCRIPTION: Checking for not exhaustive 'when' on the Enum class (with only one value) with null-check branch, but value not covered. -fun case_6(value: _EnumClassSingle?): String = when(value) { +fun case_6(value_1: _EnumClassSingle?): String = when(value_1) { null -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.1.kt index da6153db4da..98a135422db 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 1 @@ -9,11 +9,11 @@ */ // CASE DESCRIPTION: Checking for exhaustive 'when' (several value check branches and 'else' branch). -fun case_1(value: Int): String = when { - value == 0 -> "" - value > 0 && value <= 10 -> "" - value > 10 && value <= 100 -> "" - value > 100 -> "" +fun case_1(value_1: Int): String = when { + value_1 == 0 -> "" + value_1 > 0 && value_1 <= 10 -> "" + value_1 > 10 && value_1 <= 100 -> "" + value_1 > 100 -> "" else -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.2.kt index 36739710153..35f7ae49f56 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.2.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 2 @@ -11,7 +11,7 @@ */ // CASE DESCRIPTION: Checking for exhaustive 'when' (several branches). -fun case_1(value: Int): String = when (value) { +fun case_1(value_1: Int): String = when (value_1) { 0 -> "" 1 -> "" 2 -> "" @@ -20,14 +20,14 @@ fun case_1(value: Int): String = when (value) { } // CASE DESCRIPTION: Checking for exhaustive 'when' (value check branch and 'else' branch). -fun case_2(value: Boolean): String = when (value) { +fun case_2(value_1: Boolean): String = when (value_1) { true -> "" else -> "" } /* CASE DESCRIPTION: Checking for exhaustive 'when' with constant bound value (value check branch and 'else' branch). - NOTE: for potential bound value constant analysys. + NOTE: for potential bound value constant analysis. */ fun case_3(): String = when (true) { true -> "" @@ -35,6 +35,6 @@ fun case_3(): String = when (true) { } // CASE DESCRIPTION: Checking for exhaustive 'when' (only 'else' branch). -fun case_4(value: Int): String = when(value) { +fun case_4(value_1: Int): String = when(value_1) { else -> "" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt index 09e3adc4c36..5c99de7f9e4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 3 @@ -12,7 +12,7 @@ */ // CASE DESCRIPTION: Checking for redundant 'else' branch (all enum values covered). -fun case_1(value: _EnumClass): String = when (value) { +fun case_1(value_1: _EnumClass): String = when (value_1) { _EnumClass.EAST -> "" _EnumClass.NORTH -> "" _EnumClass.SOUTH -> "" @@ -21,7 +21,7 @@ fun case_1(value: _EnumClass): String = when (value) { } // CASE DESCRIPTION: Checking for redundant 'else' branch (all enum values and null value covered). -fun case_2(value: _EnumClass?): String = when (value) { +fun case_2(value_1: _EnumClass?): String = when (value_1) { _EnumClass.EAST -> "" _EnumClass.NORTH -> "" _EnumClass.SOUTH -> "" @@ -31,14 +31,14 @@ fun case_2(value: _EnumClass?): String = when (value) { } // CASE DESCRIPTION: Checking for redundant 'else' branch (both boolean value covered). -fun case_3(value: Boolean): String = when (value) { +fun case_3(value_1: Boolean): String = when (value_1) { true -> "" false -> "" else -> "" } // CASE DESCRIPTION: Checking for redundant 'else' branch (both boolean value and null value covered). -fun case_4(value: Boolean?): String = when (value) { +fun case_4(value_1: Boolean?): String = when (value_1) { true -> "" false -> "" null -> "" @@ -46,7 +46,7 @@ fun case_4(value: Boolean?): String = when (value) { } // CASE DESCRIPTION: Checking for redundant 'else' branch (all sealed class subtypes covered). -fun case_5(value: _SealedClass): String = when (value) { +fun case_5(value_1: _SealedClass): String = when (value_1) { is _SealedChild1 -> "" is _SealedChild2 -> "" is _SealedChild3 -> "" @@ -54,7 +54,7 @@ fun case_5(value: _SealedClass): String = when (value) { } // CASE DESCRIPTION: Checking for redundant 'else' branch (all sealed class subtypes and null value covered). -fun case_6(value: _SealedClass?): String = when (value) { +fun case_6(value_1: _SealedClass?): String = when (value_1) { is _SealedChild1 -> "" is _SealedChild2 -> "" is _SealedChild3 -> "" @@ -63,13 +63,13 @@ fun case_6(value: _SealedClass?): String = when (value) { } // CASE DESCRIPTION: Checking for redundant 'else' branch (sealed class itself covered). -fun case_7(value: _SealedClassSingle): String = when (value) { +fun case_7(value_1: _SealedClassSingle): String = when (value_1) { is _SealedClassSingle -> "" else -> "" } // CASE DESCRIPTION: Checking for redundant 'else' branch (sealed class itself and null value covered). -fun case_8(value: _SealedClassSingle?): String = when (value) { +fun case_8(value_1: _SealedClassSingle?): String = when (value_1) { is _SealedClassSingle -> "" null -> "" else -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/3.1.kt index e9982ca1632..f37a1a1e588 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/3.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [3] The bound expression is of type kotlin.Boolean and the conditions contain both: NUMBER: 1 @@ -9,13 +9,13 @@ */ // CASE DESCRIPTION: Checking for exhaustive 'when' (both boolean value covered). -fun case_1(value: Boolean): String = when (value) { +fun case_1(value_1: Boolean): String = when (value_1) { true -> "" false -> "" } // CASE DESCRIPTION: Checking for exhaustive 'when' (both boolean value as complex expression covered). -fun case_2(value: Boolean): String = when (value) { +fun case_2(value_1: Boolean): String = when (value_1) { true && false && ((true || false)) || true && !!!false && !!!true -> "" true && false && ((true || false)) || true && !!!false -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt index 83cf3cb1f0b..6641bffdc81 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [6] The bound valueession is of a sealed class type and all its possible subtypes are covered using type test conditions of this valueession; NUMBER: 1 @@ -12,33 +12,33 @@ */ // CASE DESCRIPTION: Checking for exhaustive 'when' (all sealed class subtypes covered). -fun case_1(value: _SealedClass): Int = when (value) { - is _SealedChild1 -> value.number - is _SealedChild2 -> value.e1 + value.e2 - is _SealedChild3 -> value.m1 + value.m2 +fun case_1(value_1: _SealedClass): Int = when (value_1) { + is _SealedChild1 -> value_1.number + is _SealedChild2 -> value_1.e1 + value_1.e2 + is _SealedChild3 -> value_1.m1 + value_1.m2 } // CASE DESCRIPTION: Checking for exhaustive 'when' (single sealed class subtypes covered). -fun case_2(value: _SealedClass): String = when (value) { +fun case_2(value_1: _SealedClass): String = when (value_1) { is _SealedClass -> "" } // CASE DESCRIPTION: Checking for exhaustive 'when' (all sealed class subtypes with methods covered). -fun case_3(value: _SealedClassWithMethods): String = when (value) { - is _SealedWithMethodsChild1 -> value.m1() - is _SealedWithMethodsChild2 -> value.m2() - is _SealedWithMethodsChild3 -> value.m3() +fun case_3(value_1: _SealedClassWithMethods): String = when (value_1) { + is _SealedWithMethodsChild1 -> value_1.m1() + is _SealedWithMethodsChild2 -> value_1.m2() + is _SealedWithMethodsChild3 -> value_1.m3() } // CASE DESCRIPTION: Checking for exhaustive 'when' (all objects covered using implicit equality operator). -fun case_4(value: _SealedClassWithObjects): String = when (value) { +fun case_4(value_1: _SealedClassWithObjects): String = when (value_1) { _SealedWithObjectsChild1 -> "" _SealedWithObjectsChild2 -> "" _SealedWithObjectsChild3 -> "" } // CASE DESCRIPTION: Checking for exhaustive 'when' (all subtypes and objects covered). -fun case_5(value: _SealedClassMixed): String = when (value) { +fun case_5(value_1: _SealedClassMixed): String = when (value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" is _SealedMixedChild3 -> "" @@ -51,7 +51,7 @@ fun case_5(value: _SealedClassMixed): String = when (value) { CASE DESCRIPTION: Checking for exhaustive 'when' (all subtypes and objects (using type checking operator) covered). DISCUSSION: is it correct that objects can be checked using the type checking operator? */ -fun case_6(value: _SealedClassMixed): String = when (value) { +fun case_6(value_1: _SealedClassMixed): String = when (value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" is _SealedMixedChild3 -> "" @@ -61,6 +61,6 @@ fun case_6(value: _SealedClassMixed): String = when (value) { } // CASE DESCRIPTION: Checking for exhaustive 'when' on the empty sealed class (without subtypes). -fun case_7(value: _SealedClassEmpty): String = when (value) { +fun case_7(value_1: _SealedClassEmpty): String = when (value_1) { else -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt index 5053f7dc517..d87fa06de19 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [7] The bound expression is of an Enum classes type and all enumerated values are checked for equality using constant conditions; NUMBER: 1 @@ -19,6 +19,6 @@ fun case_1(dir: _EnumClass): String = when (dir) { } // CASE DESCRIPTION: Checking for exhaustive 'when' (single enum value covered). -fun case_2(value: _EnumClassSingle): String = when (value) { +fun case_2(value_1: _EnumClassSingle): String = when (value_1) { _EnumClassSingle.EVERYTHING -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.1.kt index e441a0d8725..70064a771e5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.1.kt @@ -1,22 +1,22 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 - SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. + SENTENCE: [8] The bound expression is of a nullable type and one of the areas above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 1 DESCRIPTION: Check when exhaustive when boolean values are checked and contains a null check. */ // CASE DESCRIPTION: Checking for exhaustive 'when' (both boolean values and null value covered). -fun case_1(value: Boolean?): String = when (value) { +fun case_1(value_1: Boolean?): String = when (value_1) { true -> "" false -> "" null -> "" } // CASE DESCRIPTION: Checking for exhaustive 'when' (both boolean values as complex expressions and null value covered). -fun case_2(value: Boolean?): String = when (value) { +fun case_2(value_1: Boolean?): String = when (value_1) { true && false && ((true || false)) || true && !!!false && !!!true -> "" true && false && ((true || false)) || true && !!!false -> "" null -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt index 739d64ff630..8e041d991f5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 2 @@ -11,7 +11,7 @@ */ // CASE DESCRIPTION: Checking for exhaustive 'when' (both enum values and null value covered). -fun case_1(dir: _EnumClass?): String = when (dir) { +fun case_1(value_1: _EnumClass?): String = when (value_1) { _EnumClass.EAST -> "" _EnumClass.NORTH -> "" _EnumClass.SOUTH -> "" @@ -20,7 +20,7 @@ fun case_1(dir: _EnumClass?): String = when (dir) { } // CASE DESCRIPTION: Checking for exhaustive 'when' (single enum value and null value covered). -fun case_2(value: _EnumClassSingle?): String = when (value) { +fun case_2(value_1: _EnumClassSingle?): String = when (value_1) { _EnumClassSingle.EVERYTHING -> "" null -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt index e1794f10e68..c25200d422e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt @@ -3,37 +3,37 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 11 - SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. + SENTENCE: [8] The bound expression is of a nullable type and one of the areas above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 3 DESCRIPTION: Check when exhaustive when possible subtypes of the sealed class are covered and contains a null check. */ // CASE DESCRIPTION: Checking for exhaustive 'when' (all sealed class subtypes and null value covered). -fun case_1(expr: _SealedClass?): Int = when (expr) { - is _SealedChild1 -> expr.number - is _SealedChild2 -> expr.e1 + expr.e2 - is _SealedChild3 -> expr.m1 + expr.m2 +fun case_1(value_1: _SealedClass?): Int = when (value_1) { + is _SealedChild1 -> value_1.number + is _SealedChild2 -> value_1.e1 + value_1.e2 + is _SealedChild3 -> value_1.m1 + value_1.m2 null -> 0 } // CASE DESCRIPTION: Checking for exhaustive 'when' (sealed class itself and null value covered). -fun case_2(expr: _SealedClass?): String = when (expr) { +fun case_2(value_1: _SealedClass?): String = when (value_1) { is _SealedClass -> "" null -> "" } // CASE DESCRIPTION: Checking for exhaustive 'when' (all sealed class with methods subtypes and null value covered). -fun case_3(expr: _SealedClassWithMethods?): String = when (expr) { - is _SealedWithMethodsChild1 -> expr.m1() - is _SealedWithMethodsChild2 -> expr.m2() - is _SealedWithMethodsChild3 -> expr.m3() +fun case_3(value_1: _SealedClassWithMethods?): String = when (value_1) { + is _SealedWithMethodsChild1 -> value_1.m1() + is _SealedWithMethodsChild2 -> value_1.m2() + is _SealedWithMethodsChild3 -> value_1.m3() null -> "" } // CASE DESCRIPTION: Checking for exhaustive 'when' (all objects covered using implicit equality operator and null value covered). -fun case_4(expr: _SealedClassWithObjects?): String = when (expr) { +fun case_4(value_1: _SealedClassWithObjects?): String = when (value_1) { _SealedWithObjectsChild1 -> "" _SealedWithObjectsChild2 -> "" _SealedWithObjectsChild3 -> "" @@ -41,7 +41,7 @@ fun case_4(expr: _SealedClassWithObjects?): String = when (expr) { } // CASE DESCRIPTION: Checking for exhaustive 'when' (all subtypes and objects covered + null value covered). -fun case_5(value: _SealedClassMixed?): String = when (value) { +fun case_5(value_1: _SealedClassMixed?): String = when (value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" is _SealedMixedChild3 -> "" @@ -55,7 +55,7 @@ fun case_5(value: _SealedClassMixed?): String = when (value) { CASE DESCRIPTION: Checking for exhaustive 'when' (all subtypes and objects (using type checking operator) covered + null value covered). DISCUSSION: is it correct that objects can be checked using the type checking operator? */ -fun case_6(value: _SealedClassMixed?): String = when (value) { +fun case_6(value_1: _SealedClassMixed?): String = when (value_1) { is _SealedMixedChild1 -> "" is _SealedMixedChild2 -> "" is _SealedMixedChild3 -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.1.kt index 49de5595fbc..f48e4312c3e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.1.kt @@ -1,13 +1,13 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 2 SENTENCE: [3] When expression has two different forms: with bound value and without it. NUMBER: 1 DESCRIPTION: Empty 'when' with bound value. */ -fun case_1(value: Int) { - when (value) {} +fun case_1(value_1: Int) { + when (value_1) {} } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.2.kt index 8ecd2b5a6c7..98c48c8e754 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.2.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 2 SENTENCE: [3] When expression has two different forms: with bound value and without it. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/1.1.kt index cfed09cea94..9b8a3c7dba4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 3 SENTENCE: [1] When expression without bound value (the form where the expression enclosed in parantheses is absent) evaluates one of the many different expressions based on corresponding conditions present in the same when entry. NUMBER: 1 @@ -9,10 +9,10 @@ */ // CASE DESCRIPTION: 'When' with break expression (without label). -fun case_1(value: Int): String { +fun case_1(value_1: Int): String { while (true) { when { - value == 1 -> break + value_1 == 1 -> break } } @@ -20,10 +20,10 @@ fun case_1(value: Int): String { } // CASE DESCRIPTION: 'When' with continue expression (without label). -fun case_2(value: Int): String { +fun case_2(value_1: Int): String { while (true) { when { - value == 1 -> continue + value_1 == 1 -> continue } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt index 85a59fc2fb5..f47c05d806d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt @@ -3,20 +3,20 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 1 DESCRIPTION: 'When' without bound value and with not boolean condition in 'when condition'. */ -fun case_1(value1: Int, value2: String, value3: _BasicTypesProvider): String { +fun case_1(value_1: Int, value_2: String, value_3: _BasicTypesProvider): String { when { - .012f / value1 -> return "" - "$value2..." -> return "" + .012f / value_1 -> return "" + "$value_2..." -> return "" '-' -> return "" {} -> return "" - value3.getAny() -> return "" + value_3.getAny() -> return "" -10..-1 -> return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt index 62118e0c27d..f08d4ad618e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt @@ -3,18 +3,18 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 2 DESCRIPTION: 'When' without bound value and not allowed comma in when entry. */ -fun case_1(value1: _BasicTypesProvider) { +fun case_1(value_1: _BasicTypesProvider) { when { - getBoolean(), value1.getBoolean() -> return - value1.getBoolean() && getBoolean(), getLong() == 1000L -> return - value1.getList(), getLong(), {}, Any(), throw Exception() -> return + getBoolean(), value_1.getBoolean() -> return + value_1.getBoolean() && getBoolean(), getLong() == 1000L -> return + value_1.getList(), getLong(), {}, Any(), throw Exception() -> return } return diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt index 154aca6e740..d8071a1e725 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt @@ -6,7 +6,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 3 SENTENCE: [1] When expression without bound value (the form where the expression enclosed in parantheses is absent) evaluates one of the many different expressions based on corresponding conditions present in the same when entry. NUMBER: 1 @@ -14,80 +14,80 @@ */ // CASE DESCRIPTION: 'When' with control structure body as literals. -fun case_1(value: Int) { +fun case_1(value_1: Int) { when { - value == 1 -> true - value == 2 -> 100 - value == 3 -> -.09f - value == 4 -> '.' - value == 5 -> "..." - value == 6 -> null + value_1 == 1 -> true + value_1 == 2 -> 100 + value_1 == 3 -> -.09f + value_1 == 4 -> '.' + value_1 == 5 -> "..." + value_1 == 6 -> null } } // CASE DESCRIPTION: 'When' with control structure body as arithmetic expressions. -fun case_2(value: Int, value1: Byte, value2: _BasicTypesProvider) { +fun case_2(value_1: Int, value_2: Byte, value_3: _BasicTypesProvider) { when { - value == 1 -> -.09 % 10L - value == 3 -> value1 / -5 - value == 2 -> value2.getChar(99) - 11 + 90 + value_1 == 1 -> -.09 % 10L + value_1 == 3 -> value_2 / -5 + value_1 == 2 -> value_3.getChar(99) - 11 + 90 } } // CASE DESCRIPTION: 'When' with control structure body as boolean expressions (logical, equality and comparison). -fun case_3(value: Int, value1: Boolean, value2: Long) { +fun case_3(value_1: Int, value_2: Boolean, value_3: Long) { when { - value == 1 -> value1 - value == 2 -> !value1 - value == 3 -> getBoolean() && value1 - value == 5 -> getChar(10) != 'a' - value == 6 -> getList() === getAny() - value == 7 -> value2 <= 11 + value_1 == 1 -> value_2 + value_1 == 2 -> !value_2 + value_1 == 3 -> getBoolean() && value_2 + value_1 == 5 -> getChar(10) != 'a' + value_1 == 6 -> getList() === getAny() + value_1 == 7 -> value_3 <= 11 } } // CASE DESCRIPTION: 'When' with control structure body as concatenations. -fun case_4(value: Int, value1: String, value2: String) { +fun case_4(value_1: Int, value_2: String, value_3: String) { when { - value == 1 -> "..." + value1 + "" + "$value2" + "..." - value == 2 -> value1 + getString() + value_1 == 1 -> "..." + value_2 + "" + "$value_3" + "..." + value_1 == 2 -> value_2 + getString() } } // CASE DESCRIPTION: 'When' with control structure body as when expression. -fun case_5(value: Int, value1: Int, value2: Boolean?) { +fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { when { - value == 1 -> when { - value1 > 1000 -> "1" - value1 > 100 -> "2" + value_1 == 1 -> when { + value_2 > 1000 -> "1" + value_2 > 100 -> "2" else -> "3" } - value == 2 -> when { - value1 > 1000 -> "1" - value1 > 100 -> "2" + value_1 == 2 -> when { + value_2 > 1000 -> "1" + value_2 > 100 -> "2" } - value == 3 -> when {} - value == 4 -> when (value2) { + value_1 == 3 -> when {} + value_1 == 4 -> when (value_3) { true -> "1" false -> "2" null -> "3" } - value == 5 -> when (value2) { + value_1 == 5 -> when (value_3) { true -> "1" false -> "2" } - value == 6 -> when (value2) {} + value_1 == 6 -> when (value_3) {} } } // CASE DESCRIPTION: 'When' as expression with control structure body as when expression (must be exhaustive). -fun case_6(value: Int, value1: Int, value2: Boolean?) = when { - value == 1 -> when { - value1 > 1000 -> 1 - value1 > 100 -> 2 +fun case_6(value_1: Int, value_2: Int, value_3: Boolean?) = when { + value_1 == 1 -> when { + value_2 > 1000 -> 1 + value_2 > 100 -> 2 else -> 3 } - else -> when (value2) { + else -> when (value_3) { true -> 1 false -> 2 null -> 3 @@ -95,138 +95,138 @@ fun case_6(value: Int, value1: Int, value2: Boolean?) = when { } // CASE DESCRIPTION: 'When' with control structure body as if expression. -fun case_7(value: Int, value1: Int, value2: Boolean?) { +fun case_7(value_1: Int, value_2: Int, value_3: Boolean?) { when { - value == 1 -> if (value1 > 1000) "1" - value == 2 -> if (value1 > 1000) "1" + value_1 == 1 -> if (value_2 > 1000) "1" + value_1 == 2 -> if (value_2 > 1000) "1" else "2" - value == 3 -> if (value1 < 100) "1" - else if (value1 < 10) "2" + value_1 == 3 -> if (value_2 < 100) "1" + else if (value_2 < 10) "2" else "4" - value == 4 -> if (value2 == null) "1" - else if (value2) "2" - else if (!value2) "3" + value_1 == 4 -> if (value_3 == null) "1" + else if (value_3) "2" + else if (!value_3) "3" } } // CASE DESCRIPTION: 'When' as expression with control structure body as if expression (must be exhaustive). -fun case_8(value: Int, value1: Int) = when { - value == 1 -> if (value1 > 1000) "1" +fun case_8(value_1: Int, value_2: Int) = when { + value_1 == 1 -> if (value_2 > 1000) "1" else "2" - else -> if (value1 < 100) "1" - else if (value1 < 10) "2" + else -> if (value_2 < 100) "1" + else if (value_2 < 10) "2" else "4" } // CASE DESCRIPTION: 'When' with control structure body as try expression. -fun case_9(value: Int, value1: String, value2: String) = when { - value == 1 -> try { 4 } catch (e: Exception) { 5 } - value == 2 -> try { throw Exception() } catch (e: Exception) { value1 } - else -> try { throw Exception() } catch (e: Exception) { {value2} } finally { } +fun case_9(value_1: Int, value_2: String, value_3: String) = when { + value_1 == 1 -> try { 4 } catch (e: Exception) { 5 } + value_1 == 2 -> try { throw Exception() } catch (e: Exception) { value_2 } + else -> try { throw Exception() } catch (e: Exception) { {value_3} } finally { } } // CASE DESCRIPTION: 'When' with control structure body as elvis operator expression. -fun case_10(value: Int, value1: String?, value2: String?) { +fun case_10(value_1: Int, value_2: String?, value_3: String?) { when { - value == 1 -> value1 ?: true - value == 2 -> value1 ?: value2 ?: true - value == 3 -> value1!! ?: true + value_1 == 1 -> value_2 ?: true + value_1 == 2 -> value_2 ?: value_3 ?: true + value_1 == 3 -> value_2!! ?: true } } // CASE DESCRIPTION: 'When' with control structure body as range expression. -fun case_11(value: Int) { +fun case_11(value_1: Int) { when { - value == 1 -> 1..10 - value == 2 -> -100L..100L - value == 3 -> -getInt()..getLong() + value_1 == 1 -> 1..10 + value_1 == 2 -> -100L..100L + value_1 == 3 -> -getInt()..getLong() } } // CASE DESCRIPTION: 'When' with control structure body as cast expression. -fun case_12(value: Int, value1: Collection, value2: Collection?) { +fun case_12(value_1: Int, value_2: Collection, value_3: Collection?) { when { - value == 1 -> value1 as MutableList - value == 2 -> value1 as? MutableList - value == 3 -> value2 as? MutableMap - value == 4 -> (value1 as? Map) as MutableMap + value_1 == 1 -> value_2 as MutableList + value_1 == 2 -> value_2 as? MutableList + value_1 == 3 -> value_3 as? MutableMap + value_1 == 4 -> (value_2 as? Map) as MutableMap } } // CASE DESCRIPTION: 'When' with control structure body as prefix operator expression. -fun case_13(value: Int, value1: Int, value2: Int, value3: Boolean) { - var mutableValue1 = value1 - var mutableValue2 = value2 +fun case_13(value_1: Int, value_2: Int, value_3: Int, value_4: Boolean) { + var mutablevalue_2 = value_2 + var mutablevalue_3 = value_3 when { - value == 1 -> ++mutableValue1 - value == 2 -> --mutableValue2 - value == 3 -> !value3 + value_1 == 1 -> ++mutablevalue_2 + value_1 == 2 -> --mutablevalue_3 + value_1 == 3 -> !value_4 } } // CASE DESCRIPTION: 'When' with control structure body as postfix operator expression. -fun case_14(value: Int, value1: Int, value2: Int, value3: Boolean?) { - var mutableValue1 = value1 - var mutableValue2 = value2 +fun case_14(value_1: Int, value_2: Int, value_3: Int, value_4: Boolean?) { + var mutablevalue_2 = value_2 + var mutablevalue_3 = value_3 when { - value == 1 -> mutableValue1++ - value == 2 -> mutableValue2-- - value == 3 -> value3!! + value_1 == 1 -> mutablevalue_2++ + value_1 == 2 -> mutablevalue_3-- + value_1 == 3 -> value_4!! } } // CASE DESCRIPTION: 'When' with control structure body as indexing expression. -fun case_15(value: Int, value1: List, value2: List>>>) { +fun case_15(value_1: Int, value_2: List, value_3: List>>>) { when { - value == 1 -> value1[0] - value == 2 -> value2[0][-4][1][-1] + value_1 == 1 -> value_2[0] + value_1 == 2 -> value_3[0][-4][1][-1] } } // CASE DESCRIPTION: 'When' with control structure body as call expression. -fun case_16(value: Int, value1: _Class, value2: _Class?, value3: Int) { +fun case_16(value_1: Int, value_2: _Class, value_3: _Class?, value_4: Int) { fun __fun_1(): () -> Unit { return fun() { } } when { - value == 1 -> _funWithoutArgs() - value == 2 -> __fun_1()() - value == 3 -> value1.fun_2(value3) - value == 4 -> value2?.fun_2(value3) - value == 5 -> value2!!.fun_2(value3) + value_1 == 1 -> _funWithoutArgs() + value_1 == 2 -> __fun_1()() + value_1 == 3 -> value_2.fun_2(value_4) + value_1 == 4 -> value_3?.fun_2(value_4) + value_1 == 5 -> value_3!!.fun_2(value_4) } } // CASE DESCRIPTION: 'When' with control structure body as property access expression. -fun case_17(value: Int, value1: _Class, value2: _Class?) { +fun case_17(value_1: Int, value_2: _Class, value_3: _Class?) { when { - value == 1 -> value1.prop_1 - value == 2 -> value2?.prop_1 - value == 3 -> value1::prop_1.get() - value == 4 -> value2!!::prop_3.get() + value_1 == 1 -> value_2.prop_1 + value_1 == 2 -> value_3?.prop_1 + value_1 == 3 -> value_2::prop_1.get() + value_1 == 4 -> value_3!!::prop_3.get() } } // CASE DESCRIPTION: 'When' with control structure body as fun literal. -fun case_18(value: Int) { +fun case_18(value_1: Int) { val fun_1 = fun(): Int { return 0 } when { - value == 1 -> fun() {} - value == 2 -> fun(): Int { return 0 } - value == 3 -> fun(): () -> Unit { return fun() {} } - value == 4 -> fun_1 + value_1 == 1 -> fun() {} + value_1 == 2 -> fun(): Int { return 0 } + value_1 == 3 -> fun(): () -> Unit { return fun() {} } + value_1 == 4 -> fun_1 } } // CASE DESCRIPTION: 'When' with control structure body as lambda literal. -fun case_19(value: Int): () -> Any { +fun case_19(value_1: Int): () -> Any { val lambda_1 = { 0 } return when { - value == 1 -> lambda_1 - value == 2 -> { { {} } } + value_1 == 1 -> lambda_1 + value_1 == 2 -> { { {} } } else -> { -> (Int) { arg: Int -> { { println(arg) } } } } @@ -234,18 +234,18 @@ fun case_19(value: Int): () -> Any { } // CASE DESCRIPTION: 'When' with control structure body as object literal. -fun case_20(value: Int) { +fun case_20(value_1: Int) { val object_1 = object { val prop_1 = 1 } when { - value == 1 -> object {} - value == 2 -> object { + value_1 == 1 -> object {} + value_1 == 2 -> object { private fun fun_1() { } val prop_1 = 1 } - value == 3 -> object_1 + value_1 == 3 -> object_1 } } @@ -255,41 +255,41 @@ class A { val lambda_1 = { 1 } fun fun_1(): Int { return 1 } - fun case_21(value: Int) { + fun case_21(value_1: Int) { when { - value == 1 -> this - value == 2 -> ((this)) - value == 3 -> this::prop_1.get() - value == 4 -> this.prop_1 - value == 5 -> this.lambda_1() - value == 6 -> this::lambda_1.get()() - value == 7 -> this.fun_1() - value == 8 -> this::fun_1.invoke() + value_1 == 1 -> this + value_1 == 2 -> ((this)) + value_1 == 3 -> this::prop_1.get() + value_1 == 4 -> this.prop_1 + value_1 == 5 -> this.lambda_1() + value_1 == 6 -> this::lambda_1.get()() + value_1 == 7 -> this.fun_1() + value_1 == 8 -> this::fun_1.invoke() } } } // CASE DESCRIPTION: 'When' with control structure body as throw expression. -fun case_22(value: Int) { +fun case_22(value_1: Int) { when { - value == 1 -> throw Exception() - value == 2 -> throw throw throw Exception() + value_1 == 1 -> throw Exception() + value_1 == 2 -> throw throw throw Exception() } } // CASE DESCRIPTION: 'When' with control structure body as return expression. -fun case_23(value: Int) { +fun case_23(value_1: Int) { fun r_1() { when { - value == 1 -> return - value == 2 -> return return return + value_1 == 1 -> return + value_1 == 2 -> return return return } } fun r_2(): List? { when { - value == 1 -> return listOf(0, 1, 2) - value == 2 -> return null + value_1 == 1 -> return listOf(0, 1, 2) + value_1 == 2 -> return null } return null @@ -297,24 +297,24 @@ fun case_23(value: Int) { } // CASE DESCRIPTION: 'When' with control structure body as continue expression. -fun case_24(value: Int) { +fun case_24(value_1: Int) { loop1@ while (true) { loop2@ while (true) { when { - value == 1 -> continue@loop1 - value == 2 -> continue@loop2 + value_1 == 1 -> continue@loop1 + value_1 == 2 -> continue@loop2 } } } } // CASE DESCRIPTION: 'When' with control structure body as break expression. -fun case_25(value: Int) { +fun case_25(value_1: Int) { loop1@ while (true) { loop2@ while (true) { when { - value == 1 -> break@loop1 - value == 2 -> break@loop2 + value_1 == 1 -> break@loop1 + value_1 == 2 -> break@loop2 } } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt index 630ec72a720..93326b2bd03 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 1 @@ -13,14 +13,14 @@ */ // CASE DESCRIPTION: 'When' with boolean expressions and else branch. -fun case_1(value1: Boolean, value2: Long): Int { +fun case_1(value_1: Boolean, value_2: Long): Int { return when { - value1 -> 1 - getBoolean() && value1 -> 2 + value_1 -> 1 + getBoolean() && value_1 -> 2 getChar(10) != 'a' -> 3 getList() === getAny() -> 4 - value2 <= 11 -> 5 - !value1 -> 6 + value_2 <= 11 -> 5 + !value_1 -> 6 else -> 7 } } @@ -29,12 +29,12 @@ fun case_1(value1: Boolean, value2: Long): Int { CASE DESCRIPTION: 'When' with boolean expressions. NOTE: for potential analysys on exhaustive by enum of when without bound value. */ -fun case_2(value: _EnumClass) { +fun case_2(value_1: _EnumClass) { when { - value == _EnumClass.NORTH -> {} - value == _EnumClass.SOUTH -> {} - value == _EnumClass.WEST -> {} - value == _EnumClass.EAST -> {} + value_1 == _EnumClass.NORTH -> {} + value_1 == _EnumClass.SOUTH -> {} + value_1 == _EnumClass.WEST -> {} + value_1 == _EnumClass.EAST -> {} } } @@ -42,10 +42,10 @@ fun case_2(value: _EnumClass) { CASE DESCRIPTION: 'When' with boolean expressions. NOTE: for potential analysys on exhaustive by boolean of when without bound value. */ -fun case_3(value: Boolean) { +fun case_3(value_1: Boolean) { when { - value == true -> return - value == false -> return + value_1 == true -> return + value_1 == false -> return } } @@ -53,11 +53,11 @@ fun case_3(value: Boolean) { CASE DESCRIPTION: 'When' with boolean literals. NOTE: for potential mark code after true branch as unreacable. */ -fun case_4(value1: Boolean) { +fun case_4(value_1: Boolean) { when { false -> return true -> return - value1 -> return + value_1 -> return } } @@ -65,60 +65,60 @@ fun case_4(value1: Boolean) { CASE DESCRIPTION: 'When' with boolean constants. NOTE: for potential const propagation use in this case. */ -fun case_5(value1: Boolean) { - val value2 = false - val value3 = false || !!!false || false +fun case_5(value_1: Boolean) { + val value_2 = false + val value_3 = false || !!!false || false when { - value3 -> return - value2 -> return - value1 -> return + value_3 -> return + value_2 -> return + value_1 -> return } } // CASE DESCRIPTION: 'When' with type checking operator. -fun case_6(value: Any) { +fun case_6(value_1: Any) { when { - value is Nothing -> {} - value is Int -> {} - value is Boolean -> {} - value is String -> {} - value is Number -> {} - value is Float -> {} - value is Any -> {} + value_1 is Nothing -> {} + value_1 is Int -> {} + value_1 is Boolean -> {} + value_1 is String -> {} + value_1 is Number -> {} + value_1 is Float -> {} + value_1 is Any -> {} } } /* CASE DESCRIPTION: 'When' with invert type checking operator. - NOTE: for potential analysys on exhaustive of when without bound value. + NOTE: for potential analysys on exhaustive of when without bound value_1. */ -fun case_7(value: Any) { +fun case_7(value_1: Any) { when { - value !is Number -> {} - value is Float -> {} - value is Number -> {} - value is Any -> {} + value_1 !is Number -> {} + value_1 is Float -> {} + value_1 is Number -> {} + value_1 is Any -> {} } } /* CASE DESCRIPTION: 'When' with type checking operator by sealed class. - NOTE: for potential analysys on exhaustive by sealed class of when without bound value. + NOTE: for potential analysys on exhaustive by sealed class of when without bound value_1. */ -fun case_8(value: _SealedClass) { +fun case_8(value_1: _SealedClass) { when { - value is _SealedChild1 -> {} - value is _SealedChild2 -> {} - value is _SealedChild3 -> {} + value_1 is _SealedChild1 -> {} + value_1 is _SealedChild2 -> {} + value_1 is _SealedChild3 -> {} } } // CASE DESCRIPTION: 'When' with containment operator. -fun case_9(value: Int, value1: IntRange) { +fun case_9(value_1: Int, value_2: IntRange) { when { - value in -10..100L -> {} - value in value1 -> {} - value !in listOf(0, 1, 2) -> {} + value_1 in -10..100L -> {} + value_1 in value_2 -> {} + value_1 !in listOf(0, 1, 2) -> {} } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.2.kt index 026bf0a1e60..1e87de7a6cf 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.2.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt index 60a879c8d7d..84beea6b1d5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt @@ -3,17 +3,17 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 3 DESCRIPTION: 'When' without bound value and with Nothing in condition (subtype of Boolean). - UNEXPECTED BEHAVIOUR + DISCUSSION ISSUES: KT-25948 */ // CASE DESCRIPTION: 'When' with return expression in condition. -fun case_1(value1: _BasicTypesProvider) { +fun case_1(value_1: _BasicTypesProvider) { when { return -> return return == return -> return @@ -24,7 +24,7 @@ fun case_1(value1: _BasicTypesProvider) { } // CASE DESCRIPTION: 'When' with throw expression in condition. -fun case_2(value1: _BasicTypesProvider) { +fun case_2(value_1: _BasicTypesProvider) { when { throw Exception() -> return (throw Exception()) == (throw Exception()) -> return @@ -35,7 +35,7 @@ fun case_2(value1: _BasicTypesProvider) { } // CASE DESCRIPTION: 'When' with break expression in condition. -fun case_3(value1: _BasicTypesProvider) { +fun case_3(value_1: _BasicTypesProvider) { loop1@ while (true) { loop2@ while (true) { loop3@ while (true) { @@ -50,7 +50,7 @@ fun case_3(value1: _BasicTypesProvider) { } // CASE DESCRIPTION: 'When' with continue expression in condition. -fun case_4(value1: _BasicTypesProvider): String { +fun case_4(value_1: _BasicTypesProvider): String { loop1@ while (true) { loop2@ while (true) { loop3@ while (true) { @@ -65,19 +65,19 @@ fun case_4(value1: _BasicTypesProvider): String { } // CASE DESCRIPTION: 'When' with values of Nothing type. -fun case_6(value1: Nothing, value2: _BasicTypesProvider): String { +fun case_6(value_1: Nothing, value_2: _BasicTypesProvider): String { when { - value1 -> return "" - value2.getNothing() -> return "" + value_1 -> return "" + value_2.getNothing() -> return "" getNothing() -> return "" - value1 && (getNothing() == value2.getNothing()) -> return "" + value_1 && (getNothing() == value_2.getNothing()) -> return "" } return "" } // CASE DESCRIPTION: 'When' with mixed Nothing expression in condition. -fun case_5(value1: _BasicTypesProvider, value2: Nothing) { +fun case_5(value_1: _BasicTypesProvider, value_2: Nothing) { loop1@ while (true) { loop2@ while (true) { loop3@ while (true) { @@ -87,9 +87,9 @@ fun case_5(value1: _BasicTypesProvider, continue@loop1 != 10L && (return return) == continue@loop1 -> return return continue@loop1 -> return (throw break@loop1) && break@loop3 -> return - (throw getNothing()) && value1.getNothing() -> return - return return return value2 -> return - getNothing() != 10L && (return return) == value2 -> return + (throw getNothing()) && value_1.getNothing() -> return + return return return value_2 -> return + getNothing() != 10L && (return return) == value_2 -> return } } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg/1.1.kt index 783e855ba34..8103358f061 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 5 SENTENCE: [1] The else entry is also special in the sense that it must be the last entry in the expression, otherwise a compiler error must be generated. NUMBER: 1 @@ -9,16 +9,16 @@ */ // CASE DESCRIPTION: 'When' with 'else' branch in the first position. -fun case_1(value: Int): String = when { +fun case_1(value_1: Int): String = when { else -> "" - value == 1 -> "" + value_1 == 1 -> "" } // CASE DESCRIPTION: 'When' with 'else' branch in the middle position. -fun case_2(value: Int): String = when { - value == 1 -> "" +fun case_2(value_1: Int): String = when { + value_1 == 1 -> "" else -> "" - value == 2 -> "" + value_1 == 2 -> "" } // CASE DESCRIPTION: 'When' with two 'else' branches. diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos/1.1.kt index f0dda665a20..beda52d25c5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 5 SENTENCE: [1] The else entry is also special in the sense that it must be the last entry in the expression, otherwise a compiler error must be generated. NUMBER: 1 @@ -9,17 +9,17 @@ */ // CASE DESCRIPTION: 'When' with else branch as statement -fun case_1(value: Int): String { +fun case_1(value_1: Int): String { when { - value == 1 -> return "" - value == 2 -> return "" + value_1 == 1 -> return "" + value_1 == 2 -> return "" else -> return "" } } // CASE DESCRIPTION: 'When' with else branch as expression -fun case_2(value: Int): String = when { - value == 1 -> "" - value == 2 -> "" +fun case_2(value_1: Int): String = when { + value_1 == 1 -> "" + value_1 == 2 -> "" else -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg/1.1.kt index 61e02793025..e4a65f865c9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 6 SENTENCE: [1] When expression with bound value (the form where the expression enclosed in parantheses is present) are very similar to the form without bound value, but use different syntax for conditions. NUMBER: 1 @@ -9,9 +9,9 @@ */ // CASE DESCRIPTION: 'When' with break expression (without label). -fun case_1(value: Int): Int { +fun case_1(value_1: Int): Int { while (true) { - when (value) { + when (value_1) { 1 -> return 1 2 -> break } @@ -21,9 +21,9 @@ fun case_1(value: Int): Int { } // CASE DESCRIPTION: 'When' with continue expression (without label). -fun case_2(value: Int): Int { +fun case_2(value_1: Int): Int { while (true) { - when (value) { + when (value_1) { 1 -> continue 2 -> return 1 } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt index b3c27ca348b..050414e9411 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt @@ -6,7 +6,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 6 SENTENCE: [1] When expression with bound value (the form where the expression enclosed in parantheses is present) are very similar to the form without bound value, but use different syntax for conditions. NUMBER: 1 @@ -14,8 +14,8 @@ */ // CASE DESCRIPTION: 'When' with control structure body as literals. -fun case_1(value: Int) { - when (value) { +fun case_1(value_1: Int) { + when (value_1) { 1 -> true 2 -> 100 3 -> -.09f @@ -26,69 +26,69 @@ fun case_1(value: Int) { } // CASE DESCRIPTION: 'When' with control structure body as arithmetic expressions. -fun case_2(value: Int, value1: Byte, value2: _BasicTypesProvider) { - when (value) { +fun case_2(value_1: Int, value_2: Byte, value_3: _BasicTypesProvider) { + when (value_1) { 1 -> -.09 % 10L - 3 -> value1 / -5 - 2 -> value2.getChar(99) - 11 + 90 + 3 -> value_2 / -5 + 2 -> value_3.getChar(99) - 11 + 90 4 -> 100 } } // CASE DESCRIPTION: 'When' with control structure body as boolean expressions (logical, equality and comparison). -fun case_3(value: Int, value1: Boolean, value2: Long) { - when (value) { - 1 -> value1 - 2 -> !value1 - 3 -> getBoolean() && value1 +fun case_3(value_1: Int, value_2: Boolean, value_3: Long) { + when (value_1) { + 1 -> value_2 + 2 -> !value_2 + 3 -> getBoolean() && value_2 5 -> getChar(10) != 'a' 6 -> getList() === getAny() - 7 -> value2 <= 11 + 7 -> value_3 <= 11 } } // CASE DESCRIPTION: 'When' with control structure body as concatenations. -fun case_4(value: Int, value1: String, value2: String) { - when (value) { - 1 -> "..." + value1 + "" + "$value2" + "..." - 2 -> value1 + getString() +fun case_4(value_1: Int, value_2: String, value_3: String) { + when (value_1) { + 1 -> "..." + value_2 + "" + "$value_3" + "..." + 2 -> value_2 + getString() } } // CASE DESCRIPTION: 'When' with control structure body as when expression. -fun case_5(value: Int, value1: Int, value2: Boolean?) { - when (value) { - 1 -> when (value2) { - value1 > 1000 -> "1" - value1 > 100 -> "2" +fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { + when (value_1) { + 1 -> when (value_3) { + value_2 > 1000 -> "1" + value_2 > 100 -> "2" else -> "3" } - 2 -> when (value2) { - value1 > 1000 -> "1" - value1 > 100 -> "2" + 2 -> when (value_3) { + value_2 > 1000 -> "1" + value_2 > 100 -> "2" } - 3 -> when (value2) {} - 4 -> when (value2) { + 3 -> when (value_3) {} + 4 -> when (value_3) { true -> "1" false -> "2" null -> "3" } - 5 -> when (value2) { + 5 -> when (value_3) { true -> "1" false -> "2" } - 6 -> when (value2) {} + 6 -> when (value_3) {} } } // CASE DESCRIPTION: 'When' as expression with control structure body as when expression (must be exhaustive). -fun case_6(value: Int, value1: Int, value2: Boolean?) = when (value) { - 1 -> when (value2) { - value1 > 1000 -> 1 - value1 > 100 -> 2 +fun case_6(value_1: Int, value_2: Int, value_3: Boolean?) = when (value_1) { + 1 -> when (value_3) { + value_2 > 1000 -> 1 + value_2 > 100 -> 2 else -> 3 } - else -> when (value2) { + else -> when (value_3) { true -> 1 false -> 2 null -> 3 @@ -96,50 +96,50 @@ fun case_6(value: Int, value1: Int, value2: Boolean?) = when (value) { } // CASE DESCRIPTION: 'When' with control structure body as if expression. -fun case_7(value: Int, value1: Int, value2: Boolean?) { - when (value) { - 1 -> if (value1 > 1000) "1" - 2 -> if (value1 > 1000) "1" +fun case_7(value_1: Int, value_2: Int, value_3: Boolean?) { + when (value_1) { + 1 -> if (value_2 > 1000) "1" + 2 -> if (value_2 > 1000) "1" else "2" - 3 -> if (value1 < 100) "1" - else if (value1 < 10) "2" + 3 -> if (value_2 < 100) "1" + else if (value_2 < 10) "2" else "4" - 4 -> if (value2 == null) "1" - else if (value2) "2" - else if (!value2) "3" + 4 -> if (value_3 == null) "1" + else if (value_3) "2" + else if (!value_3) "3" } } // CASE DESCRIPTION: 'When' as expression with control structure body as if expression (must be exhaustive). -fun case_8(value: Int, value1: Int) = when (value) { - 1 -> if (value1 > 1000) "1" +fun case_8(value_1: Int, value_2: Int) = when (value_1) { + 1 -> if (value_2 > 1000) "1" else "2" - else -> if (value1 < 100) "1" - else if (value1 < 10) "2" + else -> if (value_2 < 100) "1" + else if (value_2 < 10) "2" else "4" } // CASE DESCRIPTION: 'When' with control structure body as try expression. -fun case_9(value: Int, value1: String, value2: String): Any { - return when (value) { +fun case_9(value_1: Int, value_2: String, value_3: String): Any { + return when (value_1) { 1 -> try { 4 } catch (e: Exception) { 5 } - 2 -> try { throw Exception() } catch (e: Exception) { value1 } - else -> try { throw Exception() } catch (e: Exception) { {value2} } finally { } + 2 -> try { throw Exception() } catch (e: Exception) { value_2 } + else -> try { throw Exception() } catch (e: Exception) { {value_3} } finally { } } } // CASE DESCRIPTION: 'When' with control structure body as elvis operator expression. -fun case_10(value: Int, value1: String?, value2: String?) { - when (value) { - 1 -> value1 ?: true - 2 -> value1 ?: value2 ?: true - 3 -> value1!! ?: true +fun case_10(value_1: Int, value_2: String?, value_3: String?) { + when (value_1) { + 1 -> value_2 ?: true + 2 -> value_2 ?: value_3 ?: true + 3 -> value_2!! ?: true } } // CASE DESCRIPTION: 'When' with control structure body as range expression. -fun case_11(value: Int) { - when (value) { +fun case_11(value_1: Int) { + when (value_1) { 1 -> 1..10 2 -> -100L..100L 3 -> -getInt()..getLong() @@ -147,75 +147,75 @@ fun case_11(value: Int) { } // CASE DESCRIPTION: 'When' with control structure body as cast expression. -fun case_12(value: Int, value1: Collection, value2: Collection?) { - when (value) { - 1 -> value1 as MutableList - 2 -> value1 as? MutableList - 3 -> value2 as? MutableMap - 4 -> (value1 as? Map) as MutableMap +fun case_12(value_1: Int, value_2: Collection, value_3: Collection?) { + when (value_1) { + 1 -> value_2 as MutableList + 2 -> value_2 as? MutableList + 3 -> value_3 as? MutableMap + 4 -> (value_2 as? Map) as MutableMap } } // CASE DESCRIPTION: 'When' with control structure body as prefix operator expression. -fun case_13(value: Int, value1: Int, value2: Int, value3: Boolean) { - var mutableValue1 = value1 - var mutableValue2 = value2 +fun case_13(value_1: Int, value_2: Int, value_3: Int, value_4: Boolean) { + var mutableValue1 = value_2 + var mutableValue2 = value_3 - when (value) { + when (value_1) { 1 -> ++mutableValue1 2 -> --mutableValue2 - 3 -> !value3 + 3 -> !value_4 } } // CASE DESCRIPTION: 'When' with control structure body as postfix operator expression. -fun case_14(value: Int, value1: Int, value2: Int, value3: Boolean?) { - var mutableValue1 = value1 - var mutableValue2 = value2 +fun case_14(value_1: Int, value_2: Int, value_3: Int, value_4: Boolean?) { + var mutableValue1 = value_2 + var mutableValue2 = value_3 - when (value) { + when (value_1) { 1 -> mutableValue1++ 2 -> mutableValue2-- - 3 -> value3!! + 3 -> value_4!! } } // CASE DESCRIPTION: 'When' with control structure body as indexing expression. -fun case_15(value: Int, value1: List, value2: List>>>) { - when (value) { - 1 -> value1[0] - 2 -> value2[0][-4][1][-1] +fun case_15(value_1: Int, value_2: List, value_3: List>>>) { + when (value_1) { + 1 -> value_2[0] + 2 -> value_3[0][-4][1][-1] } } // CASE DESCRIPTION: 'When' with control structure body as call expression. -fun case_16(value: Int, value1: _Class, value2: _Class?, value3: Int) { +fun case_16(value_1: Int, value_2: _Class, value_3: _Class?, value_4: Int) { fun __fun_1(): () -> Unit { return fun() { } } - when (value) { + when (value_1) { 1 -> _funWithoutArgs() 2 -> __fun_1()() - 3 -> value1.fun_2(value3) - 4 -> value2?.fun_2(value3) - 5 -> value2!!.fun_2(value3) + 3 -> value_2.fun_2(value_4) + 4 -> value_3?.fun_2(value_4) + 5 -> value_3!!.fun_2(value_4) } } // CASE DESCRIPTION: 'When' with control structure body as property access expression. -fun case_17(value: Int, value1: _Class, value2: _Class?) { - when (value) { - 1 -> value1.prop_1 - 2 -> value2?.prop_1 - 3 -> value1::prop_1.get() - 4 -> value2!!::prop_3.get() +fun case_17(value_1: Int, value_2: _Class, value_3: _Class?) { + when (value_1) { + 1 -> value_2.prop_1 + 2 -> value_3?.prop_1 + 3 -> value_2::prop_1.get() + 4 -> value_3!!::prop_3.get() } } // CASE DESCRIPTION: 'When' with control structure body as fun literal. -fun case_18(value: Int) { +fun case_18(value_1: Int) { val fun_1 = fun(): Int { return 0 } - when (value) { + when (value_1) { 1 -> fun() {} 2 -> fun(): Int { return 1 } 3 -> fun(): () -> Unit { return fun() {} } @@ -224,10 +224,10 @@ fun case_18(value: Int) { } // CASE DESCRIPTION: 'When' with control structure body as lambda literal. -fun case_19(value: Int): Any { +fun case_19(value_1: Int): Any { val lambda_1 = { 0 } - return when (value) { + return when (value_1) { 1 -> lambda_1 2 -> { { {} } } else -> { -> (Int) @@ -237,12 +237,12 @@ fun case_19(value: Int): Any { } // CASE DESCRIPTION: 'When' with control structure body as object literal. -fun case_20(value: Int) { +fun case_20(value_1: Int) { val object_1 = object { val prop_1 = 1 } - when (value) { + when (value_1) { 1 -> object {} 2 -> object { private fun fun_1() { } @@ -258,8 +258,8 @@ class A { val lambda_1 = { 1 } fun fun_1(): Int { return 1 } - fun case_21(value: Int) { - when (value) { + fun case_21(value_1: Int) { + when (value_1) { 1 -> this 2 -> ((this)) 3 -> this::prop_1.get() @@ -273,24 +273,24 @@ class A { } // CASE DESCRIPTION: 'When' with control structure body as throw expression. -fun case_22(value: Int) { - when (value) { +fun case_22(value_1: Int) { + when (value_1) { 1 -> throw Exception() 2 -> throw throw throw Exception() } } // CASE DESCRIPTION: 'When' with control structure body as return expression. -fun case_23(value: Int) { +fun case_23(value_1: Int) { fun r_1() { - when (value) { + when (value_1) { 1 -> return 2 -> return return return } } fun r_2(): List? { - when (value) { + when (value_1) { 1 -> return listOf(0, 1, 2) 2 -> return null } @@ -300,10 +300,10 @@ fun case_23(value: Int) { } // CASE DESCRIPTION: 'When' with control structure body as continue expression. -fun case_24(value: Int) { +fun case_24(value_1: Int) { loop1@ while (true) { loop2@ while (true) { - when (value) { + when (value_1) { 1 -> continue@loop1 2 -> continue@loop2 } @@ -312,10 +312,10 @@ fun case_24(value: Int) { } // CASE DESCRIPTION: 'When' with control structure body as break expression. -fun case_25(value: Int) { +fun case_25(value_1: Int) { loop1@ while (true) { loop2@ while (true) { - when (value) { + when (value_1) { 1 -> break@loop1 2 -> break@loop2 } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt index c7fd105b8b8..eddd68f7359 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 1 @@ -11,8 +11,8 @@ */ // CASE DESCRIPTION: 'When' with custom class type test condition. -fun case_1(value: Any): String { - when (value) { +fun case_1(value_1: Any): String { + when (value_1) { _EmptyClass -> return "" } @@ -20,8 +20,8 @@ fun case_1(value: Any): String { } // CASE DESCRIPTION: 'When' with Any type test condition. -fun case_2(value: Any): String { - when (value) { +fun case_2(value_1: Any): String { + when (value_1) { Any -> return "" } @@ -29,8 +29,8 @@ fun case_2(value: Any): String { } // CASE DESCRIPTION: 'When' with Nothing type test condition. -fun case_3(value: Any): String { - when (value) { +fun case_3(value_1: Any): String { + when (value_1) { Nothing -> return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt index 1be2bdb7e40..101797376b8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt @@ -3,16 +3,16 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 2 DESCRIPTION: 'When' with bound value and type test condition on the non-type operand of the type checking operator. */ -fun case_1(value: Any, value1: Int): String { - when (value) { - is value1 -> return "" +fun case_1(value_1: Any, value_2: Int): String { + when (value_1) { + is value_2 -> return "" } return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt index baabc613a4e..f2eb648ed2e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt @@ -3,17 +3,17 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [3] Contains test condition: containment operator followed by an expression. NUMBER: 1 DESCRIPTION: 'When' with bound value and 'when condition' with range expression, but without containment checking operator. */ -fun case_1(value: Int, value1: _BasicTypesProvider): String { - when (value) { +fun case_1(value_1: Int, value_2: _BasicTypesProvider): String { + when (value_1) { -1000L..100 -> return "" - value1.getInt()..getLong() -> return "" + value_2.getInt()..getLong() -> return "" } return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt index 75b01cdcbac..643342aaf92 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [3] Contains test condition: containment operator followed by an expression. NUMBER: 2 @@ -12,11 +12,11 @@ */ // CASE DESCRIPTION: 'When' with values of types without defined contains operator. -fun case_1(value: Int, value1: _EmptyClass, value2: Int, value3: Any): String { - when (value) { - in value1 -> return "" - in value2 -> return "" - in value3 -> return "" +fun case_1(value_1: Int, value_2: _EmptyClass, value_3: Int, value_4: Any): String { + when (value_1) { + in value_2 -> return "" + in value_3 -> return "" + in value_4 -> return "" } return "" @@ -24,12 +24,12 @@ fun case_1(value: Int, value1: _EmptyClass, value2: Int, value3: Any): String { /* CASE DESCRIPTION: 'When' with values of Nothing (all existing contains operators used here). - UNEXPECTED BEHAVIOUR + DISCUSSION ISSUES: KT-25948 */ -fun case_2(value: Int, value3: Nothing) { - when (value) { - in value3 -> {} +fun case_2(value_1: Int, value_3: Nothing) { + when (value_1) { + in value_3 -> {} in throw Exception() -> {} in return -> {} } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.1.kt index 9b913c9e9ab..29ca1ac31e1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [5] Any other expression. NUMBER: 1 @@ -11,24 +11,24 @@ */ // CASE DESCRIPTION: 'When' with cycles in when condition. -fun case_1(value: Int, value1: List): String { - when (value) { +fun case_1(value_1: Int, value_2: List): String { + when (value_1) { while (false) {} -> return "" do {} while (false) -> return "" - for (value2 in value1) {} -> return "" + for (value in value_2) {} -> return "" } return "" } // CASE DESCRIPTION: 'When' with assignments in when condition. -fun case_4(value: Int): String { - var value1: Int - var value2 = 10 +fun case_4(value_1: Int): String { + var value_2: Int + var value_3 = 10 - when (value) { - value1 = 10 -> return "" - value2 %= 10 -> return "" + when (value_1) { + value_2 = 10 -> return "" + value_3 %= 10 -> return "" } return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.2.kt index 026da87c82f..491c00981f2 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.2.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [5] Any other expression. NUMBER: 2 @@ -9,9 +9,9 @@ */ // CASE DESCRIPTION: 'When' with break expression (without label). -fun case_1(value: Int): String { +fun case_1(value_1: Int): String { while (true) { - when (value) { + when (value_1) { break -> return "" } } @@ -20,9 +20,9 @@ fun case_1(value: Int): String { } // CASE DESCRIPTION: 'When' with continue expression (without label). -fun case_2(value: Int): String { +fun case_2(value_1: Int): String { while (true) { - when (value) { + when (value_1) { continue -> return "" } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/7.1.kt index 22ebc85ed81..86576916b45 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/7.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [7] The else condition, which works the exact same way as it would in the form without bound expression. NUMBER: 1 @@ -11,21 +11,21 @@ */ // CASE DESCRIPTION: 'When' with 'else' branch in the first position. -fun case_1(value: Int): String = when (value) { +fun case_1(value_1: Int): String = when (value_1) { else -> "" 1 -> "" } // CASE DESCRIPTION: 'When' with 'else' branch in the middle position. -fun case_2(value: Int): String = when (value) { +fun case_2(value_1: Int): String = when (value_1) { 1 -> "" else -> "" 2 -> "" } // CASE DESCRIPTION: 'When' with two 'else' branches. -fun case_3(value: Int): String { - when (value) { +fun case_3(value_1: Int): String { + when (value_1) { else -> return "" else -> return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt index bb154232531..cd4ea91f282 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 1 @@ -12,8 +12,8 @@ */ // CASE DESCRIPTION: 'When' with type test condition on the various basic types. -fun case_1(value: Any): String { - when (value) { +fun case_1(value_1: Any): String { + when (value_1) { is Int -> return "" is Float -> return "" is Double -> return "" @@ -26,20 +26,20 @@ fun case_1(value: Any): String { } // CASE DESCRIPTION: 'When' with type test condition on the various nullable basic types. -fun case_2(value: Any?): String = when (value) { +fun case_2(value_1: Any?): String = when (value_1) { is Int? -> "" // if value is null then this branch will be executed is Float -> "" else -> "" } // CASE DESCRIPTION: 'When' with 'else' branch and type test condition on Any. -fun case_3(value: Any?): String = when (value) { +fun case_3(value_1: Any?): String = when (value_1) { is Any -> "" else -> "" } // CASE DESCRIPTION: 'When' with 'else' branch and type test condition on nullable (redundant) Any. -fun case_4(value: Any): String = when (value) { +fun case_4(value_1: Any): String = when (value_1) { is Any? -> "" else -> "" } @@ -49,7 +49,7 @@ fun case_4(value: Any): String = when (value) { UNEXPECTED BEHAVIOUR ISSUES: KT-22996 */ -fun case_5(value: Any?): String = when (value) { +fun case_5(value_1: Any?): String = when (value_1) { is Double -> "" is Int? -> "" // if value is null then this branch will be executed is String -> "" @@ -60,8 +60,8 @@ fun case_5(value: Any?): String = when (value) { } // CASE DESCRIPTION: 'When' with type test condition on the objetcs. -fun case_6(value: Any): String { - when (value) { +fun case_6(value_1: Any): String { + when (value_1) { is _EmptyObject -> return "" is _ClassWithCompanionObject.Companion -> return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt index efc906f4cd6..c40cc7e7dd8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 2 @@ -13,7 +13,7 @@ */ // CASE DESCRIPTION: 'When' in which all branches includes invert type checking operators. -fun case_1(value: _SealedClass) = when (value) { +fun case_1(value_1: _SealedClass) = when (value_1) { !is _SealedChild1 -> {} !is _SealedChild2 -> {} !is _SealedChild3 -> {} @@ -24,14 +24,14 @@ fun case_1(value: _SealedClass) = when (value) { UNEXPECTED BEHAVIOUR ISSUES: KT-22996 */ -fun case_2(value: _SealedClass?): String = when (value) { +fun case_2(value_1: _SealedClass?): String = when (value_1) { !is _SealedChild2 -> "" // including null is _SealedChild2 -> "" null -> "" // redundant } // CASE DESCRIPTION: 'When' with direct and invert type checking operators on the same types and null-check. -fun case_3(value: _SealedClass?): String = when (value) { +fun case_3(value_1: _SealedClass?): String = when (value_1) { !is _SealedChild2? -> "" // null isn't included is _SealedChild2 -> "" null -> "" @@ -42,16 +42,16 @@ fun case_3(value: _SealedClass?): String = when (value) { UNEXPECTED BEHAVIOUR ISSUES: KT-22996 */ -fun case_4(value: _SealedClass?) { - when (value) { +fun case_4(value_1: _SealedClass?) { + when (value_1) { !is _SealedChild2 -> {} // including null is _SealedChild2? -> {} // redundant nullable type check } } // CASE DESCRIPTION: 'When' with direct and invert type checking operator on the objects. -fun case_5(value: Any): String { - when (value) { +fun case_5(value_1: Any): String { + when (value_1) { is _EmptyObject -> return "" !is _ClassWithCompanionObject.Companion -> return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt index 0ce24a40ad9..67654c7f75b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 3 @@ -13,7 +13,7 @@ */ // CASE DESCRIPTION: 'When' with type test condition on the various basic types. -fun case_1(value: Any) = when (value) { +fun case_1(value_1: Any) = when (value_1) { is Int -> {} is Float, is Char, is Boolean -> {} is String -> {} @@ -21,7 +21,7 @@ fun case_1(value: Any) = when (value) { } // CASE DESCRIPTION: 'When' with 'else' branch and type test condition on the various nullable basic types. -fun case_2(value: Any?) = when (value) { +fun case_2(value_1: Any?) = when (value_1) { is Float, is Char, is _SealedClass? -> "" // if value is null then this branch will be executed is Double, is Boolean, is _ClassWithCompanionObject.Companion -> "" else -> "" @@ -32,7 +32,7 @@ fun case_2(value: Any?) = when (value) { UNEXPECTED BEHAVIOUR ISSUES: KT-22996 */ -fun case_3(value: Any?) = when (value) { +fun case_3(value_1: Any?) = when (value_1) { is Float, is Char, is Int? -> "" // if value is null then this branch will be executed is _SealedChild2, is Boolean?, is String -> "" // redundant nullable type check else -> "" @@ -43,7 +43,7 @@ fun case_3(value: Any?) = when (value) { UNEXPECTED BEHAVIOUR ISSUES: KT-22996 */ -fun case_4(value: Any?) = when (value) { +fun case_4(value_1: Any?) = when (value_1) { is Float, is Char?, is Int? -> "" // double nullable type check in the one branch is _SealedChild1, is Boolean, is String -> "" else -> "" @@ -54,8 +54,8 @@ fun case_4(value: Any?) = when (value) { UNEXPECTED BEHAVIOUR ISSUES: KT-22996 */ -fun case_5(value: Any?): String { - when (value) { +fun case_5(value_1: Any?): String { + when (value_1) { is Float, is Char?, is Int -> return "" is Double, is _EmptyObject, is String -> return "" null -> return "" // null-check redundant @@ -68,8 +68,8 @@ fun case_5(value: Any?): String { UNEXPECTED BEHAVIOUR ISSUES: KT-22996 */ -fun case_6(value: Any?): String { - when (value) { +fun case_6(value_1: Any?): String { + when (value_1) { is Float, is Char?, null, is Int -> return "" // double nullable type check in the one branch is Double, is _EmptyObject, is String -> return "" else -> return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt index 1c3a83fe0c9..1e2b4ea007b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 4 @@ -11,28 +11,28 @@ */ // CASE DESCRIPTION: 'When' with direct and invert type checking operator in the one branch and other branch. -fun case_1(value: _SealedClass): String = when (value) { +fun case_1(value_1: _SealedClass): String = when (value_1) { is _SealedChild1, !is _SealedChild3 -> "" is _SealedChild3 -> "" } // CASE DESCRIPTION: 'When' with three invert type checking operator in the one branch. -fun case_2(value: _SealedClass) = when (value) { +fun case_2(value_1: _SealedClass) = when (value_1) { !is _SealedChild1, !is _SealedChild2, !is _SealedChild3 -> {} } // CASE DESCRIPTION: 'When' with direct (first) and invert (second) type checking operator on the some type in the one branch. -fun case_3(value: _SealedClass): String = when (value) { +fun case_3(value_1: _SealedClass): String = when (value_1) { is _SealedChild2, !is _SealedChild2 -> "" } // CASE DESCRIPTION: 'When' with direct (second) and invert (first) type checking operator in the one branch. -fun case_4(value: _SealedClass): String = when (value) { +fun case_4(value_1: _SealedClass): String = when (value_1) { !is _SealedChild1, is _SealedChild1 -> "" } // CASE DESCRIPTION: 'When' with direct and invert (nullable) type checking operator on the some type in the one branch. -fun case_5(value: Any?): String = when (value) { +fun case_5(value_1: Any?): String = when (value_1) { is _SealedChild3, !is _SealedChild3? -> "" else -> "" } @@ -42,7 +42,7 @@ fun case_5(value: Any?): String = when (value) { UNEXPECTED BEHAVIOUR ISSUES: KT-22996 */ -fun case_6(value: Any?): String = when (value) { +fun case_6(value_1: Any?): String = when (value_1) { is Boolean?, !is _SealedChild3 -> "" // double nullable type check in the one branch is _SealedChild3 -> "" else -> "" @@ -53,7 +53,7 @@ fun case_6(value: Any?): String = when (value) { UNEXPECTED BEHAVIOUR ISSUES: KT-22996 */ -fun case_7(value: Any?): String = when (value) { +fun case_7(value_1: Any?): String = when (value_1) { is Number?, null, !is _SealedChild3 -> "" // triple nullable type check in the one branch else -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt index 01b0387a3ae..f054eebe1a9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [3] Contains test condition: containment operator followed by an expression. NUMBER: 1 @@ -12,21 +12,21 @@ */ // CASE DESCRIPTION: 'When' with range operator. -fun case_1(value: Int, value1: Int, value2: Short): String { - when (value) { +fun case_1(value_1: Int, value_2: Int, value_3: Short): String { + when (value_1) { in Long.MIN_VALUE..-100 -> return "" in -99..0 -> return "" - !in 100.toByte()..value1 -> return "" - in value1..value2 -> return "" + !in 100.toByte()..value_2 -> return "" + in value_2..value_3 -> return "" } return "" } // CASE DESCRIPTION: 'When' on types with contains method defined. -fun case_2(value: Int, value1: List, value2: _Class) = when (value) { - in value1[0] -> "" +fun case_2(value_1: Int, value_2: List, value_3: _Class) = when (value_1) { + in value_2[0] -> "" !in listOf(0, 1, 2, 3, 4) -> "" - !in value2.getIntArray(90) -> "" + !in value_3.getIntArray(90) -> "" else -> "" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt index 093972c6dd3..4697257df2c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [3] Contains test condition: containment operator followed by an expression. NUMBER: 2 @@ -12,17 +12,17 @@ */ // CASE DESCRIPTION: 'When' with range operator. -fun case_1(value: Int, value1: Int, value2: Short): String { - when (value) { +fun case_1(value_1: Int, value_2: Int, value_3: Short): String { + when (value_1) { in Long.MIN_VALUE..-100, in -99..0 -> return "" - !in 100.toByte()..value1, in value1..value2 -> return "" + !in 100.toByte()..value_2, in value_2..value_3 -> return "" } return "" } // CASE DESCRIPTION: 'When' on types with contains method defined. -fun case_2(value: Int, value1: List, value2: _Class) = when (value) { - !in value1[0], !in listOf(0, 1, 2, 3, 4), !in value2.getIntArray(90) -> "" +fun case_2(value_1: Int, value_2: List, value_3: _Class) = when (value_1) { + !in value_2[0], !in listOf(0, 1, 2, 3, 4), !in value_3.getIntArray(90) -> "" else -> "" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt index 47208e4c6b6..fe33e590e08 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [5] Any other expression. NUMBER: 1 @@ -13,8 +13,8 @@ */ // CASE DESCRIPTION: 'When' with condition as literals. -fun case_1(value: Any?) { - when (value) { +fun case_1(value_1: Any?) { + when (value_1) { true -> {} 100 -> {} -.09f -> {} @@ -25,48 +25,48 @@ fun case_1(value: Any?) { } // CASE DESCRIPTION: 'When' with condition as arithmetic expressions. -fun case_2(value: Number, value1: Int) { - when (value) { +fun case_2(value_1: Number, value_2: Int) { + when (value_1) { -.09 % 10L -> {} - value1 / -5 -> {} + value_2 / -5 -> {} getByte(99) - 11 + 90 -> {} } } // CASE DESCRIPTION: 'When' with condition as boolean expressions (logical, equality and comparison). -fun case_3(value: Boolean, value1: Boolean, value2: Long) { - when (value) { - value1 -> {} - !value1 -> {} - getBoolean() && value1 -> {} +fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) { + when (value_1) { + value_2 -> {} + !value_2 -> {} + getBoolean() && value_2 -> {} getChar(10) != 'a' -> {} getList() === getAny() -> {} - value2 <= 11 -> {} + value_3 <= 11 -> {} } } // CASE DESCRIPTION: 'When' with condition as concatenations. -fun case_4(value: String, value1: String, value2: String) { - when (value) { - "..." + value1 + "" + "$value2" + "..." -> {} - value1 + getString() -> {} +fun case_4(value_1: String, value_2: String, value_3: String) { + when (value_1) { + "..." + value_2 + "" + "$value_3" + "..." -> {} + value_2 + getString() -> {} } } // CASE DESCRIPTION: 'When' with condition as when expression. -fun case_5(value: Int, value1: Int, value2: Boolean?) { - when (value) { +fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { + when (value_1) { when { - value1 > 1000 -> 1 - value1 > 100 -> 2 + value_2 > 1000 -> 1 + value_2 > 100 -> 2 else -> 3 } -> {} - when (value2) { + when (value_3) { true -> 1 false -> 2 null -> 3 } -> {} - when (value2!!) { + when (value_3!!) { true -> 1 false -> 2 } -> {} @@ -74,37 +74,37 @@ fun case_5(value: Int, value1: Int, value2: Boolean?) { } // CASE DESCRIPTION: 'When' with condition as if expression. -fun case_6(value: Int, value1: Int) { - when (value) { - if (value1 > 1000) 1 +fun case_6(value_1: Int, value_2: Int) { + when (value_1) { + if (value_2 > 1000) 1 else 2 -> {} - if (value1 < 100) 1 - else if (value1 < 10) 2 + if (value_2 < 100) 1 + else if (value_2 < 10) 2 else 3 -> {} } } // CASE DESCRIPTION: 'When' with condition as try expression. -fun case_7(value: Any, value1: String, value2: String) { - when (value) { +fun case_7(value_1: Any, value_2: String, value_3: String) { + when (value_1) { try { 4 } catch (e: Exception) { 5 } -> {} - try { throw Exception() } catch (e: Exception) { value1 } -> {} - try { throw Exception() } catch (e: Exception) { {value2} } finally { } -> {} + try { throw Exception() } catch (e: Exception) { value_2 } -> {} + try { throw Exception() } catch (e: Exception) { {value_3} } finally { } -> {} } } // CASE DESCRIPTION: 'When' with condition as elvis operator expression. -fun case_8(value: Int, value1: Int?, value2: Int?) { - when (value) { - value1 ?: 0 -> {} - value1 ?: value2 ?: 0 -> {} - value1!! ?: 0 -> {} +fun case_8(value_1: Int, value_2: Int?, value_3: Int?) { + when (value_1) { + value_2 ?: 0 -> {} + value_2 ?: value_3 ?: 0 -> {} + value_2!! ?: 0 -> {} } } // CASE DESCRIPTION: 'When' with condition as range expression. -fun case_9(value: Any) { - when (value) { +fun case_9(value_1: Any) { + when (value_1) { 1..10 -> {} -100L..100L -> {} -getInt()..getLong() -> {} @@ -112,75 +112,75 @@ fun case_9(value: Any) { } // CASE DESCRIPTION: 'When' with condition as cast expression. -fun case_10(value: Collection, value1: Collection, value2: Collection?) { - when (value) { - value1 as MutableList -> {} - value1 as? MutableList -> {} - value2 as? MutableMap -> {} - (value1 as? Map) as MutableMap -> {} +fun case_10(value_1: Collection, value_2: Collection, value_3: Collection?) { + when (value_1) { + value_2 as MutableList -> {} + value_2 as? MutableList -> {} + value_3 as? MutableMap -> {} + (value_2 as? Map) as MutableMap -> {} } } // CASE DESCRIPTION: 'When' with condition as prefix operator expression. -fun case_11(value: Any, value1: Int, value2: Int, value3: Boolean) { - var mutableValue1 = value1 - var mutableValue2 = value2 +fun case_11(value_1: Any, value_2: Int, value_3: Int, value_4: Boolean) { + var mutableValue1 = value_2 + var mutableValue2 = value_3 - when (value) { + when (value_1) { ++mutableValue1 -> {} --mutableValue2 -> {} - !value3 -> {} + !value_4 -> {} } } // CASE DESCRIPTION: 'When' with condition as postfix operator expression. -fun case_12(value: Int, value1: Int, value2: Int, value3: Int?) { - var mutableValue1 = value1 - var mutableValue2 = value2 +fun case_12(value_1: Int, value_2: Int, value_3: Int, value_4: Int?) { + var mutableValue1 = value_2 + var mutableValue2 = value_3 - when (value) { + when (value_1) { mutableValue1++ -> {} mutableValue2-- -> {} - value3!! -> {} + value_4!! -> {} } } // CASE DESCRIPTION: 'When' with condition as indexing expression. -fun case_13(value: Int, value1: List, value2: List>>>) { - when (value) { - value1[0] -> {} - value2[0][-4][1][-1] -> {} +fun case_13(value_1: Int, value_2: List, value_3: List>>>) { + when (value_1) { + value_2[0] -> {} + value_3[0][-4][1][-1] -> {} } } // CASE DESCRIPTION: 'When' with condition as call expression. -fun case_14(value: Any, value1: _Class, value2: _Class?, value3: Int) { +fun case_14(value_1: Any, value_2: _Class, value_3: _Class?, value_4: Int) { fun __fun_1(): () -> Any { return fun() { } } - when (value) { + when (value_1) { _funWithoutArgs() -> {} __fun_1()() -> {} - value1.fun_2(value3) -> {} - value2?.fun_2(value3) -> {} - value2!!.fun_2(value3) -> {} + value_2.fun_2(value_4) -> {} + value_3?.fun_2(value_4) -> {} + value_3!!.fun_2(value_4) -> {} } } // CASE DESCRIPTION: 'When' with condition as property access expression. -fun case_15(value: Int, value1: _Class, value2: _Class?) { - when (value) { - value1.prop_1 -> {} - value2?.prop_2 -> {} - value1::prop_1.get() -> {} - value2!!::prop_3.get() -> {} +fun case_15(value_1: Int, value_2: _Class, value_3: _Class?) { + when (value_1) { + value_2.prop_1 -> {} + value_3?.prop_2 -> {} + value_2::prop_1.get() -> {} + value_3!!::prop_3.get() -> {} } } // CASE DESCRIPTION: 'When' with condition as fun literal. -fun case_16(value: () -> Any): Any { +fun case_16(value_1: () -> Any): Any { val fun_1 = fun() { return } - return when (value) { + return when (value_1) { fun() {} -> {} fun() { return } -> {} fun(): () -> Unit { return fun() {} } -> {} @@ -190,10 +190,10 @@ fun case_16(value: () -> Any): Any { } // CASE DESCRIPTION: 'When' with condition as lambda literal. -fun case_17(value: () -> Any) { +fun case_17(value_1: () -> Any) { val lambda_1 = { 0 } - when (value) { + when (value_1) { lambda_1 -> {} { { {} } } -> {} { -> (Int) @@ -203,12 +203,12 @@ fun case_17(value: () -> Any) { } // CASE DESCRIPTION: 'When' with condition as object literal. -fun case_18(value: Any) { +fun case_18(value_1: Any) { val object_1 = object { val prop_1 = 1 } - when (value) { + when (value_1) { object {} -> {} object { private fun fun_1() { } @@ -224,8 +224,8 @@ class A { val lambda_1 = { 1 } fun fun_1(): Int { return 1 } - fun case_19(value: Any) { - when (value) { + fun case_19(value_1: Any) { + when (value_1) { this -> {} ((this)) -> {} this::prop_1.get() -> {} @@ -239,24 +239,24 @@ class A { } // CASE DESCRIPTION: 'When' with condition as throw expression. -fun case_20(value: Nothing) { - when (value) { +fun case_20(value_1: Nothing) { + when (value_1) { throw Exception() -> {} throw throw throw Exception() -> {} } } // CASE DESCRIPTION: 'When' with condition as return expression. -fun case_21(value: Nothing) { +fun case_21(value_1: Nothing) { fun r_1() { - when (value) { + when (value_1) { return -> 1 return return return -> 2 } } fun r_2(): List? { - when (value) { + when (value_1) { return listOf(0, 1, 2) -> 1 return null -> 2 } @@ -264,10 +264,10 @@ fun case_21(value: Nothing) { } // CASE DESCRIPTION: 'When' with condition as continue expression. -fun case_22(value: Nothing) { +fun case_22(value_1: Nothing) { loop1@ while (true) { loop2@ while (true) { - when (value) { + when (value_1) { continue@loop1 -> 1 continue@loop2 -> 2 } @@ -276,10 +276,10 @@ fun case_22(value: Nothing) { } // CASE DESCRIPTION: 'When' with condition as break expression. -fun case_23(value: Nothing) { +fun case_23(value_1: Nothing) { loop1@ while (true) { loop2@ while (true) { - when (value) { + when (value_1) { break@loop1 -> 1 break@loop2 -> 2 } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt index a4c412bfc39..bad2f707a51 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [5] Any other expression. NUMBER: 2 @@ -13,47 +13,47 @@ */ // CASE DESCRIPTION: 'When' with condition as literals. -fun case_1(value: Any?) { - when (value) { +fun case_1(value_1: Any?) { + when (value_1) { true, 100, -.09f -> {} '.', "...", null -> {} } } // CASE DESCRIPTION: 'When' with condition as arithmetic expressions. -fun case_2(value: Number, value1: Int) { - when (value) { - -.09 % 10L, value1 / -5, getByte(99) - 11 + 90 -> {} +fun case_2(value_1: Number, value_2: Int) { + when (value_1) { + -.09 % 10L, value_2 / -5, getByte(99) - 11 + 90 -> {} } } // CASE DESCRIPTION: 'When' with condition as boolean expressions (logical, equality and comparison). -fun case_3(value: Boolean, value1: Boolean, value2: Long) { - when (value) { - value1, !value1, getBoolean() && value1, getChar(10) != 'a' -> {} - getList() === getAny(), value2 <= 11 -> {} +fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) { + when (value_1) { + value_2, !value_2, getBoolean() && value_2, getChar(10) != 'a' -> {} + getList() === getAny(), value_3 <= 11 -> {} } } // CASE DESCRIPTION: 'When' with condition as concatenations. -fun case_4(value: String, value1: String, value2: String) { - when (value) { - "..." + value1 + "" + "$value2" + "...", value1 + getString() -> {} +fun case_4(value_1: String, value_2: String, value_3: String) { + when (value_1) { + "..." + value_2 + "" + "$value_3" + "...", value_2 + getString() -> {} } } // CASE DESCRIPTION: 'When' with condition as when expression. -fun case_5(value: Int, value1: Int, value2: Boolean?) { - when (value) { +fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) { + when (value_1) { when { - value1 > 1000 -> 1 - value1 > 100 -> 2 + value_2 > 1000 -> 1 + value_2 > 100 -> 2 else -> 3 - }, when (value2) { + }, when (value_3) { true -> 1 false -> 2 null -> 3 - }, when (value2!!) { + }, when (value_3!!) { true -> 1 false -> 2 } -> {} @@ -61,113 +61,113 @@ fun case_5(value: Int, value1: Int, value2: Boolean?) { } // CASE DESCRIPTION: 'When' with condition as if expression. -fun case_6(value: Int, value1: Int) { - when (value) { - if (value1 > 1000) 1 else 2, if (value1 < 100) 1 else if (value1 < 10) 2 else 3 -> {} +fun case_6(value_1: Int, value_2: Int) { + when (value_1) { + if (value_2 > 1000) 1 else 2, if (value_2 < 100) 1 else if (value_2 < 10) 2 else 3 -> {} } } // CASE DESCRIPTION: 'When' with condition as try expression. -fun case_7(value: Any, value1: String, value2: String) { - when (value) { - try { 4 } catch (e: Exception) { 5 }, try { throw Exception() } catch (e: Exception) { value1 }, try { throw Exception() } catch (e: Exception) { {value2} } finally { } -> {} +fun case_7(value_1: Any, value_2: String, value_3: String) { + when (value_1) { + try { 4 } catch (e: Exception) { 5 }, try { throw Exception() } catch (e: Exception) { value_2 }, try { throw Exception() } catch (e: Exception) { {value_3} } finally { } -> {} } } // CASE DESCRIPTION: 'When' with condition as elvis operator expression. -fun case_8(value: Int, value1: Int?, value2: Int?) { - when (value) { - value1 ?: 0, value1 ?: value2 ?: 0, value1!! ?: 0 -> {} +fun case_8(value_1: Int, value_2: Int?, value_3: Int?) { + when (value_1) { + value_2 ?: 0, value_2 ?: value_3 ?: 0, value_2!! ?: 0 -> {} } } // CASE DESCRIPTION: 'When' with condition as range expression. -fun case_9(value: Any) { - when (value) { +fun case_9(value_1: Any) { + when (value_1) { 1..10, -100L..100L, -getInt()..getLong() -> {} } } // CASE DESCRIPTION: 'When' with condition as cast expression. -fun case_10(value: Collection, value1: Collection, value2: Collection?) { - when (value) { - value1 as MutableList, value1 as? MutableList -> {} - value2 as? MutableMap, (value1 as? Map) as MutableMap -> {} +fun case_10(value_1: Collection, value_2: Collection, value_3: Collection?) { + when (value_1) { + value_2 as MutableList, value_2 as? MutableList -> {} + value_3 as? MutableMap, (value_2 as? Map) as MutableMap -> {} } } // CASE DESCRIPTION: 'When' with condition as prefix operator expression. -fun case_11(value: Any, value1: Int, value2: Int, value3: Boolean) { - var mutableValue1 = value1 - var mutableValue2 = value2 +fun case_11(value_1: Any, value_2: Int, value_3: Int, value_4: Boolean) { + var mutableValue1 = value_2 + var mutableValue2 = value_3 - when (value) { - ++mutableValue1, --mutableValue2, !value3 -> {} + when (value_1) { + ++mutableValue1, --mutableValue2, !value_4 -> {} } } // CASE DESCRIPTION: 'When' with condition as postfix operator expression. -fun case_12(value: Int, value1: Int, value2: Int, value3: Int?) { - var mutableValue1 = value1 - var mutableValue2 = value2 +fun case_12(value_1: Int, value_2: Int, value_3: Int, value_4: Int?) { + var mutableValue1 = value_2 + var mutableValue2 = value_3 - when (value) { - mutableValue1++, mutableValue2--, value3!! -> {} + when (value_1) { + mutableValue1++, mutableValue2--, value_4!! -> {} } } // CASE DESCRIPTION: 'When' with condition as indexing expression. -fun case_13(value: Int, value1: List, value2: List>>>) { - when (value) { - value1[0], value2[0][-4][1][-1] -> {} +fun case_13(value_1: Int, value_2: List, value_3: List>>>) { + when (value_1) { + value_2[0], value_3[0][-4][1][-1] -> {} } } // CASE DESCRIPTION: 'When' with condition as call expression. -fun case_14(value: Any, value1: _Class, value2: _Class?, value3: Int) { +fun case_14(value_1: Any, value_2: _Class, value_3: _Class?, value_4: Int) { fun __fun_1(): () -> Unit { return fun() { } } - when (value) { - _funWithoutArgs(), __fun_1()(), value1.fun_2(value3) -> {} - value2?.fun_2(value3), value2!!.fun_2(value3) -> {} + when (value_1) { + _funWithoutArgs(), __fun_1()(), value_2.fun_2(value_4) -> {} + value_3?.fun_2(value_4), value_3!!.fun_2(value_4) -> {} } } // CASE DESCRIPTION: 'When' with condition as property access expression. -fun case_15(value: Int, value1: _Class, value2: _Class?) { - when (value) { - value1.prop_1, value2?.prop_2 -> {} - value1::prop_1.get(), value2!!::prop_3.get() -> {} +fun case_15(value_1: Int, value_2: _Class, value_3: _Class?) { + when (value_1) { + value_2.prop_1, value_3?.prop_2 -> {} + value_2::prop_1.get(), value_3!!::prop_3.get() -> {} } } // CASE DESCRIPTION: 'When' with condition as fun literal. -fun case_16(value: () -> Any): Any { +fun case_16(value_1: () -> Any): Any { val fun_1 = fun() { return } - return when (value) { + return when (value_1) { fun() {}, fun() { return }, fun(): () -> Unit { return fun() {} }, fun_1 -> {} else -> {} } } // CASE DESCRIPTION: 'When' with condition as lambda literal. -fun case_17(value: () -> Any) { +fun case_17(value_1: () -> Any) { val lambda_1 = { 0 } - when (value) { + when (value_1) { lambda_1, { { {} } }, { -> (Int) { arg: Int -> { { println(arg) } } } } -> {} } } // CASE DESCRIPTION: 'When' with condition as object literal. -fun case_18(value: Any) { +fun case_18(value_1: Any) { val object_1 = object { val prop_1 = 1 } - when (value) { + when (value_1) { object {}, object { private fun fun_1() { } val prop_1 = 1 @@ -181,8 +181,8 @@ class A { val lambda_1 = { 1 } fun fun_1(): Int { return 1 } - fun case_19(value: Any) { - when (value) { + fun case_19(value_1: Any) { + when (value_1) { this, ((this)), this::prop_1.get() -> {} this.prop_1, this.lambda_1() -> {} this::lambda_1.get()(), this.fun_1(), this::fun_1.invoke() -> {} @@ -191,32 +191,32 @@ class A { } // CASE DESCRIPTION: 'When' with condition as throw expression. -fun case_20(value: Nothing) { - when (value) { +fun case_20(value_1: Nothing) { + when (value_1) { throw Exception(), throw throw throw Exception() -> {} } } // CASE DESCRIPTION: 'When' with condition as return expression. -fun case_21(value: Nothing) { +fun case_21(value_1: Nothing) { fun r_1() { - when (value) { + when (value_1) { return, return return return -> 2 } } fun r_2(): List? { - when (value) { + when (value_1) { return listOf(0, 1, 2), return null -> 2 } } } // CASE DESCRIPTION: 'When' with condition as continue expression. -fun case_22(value: Nothing) { +fun case_22(value_1: Nothing) { loop1@ while (true) { loop2@ while (true) { - when (value) { + when (value_1) { continue@loop1, continue@loop2 -> 2 } } @@ -224,10 +224,10 @@ fun case_22(value: Nothing) { } // CASE DESCRIPTION: 'When' with condition as break expression. -fun case_23(value: Nothing) { +fun case_23(value_1: Nothing) { loop1@ while (true) { loop2@ while (true) { - when (value) { + when (value_1) { break@loop1, break@loop2 -> 2 } } @@ -235,7 +235,7 @@ fun case_23(value: Nothing) { } // CASE DESCRIPTION: 'When' with condition as mixed Nothing expressions. -fun case_24(value: Nothing?) = when (value) { +fun case_24(value_1: Nothing?) = when (value_1) { throw Exception(), return "" -> "" null, return return return "", throw throw throw Exception() -> "" else -> "" @@ -246,7 +246,7 @@ fun case_24(value: Nothing?) = when (value) { DISCUSSION ISSUES: KT-25948 */ -fun case_25(value: Boolean) = when (value) { +fun case_25(value_1: Boolean) = when (value_1) { true -> {} throw Exception(), return -> {} false, return return return, throw throw throw Exception() -> {} @@ -257,9 +257,9 @@ fun case_25(value: Boolean) = when (value) { UNEXPECTED BEHAVIOUR ISSUES: KT-26045 */ -fun case_26(value: Int?, value1: _Class, value2: _Class?) { - when (value) { - value1.prop_1, value2?.prop_1 -> {} +fun case_26(value_1: Int?, value_2: _Class, value_3: _Class?) { + when (value_1) { + value_2.prop_1, value_3?.prop_1 -> {} 10 -> {} } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/7.1.kt index 03aaa4dee3c..e7b42778469 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/7.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 7 SENTENCE: [7] The else condition, which works the exact same way as it would in the form without bound expression. NUMBER: 1 @@ -9,7 +9,7 @@ */ // CASE DESCRIPTION: Simple when with bound value, with 'else' branch and expression as when condition. -fun case_1(value: Int?) = when (value) { +fun case_1(value_1: Int?) = when (value_1) { 0 -> "" 1 -> "" 2 -> "" @@ -17,7 +17,7 @@ fun case_1(value: Int?) = when (value) { } // CASE DESCRIPTION: Simple when with bound value, with 'else' branch and type test as when condition. -fun case_2(value: Any) = when (value) { +fun case_2(value_1: Any) = when (value_1) { is Int -> "" is Boolean -> "" is String -> "" @@ -25,7 +25,7 @@ fun case_2(value: Any) = when (value) { } // CASE DESCRIPTION: Simple when with bound value, with 'else' branch and range test as when condition. -fun case_2(value: Int) = when (value) { +fun case_2(value_1: Int) = when (value_1) { in -10..10 -> "" in 11..1000 -> "" in 1000..Int.MAX_VALUE -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt index dacc3951751..c3320fe2955 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 1 @@ -12,11 +12,11 @@ */ // CASE DESCRIPTION: Checking all types except the correct one (custom types) in 'when' without bound value. -fun case_1(value: Int): String { +fun case_1(value_1: Int): String { val whenValue = when { - value == 0 -> _ClassLevel2() - value > 0 && value <= 10 -> _ClassLevel3() - value > 10 && value <= 100 -> _ClassLevel4() + value_1 == 0 -> _ClassLevel2() + value_1 > 0 && value_1 <= 10 -> _ClassLevel3() + value_1 > 10 && value_1 <= 100 -> _ClassLevel4() else -> _ClassLevel5() } @@ -32,8 +32,8 @@ fun case_1(value: Int): String { } // CASE DESCRIPTION: Checking all types except the correct one (custom types) in 'when' with bound value. -fun case_2(value: Int): String { - val whenValue = when (value) { +fun case_2(value_1: Int): String { + val whenValue = when (value_1) { 0 -> _ClassLevel2() 1 -> _ClassLevel3() 2 -> _ClassLevel4() @@ -55,14 +55,14 @@ fun case_2(value: Int): String { CASE DESCRIPTION: Checking all types except the correct one (numbers) in 'when' without bound value. UNEXPECTED BEHAVIOUR ISSUES: KT-25268 - */ -fun case_3(value: Int): String { +*/ +fun case_3(value_1: Int): String { val whenValue = when { - value == 0 -> 1 + 1 - value == 1 -> 1 + 1L - value == 2 -> 1 + -.122 - value == 3 -> 1 + -.000f - value == 4 -> 1 + 10.toShort() + value_1 == 0 -> 1 + 1 + value_1 == 1 -> 1 + 1L + value_1 == 2 -> 1 + -.122 + value_1 == 3 -> 1 + -.000f + value_1 == 4 -> 1 + 10.toShort() else -> 1 + 10.toByte() } @@ -89,8 +89,8 @@ fun case_3(value: Int): String { UNEXPECTED BEHAVIOUR ISSUES: KT-25268 */ -fun case_4(value: Int): String { - val whenValue = when (value) { +fun case_4(value_1: Int): String { + val whenValue = when (value_1) { 0 -> 1 + 1 1 -> 1 + 1L 2 -> 1 + -.122 @@ -118,11 +118,11 @@ fun case_4(value: Int): String { } // CASE DESCRIPTION: Checking all types except the Any (implicit cast to any) in 'when' without bound value. -fun case_5(value: Int): String { +fun case_5(value_1: Int): String { val whenValue = when { - value == 0 -> 10 - value > 0 && value <= 10 -> "" - value > 10 && value <= 100 -> {{}} + value_1 == 0 -> 10 + value_1 > 0 && value_1 <= 10 -> "" + value_1 > 10 && value_1 <= 100 -> {{}} else -> object {} } @@ -137,8 +137,8 @@ fun case_5(value: Int): String { } // CASE DESCRIPTION: Checking all types except the Any (implicit cast to any) in 'when' with bound value. -fun case_6(value: Int): String { - val whenValue = when (value) { +fun case_6(value_1: Int): String { + val whenValue = when (value_1) { 0 -> 10 1 -> "" 2 -> {{}} diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt index 4c9663675d9..2427682aada 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 2 @@ -13,8 +13,8 @@ */ // CASE DESCRIPTION: Checking all types except the correct one in 'when'. -fun case_1(value: _EnumClass): String { - val whenValue = when (value) { +fun case_1(value_1: _EnumClass): String { + val whenValue = when (value_1) { _EnumClass.EAST -> _ClassLevel2() _EnumClass.NORTH -> _ClassLevel3() _EnumClass.SOUTH -> _ClassLevel4() @@ -33,8 +33,8 @@ fun case_1(value: _EnumClass): String { } // CASE DESCRIPTION: Checking all types except the correct one in 'when' with null-check branch. -fun case_2(value: _EnumClass?): String { - val whenValue = when (value) { +fun case_2(value_1: _EnumClass?): String { + val whenValue = when (value_1) { _EnumClass.EAST -> _ClassLevel2() _EnumClass.NORTH -> _ClassLevel3() _EnumClass.SOUTH -> _ClassLevel4() @@ -56,8 +56,8 @@ fun case_2(value: _EnumClass?): String { } // CASE DESCRIPTION: Checking all types except the Any (implicit cast to any) in 'when'. -fun case_3(value: _EnumClass): String { - val whenValue = when (value) { +fun case_3(value_1: _EnumClass): String { + val whenValue = when (value_1) { _EnumClass.EAST -> 10 _EnumClass.NORTH -> "" _EnumClass.SOUTH -> {{}} @@ -75,8 +75,8 @@ fun case_3(value: _EnumClass): String { } // CASE DESCRIPTION: Checking all types except the Any (implicit cast to any) in 'when' with null-check branch. -fun case_4(value: _EnumClass?): String { - val whenValue = when (value) { +fun case_4(value_1: _EnumClass?): String { + val whenValue = when (value_1) { _EnumClass.EAST -> 10 _EnumClass.NORTH -> "" _EnumClass.SOUTH -> {{}} diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt index e3c85158578..49f64853db9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 3 @@ -12,8 +12,8 @@ */ // CASE DESCRIPTION: Checking all types except the correct one in 'when'. -fun case_1(value: Boolean): String { - val whenValue = when (value) { +fun case_1(value_1: Boolean): String { + val whenValue = when (value_1) { true -> _ClassLevel2() false -> _ClassLevel3() } @@ -28,8 +28,8 @@ fun case_1(value: Boolean): String { } // CASE DESCRIPTION: Checking all types except the correct one in 'when' with null-check branch. -fun case_2(value: Boolean?): String { - val whenValue = when (value) { +fun case_2(value_1: Boolean?): String { + val whenValue = when (value_1) { true -> _ClassLevel2() false -> _ClassLevel3() null -> _ClassLevel4() @@ -45,8 +45,8 @@ fun case_2(value: Boolean?): String { } // CASE DESCRIPTION: Checking all types except the Any (implicit cast to any) in 'when'. -fun case_3(value: Boolean): String { - val whenValue = when (value) { +fun case_3(value_1: Boolean): String { + val whenValue = when (value_1) { true -> 10 false -> "" } @@ -60,8 +60,8 @@ fun case_3(value: Boolean): String { } // CASE DESCRIPTION: Checking all types except the Any (implicit cast to any) in 'when' with null-check branch. -fun case_4(value: Boolean?): String { - val whenValue = when (value) { +fun case_4(value_1: Boolean?): String { + val whenValue = when (value_1) { true -> 10 false -> {{}} null -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt index 5a31d8ed68e..e79a5a7252a 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 4 @@ -13,8 +13,8 @@ */ // CASE DESCRIPTION: Checking all types except the correct one in 'when'. -fun case_1(value: _SealedClass): String { - val whenValue = when (value) { +fun case_1(value_1: _SealedClass): String { + val whenValue = when (value_1) { is _SealedChild1 -> _ClassLevel2() is _SealedChild2 -> _ClassLevel3() is _SealedChild3 -> _ClassLevel4() @@ -30,8 +30,8 @@ fun case_1(value: _SealedClass): String { } // CASE DESCRIPTION: Checking all types except the correct one in 'when' with null-check branch. -fun case_2(value: _SealedClass?): String { - val whenValue = when (value) { +fun case_2(value_1: _SealedClass?): String { + val whenValue = when (value_1) { is _SealedChild1 -> _ClassLevel2() is _SealedChild2 -> _ClassLevel3() is _SealedChild3 -> _ClassLevel4() @@ -50,8 +50,8 @@ fun case_2(value: _SealedClass?): String { } // CASE DESCRIPTION: Checking all types except the Any (implicit cast to any) in 'when'. -fun case_3(value: _SealedClass): String { - val whenValue = when (value) { +fun case_3(value_1: _SealedClass): String { + val whenValue = when (value_1) { is _SealedChild1 -> 10 is _SealedChild2 -> "" is _SealedChild3 -> object {} @@ -66,8 +66,8 @@ fun case_3(value: _SealedClass): String { } // CASE DESCRIPTION: Checking all types except the Any (implicit cast to any) in 'when' with null-check branch. -fun case_4(value: _SealedClass?): String { - val whenValue = when (value) { +fun case_4(value_1: _SealedClass?): String { + val whenValue = when (value_1) { is _SealedChild1 -> 10 is _SealedChild2 -> "" is _SealedChild3 -> object {} @@ -85,8 +85,8 @@ fun case_4(value: _SealedClass?): String { } // CASE DESCRIPTION: Checking objects except the correct one in 'when'. -fun case_5(value: _SealedClassWithObjects): String { - val whenValue = when (value) { +fun case_5(value_1: _SealedClassWithObjects): String { + val whenValue = when (value_1) { _SealedWithObjectsChild1 -> _ClassLevel2() _SealedWithObjectsChild2 -> _ClassLevel3() _SealedWithObjectsChild3 -> _ClassLevel4() @@ -102,8 +102,8 @@ fun case_5(value: _SealedClassWithObjects): String { } // CASE DESCRIPTION: Checking objects except the correct one in 'when' with null-check branch. -fun case_6(value: _SealedClassWithObjects?): String { - val whenValue = when (value) { +fun case_6(value_1: _SealedClassWithObjects?): String { + val whenValue = when (value_1) { _SealedWithObjectsChild1 -> _ClassLevel2() _SealedWithObjectsChild2 -> _ClassLevel3() _SealedWithObjectsChild3 -> _ClassLevel4() @@ -122,8 +122,8 @@ fun case_6(value: _SealedClassWithObjects?): String { } // CASE DESCRIPTION: Checking objects except the Any (implicit cast to any) in 'when'. -fun case_7(value: _SealedClassWithObjects): String { - val whenValue = when (value) { +fun case_7(value_1: _SealedClassWithObjects): String { + val whenValue = when (value_1) { _SealedWithObjectsChild1 -> 10 _SealedWithObjectsChild2 -> "" _SealedWithObjectsChild3 -> object {} @@ -138,8 +138,8 @@ fun case_7(value: _SealedClassWithObjects): String { } // CASE DESCRIPTION: Checking objects except the Any (implicit cast to any) in 'when' with null-check branch. -fun case_8(value: _SealedClassWithObjects?): String { - val whenValue = when (value) { +fun case_8(value_1: _SealedClassWithObjects?): String { + val whenValue = when (value_1) { _SealedWithObjectsChild1 -> 10 _SealedWithObjectsChild2 -> "" _SealedWithObjectsChild3 -> object {} @@ -157,8 +157,8 @@ fun case_8(value: _SealedClassWithObjects?): String { } // CASE DESCRIPTION: Checking all types except the correct one in 'when' with 'else' branch. -fun case_9(value: _SealedClassWithObjects?): String { - val whenValue = when (value) { +fun case_9(value_1: _SealedClassWithObjects?): String { + val whenValue = when (value_1) { is _SealedClassWithObjects -> _ClassLevel2() else -> _ClassLevel3() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt index 957eff84ea1..97c41e9a116 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 1 @@ -12,11 +12,11 @@ */ // CASE DESCRIPTION: Checking correctness type (custom types) in 'when' without bound value. -fun case_1(value: Int): String { +fun case_1(value_1: Int): String { val whenValue = when { - value == 0 -> _ClassLevel2() - value > 0 && value <= 10 -> _ClassLevel3() - value > 10 && value <= 100 -> _ClassLevel4() + value_1 == 0 -> _ClassLevel2() + value_1 > 0 && value_1 <= 10 -> _ClassLevel3() + value_1 > 10 && value_1 <= 100 -> _ClassLevel4() else -> _ClassLevel5() } @@ -27,8 +27,8 @@ fun case_1(value: Int): String { } // CASE DESCRIPTION: Checking correctness type (custom types) in 'when' with bound value. -fun case_2(value: Int): String { - val whenValue = when (value) { +fun case_2(value_1: Int): String { + val whenValue = when (value_1) { 0 -> _ClassLevel2() 1 -> _ClassLevel3() 2 -> _ClassLevel4() @@ -46,13 +46,13 @@ fun case_2(value: Int): String { UNEXPECTED BEHAVIOUR ISSUES: KT-25268 */ -fun case_3(value: Int): String { +fun case_3(value_1: Int): String { val whenValue = when { - value == 0 -> 1 + 1 - value == 1 -> 1 + 1L - value == 2 -> 1 + -.122 - value == 3 -> 1 + -.000f - value == 4 -> 1 + 10.toShort() + value_1 == 0 -> 1 + 1 + value_1 == 1 -> 1 + 1L + value_1 == 2 -> 1 + -.122 + value_1 == 3 -> 1 + -.000f + value_1 == 4 -> 1 + 10.toShort() else -> 1 + 10.toShort() } @@ -66,8 +66,8 @@ fun case_3(value: Int): String { UNEXPECTED BEHAVIOUR ISSUES: KT-25268 */ -fun case_4(value: Int): String { - val whenValue = when (value) { +fun case_4(value_1: Int): String { + val whenValue = when (value_1) { 0 -> 1 + 1 1 -> 1 + 1L 2 -> 1 + -.122 @@ -82,11 +82,11 @@ fun case_4(value: Int): String { } // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when' without bound value. -fun case_5(value: Int): String { +fun case_5(value_1: Int): String { val whenValue = when { - value == 0 -> 10 - value > 0 && value <= 10 -> "" - value > 10 && value <= 100 -> {{}} + value_1 == 0 -> 10 + value_1 > 0 && value_1 <= 10 -> "" + value_1 > 10 && value_1 <= 100 -> {{}} else -> object {} } @@ -97,8 +97,8 @@ fun case_5(value: Int): String { } // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when' with bound value. -fun case_6(value: Int): String { - val whenValue = when (value) { +fun case_6(value_1: Int): String { + val whenValue = when (value_1) { 0 -> 10 1 -> "" 2 -> {{}} diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt index 23d722a2c5a..171f5f67fb6 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 2 @@ -13,8 +13,8 @@ */ // CASE DESCRIPTION: Checking correct type in 'when'. -fun case_1(value: _EnumClass): String { - val whenValue = when (value) { +fun case_1(value_1: _EnumClass): String { + val whenValue = when (value_1) { _EnumClass.EAST -> _ClassLevel2() _EnumClass.NORTH -> _ClassLevel3() _EnumClass.SOUTH -> _ClassLevel4() @@ -28,8 +28,8 @@ fun case_1(value: _EnumClass): String { } // CASE DESCRIPTION: Checking correct type in 'when' with null-check branch. -fun case_2(value: _EnumClass?): String { - val whenValue = when (value) { +fun case_2(value_1: _EnumClass?): String { + val whenValue = when (value_1) { _EnumClass.EAST -> _ClassLevel2() _EnumClass.NORTH -> _ClassLevel3() _EnumClass.SOUTH -> _ClassLevel4() @@ -44,8 +44,8 @@ fun case_2(value: _EnumClass?): String { } // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when'. -fun case_3(value: _EnumClass): String { - val whenValue = when (value) { +fun case_3(value_1: _EnumClass): String { + val whenValue = when (value_1) { _EnumClass.EAST -> 10 _EnumClass.NORTH -> "" _EnumClass.SOUTH -> {{}} @@ -59,8 +59,8 @@ fun case_3(value: _EnumClass): String { } // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when' with null-check branch. -fun case_4(value: _EnumClass?): String { - val whenValue = when (value) { +fun case_4(value_1: _EnumClass?): String { + val whenValue = when (value_1) { _EnumClass.EAST -> 10 _EnumClass.NORTH -> "" _EnumClass.SOUTH -> {{}} diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt index f02c2fbeb54..85e1f1e4089 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 3 @@ -12,8 +12,8 @@ */ // CASE DESCRIPTION: Checking correct type in 'when'. -fun case_1(value: Boolean): String { - val whenValue = when (value) { +fun case_1(value_1: Boolean): String { + val whenValue = when (value_1) { true -> _ClassLevel2() false -> _ClassLevel3() } @@ -25,8 +25,8 @@ fun case_1(value: Boolean): String { } // CASE DESCRIPTION: Checking correct type in 'when' with null-check branch. -fun case_2(value: Boolean?): String { - val whenValue = when (value) { +fun case_2(value_1: Boolean?): String { + val whenValue = when (value_1) { true -> _ClassLevel2() false -> _ClassLevel3() null -> _ClassLevel4() @@ -40,8 +40,8 @@ fun case_2(value: Boolean?): String { // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when'. -fun case_3(value: Boolean): String { - val whenValue = when (value) { +fun case_3(value_1: Boolean): String { + val whenValue = when (value_1) { true -> 10 false -> object {} } @@ -54,8 +54,8 @@ fun case_3(value: Boolean): String { // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when' with null-check branch. -fun case_4(value: Boolean?): String { - val whenValue = when (value) { +fun case_4(value_1: Boolean?): String { + val whenValue = when (value_1) { true -> 10 false -> {{}} null -> object {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt index 628cbabd49d..40d8cea6310 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: when-expression + SECTIONS: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 4 @@ -13,8 +13,8 @@ */ // CASE DESCRIPTION: Checking correct type in 'when'. -fun case_1(value: _SealedClass): String { - val whenValue = when (value) { +fun case_1(value_1: _SealedClass): String { + val whenValue = when (value_1) { is _SealedChild1 -> _ClassLevel2() is _SealedChild2 -> _ClassLevel3() is _SealedChild3 -> _ClassLevel4() @@ -27,8 +27,8 @@ fun case_1(value: _SealedClass): String { } // CASE DESCRIPTION: Checking correct type in 'when' with null-check branch. -fun case_2(value: _SealedClass?): String { - val whenValue = when (value) { +fun case_2(value_1: _SealedClass?): String { + val whenValue = when (value_1) { is _SealedChild1 -> _ClassLevel2() is _SealedChild2 -> _ClassLevel3() is _SealedChild3 -> _ClassLevel4() @@ -42,8 +42,8 @@ fun case_2(value: _SealedClass?): String { } // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when'. -fun case_3(value: _SealedClass): String { - val whenValue = when (value) { +fun case_3(value_1: _SealedClass): String { + val whenValue = when (value_1) { is _SealedChild1 -> 10 is _SealedChild2 -> "" is _SealedChild3 -> object {} @@ -56,8 +56,8 @@ fun case_3(value: _SealedClass): String { } // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when' with null-check branch. -fun case_4(value: _SealedClass?): String { - val whenValue = when (value) { +fun case_4(value_1: _SealedClass?): String { + val whenValue = when (value_1) { is _SealedChild1 -> 10 is _SealedChild2 -> "" is _SealedChild3 -> object {} @@ -71,8 +71,8 @@ fun case_4(value: _SealedClass?): String { } // CASE DESCRIPTION: Checking correct type in 'when' (equality with objects). -fun case_5(value: _SealedClassWithObjects): String { - val whenValue = when (value) { +fun case_5(value_1: _SealedClassWithObjects): String { + val whenValue = when (value_1) { _SealedWithObjectsChild1 -> _ClassLevel2() _SealedWithObjectsChild2 -> _ClassLevel3() _SealedWithObjectsChild3 -> _ClassLevel4() @@ -85,8 +85,8 @@ fun case_5(value: _SealedClassWithObjects): String { } // CASE DESCRIPTION: Checking correct type in 'when' (equality with objects) with null-check branch. -fun case_6(value: _SealedClassWithObjects?): String { - val whenValue = when (value) { +fun case_6(value_1: _SealedClassWithObjects?): String { + val whenValue = when (value_1) { _SealedWithObjectsChild1 -> _ClassLevel2() _SealedWithObjectsChild2 -> _ClassLevel3() _SealedWithObjectsChild3 -> _ClassLevel4() @@ -100,8 +100,8 @@ fun case_6(value: _SealedClassWithObjects?): String { } // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when' (equality with objects). -fun case_7(value: _SealedClassWithObjects): String { - val whenValue = when (value) { +fun case_7(value_1: _SealedClassWithObjects): String { + val whenValue = when (value_1) { _SealedWithObjectsChild1 -> 10 _SealedWithObjectsChild2 -> "" _SealedWithObjectsChild3 -> object {} @@ -114,8 +114,8 @@ fun case_7(value: _SealedClassWithObjects): String { } // CASE DESCRIPTION: Checking Any type (implicit cast to any) in 'when' with null-check branch (equality with objects). -fun case_8(value: _SealedClassWithObjects?): String { - val whenValue = when (value) { +fun case_8(value_1: _SealedClassWithObjects?): String { + val whenValue = when (value_1) { _SealedWithObjectsChild1 -> 10 _SealedWithObjectsChild2 -> "" _SealedWithObjectsChild3 -> object {} @@ -129,8 +129,8 @@ fun case_8(value: _SealedClassWithObjects?): String { } // CASE DESCRIPTION: Checking correct basic type (Int) in 'when' with. -fun case_9(value: _SealedClassWithObjects): String { - val whenValue = when (value) { +fun case_9(value_1: _SealedClassWithObjects): String { + val whenValue = when (value_1) { is _SealedClassWithObjects -> 10 } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.kt index 09a0daa98f7..2d0dae5df36 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/neg/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, common + CATEGORIES: analysis, common NUMBER: 1 DESCRIPTION: Analysis by contracts with mixed CallsInPlace and Returns effects. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/1.kt index bbbbda3d4b7..1303f238267 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, common + CATEGORIES: analysis, common NUMBER: 1 DESCRIPTION: Analysis by contracts with mixed CallsInPlace and Returns effects. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/2.kt index 4aedf808188..66340da5ee8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/2.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, common + CATEGORIES: analysis, common NUMBER: 2 DESCRIPTION: Recursion in the lambda of contract function. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt index fb6115baf12..86cab9146cd 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 1 DESCRIPTION: val/var reassignment and/or uninitialized variable usages based on CallsInPlace effect with wrong invocation kind */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.kt index 89b5d87b7de..6854c62868a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 2 DESCRIPTION: val/var reassignment and/or uninitialized variable usages based on nested CallsInPlace effects with wrong invocation kind */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.kt index 0561f3f1363..3ed4d77112d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.kt @@ -8,7 +8,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 3 DESCRIPTION: val/var reassignment and/or uninitialized variable usages with compelx control flow inside/outside lambda of contract function with CallsInPlace effect */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.kt index 07a78d20456..d04e4f2b399 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 4 DESCRIPTION: CallsInPlace contract functions with name shadowing and wrong invocation kind */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.kt index d3d8d25f289..26fed37b9b8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 5 DESCRIPTION: CallsInPlace contract functions with invalid lambda passing to function parameter. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/6.kt index bd9c9a46396..ecea048a3da 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/6.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 6 DESCRIPTION: Check the lack of CallsInPlace effect on the lambda in the parentheses. UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt index 404bcbe539c..559d7baa866 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 1 DESCRIPTION: val/var assignments using contract functions with CallsInPlace effect */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/2.kt index cce23d59003..60c691d644a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/2.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 2 DESCRIPTION: Nested val/var assignments using contract functions with CallsInPlace effect */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.kt index 0e6d4d4b9d3..26a1f2052db 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.kt @@ -8,7 +8,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 3 DESCRIPTION: val/var assignments or subsequent usages with compelx control flow inside/outside lambda of contract function with CallsInPlace effect */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.kt index 5487680921f..745069fa4ab 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 4 DESCRIPTION: CallsInPlace contract functions with name shadowing */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/5.kt index f3f7c40824b..421bdcc1d1b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/5.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, initialization + CATEGORIES: analysis, controlFlow, initialization NUMBER: 5 DESCRIPTION: Smart initialization with correspond contract function with default value before lambda. ISSUES: KT-26444 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt index e1f9bb32f8b..014accabb33 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, unreachableCode + CATEGORIES: analysis, controlFlow, unreachableCode NUMBER: 1 DESCRIPTION: Using not allowed break and continue inside lambda of contract function */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.kt index a7fc62faaef..1aa721b2dd0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.kt @@ -8,7 +8,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, unreachableCode + CATEGORIES: analysis, controlFlow, unreachableCode NUMBER: 1 DESCRIPTION: Unreachable code detection using contract function with CallsInPlace effect */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/2.kt index e0de282d281..0dd2aa1f582 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/2.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, unreachableCode + CATEGORIES: analysis, controlFlow, unreachableCode NUMBER: 2 DESCRIPTION: Check for lack of unreachable code report when 'at most once' and 'unknown' invokations in CallsInPlace effect used. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.kt index fcd9f4f8ea0..6bf140c4322 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, unreachableCode + CATEGORIES: analysis, controlFlow, unreachableCode NUMBER: 3 DESCRIPTION: Unreachable code detection using local functions or labdas combined with contract functions with CallsInPlace effect */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.kt index acab5fcffec..802288069e3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, unreachableCode + CATEGORIES: analysis, controlFlow, unreachableCode NUMBER: 4 DESCRIPTION: Unreachable code detection using nested contract functions with CallsInPlace effect */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.kt index 42154b0bd25..12bde6149f4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, unreachableCode + CATEGORIES: analysis, controlFlow, unreachableCode NUMBER: 5 DESCRIPTION: Unreachable code detection using contract functions with complex control flow inside */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.kt index 69e6b145204..52dc4c2320c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, unreachableCode + CATEGORIES: analysis, controlFlow, unreachableCode NUMBER: 6 DESCRIPTION: Check for lack of unreachable code report when in complex control flow of contract function lambda not all branches are doing non-local return */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/7.kt index f6d240f1540..4c563dee613 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/7.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/7.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, controlFlow, unreachableCode + CATEGORIES: analysis, controlFlow, unreachableCode NUMBER: 7 DESCRIPTION: Smart initialization with correspond contract function with default value before lambda. ISSUES: KT-26444 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.kt index 5143dee4e65..6c151d7626f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 1 DESCRIPTION: Smartcasts using Returns effects with simple type checking, not-null conditions and custom condition (condition for smartcast outside contract). */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.kt index 6fff28ba4a2..f213bd2aab2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 10 DESCRIPTION: Check the lack of smartcasts after non-null assertions or not-null value assignment in lambdas of contract function with 'unknown' or 'at most once' CallsInPlace effects. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.kt index 4772b344107..dc2ee44c1ea 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 11 DESCRIPTION: Check smartcasts using double negation (returnsFalse/invert type checking/not operator). UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/12.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/12.kt index 3aca9db01e2..761ece4d50e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/12.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/12.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 12 DESCRIPTION: Check smartcast to upper bound of the types in disjunction. UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.kt index 68622107367..2a23f9c4af1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 13 DESCRIPTION: Smartcast using many of the various Returns effects on the same values. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.kt index dc3ec5c4fbb..5701a580268 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 2 DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions outside contract (custom condition). */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.kt index 589c6a59a33..8e5eaf333d9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/3.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 3 DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions inside contract. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.kt index b5687201f39..31b64f34b81 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/4.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 4 DESCRIPTION: Smartcasts using Returns effects with simple type checking and not-null conditions on receiver inside contract. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/5.kt index 9a2d091ee9b..014644bdb0c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/5.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 5 DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions on receiver inside contract. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.kt index 7d9a52618d0..00220d608a5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/6.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 6 DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions on receiver and some values (mixed) inside contract. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.kt index 488fe6ee6f1..2f5506cc315 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/7.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 7 DESCRIPTION: Smartcasts using Returns effects with nested or subsequent contract function calls. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.kt index afa114ee411..95a77885c51 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 8 DESCRIPTION: Smartcasts using some Returns effects. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt index 9a6a8bc8909..60a5fc2eba4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 9 DESCRIPTION: Smartcasts after non-null assertions or not-null value assignment in lambdas of contract function with 'exactly once' or 'at least once' CallsInPlace effects. UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.kt index 2037ec36ab2..25b945e17a5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 1 DESCRIPTION: Smartcasts using Returns effects with simple type checking, not-null conditions and custom condition (condition for smartcast outside contract). */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.kt index 27bed38b602..496ad646495 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 10 DESCRIPTION: Smartcasts with correspond contract function with default value in last parameter. ISSUES: KT-26444 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.kt index 48e531688fe..ea8c4dfb295 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 11 DESCRIPTION: Check smartcasts with passing same fields of instances of the same class in contract function with conjunction not-null condition. ISSUES: KT-26300 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt index 4d79a4be6e6..798a19e12ec 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 2 DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions outside contract (custom condition). */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.kt index 5f3b7f47212..fc5b49c4649 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/3.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 3 DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions inside contract. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.kt index 1efd9d04262..f887741d0ba 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/4.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 4 DESCRIPTION: Smartcasts using Returns effects with simple type checking and not-null conditions on receiver inside contract. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/5.kt index 5d52c917d89..652cad4c4dd 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/5.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 5 DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions on receiver inside contract. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.kt index ee3de2e0153..5d141b70a99 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/6.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 6 DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions on receiver and some values (mixed) inside contract. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/7.kt index 960cc733a29..1034ad09ab4 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/7.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/7.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 7 DESCRIPTION: Smartcasts using Returns effects with nested or subsequent contract function calls. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt index 277c0cc9624..2ca64bc2a89 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 8 DESCRIPTION: Smartcasts using some Returns effects. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.kt index 73e5aae0fff..03c279ec113 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.kt @@ -8,7 +8,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: analysis, smartcasts + CATEGORIES: analysis, smartcasts NUMBER: 9 DESCRIPTION: Smartcast using complex condition with some contract functions (Returns effect). */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/1.kt index 83a9db54dc4..b4b9e9e27de 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 1 DESCRIPTION: Contract isn't first statement. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/10.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/10.kt index 0e8e332f3f0..ba1406fba8a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/10.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/10.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 10 DESCRIPTION: Contract with label after 'contract' keyword. ISSUES: KT-26153 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/11.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/11.kt index 4673e158e1b..6dfa492a2d7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/11.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/11.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 11 DESCRIPTION: Functions with contracts and external contract builder. ISSUES: KT-26186 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/12.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/12.kt index fa178a38d01..dbee8e6b2ef 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/12.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/12.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 12 DESCRIPTION: Functions with contracts and external effect builder. ISSUES: KT-26186 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/13.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/13.kt index 3547efe4ab4..2da44cff002 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/13.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/13.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 13 DESCRIPTION: Contract function with CallsInPlace effect with not allowed implies. ISSUES: KT-26409 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/2.kt index e28f05319fb..3c30d71c1f5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/2.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 2 DESCRIPTION: contracts with not allowed simple conditions in implies */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/3.kt index 1423b2c658f..41a94a43c8d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/3.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 3 DESCRIPTION: contracts with not allowed complex conditions in implies. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/4.kt index fa3db6793f6..594cd4fcbc3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/4.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 4 DESCRIPTION: contracts with not allowed conditions with constants in implies. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/5.kt index 2f920135435..b6fb238876f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/5.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 5 DESCRIPTION: contracts with not allowed expressions in implies. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.kt index 459a2006d52..8263a9d9f6c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 6 DESCRIPTION: contracts with not function parameters in implies. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.kt index cd312ad2a5a..90f4143b2d7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 7 DESCRIPTION: Contract function with 'this' labeled by not current extensible object ISSUES: KT-26149 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/8.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/8.kt index 8102a5d827e..0b3cfa14fdf 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/8.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/8.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 8 DESCRIPTION: Not allowed empty contract. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/9.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/9.kt index 2828239250c..2180285ddbb 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/9.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/9.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 9 DESCRIPTION: Function with contract as returned expression. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/1.kt index 5a5c4ecd094..23612943bf0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 1 DESCRIPTION: Functions with simple contracts. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/2.kt index 4624ad2677c..aea90abcdbc 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/2.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 2 DESCRIPTION: Contract is first statement in control flow terms, but not in tokens order terms. UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/3.kt index bd9e822f4e2..0762c12f1d3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/3.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 3 DESCRIPTION: Functions with contract and builder lambda in parentheses. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/4.kt index bce396a8ba8..d27755f0bbd 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/pos/4.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, common + CATEGORIES: declarations, contractBuilder, common NUMBER: 4 DESCRIPTION: Contract isn't in the first position. UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/1.kt index 643a9e40b5a..cd94aff701c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/neg/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, callsInPlace + CATEGORIES: declarations, contractBuilder, effects, callsInPlace NUMBER: 1 DESCRIPTION: contract functions with CallsInPlace with dynamic InvocationKind. ISSUES: KT-26152 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/1.kt index a7b6df89825..f8b17a1afba 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, callsInPlace + CATEGORIES: declarations, contractBuilder, effects, callsInPlace NUMBER: 1 DESCRIPTION: contract functions with CallsInPlace effects with different invocation kinds. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/2.kt index 0826a3b4a13..5a34ead72f8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/2.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, callsInPlace + CATEGORIES: declarations, contractBuilder, effects, callsInPlace NUMBER: 2 DESCRIPTION: functions with contract and duplicate CallsInPlace. UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/3.kt index a461958883b..970cfb70db0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/callsInPlace/pos/3.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, callsInPlace + CATEGORIES: declarations, contractBuilder, effects, callsInPlace NUMBER: 3 DESCRIPTION: Contract with 'this' in first parameter of CallsInPlace. UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/common/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/common/neg/1.kt index 94334ae6d1c..f59a820786b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/common/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/common/neg/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, common + CATEGORIES: declarations, contractBuilder, effects, common NUMBER: 1 DESCRIPTION: Indirect effect functions call. ISSUES: KT-26175 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/1.kt index 2035a1dffff..dd04b141872 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 1 DESCRIPTION: Using equality with expressions in implies. ISSUES: KT-26178 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/2.kt index cceaee17288..89f607a343c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/2.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 2 DESCRIPTION: Using equality with not labeled 'this' in implies. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.kt index 6d3fb9b3f9a..f6cf7853f17 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 3 DESCRIPTION: Using reference equality in implies. ISSUES: KT-26177 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/4.kt index 22499ac09d7..11132023c2f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/4.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 4 DESCRIPTION: Using equality with literals in implies. ISSUES: KT-26178 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/5.kt index d679d6bb7b8..1d7261c0784 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/5.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 5 DESCRIPTION: Contract on the extension function with Boolean upper bound (Boolean or Nothing) or smartcast to Boolean. DISCUSSION diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/6.kt index 2f4080e703a..b7157667ca8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/6.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 6 DESCRIPTION: Contract on the extension function with smartcast to Boolean. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/7.kt index fe7ad943fa8..0d67d0d2c3c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/7.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/7.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 7 DESCRIPTION: Returns effect with type checking with generic parameter ISSUES: KT-26296 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt index a5c8d057bbf..8c0402c1ecd 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 1 DESCRIPTION: Returns effect with simple conditions. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.kt index 98e39d940fe..7006692cb09 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 2 DESCRIPTION: Returns effect with complex conditions (using conjunction and disjuntion). */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/3.kt index d2786dcd8db..131a0cba8ad 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/3.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractBuilder, effects, returns + CATEGORIES: declarations, contractBuilder, effects, returns NUMBER: 3 DESCRIPTION: Returns effect with conditions on receiver. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/1.kt index 6a04909a7c6..ec58699e1b7 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractFunction + CATEGORIES: declarations, contractFunction NUMBER: 1 DESCRIPTION: Check that recursion isn't allowed in contract functions with CallsInPlace effect. */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.kt index f8d0de5dcc4..d4255e3e25b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.kt @@ -7,7 +7,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) SECTION: contracts - CATEGORY: declarations, contractFunction + CATEGORIES: declarations, contractFunction NUMBER: 2 DESCRIPTION: Check report about use contracts in literal functions, lambdas or not top-level functions. ISSUES: KT-26149 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/1.kt index 012b3d49a2f..a213eb163da 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/1.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractFunction + CATEGORIES: declarations, contractFunction NUMBER: 1 DESCRIPTION: Check that fun with contract and CallsInPlace effect is an inline function. UNEXPECTED BEHAVIOUR diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/2.kt index e1ea2f58653..01026aa3e16 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/pos/2.kt @@ -6,7 +6,7 @@ KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) SECTION: contracts - CATEGORY: declarations, contractFunction + CATEGORIES: declarations, contractFunction NUMBER: 2 DESCRIPTION: Contract function usage before declaration it */ diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/DiagnosticTestTypeValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/DiagnosticTestTypeValidator.kt index e55b09575dc..01e0494aba0 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/DiagnosticTestTypeValidator.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/DiagnosticTestTypeValidator.kt @@ -26,8 +26,8 @@ class DiagnosticTestTypeValidator(testFiles: List) } private fun collectDiagnostics(files: List) { - files.forEach { - it.actualDiagnostics.forEach { + files.forEach { file -> + file.actualDiagnostics.forEach { val diagnosticName = it.diagnostic.factory.name diagnosticStats.run { put(diagnosticName, getOrDefault(diagnosticName, 0) + 1) } diagnostics.add(it.diagnostic) diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/LinkedSpecTestValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/LinkedSpecTestValidator.kt index b064329b1ae..01a06f2de23 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/LinkedSpecTestValidator.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/LinkedSpecTestValidator.kt @@ -13,7 +13,10 @@ enum class LinkedSpecTestFileInfoElementType( override val valuePattern: Pattern? = null, override val required: Boolean = false ) : SpecTestInfoElementType { - SECTION(required = true), + SECTIONS( + Pattern.compile("""\w+(,\s+\w+)*"""), + required = true + ), PARAGRAPH(required = true), SENTENCE( valuePattern = Pattern.compile("""\[(?${AbstractSpecTestValidator.INTEGER_REGEX})\](?.*?)"""), @@ -30,7 +33,7 @@ enum class LinkedSpecTestFileInfoElementType( class LinkedSpecTest( testArea: TestArea, testType: TestType, - section: String, + val sections: List, val paragraphNumber: Int, val sentenceNumber: Int, val sentence: String? = null, @@ -39,10 +42,10 @@ class LinkedSpecTest( cases: List? = null, unexpectedBehavior: Boolean? = null, issues: Set? = null -) : AbstractSpecTest(testArea, testType, section, testNumber, description, cases, unexpectedBehavior, issues) { +) : AbstractSpecTest(testArea, testType, sections[0], testNumber, description, cases, unexpectedBehavior, issues) { override fun checkConsistency(other: AbstractSpecTest) = other is LinkedSpecTest - && this.section == other.section + && this.sections == other.sections && this.testArea == other.testArea && this.testType == other.testType && this.testNumber == other.testNumber @@ -57,7 +60,7 @@ class LinkedSpecTestValidator(testDataFile: File) : AbstractSpecTestValidator
  • [\w-]+)${pathSeparator}p-(?$INTEGER_REGEX)""" + """${SpecTestLinkedType.LINKED.testDataPath}$pathSeparator(?(?:[\w-]+)(?:/[\w-]+)*?)${pathSeparator}p-(?$INTEGER_REGEX)""" override val filenameRegex = """(?$INTEGER_REGEX)\.(?$INTEGER_REGEX)\.kt""" override fun getPathPattern(): Pattern = Pattern.compile(testPathRegexTemplate.format(pathPartRegex, filenameRegex)) } @@ -72,9 +75,9 @@ class LinkedSpecTestValidator(testDataFile: File) : AbstractSpecTestValidator
  • ) = diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/NotLinkedSpecTestValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/NotLinkedSpecTestValidator.kt index 23f0dcbf4f4..7f90eaad1d1 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/NotLinkedSpecTestValidator.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/NotLinkedSpecTestValidator.kt @@ -14,7 +14,7 @@ enum class NotLinkedSpecTestFileInfoElementType( override val required: Boolean = false ) : SpecTestInfoElementType { SECTION(required = true), - CATEGORY( + CATEGORIES( valuePattern = Pattern.compile("""\w+(,\s+\w+)*"""), required = true ), @@ -53,7 +53,7 @@ class NotLinkedSpecTestValidator(testDataFile: File) : AbstractSpecTestValidator companion object : SpecTestValidatorHelperObject { override val pathPartRegex = - """${dirsByLinkedType[SpecTestLinkedType.NOT_LINKED]}$pathSeparator(?
    [\w-]+)$pathSeparator(?(?:[\w-]+)(?:/[\w-]+)*?)""" + """${SpecTestLinkedType.NOT_LINKED.testDataPath}$pathSeparator(?[\w-]+)$pathSeparator(?(?:[\w-]+)(?:/[\w-]+)*?)""" override val filenameRegex = """(?$INTEGER_REGEX)\.kt""" override fun getPathPattern(): Pattern = Pattern.compile(testPathRegexTemplate.format(pathPartRegex, filenameRegex)) } @@ -66,10 +66,10 @@ class NotLinkedSpecTestValidator(testDataFile: File) : AbstractSpecTestValidator issues: Set? ) = NotLinkedSpecTest( - TestArea.valueOf(testInfoMatcher.group("testArea").toUpperCase()), + TestArea.valueOf(testInfoMatcher.group("testArea").replace(" ", "_").toUpperCase()), TestType.valueOf(testInfoMatcher.group("testType")), testInfoElements[NotLinkedSpecTestFileInfoElementType.SECTION]!!.content, - testInfoElements[NotLinkedSpecTestFileInfoElementType.CATEGORY]!!.content.split(Regex(""",\s*""")), + testInfoElements[NotLinkedSpecTestFileInfoElementType.CATEGORIES]!!.content.split(Regex(""",\s*""")), testInfoElements[NotLinkedSpecTestFileInfoElementType.NUMBER]!!.content.toInt(), testInfoElements[NotLinkedSpecTestFileInfoElementType.DESCRIPTION]!!.content, testCases, @@ -81,7 +81,7 @@ class NotLinkedSpecTestValidator(testDataFile: File) : AbstractSpecTestValidator NotLinkedSpecTest( TestArea.valueOf(testInfoMatcher.group("testArea").toUpperCase()), TestType.fromValue(testInfoMatcher.group("testType"))!!, - testInfoMatcher.group("section"), + testInfoMatcher.group("sections"), testInfoMatcher.group("categories").split("/"), testNumber = testInfoMatcher.group("testNumber").toInt() ) @@ -93,7 +93,7 @@ class NotLinkedSpecTestValidator(testDataFile: File) : AbstractSpecTestValidator if (testInfoByContent.unexpectedBehavior!!) println("(!!!) HAS UNEXPECTED BEHAVIOUR (!!!)") println("${testInfoByFilename.testArea} ${testInfoByFilename.testType} NOT LINKED SPEC TEST") - println("SECTION: ${testInfoByContent.section}") + println("SECTIONS: ${testInfoByContent.section}") println("CATEGORIES: ${testInfoByContent.categories.joinToString(", ")}") println("TEST NUMBER: ${testInfoByContent.testNumber}") println("NUMBER OF TEST CASES: ${testInfoByContent.cases!!.size}")