[FIR] Fix TEST SPEC tests

Ensure the test data contents for both the frontends
are identical. This is needed for proper analysis of
K2-differences.
This commit is contained in:
Nikolay Lunyak
2023-06-12 15:20:46 +03:00
committed by Space Team
parent e6633d3d92
commit 7541732752
583 changed files with 4053 additions and 5418 deletions
@@ -1,28 +0,0 @@
// SKIP_TXT
// 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 ""
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
/*
@@ -1,5 +1,15 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-296
* MAIN LINK: 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
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: Any, value_2: Int): String {
when (value_1) {
@@ -1,11 +0,0 @@
// SKIP_TXT
// TESTCASE NUMBER: 1
fun case_1(value_1: Int, value_2: TypesProvider): String {
when (value_1) {
<!INCOMPATIBLE_TYPES!>-1000L..100<!> -> return ""
<!INCOMPATIBLE_TYPES!>value_2.getInt()..getLong()<!> -> return ""
}
return ""
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
/*
@@ -1,6 +1,16 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-296
* MAIN LINK: 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
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: Int, value_2: EmptyClass, value_3: Int, value_4: Any): String {
when (value_1) {
@@ -1,13 +0,0 @@
// SKIP_TXT
// TESTCASE NUMBER: 3
fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) {
<!NO_ELSE_IN_WHEN!>when<!> (value_1) {
value_2 -> {}
!value_2 -> {}
<!CONFUSING_BRANCH_CONDITION_ERROR!>getBoolean() && value_2<!> -> {}
<!CONFUSING_BRANCH_CONDITION_ERROR!>getChar() != 'a'<!> -> {}
<!CONFUSING_BRANCH_CONDITION_ERROR!>getList() === getAny()<!> -> {}
<!CONFUSING_BRANCH_CONDITION_ERROR!>value_3 <= 11<!> -> {}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
/*
@@ -1,6 +1,15 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-313
* MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 7
* NUMBER: 1
* DESCRIPTION: 'When' with bound value and with else branch not in the last position.
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: Int): String = when (value_1) {
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> ""
@@ -1,5 +1,13 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-435
* MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 7
* NUMBER: 2
* DESCRIPTION: 'When' without bound value and with 'else' branch not in the last position.
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: Int): String = when {
@@ -1,5 +1,15 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-296
* MAIN LINK: expressions, when-expression -> paragraph 6 -> 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) {
@@ -1,5 +1,16 @@
// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-296
* MAIN LINK: 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
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: SealedClass) = when (value_1) {
!is SealedChild1 -> {}
@@ -34,6 +45,7 @@ fun case_4(value_1: SealedClass?) {
when (value_1) {
!is SealedChild2 -> {} // including null
<!USELESS_IS_CHECK!>is SealedChild2?<!> -> {} // redundant nullable type check
else -> {}
}
}
@@ -1,5 +1,15 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-296
* MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 1
* NUMBER: 3
* DESCRIPTION: 'When' with bound value and enumaration of type test conditions.
* HELPERS: classes, sealedClasses, objects
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: Any) = when (value_1) {
is Int -> {}
@@ -1,5 +1,15 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-296
* MAIN LINK: 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
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: SealedClass): String = when (value_1) {
is SealedChild1, !is SealedChild3 -> ""
@@ -1,5 +1,15 @@
// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-435
* MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 5
* NUMBER: 1
* DESCRIPTION: 'When' with enumeration of the different variants of expressions in 'when condition'.
* HELPERS: typesProvider, classes, functions
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: Any?) {
@@ -24,9 +34,10 @@ fun case_2(value_1: Number, value_2: Int) {
// TESTCASE NUMBER: 3
fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) {
<!NO_ELSE_IN_WHEN!>when<!> (value_1) {
when (value_1) {
value_2 -> {}
!value_2 -> {}
else -> {}
}
}
@@ -1,5 +1,15 @@
// LANGUAGE: +WarnAboutNonExhaustiveWhenOnAlgebraicTypes
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-435
* MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 5
* NUMBER: 2
* DESCRIPTION: 'When' with different variants of the arithmetic expressions (additive expression and multiplicative expression) in 'when condition'.
* HELPERS: typesProvider, classes, functions
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: Any?) {
@@ -1,5 +1,13 @@
// SKIP_TXT
/*
* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-435
* MAIN LINK: expressions, when-expression -> paragraph 6 -> sentence 6
* NUMBER: 1
* DESCRIPTION: 'When' with bound value and not allowed break and continue expression (without labels) in 'when condition'.
*/
// TESTCASE NUMBER: 1
fun case_1(value_1: Int): String {