Relinking spec tests
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Non-exhaustive when, without bound value, without else branch.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 1
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Non-exhaustive when, with bound value, without else branch.
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 8
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 10
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Non-exhaustive when using nullable boolean values.
|
||||
*/
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 8
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 10
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Non-exhaustive when using subclasses of the nullable sealed class.
|
||||
* HELPERS: sealedClasses
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 8
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 10
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: Non-exhaustive when using nullable enum values.
|
||||
* HELPERS: enumClasses
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 3
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Non-exhaustive when using boolean values.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 6
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Non-exhaustive when using subclasses of the sealed class.
|
||||
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 7
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Non-exhaustive when using enum values.
|
||||
* HELPERS: enumClasses
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: EnumClass): String = <!NO_ELSE_IN_WHEN!>when<!>(value_1) {
|
||||
EnumClass.EAST -> ""
|
||||
EnumClass.SOUTH -> ""
|
||||
EnumClass.NORTH -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: EnumClass): String = <!NO_ELSE_IN_WHEN!>when<!>(value_1) {
|
||||
EnumClass.EAST, EnumClass.SOUTH, EnumClass.NORTH -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: EnumClass): String = <!NO_ELSE_IN_WHEN!>when<!>(value_1) {
|
||||
EnumClass.EAST -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: EnumClass): String = <!NO_ELSE_IN_WHEN!>when<!>(value_1) { }
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: EnumClassSingle): String = <!NO_ELSE_IN_WHEN!>when<!>(value_1) { }
|
||||
|
||||
/*
|
||||
* TESTCASE NUMBER: 6
|
||||
* DISCUSSION: maybe use const propagation here?
|
||||
* ISSUES: KT-25265
|
||||
*/
|
||||
fun case_6(value_1: EnumClass): String {
|
||||
val west = EnumClass.WEST
|
||||
|
||||
return <!NO_ELSE_IN_WHEN!>when<!> (value_1) {
|
||||
EnumClass.EAST -> ""
|
||||
EnumClass.SOUTH -> ""
|
||||
EnumClass.NORTH -> ""
|
||||
west -> ""
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TESTCASE NUMBER: 7
|
||||
* DISCUSSION
|
||||
* ISSUES: KT-26044
|
||||
*/
|
||||
fun case_7(value_1: EnumClassEmpty): String = <!NO_ELSE_IN_WHEN!>when<!> (value_1) { }
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Exhaustive when, without bound value, with else branch.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 1
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Exhaustive when, with bound value, with else branch.
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 1
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: Exhaustive when, with bound value (sealed, enum, boolean), with redundant else branch.
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 10
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Exhaustive when using nullable boolean values.
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Boolean?): String = when (value_1) {
|
||||
true -> ""
|
||||
false -> ""
|
||||
null -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
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
-3
@@ -3,10 +3,10 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 8
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 10
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Exhaustive when using enum values.
|
||||
* DESCRIPTION: Exhaustive when using nullable enum values.
|
||||
* HELPERS: enumClasses
|
||||
*/
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 8
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 10
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: Exhaustive when using subclasses of the nullable sealed class.
|
||||
* HELPERS: sealedClasses
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 3
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Exhaustive when using boolean values.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 6
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Exhaustive when using subclasses of the sealed class.
|
||||
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 7
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Exhaustive when using enum values.
|
||||
* HELPERS: enumClasses
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(dir: EnumClass): String = when (dir) {
|
||||
EnumClass.EAST -> ""
|
||||
EnumClass.NORTH -> ""
|
||||
EnumClass.SOUTH -> ""
|
||||
EnumClass.WEST -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: EnumClassSingle): String = when (value_1) {
|
||||
EnumClassSingle.EVERYTHING -> ""
|
||||
}
|
||||
+10
-10
@@ -3,22 +3,22 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression, exhaustive-when-expressions -> paragraph 2 -> sentence 8
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Exhaustive when using nullable boolean values.
|
||||
* DESCRIPTION: Exhaustive when using enum values.
|
||||
* HELPERS: enumClasses
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Boolean?): String = when (value_1) {
|
||||
true -> ""
|
||||
false -> ""
|
||||
null -> ""
|
||||
fun case_1(dir: EnumClass): String = when (dir) {
|
||||
EnumClass.EAST -> ""
|
||||
EnumClass.NORTH -> ""
|
||||
EnumClass.SOUTH -> ""
|
||||
EnumClass.WEST -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Boolean?): String = when (value_1) {
|
||||
true && false && ((true || false)) || true && !!!false && !!!true -> ""
|
||||
true && false && ((true || false)) || true && !!!false -> ""
|
||||
null -> ""
|
||||
fun case_2(value_1: EnumClassSingle): String = when (value_1) {
|
||||
EnumClassSingle.EVERYTHING -> ""
|
||||
}
|
||||
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"2": {
|
||||
"neg": {
|
||||
"10": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 6,
|
||||
"description": "Non-exhaustive when using nullable enum values.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 10,
|
||||
"description": "Non-exhaustive when using subclasses of the nullable sealed class.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 3,
|
||||
"description": "Non-exhaustive when using nullable boolean values.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 3,
|
||||
"description": "Non-exhaustive when, with bound value, without else branch.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 3,
|
||||
"description": "Non-exhaustive when, without bound value, without else branch.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"3": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 5,
|
||||
"description": "Non-exhaustive when using boolean values.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"6": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 12,
|
||||
"description": "Non-exhaustive when using subclasses of the sealed class.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"pos": {
|
||||
"10": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 7,
|
||||
"description": "Exhaustive when using subclasses of the nullable sealed class.",
|
||||
"unexpectedBehaviour": true
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 3,
|
||||
"description": "Exhaustive when using nullable enum values.",
|
||||
"unexpectedBehaviour": true
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "Exhaustive when using nullable boolean values.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 4,
|
||||
"description": "Exhaustive when, with bound value, with else branch.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 8,
|
||||
"description": "Exhaustive when, with bound value (sealed, enum, boolean), with redundant else branch.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 3,
|
||||
"description": "Exhaustive when, without bound value, with else branch.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"3": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "Exhaustive when using boolean values.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"8": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "Exhaustive when using enum values.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"6": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 9,
|
||||
"description": "Exhaustive when using subclasses of the sealed class.",
|
||||
"unexpectedBehaviour": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 3
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 1 -> sentence 3
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Empty when with bound value.
|
||||
*/
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 3
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 1 -> sentence 3
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: Empty when without bound value.
|
||||
*/
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 3 -> sentence 1
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: Forbidden break and continue in the control structure body of when.
|
||||
*/
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 3 -> sentence 2
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 2
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: When with non-boolean value in the when condition.
|
||||
* HELPERS: typesProvider
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 3 -> sentence 2
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 2
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: When without bound value, forbidden comma in the when condition.
|
||||
* HELPERS: typesProvider, classes
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 3 -> sentence 1
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: When without bound value, various expressions in the control structure body.
|
||||
* HELPERS: typesProvider, classes, functions
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 3 -> sentence 2
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 2
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: When without bound value, various boolean values in the when condition.
|
||||
* HELPERS: typesProvider, enumClasses, sealedClasses, classes
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 3 -> sentence 2
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 2
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' without bound value and only one 'else' branch.
|
||||
*/
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 3 -> sentence 2
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 2 -> sentence 2
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: 'When' without bound value and with Nothing in condition (subtype of Boolean).
|
||||
* DISCUSSION
|
||||
+18
-17
@@ -3,31 +3,32 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 5 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' without bound value and with 'else' branch not in the last position.
|
||||
* DESCRIPTION: 'When' with bound value and not allowed break and continue expression (without labels) in the control structure body.
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(<!UNUSED_PARAMETER!>value_1<!>: Int): String = when {
|
||||
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> ""
|
||||
<!UNREACHABLE_CODE!>value_1 == 1 -> ""<!>
|
||||
fun case_1(value_1: Int): Int {
|
||||
while (true) {
|
||||
when (value_1) {
|
||||
1 -> return 1
|
||||
2 -> <!BREAK_OR_CONTINUE_IN_WHEN!>break<!>
|
||||
}
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int): String = when {
|
||||
value_1 == 1 -> ""
|
||||
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> ""
|
||||
<!UNREACHABLE_CODE!>value_1 == 2 -> ""<!>
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(): String {
|
||||
when {
|
||||
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> return ""
|
||||
<!UNREACHABLE_CODE!>else -> return ""<!>
|
||||
fun case_2(value_1: Int): Int {
|
||||
while (true) {
|
||||
when (value_1) {
|
||||
1 -> <!BREAK_OR_CONTINUE_IN_WHEN!>continue<!>
|
||||
2 -> return 1
|
||||
}
|
||||
}
|
||||
|
||||
<!UNREACHABLE_CODE!>return ""<!>
|
||||
<!UNREACHABLE_CODE!>return 0<!>
|
||||
}
|
||||
|
||||
+307
-11
@@ -1,26 +1,322 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 5 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' without bound value and with else branch in the last position.
|
||||
* DESCRIPTION: 'When' with bound value and with different variants of expressions in the control structure body.
|
||||
* HELPERS: typesProvider, classes, functions
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int): String {
|
||||
when {
|
||||
value_1 == 1 -> return ""
|
||||
value_1 == 2 -> return ""
|
||||
else -> return ""
|
||||
fun case_1(value_1: Int) {
|
||||
when (value_1) {
|
||||
1 -> true
|
||||
2 -> 100
|
||||
3 -> -.09f
|
||||
4 -> '.'
|
||||
5 -> "..."
|
||||
6 -> null
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int): String = when {
|
||||
value_1 == 1 -> ""
|
||||
value_1 == 2 -> ""
|
||||
else -> ""
|
||||
fun case_2(value_1: Int, value_2: Byte, value_3: TypesProvider) {
|
||||
when (value_1) {
|
||||
1 -> -.09 % 10L
|
||||
3 -> value_2 / -5
|
||||
2 -> value_3.getChar() - 11 + 90
|
||||
4 -> 100
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
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() != 'a'
|
||||
6 -> getList() === getAny()
|
||||
7 -> value_3 <= 11
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: Int, value_2: String, value_3: String) {
|
||||
when (value_1) {
|
||||
1 -> "..." + value_2 + "" + "$value_3" + "..."
|
||||
2 -> value_2 + getString()
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
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 (value_3) {
|
||||
value_2 > 1000 -> "1"
|
||||
value_2 > 100 -> "2"
|
||||
}
|
||||
3 -> when (value_3) {}
|
||||
4 -> when (value_3) {
|
||||
true -> "1"
|
||||
false -> "2"
|
||||
null -> "3"
|
||||
}
|
||||
5 -> when (value_3) {
|
||||
true -> "1"
|
||||
false -> "2"
|
||||
}
|
||||
6 -> when (value_3) {}
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
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 (value_3) {
|
||||
true -> 1
|
||||
false -> 2
|
||||
null -> 3
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 7
|
||||
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 (value_2 < 100) "1"
|
||||
else if (value_2 < 10) "2"
|
||||
else "4"
|
||||
4 -> if (value_3 == null) "1"
|
||||
else if (<!DEBUG_INFO_SMARTCAST!>value_3<!>) "2"
|
||||
else if (!<!DEBUG_INFO_SMARTCAST!>value_3<!>) "3"
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 8
|
||||
fun case_8(value_1: Int, value_2: Int) = when (value_1) {
|
||||
1 -> if (value_2 > 1000) "1"
|
||||
else "2"
|
||||
else -> if (value_2 < 100) "1"
|
||||
else if (value_2 < 10) "2"
|
||||
else "4"
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 9
|
||||
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) { value_2 }
|
||||
else -> try { throw Exception() } catch (e: Exception) { {value_3} } finally { }
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 10
|
||||
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!! <!USELESS_ELVIS!>?: true<!>
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 11
|
||||
fun case_11(value_1: Int) {
|
||||
when (value_1) {
|
||||
1 -> 1..10
|
||||
2 -> -100L..100L
|
||||
3 -> -getInt()..getLong()
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 12
|
||||
fun case_12(value_1: Int, value_2: Collection<Int>, value_3: Collection<Int>?) {
|
||||
when (value_1) {
|
||||
1 -> value_2 as List<Int>
|
||||
2 -> value_2 as? List<Int>
|
||||
3 -> value_3 <!UNCHECKED_CAST!>as? MutableMap<Int, Int><!>
|
||||
4 -> (value_2 <!UNCHECKED_CAST!>as? Map<Int, Int><!>) as MutableMap<Int, Int>
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 13
|
||||
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_1) {
|
||||
1 -> ++mutableValue1
|
||||
2 -> --mutableValue2
|
||||
3 -> !value_4
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 14
|
||||
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_1) {
|
||||
1 -> <!UNUSED_CHANGED_VALUE!>mutableValue1++<!>
|
||||
2 -> <!UNUSED_CHANGED_VALUE!>mutableValue2--<!>
|
||||
3 -> value_4!!
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 15
|
||||
fun case_15(value_1: Int, value_2: List<Int>, value_3: List<List<List<List<Int>>>>) {
|
||||
when (value_1) {
|
||||
1 -> value_2[0]
|
||||
2 -> value_3[0][-4][1][-1]
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 16
|
||||
fun case_16(value_1: Int, value_2: Class, value_3: Class?, value_4: Int) {
|
||||
fun __fun_1(): () -> Unit { return fun() { } }
|
||||
|
||||
when (value_1) {
|
||||
1 -> funWithoutArgs()
|
||||
2 -> __fun_1()()
|
||||
3 -> value_2.fun_2(value_4)
|
||||
4 -> value_3?.fun_2(value_4)
|
||||
5 -> value_3!!.fun_2(value_4)
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 17
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 18
|
||||
fun case_18(value_1: Int) {
|
||||
val fun_1 = fun(): Int { return 0 }
|
||||
|
||||
when (value_1) {
|
||||
1 -> fun() {}
|
||||
2 -> fun(): Int { return 1 }
|
||||
3 -> fun(): () -> Unit { return fun() {} }
|
||||
4 -> fun_1
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 19
|
||||
fun case_19(value_1: Int): Any {
|
||||
val lambda_1 = { 0 }
|
||||
|
||||
return when (value_1) {
|
||||
1 -> lambda_1
|
||||
2 -> { { {} } }
|
||||
else -> { -> (Int)
|
||||
{ arg: Int -> { { println(arg) } } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 20
|
||||
fun case_20(value_1: Int) {
|
||||
val object_1 = object {
|
||||
val prop_1 = 1
|
||||
}
|
||||
|
||||
when (value_1) {
|
||||
1 -> object {}
|
||||
2 -> object {
|
||||
private fun fun_1() { }
|
||||
val prop_1 = 1
|
||||
}
|
||||
3 -> object_1
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 21
|
||||
class A {
|
||||
val prop_1 = 1
|
||||
val lambda_1 = { 1 }
|
||||
fun fun_1(): Int { return 1 }
|
||||
|
||||
fun case_21(value_1: Int) {
|
||||
when (value_1) {
|
||||
1 -> this
|
||||
2 -> ((this))
|
||||
3 -> this::prop_1.get()
|
||||
4 -> this.prop_1
|
||||
5 -> this.lambda_1()
|
||||
6 -> this::lambda_1.get()()
|
||||
7 -> this.fun_1()
|
||||
8 -> this::fun_1.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 22
|
||||
fun case_22(value_1: Int) {
|
||||
when (value_1) {
|
||||
1 -> throw Exception()
|
||||
2 -> throw throw throw Exception()
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 23
|
||||
fun case_23(value_1: Int) {
|
||||
fun r_1() {
|
||||
when (value_1) {
|
||||
1 -> return
|
||||
2 -> <!UNREACHABLE_CODE!>return return<!> return
|
||||
}
|
||||
}
|
||||
|
||||
fun r_2(): List<Int>? {
|
||||
when (value_1) {
|
||||
1 -> return listOf(0, 1, 2)
|
||||
2 -> return null
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 24
|
||||
fun case_24(value_1: Int) {
|
||||
loop1@ while (true) {
|
||||
loop2@ while (true) {
|
||||
when (value_1) {
|
||||
1 -> continue@loop1
|
||||
2 -> continue@loop2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 25
|
||||
fun case_25(value_1: Int) {
|
||||
loop1@ while (true) {
|
||||
loop2@ while (true) {
|
||||
when (value_1) {
|
||||
1 -> break@loop1
|
||||
2 -> break@loop2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
-16
@@ -3,32 +3,36 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with bound value and not allowed break and continue expression (without labels) in the control structure body.
|
||||
* DESCRIPTION: 'When' with bound value and type test condition (without companion object in classes), but without type checking operator.
|
||||
* HELPERS: classes
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int): Int {
|
||||
while (true) {
|
||||
when (value_1) {
|
||||
1 -> return 1
|
||||
2 -> <!BREAK_OR_CONTINUE_IN_WHEN!>break<!>
|
||||
}
|
||||
fun case_1(value_1: Any): String {
|
||||
when (value_1) {
|
||||
<!NO_COMPANION_OBJECT!>EmptyClass<!> -> return ""
|
||||
}
|
||||
|
||||
return 0
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int): Int {
|
||||
while (true) {
|
||||
when (value_1) {
|
||||
1 -> <!BREAK_OR_CONTINUE_IN_WHEN!>continue<!>
|
||||
2 -> return 1
|
||||
}
|
||||
fun case_2(value_1: Any): String {
|
||||
when (value_1) {
|
||||
<!NO_COMPANION_OBJECT!>Any<!> -> return ""
|
||||
}
|
||||
|
||||
<!UNREACHABLE_CODE!>return 0<!>
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: Any): String {
|
||||
when (value_1) {
|
||||
<!NO_COMPANION_OBJECT!>Nothing<!> -> return ""
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 1
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 1
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' with bound value and type test condition on the non-type operand of the type checking operator.
|
||||
* HELPERS: classes
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 11
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' without bound value and with 'else' branch not in the last position.
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(<!UNUSED_PARAMETER!>value_1<!>: Int): String = when {
|
||||
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> ""
|
||||
<!UNREACHABLE_CODE!>value_1 == 1 -> ""<!>
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int): String = when {
|
||||
value_1 == 1 -> ""
|
||||
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> ""
|
||||
<!UNREACHABLE_CODE!>value_1 == 2 -> ""<!>
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(): String {
|
||||
when {
|
||||
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> return ""
|
||||
<!UNREACHABLE_CODE!>else -> return ""<!>
|
||||
}
|
||||
|
||||
<!UNREACHABLE_CODE!>return ""<!>
|
||||
}
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 3
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 3
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with bound value and 'when condition' with range expression, but without containment checking operator.
|
||||
* HELPERS: typesProvider
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 3
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 3
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' with bound value and 'when condition' with contains operator and type without defined contains operator.
|
||||
* HELPERS: classes
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 7
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 6
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with bound value and with else branch not in the last position.
|
||||
*/
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 5
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 9
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with bound value and non-expressions in 'when condition'.
|
||||
*/
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 5
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 9
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' with bound value and not allowed break and continue expression (without labels) in 'when condition'.
|
||||
*/
|
||||
+40
-293
@@ -1,322 +1,69 @@
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with bound value and with different variants of expressions in the control structure body.
|
||||
* HELPERS: typesProvider, classes, functions
|
||||
* DESCRIPTION: 'When' with bound value and type test condition.
|
||||
* HELPERS: classes, objects
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int) {
|
||||
fun case_1(value_1: Any): String {
|
||||
when (value_1) {
|
||||
1 -> true
|
||||
2 -> 100
|
||||
3 -> -.09f
|
||||
4 -> '.'
|
||||
5 -> "..."
|
||||
6 -> null
|
||||
is Int -> return ""
|
||||
is Float -> return ""
|
||||
is Double -> return ""
|
||||
is String -> return ""
|
||||
is Char -> return ""
|
||||
is Boolean -> return ""
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int, value_2: Byte, value_3: TypesProvider) {
|
||||
when (value_1) {
|
||||
1 -> -.09 % 10L
|
||||
3 -> value_2 / -5
|
||||
2 -> value_3.getChar() - 11 + 90
|
||||
4 -> 100
|
||||
}
|
||||
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 -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
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() != 'a'
|
||||
6 -> getList() === getAny()
|
||||
7 -> value_3 <= 11
|
||||
}
|
||||
fun case_3(value_1: Any?): String = when (value_1) {
|
||||
is Any -> ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: Int, value_2: String, value_3: String) {
|
||||
when (value_1) {
|
||||
1 -> "..." + value_2 + "" + "$value_3" + "..."
|
||||
2 -> value_2 + getString()
|
||||
}
|
||||
fun case_4(value_1: Any): String = when (value_1) {
|
||||
<!USELESS_IS_CHECK!>is Any<!USELESS_NULLABLE_CHECK!>?<!><!> -> ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
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 (value_3) {
|
||||
value_2 > 1000 -> "1"
|
||||
value_2 > 100 -> "2"
|
||||
}
|
||||
3 -> when (value_3) {}
|
||||
4 -> when (value_3) {
|
||||
true -> "1"
|
||||
false -> "2"
|
||||
null -> "3"
|
||||
}
|
||||
5 -> when (value_3) {
|
||||
true -> "1"
|
||||
false -> "2"
|
||||
}
|
||||
6 -> when (value_3) {}
|
||||
}
|
||||
/*
|
||||
* TESTCASE NUMBER: 5
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
* ISSUES: KT-22996
|
||||
*/
|
||||
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 -> ""
|
||||
is Float? -> "" // redundant nullable type check
|
||||
is Char -> ""
|
||||
is Boolean -> ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
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 (value_3) {
|
||||
true -> 1
|
||||
false -> 2
|
||||
null -> 3
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7(value_1: Int, value_2: Int, value_3: Boolean?) {
|
||||
fun case_6(value_1: Any): String {
|
||||
when (value_1) {
|
||||
1 -> if (value_2 > 1000) "1"
|
||||
2 -> if (value_2 > 1000) "1"
|
||||
else "2"
|
||||
3 -> if (value_2 < 100) "1"
|
||||
else if (value_2 < 10) "2"
|
||||
else "4"
|
||||
4 -> if (value_3 == null) "1"
|
||||
else if (<!DEBUG_INFO_SMARTCAST!>value_3<!>) "2"
|
||||
else if (!<!DEBUG_INFO_SMARTCAST!>value_3<!>) "3"
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 8
|
||||
fun case_8(value_1: Int, value_2: Int) = when (value_1) {
|
||||
1 -> if (value_2 > 1000) "1"
|
||||
else "2"
|
||||
else -> if (value_2 < 100) "1"
|
||||
else if (value_2 < 10) "2"
|
||||
else "4"
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 9
|
||||
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) { value_2 }
|
||||
else -> try { throw Exception() } catch (e: Exception) { {value_3} } finally { }
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 10
|
||||
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!! <!USELESS_ELVIS!>?: true<!>
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 11
|
||||
fun case_11(value_1: Int) {
|
||||
when (value_1) {
|
||||
1 -> 1..10
|
||||
2 -> -100L..100L
|
||||
3 -> -getInt()..getLong()
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 12
|
||||
fun case_12(value_1: Int, value_2: Collection<Int>, value_3: Collection<Int>?) {
|
||||
when (value_1) {
|
||||
1 -> value_2 as List<Int>
|
||||
2 -> value_2 as? List<Int>
|
||||
3 -> value_3 <!UNCHECKED_CAST!>as? MutableMap<Int, Int><!>
|
||||
4 -> (value_2 <!UNCHECKED_CAST!>as? Map<Int, Int><!>) as MutableMap<Int, Int>
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 13
|
||||
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_1) {
|
||||
1 -> ++mutableValue1
|
||||
2 -> --mutableValue2
|
||||
3 -> !value_4
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 14
|
||||
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_1) {
|
||||
1 -> <!UNUSED_CHANGED_VALUE!>mutableValue1++<!>
|
||||
2 -> <!UNUSED_CHANGED_VALUE!>mutableValue2--<!>
|
||||
3 -> value_4!!
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 15
|
||||
fun case_15(value_1: Int, value_2: List<Int>, value_3: List<List<List<List<Int>>>>) {
|
||||
when (value_1) {
|
||||
1 -> value_2[0]
|
||||
2 -> value_3[0][-4][1][-1]
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 16
|
||||
fun case_16(value_1: Int, value_2: Class, value_3: Class?, value_4: Int) {
|
||||
fun __fun_1(): () -> Unit { return fun() { } }
|
||||
|
||||
when (value_1) {
|
||||
1 -> funWithoutArgs()
|
||||
2 -> __fun_1()()
|
||||
3 -> value_2.fun_2(value_4)
|
||||
4 -> value_3?.fun_2(value_4)
|
||||
5 -> value_3!!.fun_2(value_4)
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 17
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 18
|
||||
fun case_18(value_1: Int) {
|
||||
val fun_1 = fun(): Int { return 0 }
|
||||
|
||||
when (value_1) {
|
||||
1 -> fun() {}
|
||||
2 -> fun(): Int { return 1 }
|
||||
3 -> fun(): () -> Unit { return fun() {} }
|
||||
4 -> fun_1
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 19
|
||||
fun case_19(value_1: Int): Any {
|
||||
val lambda_1 = { 0 }
|
||||
|
||||
return when (value_1) {
|
||||
1 -> lambda_1
|
||||
2 -> { { {} } }
|
||||
else -> { -> (Int)
|
||||
{ arg: Int -> { { println(arg) } } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 20
|
||||
fun case_20(value_1: Int) {
|
||||
val object_1 = object {
|
||||
val prop_1 = 1
|
||||
}
|
||||
|
||||
when (value_1) {
|
||||
1 -> object {}
|
||||
2 -> object {
|
||||
private fun fun_1() { }
|
||||
val prop_1 = 1
|
||||
}
|
||||
3 -> object_1
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 21
|
||||
class A {
|
||||
val prop_1 = 1
|
||||
val lambda_1 = { 1 }
|
||||
fun fun_1(): Int { return 1 }
|
||||
|
||||
fun case_21(value_1: Int) {
|
||||
when (value_1) {
|
||||
1 -> this
|
||||
2 -> ((this))
|
||||
3 -> this::prop_1.get()
|
||||
4 -> this.prop_1
|
||||
5 -> this.lambda_1()
|
||||
6 -> this::lambda_1.get()()
|
||||
7 -> this.fun_1()
|
||||
8 -> this::fun_1.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 22
|
||||
fun case_22(value_1: Int) {
|
||||
when (value_1) {
|
||||
1 -> throw Exception()
|
||||
2 -> throw throw throw Exception()
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 23
|
||||
fun case_23(value_1: Int) {
|
||||
fun r_1() {
|
||||
when (value_1) {
|
||||
1 -> return
|
||||
2 -> <!UNREACHABLE_CODE!>return return<!> return
|
||||
}
|
||||
}
|
||||
|
||||
fun r_2(): List<Int>? {
|
||||
when (value_1) {
|
||||
1 -> return listOf(0, 1, 2)
|
||||
2 -> return null
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 24
|
||||
fun case_24(value_1: Int) {
|
||||
loop1@ while (true) {
|
||||
loop2@ while (true) {
|
||||
when (value_1) {
|
||||
1 -> continue@loop1
|
||||
2 -> continue@loop2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 25
|
||||
fun case_25(value_1: Int) {
|
||||
loop1@ while (true) {
|
||||
loop2@ while (true) {
|
||||
when (value_1) {
|
||||
1 -> break@loop1
|
||||
2 -> break@loop2
|
||||
}
|
||||
}
|
||||
is EmptyObject -> return ""
|
||||
is ClassWithCompanionObject.Companion -> return ""
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 1
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 1
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' with bound value and type test condition (invert type checking operator).
|
||||
* HELPERS: classes, sealedClasses, objects
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 1
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 1
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: 'When' with bound value and enumaration of type test conditions.
|
||||
* HELPERS: classes, sealedClasses, objects
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 1
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 1
|
||||
* NUMBER: 4
|
||||
* DESCRIPTION: 'When' with bound value and enumaration of type test conditions (with invert type checking operator).
|
||||
* HELPERS: sealedClasses
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 11
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' without bound value and with else branch in the last position.
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int): String {
|
||||
when {
|
||||
value_1 == 1 -> return ""
|
||||
value_1 == 2 -> return ""
|
||||
else -> return ""
|
||||
}
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int): String = when {
|
||||
value_1 == 1 -> ""
|
||||
value_1 == 2 -> ""
|
||||
else -> ""
|
||||
}
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 3
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 3
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with bound value and containment operator.
|
||||
* HELPERS: typesProvider, classes
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 3
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 3
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' with bound value and enumeration of the containment operators.
|
||||
* HELPERS: typesProvider, classes
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 7
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 6
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with bound value and else branch.
|
||||
*/
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
public fun case_1(/*0*/ value_1: kotlin.Int?): kotlin.String
|
||||
public fun case_2(/*0*/ value_1: kotlin.Any): kotlin.String
|
||||
public fun case_3(/*0*/ value_1: kotlin.Int): kotlin.String
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 5
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 9
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with enumeration of the different variants of expressions in 'when condition'.
|
||||
* HELPERS: typesProvider, classes, functions
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 5
|
||||
* SPEC VERSION: 0.1-100
|
||||
* PLACE: expressions, when-expression -> paragraph 6 -> sentence 9
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' with different variants of the arithmetic expressions (additive expression and multiplicative expression) in 'when condition'.
|
||||
* HELPERS: typesProvider, classes, functions
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with bound value and type test condition (without companion object in classes), but without type checking operator.
|
||||
* HELPERS: classes
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Any): String {
|
||||
when (value_1) {
|
||||
<!NO_COMPANION_OBJECT!>EmptyClass<!> -> return ""
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Any): String {
|
||||
when (value_1) {
|
||||
<!NO_COMPANION_OBJECT!>Any<!> -> return ""
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: Any): String {
|
||||
when (value_1) {
|
||||
<!NO_COMPANION_OBJECT!>Nothing<!> -> return ""
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
-69
@@ -1,69 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 7 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' with bound value and type test condition.
|
||||
* HELPERS: classes, objects
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Any): String {
|
||||
when (value_1) {
|
||||
is Int -> return ""
|
||||
is Float -> return ""
|
||||
is Double -> return ""
|
||||
is String -> return ""
|
||||
is Char -> return ""
|
||||
is Boolean -> return ""
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
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 -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: Any?): String = when (value_1) {
|
||||
is Any -> ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: Any): String = when (value_1) {
|
||||
<!USELESS_IS_CHECK!>is Any<!USELESS_NULLABLE_CHECK!>?<!><!> -> ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
/*
|
||||
* TESTCASE NUMBER: 5
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
* ISSUES: KT-22996
|
||||
*/
|
||||
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 -> ""
|
||||
is Float? -> "" // redundant nullable type check
|
||||
is Char -> ""
|
||||
is Boolean -> ""
|
||||
else -> ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: Any): String {
|
||||
when (value_1) {
|
||||
is EmptyObject -> return ""
|
||||
is ClassWithCompanionObject.Companion -> return ""
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
-143
@@ -1,143 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 9 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via else branch).
|
||||
* HELPERS: classes, checkType
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int): String {
|
||||
val whenValue = when {
|
||||
value_1 == 0 -> ClassLevel2()
|
||||
value_1 > 0 && value_1 <= 10 -> ClassLevel3()
|
||||
value_1 > 10 && value_1 <= 100 -> ClassLevel4()
|
||||
else -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel5>() }
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel5>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int): String {
|
||||
val whenValue = when (value_1) {
|
||||
0 -> ClassLevel2()
|
||||
1 -> ClassLevel3()
|
||||
2 -> ClassLevel4()
|
||||
else -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel5>() }
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel5>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: Int): String {
|
||||
val whenValue = when {
|
||||
value_1 == 0 -> <!IMPLICIT_CAST_TO_ANY!>1 + 1<!>
|
||||
value_1 == 1 -> <!IMPLICIT_CAST_TO_ANY!>1 + 1L<!>
|
||||
value_1 == 2 -> <!IMPLICIT_CAST_TO_ANY!>1 + -.122<!>
|
||||
value_1 == 3 -> <!IMPLICIT_CAST_TO_ANY!>1 + -.000f<!>
|
||||
value_1 == 4 -> <!IMPLICIT_CAST_TO_ANY!>1 + 10.toShort()<!>
|
||||
else -> <!IMPLICIT_CAST_TO_ANY!>1 + 10.toByte()<!>
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Long>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Double>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Float>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Short>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Long>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Double>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Float>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Short>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Byte>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: Int): String {
|
||||
val whenValue = when (value_1) {
|
||||
0 -> <!IMPLICIT_CAST_TO_ANY!>1 + 1<!>
|
||||
1 -> <!IMPLICIT_CAST_TO_ANY!>1 + 1L<!>
|
||||
2 -> <!IMPLICIT_CAST_TO_ANY!>1 + -.122<!>
|
||||
3 -> <!IMPLICIT_CAST_TO_ANY!>1 + -.000f<!>
|
||||
4 -> <!IMPLICIT_CAST_TO_ANY!>1 + 10.toShort()<!>
|
||||
else -> <!IMPLICIT_CAST_TO_ANY!>1 + 10.toByte()<!>
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Long>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Double>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Float>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Short>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Byte>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Long>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Double>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Float>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Short>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<Byte>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: Int): String {
|
||||
val whenValue = when {
|
||||
value_1 == 0 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
value_1 > 0 && value_1 <= 10 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
value_1 > 10 && value_1 <= 100 -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
else -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><() -> Unit>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<() -> Unit>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: Int): String {
|
||||
val whenValue = when (value_1) {
|
||||
0 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
1 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
2 -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
else -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><() -> Unit>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<() -> Unit>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 9 -> sentence 1
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via enum).
|
||||
* HELPERS: classes, enumClasses, checkType
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: EnumClass): String {
|
||||
val whenValue = when (value_1) {
|
||||
EnumClass.EAST -> ClassLevel2()
|
||||
EnumClass.NORTH -> ClassLevel3()
|
||||
EnumClass.SOUTH -> ClassLevel4()
|
||||
EnumClass.WEST -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel5>() }
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel5>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: EnumClass?): String {
|
||||
val whenValue = when (value_1) {
|
||||
EnumClass.EAST -> ClassLevel2()
|
||||
EnumClass.NORTH -> ClassLevel3()
|
||||
EnumClass.SOUTH -> ClassLevel4()
|
||||
EnumClass.WEST -> ClassLevel5()
|
||||
null -> ClassLevel6()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel5>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel6>() }
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel5>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel6>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: EnumClass): String {
|
||||
val whenValue = when (value_1) {
|
||||
EnumClass.EAST -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
EnumClass.NORTH -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
EnumClass.SOUTH -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
EnumClass.WEST -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><() -> Unit>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<() -> Unit>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: EnumClass?): String {
|
||||
val whenValue = when (value_1) {
|
||||
EnumClass.EAST -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
EnumClass.NORTH -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
EnumClass.SOUTH -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
EnumClass.WEST -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
null -> <!IMPLICIT_CAST_TO_ANY!>false<!>
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><() -> Unit>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<() -> Unit>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 9 -> sentence 1
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via boolean bound value).
|
||||
* HELPERS: classes, checkType
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Boolean): String {
|
||||
val whenValue = when (value_1) {
|
||||
true -> ClassLevel2()
|
||||
false -> ClassLevel3()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Boolean?): String {
|
||||
val whenValue = when (value_1) {
|
||||
true -> ClassLevel2()
|
||||
false -> ClassLevel3()
|
||||
null -> ClassLevel4()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: Boolean): String {
|
||||
val whenValue = when (value_1) {
|
||||
true -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
false -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: Boolean?): String {
|
||||
val whenValue = when (value_1) {
|
||||
true -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
false -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
null -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
}
|
||||
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><() -> Unit>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<() -> Unit>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
-173
@@ -1,173 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 9 -> sentence 1
|
||||
* NUMBER: 4
|
||||
* DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via sealed class).
|
||||
* HELPERS: classes, sealedClasses, checkType
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: SealedClass): String {
|
||||
val whenValue = when (value_1) {
|
||||
is SealedChild1 -> ClassLevel2()
|
||||
is SealedChild2 -> ClassLevel3()
|
||||
is SealedChild3 -> ClassLevel4()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: SealedClass?): String {
|
||||
val whenValue = when (value_1) {
|
||||
is SealedChild1 -> ClassLevel2()
|
||||
is SealedChild2 -> ClassLevel3()
|
||||
is SealedChild3 -> ClassLevel4()
|
||||
null -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel5>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
checkSubtype<ClassLevel5>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: SealedClass): String {
|
||||
val whenValue = when (value_1) {
|
||||
is SealedChild1 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
is SealedChild2 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
is SealedChild3 -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: SealedClass?): String {
|
||||
val whenValue = when (value_1) {
|
||||
is SealedChild1 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
is SealedChild2 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
is SealedChild3 -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
null -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><() -> Unit>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<() -> Unit>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: SealedClassWithObjects): String {
|
||||
val whenValue = when (value_1) {
|
||||
SealedWithObjectsChild1 -> ClassLevel2()
|
||||
SealedWithObjectsChild2 -> ClassLevel3()
|
||||
SealedWithObjectsChild3 -> ClassLevel4()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: SealedClassWithObjects?): String {
|
||||
val whenValue = when (value_1) {
|
||||
SealedWithObjectsChild1 -> ClassLevel2()
|
||||
SealedWithObjectsChild2 -> ClassLevel3()
|
||||
SealedWithObjectsChild3 -> ClassLevel4()
|
||||
null -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel5>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
checkSubtype<ClassLevel5>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7(value_1: SealedClassWithObjects): String {
|
||||
val whenValue = when (value_1) {
|
||||
SealedWithObjectsChild1 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
SealedWithObjectsChild2 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
SealedWithObjectsChild3 -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 8
|
||||
fun case_8(value_1: SealedClassWithObjects?): String {
|
||||
val whenValue = when (value_1) {
|
||||
SealedWithObjectsChild1 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
SealedWithObjectsChild2 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
SealedWithObjectsChild3 -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
null -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Int>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><String>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><() -> Unit>() }
|
||||
checkSubtype<Int>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<String>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<() -> Unit>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 9
|
||||
fun case_9(value_1: SealedClassWithObjects?): String {
|
||||
val whenValue = when (value_1) {
|
||||
is SealedClassWithObjects -> ClassLevel2()
|
||||
else -> ClassLevel3()
|
||||
}
|
||||
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel5>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel4>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel3>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><ClassLevel1>() }
|
||||
checkSubtype<ClassLevel5>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel4>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
checkSubtype<ClassLevel3>(<!TYPE_MISMATCH!>whenValue<!>)
|
||||
|
||||
return ""
|
||||
}
|
||||
-115
@@ -1,115 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 9 -> sentence 1
|
||||
* NUMBER: 1
|
||||
* DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via else branch).
|
||||
* HELPERS: classes, checkType
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Int): String {
|
||||
val whenValue = when {
|
||||
value_1 == 0 -> ClassLevel2()
|
||||
value_1 > 0 && value_1 <= 10 -> ClassLevel3()
|
||||
value_1 > 10 && value_1 <= 100 -> ClassLevel4()
|
||||
else -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Int): String {
|
||||
val whenValue = when (value_1) {
|
||||
0 -> ClassLevel2()
|
||||
1 -> ClassLevel3()
|
||||
2 -> ClassLevel4()
|
||||
else -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
/*
|
||||
* TESTCASE NUMBER: 3
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
* ISSUES: KT-25268
|
||||
*/
|
||||
fun case_3(value_1: Int): String {
|
||||
val whenValue = when {
|
||||
value_1 == 0 -> <!IMPLICIT_CAST_TO_ANY!>1 + 1<!>
|
||||
value_1 == 1 -> <!IMPLICIT_CAST_TO_ANY!>1 + 1L<!>
|
||||
value_1 == 2 -> <!IMPLICIT_CAST_TO_ANY!>1 + -.122<!>
|
||||
value_1 == 3 -> <!IMPLICIT_CAST_TO_ANY!>1 + -.000f<!>
|
||||
value_1 == 4 -> <!IMPLICIT_CAST_TO_ANY!>1 + 10.toShort()<!>
|
||||
else -> <!IMPLICIT_CAST_TO_ANY!>1 + 10.toShort()<!>
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Number>() } // unexpected behaviour!
|
||||
checkSubtype<Number>(<!TYPE_MISMATCH!>whenValue<!>) // unexpected behaviour!
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
/*
|
||||
* TESTCASE NUMBER: 4
|
||||
* UNEXPECTED BEHAVIOUR
|
||||
* ISSUES: KT-25268
|
||||
*/
|
||||
fun case_4(value_1: Int): String {
|
||||
val whenValue = when (value_1) {
|
||||
0 -> <!IMPLICIT_CAST_TO_ANY!>1 + 1<!>
|
||||
1 -> <!IMPLICIT_CAST_TO_ANY!>1 + 1L<!>
|
||||
2 -> <!IMPLICIT_CAST_TO_ANY!>1 + -.122<!>
|
||||
3 -> <!IMPLICIT_CAST_TO_ANY!>1 + -.000f<!>
|
||||
4 -> <!IMPLICIT_CAST_TO_ANY!>1 + 10.toShort()<!>
|
||||
else -> <!IMPLICIT_CAST_TO_ANY!>1 + 10.toByte()<!>
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
whenValue checkType { <!TYPE_MISMATCH!>check<!><Number>() } // unexpected behaviour!
|
||||
checkSubtype<Number>(<!TYPE_MISMATCH!>whenValue<!>) // unexpected behaviour!
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: Int): String {
|
||||
val whenValue = when {
|
||||
value_1 == 0 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
value_1 > 0 && value_1 <= 10 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
value_1 > 10 && value_1 <= 100 -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
else -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: Int): String {
|
||||
val whenValue = when (value_1) {
|
||||
0 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
1 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
2 -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
else -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 9 -> sentence 1
|
||||
* NUMBER: 2
|
||||
* DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via enum).
|
||||
* HELPERS: classes, enumClasses, checkType
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: EnumClass): String {
|
||||
val whenValue = when (value_1) {
|
||||
EnumClass.EAST -> ClassLevel2()
|
||||
EnumClass.NORTH -> ClassLevel3()
|
||||
EnumClass.SOUTH -> ClassLevel4()
|
||||
EnumClass.WEST -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: EnumClass?): String {
|
||||
val whenValue = when (value_1) {
|
||||
EnumClass.EAST -> ClassLevel2()
|
||||
EnumClass.NORTH -> ClassLevel3()
|
||||
EnumClass.SOUTH -> ClassLevel4()
|
||||
EnumClass.WEST -> ClassLevel5()
|
||||
null -> ClassLevel6()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: EnumClass): String {
|
||||
val whenValue = when (value_1) {
|
||||
EnumClass.EAST -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
EnumClass.NORTH -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
EnumClass.SOUTH -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
EnumClass.WEST -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: EnumClass?): String {
|
||||
val whenValue = when (value_1) {
|
||||
EnumClass.EAST -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
EnumClass.NORTH -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
EnumClass.SOUTH -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
EnumClass.WEST -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
null -> <!IMPLICIT_CAST_TO_ANY!>false<!>
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
-69
@@ -1,69 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 9 -> sentence 1
|
||||
* NUMBER: 3
|
||||
* DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via boolean bound value).
|
||||
* HELPERS: classes, checkType
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: Boolean): String {
|
||||
val whenValue = when (value_1) {
|
||||
true -> ClassLevel2()
|
||||
false -> ClassLevel3()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: Boolean?): String {
|
||||
val whenValue = when (value_1) {
|
||||
true -> ClassLevel2()
|
||||
false -> ClassLevel3()
|
||||
null -> ClassLevel4()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: Boolean): String {
|
||||
val whenValue = when (value_1) {
|
||||
true -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
false -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: Boolean?): String {
|
||||
val whenValue = when (value_1) {
|
||||
true -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
false -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
null -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
-139
@@ -1,139 +0,0 @@
|
||||
// SKIP_TXT
|
||||
|
||||
/*
|
||||
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
|
||||
*
|
||||
* SPEC VERSION: 0.1-draft
|
||||
* PLACE: expressions, when-expression -> paragraph 9 -> sentence 1
|
||||
* NUMBER: 4
|
||||
* DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via sealed class).
|
||||
* HELPERS: classes, sealedClasses, checkType
|
||||
*/
|
||||
|
||||
// TESTCASE NUMBER: 1
|
||||
fun case_1(value_1: SealedClass): String {
|
||||
val whenValue = when (value_1) {
|
||||
is SealedChild1 -> ClassLevel2()
|
||||
is SealedChild2 -> ClassLevel3()
|
||||
is SealedChild3 -> ClassLevel4()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(value_1: SealedClass?): String {
|
||||
val whenValue = when (value_1) {
|
||||
is SealedChild1 -> ClassLevel2()
|
||||
is SealedChild2 -> ClassLevel3()
|
||||
is SealedChild3 -> ClassLevel4()
|
||||
null -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(value_1: SealedClass): String {
|
||||
val whenValue = when (value_1) {
|
||||
is SealedChild1 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
is SealedChild2 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
is SealedChild3 -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 4
|
||||
fun case_4(value_1: SealedClass?): String {
|
||||
val whenValue = when (value_1) {
|
||||
is SealedChild1 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
is SealedChild2 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
is SealedChild3 -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
null -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
fun case_5(value_1: SealedClassWithObjects): String {
|
||||
val whenValue = when (value_1) {
|
||||
SealedWithObjectsChild1 -> ClassLevel2()
|
||||
SealedWithObjectsChild2 -> ClassLevel3()
|
||||
SealedWithObjectsChild3 -> ClassLevel4()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(value_1: SealedClassWithObjects?): String {
|
||||
val whenValue = when (value_1) {
|
||||
SealedWithObjectsChild1 -> ClassLevel2()
|
||||
SealedWithObjectsChild2 -> ClassLevel3()
|
||||
SealedWithObjectsChild3 -> ClassLevel4()
|
||||
null -> ClassLevel5()
|
||||
}
|
||||
|
||||
whenValue checkType { check<ClassLevel2>() }
|
||||
checkSubtype<ClassLevel1>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 7
|
||||
fun case_7(value_1: SealedClassWithObjects): String {
|
||||
val whenValue = when (value_1) {
|
||||
SealedWithObjectsChild1 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
SealedWithObjectsChild2 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
SealedWithObjectsChild3 -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 8
|
||||
fun case_8(value_1: SealedClassWithObjects?): String {
|
||||
val whenValue = when (value_1) {
|
||||
SealedWithObjectsChild1 -> <!IMPLICIT_CAST_TO_ANY!>10<!>
|
||||
SealedWithObjectsChild2 -> <!IMPLICIT_CAST_TO_ANY!>""<!>
|
||||
SealedWithObjectsChild3 -> <!IMPLICIT_CAST_TO_ANY!>object<!> {}
|
||||
null -> {<!IMPLICIT_CAST_TO_ANY!>{}<!>}
|
||||
}
|
||||
|
||||
whenValue checkType { check<Any>() }
|
||||
checkSubtype<Any>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 9
|
||||
fun case_9(value_1: SealedClassWithObjects): String {
|
||||
val whenValue = when (value_1) {
|
||||
<!USELESS_IS_CHECK!>is SealedClassWithObjects<!> -> 10
|
||||
}
|
||||
|
||||
whenValue checkType { check<Int>() }
|
||||
checkSubtype<Int>(whenValue)
|
||||
|
||||
return ""
|
||||
}
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
{
|
||||
"6": {
|
||||
"neg": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 1,
|
||||
"description": "\u0027When\u0027 with bound value and type test condition on the non-type operand of the type checking operator.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 3,
|
||||
"description": "\u0027When\u0027 with bound value and type test condition (without companion object in classes), but without type checking operator.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"3": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 1,
|
||||
"description": "\u0027When\u0027 with bound value and \u0027when condition\u0027 with range expression, but without containment checking operator.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "\u0027When\u0027 with bound value and \u0027when condition\u0027 with contains operator and type without defined contains operator.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"9": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "\u0027When\u0027 with bound value and non-expressions in \u0027when condition\u0027.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "\u0027When\u0027 with bound value and not allowed break and continue expression (without labels) in \u0027when condition\u0027.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"6": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 3,
|
||||
"description": "\u0027When\u0027 with bound value and with else branch not in the last position.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"11": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 3,
|
||||
"description": "\u0027When\u0027 without bound value and with \u0027else\u0027 branch not in the last position.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"pos": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 5,
|
||||
"description": "\u0027When\u0027 with bound value and type test condition (invert type checking operator).",
|
||||
"unexpectedBehaviour": true
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 6,
|
||||
"description": "\u0027When\u0027 with bound value and enumaration of type test conditions.",
|
||||
"unexpectedBehaviour": true
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 7,
|
||||
"description": "\u0027When\u0027 with bound value and enumaration of type test conditions (with invert type checking operator).",
|
||||
"unexpectedBehaviour": true
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 6,
|
||||
"description": "\u0027When\u0027 with bound value and type test condition.",
|
||||
"unexpectedBehaviour": true
|
||||
}
|
||||
],
|
||||
"3": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "\u0027When\u0027 with bound value and containment operator.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "\u0027When\u0027 with bound value and enumeration of the containment operators.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"9": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 23,
|
||||
"description": "\u0027When\u0027 with enumeration of the different variants of expressions in \u0027when condition\u0027.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 26,
|
||||
"description": "\u0027When\u0027 with different variants of the arithmetic expressions (additive expression and multiplicative expression) in \u0027when condition\u0027.",
|
||||
"unexpectedBehaviour": true
|
||||
}
|
||||
],
|
||||
"6": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 3,
|
||||
"description": "\u0027When\u0027 with bound value and else branch.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"11": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "\u0027When\u0027 without bound value and with else branch in the last position.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"1": {
|
||||
"pos": {
|
||||
"3": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 1,
|
||||
"description": "Empty when with bound value.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 1,
|
||||
"description": "Empty when without bound value.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"2": {
|
||||
"neg": {
|
||||
"2": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 1,
|
||||
"description": "When with non-boolean value in the when condition.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 1,
|
||||
"description": "When without bound value, forbidden comma in the when condition.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "Forbidden break and continue in the control structure body of when.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"pos": {
|
||||
"2": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 9,
|
||||
"description": "When without bound value, various boolean values in the when condition.",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 6,
|
||||
"description": "\u0027When\u0027 without bound value and with Nothing in condition (subtype of Boolean).",
|
||||
"unexpectedBehaviour": false
|
||||
},
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "\u0027When\u0027 without bound value and only one \u0027else\u0027 branch.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
],
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 25,
|
||||
"description": "When without bound value, various expressions in the control structure body.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"5": {
|
||||
"neg": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 2,
|
||||
"description": "\u0027When\u0027 with bound value and not allowed break and continue expression (without labels) in the control structure body.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"pos": {
|
||||
"1": [
|
||||
{
|
||||
"specVersion": "0.1-100",
|
||||
"casesNumber": 25,
|
||||
"description": "\u0027When\u0027 with bound value and with different variants of expressions in the control structure body.",
|
||||
"unexpectedBehaviour": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user