Add multilevel sections support and corresponding renaming

This commit is contained in:
victor.petukhov
2018-09-24 23:27:06 +03:00
parent 2c313e12e5
commit 84dc28374c
140 changed files with 946 additions and 943 deletions
@@ -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 -> ""
}
@@ -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 -> ""
}
@@ -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 -> ""
<!REDUNDANT_ELSE_IN_WHEN!>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) {
<!USELESS_IS_CHECK!>is _SealedClassSingle<!> -> ""
<!REDUNDANT_ELSE_IN_WHEN!>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 -> ""
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> ""
@@ -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 -> ""
}
@@ -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 -> <!DEBUG_INFO_SMARTCAST!>value<!>.number
is _SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>value<!>.e1 + <!DEBUG_INFO_SMARTCAST!>value<!>.e2
is _SealedChild3 -> <!DEBUG_INFO_SMARTCAST!>value<!>.m1 + <!DEBUG_INFO_SMARTCAST!>value<!>.m2
fun case_1(value_1: _SealedClass): Int = when (value_1) {
is _SealedChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.number
is _SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.e1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.e2
is _SealedChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1 + <!DEBUG_INFO_SMARTCAST!>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) {
<!USELESS_IS_CHECK!>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 -> <!DEBUG_INFO_SMARTCAST!>value<!>.m1()
is _SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>value<!>.m2()
is _SealedWithMethodsChild3 -> <!DEBUG_INFO_SMARTCAST!>value<!>.m3()
fun case_3(value_1: _SealedClassWithMethods): String = when (value_1) {
is _SealedWithMethodsChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1()
is _SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2()
is _SealedWithMethodsChild3 -> <!DEBUG_INFO_SMARTCAST!>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 -> ""
}
@@ -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 -> ""
}
@@ -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 -> ""
@@ -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 -> ""
}
@@ -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 -> <!DEBUG_INFO_SMARTCAST!>expr<!>.number
is _SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>expr<!>.e1 + <!DEBUG_INFO_SMARTCAST!>expr<!>.e2
is _SealedChild3 -> <!DEBUG_INFO_SMARTCAST!>expr<!>.m1 + <!DEBUG_INFO_SMARTCAST!>expr<!>.m2
fun case_1(value_1: _SealedClass?): Int = when (value_1) {
is _SealedChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.number
is _SealedChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.e1 + <!DEBUG_INFO_SMARTCAST!>value_1<!>.e2
is _SealedChild3 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1 + <!DEBUG_INFO_SMARTCAST!>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 -> <!DEBUG_INFO_SMARTCAST!>expr<!>.m1()
is _SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>expr<!>.m2()
is _SealedWithMethodsChild3 -> <!DEBUG_INFO_SMARTCAST!>expr<!>.m3()
fun case_3(value_1: _SealedClassWithMethods?): String = when (value_1) {
is _SealedWithMethodsChild1 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m1()
is _SealedWithMethodsChild2 -> <!DEBUG_INFO_SMARTCAST!>value_1<!>.m2()
is _SealedWithMethodsChild3 -> <!DEBUG_INFO_SMARTCAST!>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 -> ""