From ecf8b88c4ca169fe1af305f13e59ebd3a19177b5 Mon Sep 17 00:00:00 2001 From: "victor.petukhov" Date: Tue, 28 Aug 2018 19:06:59 +0300 Subject: [PATCH] Add 'not linked' kind of spec tests --- .../tests-spec/testData/diagnostics/ReadMe.md | 61 +- .../helpers}/basicTypes.kt | 0 .../helpers}/classes.kt | 10 +- .../helpers}/enumClasses.kt | 0 .../testData/diagnostics/helpers/functions.kt | 7 + .../helpers}/objects.kt | 0 .../helpers}/sealedClasses.kt | 0 .../helpers}/typeAliases.kt | 0 .../when-expression}/p-11/neg/1.1.kt | 2 +- .../when-expression}/p-11/neg/1.2.kt | 2 +- .../when-expression}/p-11/neg/3.1.kt | 2 +- .../when-expression}/p-11/neg/6.1.kt | 2 +- .../when-expression}/p-11/neg/7.1.kt | 2 +- .../when-expression}/p-11/neg/8.1.kt | 2 +- .../when-expression}/p-11/neg/8.2.kt | 2 +- .../when-expression}/p-11/neg/8.3.kt | 2 +- .../when-expression}/p-11/pos/1.1.kt | 2 +- .../when-expression}/p-11/pos/1.2.kt | 2 +- .../when-expression}/p-11/pos/1.3.kt | 2 +- .../when-expression}/p-11/pos/3.1.kt | 2 +- .../when-expression}/p-11/pos/6.1.kt | 2 +- .../when-expression}/p-11/pos/7.1.kt | 2 +- .../when-expression}/p-11/pos/8.1.kt | 2 +- .../when-expression}/p-11/pos/8.2.kt | 2 +- .../when-expression}/p-11/pos/8.3.kt | 2 +- .../when-expression}/p-2/pos/3.1.kt | 2 +- .../when-expression}/p-2/pos/3.2.kt | 2 +- .../when-expression}/p-3/neg/1.1.kt | 2 +- .../when-expression}/p-3/neg/2.1.kt | 2 +- .../when-expression}/p-3/neg/2.2.kt | 2 +- .../when-expression}/p-3/pos/1.1.kt | 4 +- .../when-expression}/p-3/pos/2.1.kt | 2 +- .../when-expression}/p-3/pos/2.2.kt | 2 +- .../when-expression}/p-3/pos/2.3.kt | 2 +- .../when-expression}/p-5/neg/1.1.kt | 2 +- .../when-expression}/p-5/pos/1.1.kt | 2 +- .../when-expression}/p-6/neg/1.1.kt | 2 +- .../when-expression}/p-6/pos/1.1.kt | 4 +- .../when-expression}/p-7/neg/1.1.kt | 2 +- .../when-expression}/p-7/neg/1.2.kt | 2 +- .../when-expression}/p-7/neg/3.1.kt | 2 +- .../when-expression}/p-7/neg/3.2.kt | 2 +- .../when-expression}/p-7/neg/5.1.kt | 2 +- .../when-expression}/p-7/neg/5.2.kt | 2 +- .../when-expression}/p-7/neg/7.1.kt | 2 +- .../when-expression}/p-7/pos/1.1.kt | 2 +- .../when-expression}/p-7/pos/1.2.kt | 2 +- .../when-expression}/p-7/pos/1.3.kt | 2 +- .../when-expression}/p-7/pos/1.4.kt | 2 +- .../when-expression}/p-7/pos/3.1.kt | 2 +- .../when-expression}/p-7/pos/3.2.kt | 2 +- .../when-expression}/p-7/pos/5.1.kt | 4 +- .../when-expression}/p-7/pos/5.2.kt | 4 +- .../when-expression}/p-7/pos/7.1.kt | 2 +- .../when-expression}/p-9/neg/1.1.kt | 2 +- .../when-expression}/p-9/neg/1.2.kt | 2 +- .../when-expression}/p-9/neg/1.3.kt | 2 +- .../when-expression}/p-9/neg/1.4.kt | 2 +- .../when-expression}/p-9/pos/1.1.kt | 2 +- .../when-expression}/p-9/pos/1.2.kt | 2 +- .../when-expression}/p-9/pos/1.3.kt | 2 +- .../when-expression}/p-9/pos/1.4.kt | 2 +- .../testData/helpers/diagnostics/funs.kt | 3 - .../checkers/AbstractDiagnosticsTestSpec.kt | 56 +- .../DiagnosticsTestSpecGenerated.java | 851 +++++++++--------- .../tests/GenerateCompilerSpecTests.kt | 2 +- .../spec/DiagnosticSpecTestValidator.kt | 68 -- .../kotlin/spec/SpecTestValidator.kt | 323 ------- .../validators/AbstractSpecTestValidator.kt | 291 ++++++ .../validators/DiagnosticTestTypeValidator.kt | 46 + .../validators/LinkedSpecTestValidator.kt | 122 +++ .../validators/NotLinkedSpecTestValidator.kt | 112 +++ 72 files changed, 1140 insertions(+), 928 deletions(-) rename compiler/tests-spec/testData/{helpers/diagnostics => diagnostics/helpers}/basicTypes.kt (100%) rename compiler/tests-spec/testData/{helpers/diagnostics => diagnostics/helpers}/classes.kt (61%) rename compiler/tests-spec/testData/{helpers/diagnostics => diagnostics/helpers}/enumClasses.kt (100%) create mode 100644 compiler/tests-spec/testData/diagnostics/helpers/functions.kt rename compiler/tests-spec/testData/{helpers/diagnostics => diagnostics/helpers}/objects.kt (100%) rename compiler/tests-spec/testData/{helpers/diagnostics => diagnostics/helpers}/sealedClasses.kt (100%) rename compiler/tests-spec/testData/{helpers/diagnostics => diagnostics/helpers}/typeAliases.kt (100%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/neg/1.1.kt (95%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/neg/1.2.kt (95%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/neg/3.1.kt (97%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/neg/6.1.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/neg/7.1.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/neg/8.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/neg/8.2.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/neg/8.3.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/pos/1.1.kt (95%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/pos/1.2.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/pos/1.3.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/pos/3.1.kt (95%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/pos/6.1.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/pos/7.1.kt (95%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/pos/8.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/pos/8.2.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-11/pos/8.3.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-2/pos/3.1.kt (89%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-2/pos/3.2.kt (88%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-3/neg/1.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-3/neg/2.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-3/neg/2.2.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-3/pos/1.1.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-3/pos/2.1.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-3/pos/2.2.kt (94%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-3/pos/2.3.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-5/neg/1.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-5/pos/1.1.kt (95%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-6/neg/1.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-6/pos/1.1.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/neg/1.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/neg/1.2.kt (93%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/neg/3.1.kt (94%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/neg/3.2.kt (97%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/neg/5.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/neg/5.2.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/neg/7.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/pos/1.1.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/pos/1.2.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/pos/1.3.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/pos/1.4.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/pos/3.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/pos/3.2.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/pos/5.1.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/pos/5.2.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-7/pos/7.1.kt (96%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-9/neg/1.1.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-9/neg/1.2.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-9/neg/1.3.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-9/neg/1.4.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-9/pos/1.1.kt (99%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-9/pos/1.2.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-9/pos/1.3.kt (98%) rename compiler/tests-spec/testData/diagnostics/{s-16.30_when-expression => linked/when-expression}/p-9/pos/1.4.kt (99%) delete mode 100644 compiler/tests-spec/testData/helpers/diagnostics/funs.kt delete mode 100644 compiler/tests-spec/tests/org/jetbrains/kotlin/spec/DiagnosticSpecTestValidator.kt delete mode 100644 compiler/tests-spec/tests/org/jetbrains/kotlin/spec/SpecTestValidator.kt create mode 100644 compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/AbstractSpecTestValidator.kt create mode 100644 compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/DiagnosticTestTypeValidator.kt create mode 100644 compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/LinkedSpecTestValidator.kt create mode 100644 compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/NotLinkedSpecTestValidator.kt diff --git a/compiler/tests-spec/testData/diagnostics/ReadMe.md b/compiler/tests-spec/testData/diagnostics/ReadMe.md index eea162258cf..824e73947cf 100644 --- a/compiler/tests-spec/testData/diagnostics/ReadMe.md +++ b/compiler/tests-spec/testData/diagnostics/ReadMe.md @@ -9,13 +9,13 @@ Note: diagnostic tests format specification you can see in the [diagnostic tests Each test relates to a specific section, paragraph, and sentence of the Kotlin language specification, and is either positive or negative. The folder structure is as follows: -* `s-_` +* `` * `p-` * `` * `..kt` (test source code) * `..txt` (descriptors file) -Example test file path: `testsSpec/s-16.30_when-expression/p-2/neg/3.1.kt` +Example test file path: `testData/diagnostics/linked/when-expression/p-2/neg/3.1.kt` ## Positive and negative tests @@ -35,9 +35,9 @@ A comment with meta information has the following format: /* KOTLIN SPEC TEST () - SECTION : + SECTION: PARAGRAPH: - SENTENCE : + SENTENCE: [] NUMBER: DESCRIPTION: */ @@ -45,17 +45,17 @@ A comment with meta information has the following format: Example: ``` /* - KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION 16.30: When expression - PARAGRAPH: 3 - SENTENCE 2: Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. + SECTION: when-expression + PARAGRAPH: 2 + SENTENCE: [3] When expression has two different forms: with bound value and without it. NUMBER: 1 - DESCRIPTION: 'When' with not boolean condition in 'when condition' + DESCRIPTION: Empty 'when' with bound value. */ ``` -Meta-information should be placed at the beginning of the file after diagnostic directives (if any). +Meta-information should be placed at the beginning of the file after directives (if any). ### Case description @@ -92,23 +92,23 @@ If the validation fails, you will receive exception about it. During the test run, the following information is displayed for each test: ``` - DIAGNOSTICS SPEC TEST -SECTION: (paragraph: ) -SENTENCE []: +DIAGNOSTICS SPEC TEST +SECTION: (paragraph: ) +SENTENCE : TEST NUMBER: -NUMBER OF TEST CASES: +TEST CASES: DESCRIPTION: DIAGNOSTICS: | ``` Example: ``` -POSITIVE DIAGNOSTICS SPEC TEST -SECTION: 16.30 When expression (paragraph: 5) -SENTENCE 1 [http://jetbrains.github.io/kotlin-spec/#when-expression:5:1]: The type of the resulting expression is the least upper bound of the types of all the entries. -TEST NUMBER: 4 -NUMBER OF TEST CASES: 9 -DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via sealed class). -DIAGNOSTICS: {WARNING=15} | {USELESS_IS_CHECK=1, IMPLICIT_CAST_TO_ANY=14} +DIAGNOSTICS NEGATIVE SPEC TEST +SECTION: when-expression (paragraph: 3) +SENTENCE 1: +TEST NUMBER: 1 +NUMBER OF TEST CASES: 3 +DESCRIPTION: 'When' without bound value and not allowed break and continue expression (without labels) in the control structure body. +DIAGNOSTICS: {ERROR=2, WARNING=1} | {BREAK_OR_CONTINUE_IN_WHEN=2, UNREACHABLE_CODE=1} ``` ## Statistics on specification tests @@ -118,18 +118,19 @@ To see statistics for existing tests you can run gradle task `printSpecTestStati Example output: ``` --------------------------------------------------- +================================================== SPEC TESTS STATISTIC -------------------------------------------------- -DIAGNOSTICS: 131 tests - 16.30 WHEN-EXPRESSION: 131 tests - PARAGRAPH 2: 4 tests (neg: 2, pos: 2) - PARAGRAPH 3: 35 tests (neg: 5, pos: 30) - PARAGRAPH 4: 67 tests (neg: 11, pos: 56) - PARAGRAPH 5: 8 tests (neg: 4, pos: 4) - PARAGRAPH 6: 17 tests (neg: 8, pos: 9) PSI: 0 tests +DIAGNOSTICS: 54 tests + when-expression: 54 tests + PARAGRAPH 9: 8 tests [ neg: 4 ] [ pos: 4 ] + PARAGRAPH 7: 16 tests [ neg: 7 ] [ pos: 9 ] + PARAGRAPH 6: 2 tests [ neg: 1 ] [ pos: 1 ] + PARAGRAPH 11: 17 tests [ neg: 8 ] [ pos: 9 ] + PARAGRAPH 3: 7 tests [ neg: 3 ] [ pos: 4 ] + PARAGRAPH 2: 2 tests [ pos: 2 ] + PARAGRAPH 5: 2 tests [ neg: 1 ] [ pos: 1 ] CODEGEN: 0 tests --------------------------------------------------- ``` \ No newline at end of file diff --git a/compiler/tests-spec/testData/helpers/diagnostics/basicTypes.kt b/compiler/tests-spec/testData/diagnostics/helpers/basicTypes.kt similarity index 100% rename from compiler/tests-spec/testData/helpers/diagnostics/basicTypes.kt rename to compiler/tests-spec/testData/diagnostics/helpers/basicTypes.kt diff --git a/compiler/tests-spec/testData/helpers/diagnostics/classes.kt b/compiler/tests-spec/testData/diagnostics/helpers/classes.kt similarity index 61% rename from compiler/tests-spec/testData/helpers/diagnostics/classes.kt rename to compiler/tests-spec/testData/diagnostics/helpers/classes.kt index be53fd9b2a0..0dd45f058fc 100644 --- a/compiler/tests-spec/testData/helpers/diagnostics/classes.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/classes.kt @@ -4,16 +4,16 @@ class _Class { val prop_3 = 3 fun fun_1(): (Int) -> (Int) -> Int = {number: Int -> { number * 5 }} - fun fun_2(value: Int): Int = value * 2 - fun fun_3(value1: Int): (Int) -> Int = fun(value2: Int): Int = value1 * value2 * 2 + fun fun_2(value_1: Int): Int = value_1 * 2 + fun fun_3(value_1: Int): (Int) -> Int = fun(value_2: Int): Int = value_1 * value_2 * 2 operator fun contains(a: Int): Boolean = a > 30 operator fun contains(a: Long): Boolean = a > 30L operator fun contains(a: Char): Boolean = a > 30.toChar() - fun getIntArray(value: Int): IntArray = intArrayOf(1, 2, 3, value, 91923, 14, 123124) - fun getLongArray(value: Long): LongArray = longArrayOf(1L, 2L, 3L, value, 9192323244L, 14L, 123124L) - fun getCharArray(value: Char): CharArray = charArrayOf(1.toChar(), 2.toChar(), 3.toChar(), value) + fun getIntArray(value_1: Int): IntArray = intArrayOf(1, 2, 3, value_1, 91923, 14, 123124) + fun getLongArray(value_1: Long): LongArray = longArrayOf(1L, 2L, 3L, value_1, 9192323244L, 14L, 123124L) + fun getCharArray(value_1: Char): CharArray = charArrayOf(1.toChar(), 2.toChar(), 3.toChar(), value_1) class _NestedClass { val prop_4 = 4 diff --git a/compiler/tests-spec/testData/helpers/diagnostics/enumClasses.kt b/compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt similarity index 100% rename from compiler/tests-spec/testData/helpers/diagnostics/enumClasses.kt rename to compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt diff --git a/compiler/tests-spec/testData/diagnostics/helpers/functions.kt b/compiler/tests-spec/testData/diagnostics/helpers/functions.kt new file mode 100644 index 00000000000..57e3c6bb6e5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/helpers/functions.kt @@ -0,0 +1,7 @@ +fun _funWithoutArgs(): Int { + return Any().hashCode().toInt() +} + +fun _funWithAnyArg(value_1: Any): Int { + return value_1.hashCode() +} diff --git a/compiler/tests-spec/testData/helpers/diagnostics/objects.kt b/compiler/tests-spec/testData/diagnostics/helpers/objects.kt similarity index 100% rename from compiler/tests-spec/testData/helpers/diagnostics/objects.kt rename to compiler/tests-spec/testData/diagnostics/helpers/objects.kt diff --git a/compiler/tests-spec/testData/helpers/diagnostics/sealedClasses.kt b/compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt similarity index 100% rename from compiler/tests-spec/testData/helpers/diagnostics/sealedClasses.kt rename to compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt diff --git a/compiler/tests-spec/testData/helpers/diagnostics/typeAliases.kt b/compiler/tests-spec/testData/diagnostics/helpers/typeAliases.kt similarity index 100% rename from compiler/tests-spec/testData/helpers/diagnostics/typeAliases.kt rename to compiler/tests-spec/testData/diagnostics/helpers/typeAliases.kt diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.1.kt similarity index 95% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.1.kt index 4936394aebc..8c03beec61a 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.2.kt similarity index 95% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/1.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.2.kt index 51de76fb102..0e03d9a76e7 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.2.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/3.1.kt similarity index 97% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/3.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/3.1.kt index 67ba826e240..e02416fb4ae 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/3.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [3] The bound expression is of type kotlin.Boolean and the conditions contain both: NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/6.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/6.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt index 8a73ce823cf..7ac7f2ed2fa 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/6.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [6] The bound expression is of a sealed class type and all its possible subtypes are covered using type test conditions of this expression; NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/7.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt index 4667da81e0d..65eb6a4c4d1 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [7] The bound expression is of an Enum classes type and all enumerated values are checked for equality using constant conditions; NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.1.kt index ebc76ba6f89..987079a9709 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt index 87391877215..3fd0fe144ef 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.3.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt index 0cbeddf93f8..3e5cdadabc9 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 3 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.1.kt similarity index 95% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.1.kt index 1ab682b8abb..da6153db4da 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.2.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.2.kt index 766e252b807..36739710153 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.2.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.3.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt index 221cf208145..09e3adc4c36 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [1] It has an else entry; NUMBER: 3 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/3.1.kt similarity index 95% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/3.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/3.1.kt index ecf630eeafc..e9982ca1632 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/3.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [3] The bound expression is of type kotlin.Boolean and the conditions contain both: NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/6.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/6.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt index 9ac28683542..83cf3cb1f0b 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/6.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When valueession + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [6] The bound valueession is of a sealed class type and all its possible subtypes are covered using type test conditions of this valueession; NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt similarity index 95% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/7.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt index 5acea8fb535..5053f7dc517 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [7] The bound expression is of an Enum classes type and all enumerated values are checked for equality using constant conditions; NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.1.kt index 538c4189f66..e441a0d8725 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt index 61de8d6e24e..739d64ff630 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.3.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt index 89a5a6f755e..e1794f10e68 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 11 SENTENCE: [8] The bound expression is of a nullable type and one of the cases above is met for its non-nullable counterpart and, in addition, there is a condition containing literal null. NUMBER: 3 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.1.kt similarity index 89% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos/3.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.1.kt index d026af963a0..49de5595fbc 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 2 SENTENCE: [3] When expression has two different forms: with bound value and without it. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.2.kt similarity index 88% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos/3.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.2.kt index 5fc120e3eb6..8ecd2b5a6c7 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos/3.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.2.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 2 SENTENCE: [3] When expression has two different forms: with bound value and without it. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/1.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/1.1.kt index 6095b620c1e..cfed09cea94 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 3 SENTENCE: [1] When expression without bound value (the form where the expression enclosed in parantheses is absent) evaluates one of the many different expressions based on corresponding conditions present in the same when entry. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/2.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt index 467c1a41ee8..85a59fc2fb5 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/2.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt index 958213edb67..62118e0c27d 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/2.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt index f207d299944..154aca6e740 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt @@ -1,12 +1,12 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -DEBUG_INFO_SMARTCAST // !WITH_BASIC_TYPES // !WITH_CLASSES -// !WITH_FUNS +// !WITH_FUNCTIONS /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 3 SENTENCE: [1] When expression without bound value (the form where the expression enclosed in parantheses is absent) evaluates one of the many different expressions based on corresponding conditions present in the same when entry. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt index bf750225f67..630ec72a720 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.2.kt similarity index 94% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.2.kt index 9b259920193..026bf0a1e60 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.2.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.3.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt index e198b5085b5..60a879c8d7d 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 3 SENTENCE: [2] Each entry consists of a boolean condition (or a special else condition), each of which is checked and evaluated in order of appearance. NUMBER: 3 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg/1.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/neg/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg/1.1.kt index 0a8c8f81177..783e855ba34 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 5 SENTENCE: [1] The else entry is also special in the sense that it must be the last entry in the expression, otherwise a compiler error must be generated. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos/1.1.kt similarity index 95% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/pos/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos/1.1.kt index 2b51b5d5ddf..f0dda665a20 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 5 SENTENCE: [1] The else entry is also special in the sense that it must be the last entry in the expression, otherwise a compiler error must be generated. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg/1.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/neg/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg/1.1.kt index 2611ebf15f3..61e02793025 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg/1.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 6 SENTENCE: [1] When expression with bound value (the form where the expression enclosed in parantheses is present) are very similar to the form without bound value, but use different syntax for conditions. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/pos/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt index 85b59ad0ec5..b3c27ca348b 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt @@ -1,12 +1,12 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION // !WITH_BASIC_TYPES -// !WITH_FUNS +// !WITH_FUNCTIONS // !WITH_CLASSES /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 6 SENTENCE: [1] When expression with bound value (the form where the expression enclosed in parantheses is present) are very similar to the form without bound value, but use different syntax for conditions. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt index b1b0731cbc1..c7fd105b8b8 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt similarity index 93% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/1.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt index b2783880367..1be2bdb7e40 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt similarity index 94% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/3.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt index cc5e9392e8f..baabc613a4e 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [3] Contains test condition: containment operator followed by an expression. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt similarity index 97% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/3.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt index 088eda81cc4..75b01cdcbac 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/3.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [3] Contains test condition: containment operator followed by an expression. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/5.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.1.kt index bec35f82af3..9b913c9e9ab 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/5.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [5] Any other expression. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/5.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.2.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/5.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.2.kt index 51f9f81d1a0..026da87c82f 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/5.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.2.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [5] Any other expression. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/7.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/7.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/7.1.kt index 31da9912a5e..22ebc85ed81 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/7.1.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [7] The else condition, which works the exact same way as it would in the form without bound expression. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt index 8d652369b5d..bb154232531 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt index 97973c96d9e..efc906f4cd6 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.3.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt index 780d9cff526..0ce24a40ad9 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 3 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.4.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt index 2ab17dc869a..1c3a83fe0c9 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt @@ -3,7 +3,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [1] Type test condition: type checking operator followed by type. NUMBER: 4 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/3.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt index a6c1f0397ff..01b0387a3ae 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [3] Contains test condition: containment operator followed by an expression. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/3.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt index 2e35fbab1b6..093972c6dd3 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/3.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [3] Contains test condition: containment operator followed by an expression. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/5.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt index 510aae7bfe1..47208e4c6b6 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/5.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt @@ -1,11 +1,11 @@ // !WITH_BASIC_TYPES -// !WITH_FUNS +// !WITH_FUNCTIONS // !WITH_CLASSES /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [5] Any other expression. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/5.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/5.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt index 09cccb2c59c..a4c412bfc39 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/5.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt @@ -1,11 +1,11 @@ // !WITH_BASIC_TYPES // !WITH_CLASSES -// !WITH_FUNS +// !WITH_FUNCTIONS /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [5] Any other expression. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/7.1.kt similarity index 96% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/7.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/7.1.kt index 633835da7bf..03aaa4dee3c 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/7.1.kt @@ -1,7 +1,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 7 SENTENCE: [7] The else condition, which works the exact same way as it would in the form without bound expression. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt index 3c0e02a9ff7..dacc3951751 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt index 0653f4c639f..4c9663675d9 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.3.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt index c302985e8a7..e3c85158578 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 3 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.4.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt index cfedcd3e6c9..5a31d8ed68e 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 4 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt index 80e049e0929..957eff84ea1 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt index 65f8561aacb..23d722a2c5a 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt similarity index 98% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.3.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt index 18157af38a6..f02c2fbeb54 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt @@ -4,7 +4,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 3 diff --git a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt similarity index 99% rename from compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.4.kt rename to compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt index 1d7a29b9796..628cbabd49d 100644 --- a/compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt @@ -5,7 +5,7 @@ /* KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - SECTION: 16.30 When expression + SECTION: when-expression PARAGRAPH: 9 SENTENCE: [1] The type of the resulting expression is the least upper bound of the types of all the entries. NUMBER: 4 diff --git a/compiler/tests-spec/testData/helpers/diagnostics/funs.kt b/compiler/tests-spec/testData/helpers/diagnostics/funs.kt deleted file mode 100644 index 6685358da7a..00000000000 --- a/compiler/tests-spec/testData/helpers/diagnostics/funs.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun _funWithoutArgs(): Int { - return Any().hashCode().toInt() -} diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestSpec.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestSpec.kt index 5eb0ed09c5d..b7aa0febe88 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestSpec.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestSpec.kt @@ -9,8 +9,7 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.spec.DiagnosticSpecTestValidator -import org.jetbrains.kotlin.spec.SpecTestValidationException +import org.jetbrains.kotlin.spec.validators.* import org.jetbrains.kotlin.test.* import org.junit.Assert import java.io.File @@ -19,38 +18,50 @@ abstract class AbstractDiagnosticsTestSpec : AbstractDiagnosticsTest() { companion object { // map of pairs: source helper filename - target helper filename private val directives = mapOf( - "WITH_BASIC_TYPES" to Pair("basicTypes.kt", "BASIC_TYPES.kt"), - "WITH_CLASSES" to Pair("classes.kt", "CLASSES.kt"), - "WITH_ENUM_CLASSES" to Pair("enumClasses.kt", "ENUM_CLASSES.kt"), - "WITH_SEALED_CLASSES" to Pair("sealedClasses.kt", "SEALED_CLASSES.kt"), - "WITH_FUNS" to Pair("funs.kt", "FUNS.kt"), - "WITH_OBJECTS" to Pair("objects.kt", "OBJECTS.kt"), - "WITH_TYPEALIASES" to Pair("typeAliases.kt", "TYPE_ALIASES.kt") + "WITH_BASIC_TYPES" to "basicTypes.kt", + "WITH_CLASSES" to "classes.kt", + "WITH_ENUM_CLASSES" to "enumClasses.kt", + "WITH_SEALED_CLASSES" to "sealedClasses.kt", + "WITH_FUNCTIONS" to "functions.kt", + "WITH_OBJECTS" to "objects.kt", + "WITH_TYPEALIASES" to "typeAliases.kt", + "WITH_CONTRACT_FUNCTIONS" to "contractFunctions.kt" ) - private const val MODULE_PATH = "./compiler/tests-spec" - private const val HELPERS_PATH = "$MODULE_PATH/testData/helpers/diagnostics" + private val withoutDescriptorsTestGroups = listOf( + "linked/when-expression" + ) + + private const val MODULE_PATH = "compiler/tests-spec" + private const val DIAGNOSTICS_TESTDATA_PATH = "$MODULE_PATH/testData/diagnostics" + private const val HELPERS_PATH = "$DIAGNOSTICS_TESTDATA_PATH/helpers" } - private lateinit var testValidator: DiagnosticSpecTestValidator + private lateinit var testValidator: AbstractSpecTestValidator + private var skipDescriptors = true private fun checkDirective(directive: String, testFiles: List) = testFiles.any { it.directives.contains(directive) } + private fun enableDescriptorsGenerationIfNeeded(testDataFile: File) { + skipDescriptors = withoutDescriptorsTestGroups.any { + val testGroupAbsolutePath = File("$DIAGNOSTICS_TESTDATA_PATH/$it").absolutePath + testDataFile.absolutePath.startsWith(testGroupAbsolutePath) + } + } + override fun getConfigurationKind() = ConfigurationKind.ALL - override fun skipDescriptorsValidation(): Boolean = true + override fun skipDescriptorsValidation() = skipDescriptors override fun getKtFiles(testFiles: List, includeExtras: Boolean): List { val ktFiles = super.getKtFiles(testFiles, includeExtras) as ArrayList if (includeExtras) { - for ((name, filenames) in directives) { + for ((name, filename) in directives) { if (checkDirective(name, testFiles)) { - val (sourceFilename, targetFilename) = filenames - val declarations = File("$HELPERS_PATH/$sourceFilename").readText() - - ktFiles.add(KotlinTestUtils.createFile(targetFilename, declarations, project)) + val declarations = File("$HELPERS_PATH/$filename").readText() + ktFiles.add(KotlinTestUtils.createFile(filename, declarations, project)) } } } @@ -59,7 +70,9 @@ abstract class AbstractDiagnosticsTestSpec : AbstractDiagnosticsTest() { } override fun analyzeAndCheck(testDataFile: File, files: List) { - testValidator = DiagnosticSpecTestValidator(testDataFile) + enableDescriptorsGenerationIfNeeded(testDataFile) + + testValidator = AbstractSpecTestValidator.getInstanceByType(testDataFile) try { testValidator.parseTestInfo() @@ -80,12 +93,13 @@ abstract class AbstractDiagnosticsTestSpec : AbstractDiagnosticsTest() { moduleBindings: Map, languageVersionSettingsByModule: Map ) { + val diagnosticValidator = DiagnosticTestTypeValidator(testFiles) try { - testValidator.validateTestType(testFiles) + testValidator.validateTestType(computedTestType = diagnosticValidator.computeTestType()) } catch (e: SpecTestValidationException) { Assert.fail(e.description) } finally { - testValidator.printDiagnosticStatistic() + diagnosticValidator.printDiagnosticStatistic() } } } diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java index bf55d0451a3..33b41fb4714 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java @@ -26,547 +26,560 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInDiagnostics() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true, "helpers"); } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression") + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class S_16_30_when_expression extends AbstractDiagnosticsTestSpec { + public static class Linked extends AbstractDiagnosticsTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - public void testAllFilesPresentInS_16_30_when_expression() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + public void testAllFilesPresentInLinked() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11") + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class P_11 extends AbstractDiagnosticsTestSpec { + public static class When_expression extends AbstractDiagnosticsTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - public void testAllFilesPresentInP_11() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + public void testAllFilesPresentInWhen_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg") + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class Neg extends AbstractDiagnosticsTestSpec { + public static class P_11 extends AbstractDiagnosticsTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/1.1.kt"); + public void testAllFilesPresentInP_11() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("1.2.kt") - public void test1_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/1.2.kt"); + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/1.2.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/3.1.kt"); + } + + @TestMetadata("6.1.kt") + public void test6_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt"); + } + + @TestMetadata("7.1.kt") + public void test7_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt"); + } + + @TestMetadata("8.1.kt") + public void test8_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.1.kt"); + } + + @TestMetadata("8.2.kt") + public void test8_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt"); + } + + @TestMetadata("8.3.kt") + public void test8_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } - @TestMetadata("3.1.kt") - public void test3_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/3.1.kt"); - } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } - @TestMetadata("6.1.kt") - public void test6_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/6.1.kt"); - } + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.1.kt"); + } - @TestMetadata("7.1.kt") - public void test7_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/7.1.kt"); - } + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.2.kt"); + } - @TestMetadata("8.1.kt") - public void test8_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.1.kt"); - } + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt"); + } - @TestMetadata("8.2.kt") - public void test8_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.2.kt"); - } + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/3.1.kt"); + } - @TestMetadata("8.3.kt") - public void test8_3() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg/8.3.kt"); - } + @TestMetadata("6.1.kt") + public void test6_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt"); + } - public void testAllFilesPresentInNeg() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + @TestMetadata("7.1.kt") + public void test7_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt"); + } + + @TestMetadata("8.1.kt") + public void test8_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.1.kt"); + } + + @TestMetadata("8.2.kt") + public void test8_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt"); + } + + @TestMetadata("8.3.kt") + public void test8_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos") + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class Pos extends AbstractDiagnosticsTestSpec { + public static class P_2 extends AbstractDiagnosticsTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.1.kt"); + public void testAllFilesPresentInP_2() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("1.2.kt") - public void test1_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.2.kt"); - } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } - @TestMetadata("1.3.kt") - public void test1_3() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/1.3.kt"); - } + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.1.kt"); + } - @TestMetadata("3.1.kt") - public void test3_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/3.1.kt"); - } + @TestMetadata("3.2.kt") + public void test3_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos/3.2.kt"); + } - @TestMetadata("6.1.kt") - public void test6_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/6.1.kt"); - } - - @TestMetadata("7.1.kt") - public void test7_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/7.1.kt"); - } - - @TestMetadata("8.1.kt") - public void test8_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.1.kt"); - } - - @TestMetadata("8.2.kt") - public void test8_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.2.kt"); - } - - @TestMetadata("8.3.kt") - public void test8_3() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos/8.3.kt"); - } - - public void testAllFilesPresentInPos() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-11/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } } - } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class P_2 extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInP_2() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos") + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class Pos extends AbstractDiagnosticsTestSpec { + public static class P_3 extends AbstractDiagnosticsTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - @TestMetadata("3.1.kt") - public void test3_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos/3.1.kt"); + public void testAllFilesPresentInP_3() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("3.2.kt") - public void test3_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos/3.2.kt"); + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/1.1.kt"); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } - public void testAllFilesPresentInPos() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt"); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.2.kt"); + } + + @TestMetadata("2.3.kt") + public void test2_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } } - } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class P_3 extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInP_3() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg") + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class Neg extends AbstractDiagnosticsTestSpec { + public static class P_5 extends AbstractDiagnosticsTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/1.1.kt"); + public void testAllFilesPresentInP_5() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("2.1.kt") - public void test2_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/2.1.kt"); + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } - @TestMetadata("2.2.kt") - public void test2_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg/2.2.kt"); - } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } - public void testAllFilesPresentInNeg() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-5/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos") + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class Pos extends AbstractDiagnosticsTestSpec { + public static class P_6 extends AbstractDiagnosticsTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/1.1.kt"); + public void testAllFilesPresentInP_6() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - @TestMetadata("2.1.kt") - public void test2_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.1.kt"); + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } - @TestMetadata("2.2.kt") - public void test2_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.2.kt"); - } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } - @TestMetadata("2.3.kt") - public void test2_3() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos/2.3.kt"); - } + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt"); + } - public void testAllFilesPresentInPos() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } } - } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class P_5 extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInP_5() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/neg") + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class Neg extends AbstractDiagnosticsTestSpec { + public static class P_7 extends AbstractDiagnosticsTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/neg/1.1.kt"); + public void testAllFilesPresentInP_7() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - public void testAllFilesPresentInNeg() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt"); + } + + @TestMetadata("3.2.kt") + public void test3_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt"); + } + + @TestMetadata("5.1.kt") + public void test5_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.1.kt"); + } + + @TestMetadata("5.2.kt") + public void test5_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/5.2.kt"); + } + + @TestMetadata("7.1.kt") + public void test7_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/7.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt"); + } + + @TestMetadata("3.2.kt") + public void test3_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt"); + } + + @TestMetadata("5.1.kt") + public void test5_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt"); + } + + @TestMetadata("5.2.kt") + public void test5_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt"); + } + + @TestMetadata("7.1.kt") + public void test7_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/7.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/pos") + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) - public static class Pos extends AbstractDiagnosticsTestSpec { + public static class P_9 extends AbstractDiagnosticsTestSpec { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); } - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/pos/1.1.kt"); + public void testAllFilesPresentInP_9() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } - public void testAllFilesPresentInPos() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-5/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - } - } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class P_6 extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt"); + } - public void testAllFilesPresentInP_6() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt"); + } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/neg") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Neg extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/neg/1.1.kt"); - } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } - public void testAllFilesPresentInNeg() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - } + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt"); + } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/pos") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Pos extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt"); + } - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/pos/1.1.kt"); - } + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt"); + } - public void testAllFilesPresentInPos() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-6/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - } - } + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt"); + } - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class P_7 extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInP_7() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Neg extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/1.1.kt"); - } - - @TestMetadata("1.2.kt") - public void test1_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/1.2.kt"); - } - - @TestMetadata("3.1.kt") - public void test3_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/3.1.kt"); - } - - @TestMetadata("3.2.kt") - public void test3_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/3.2.kt"); - } - - @TestMetadata("5.1.kt") - public void test5_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/5.1.kt"); - } - - @TestMetadata("5.2.kt") - public void test5_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/5.2.kt"); - } - - @TestMetadata("7.1.kt") - public void test7_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg/7.1.kt"); - } - - public void testAllFilesPresentInNeg() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Pos extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.1.kt"); - } - - @TestMetadata("1.2.kt") - public void test1_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.2.kt"); - } - - @TestMetadata("1.3.kt") - public void test1_3() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.3.kt"); - } - - @TestMetadata("1.4.kt") - public void test1_4() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/1.4.kt"); - } - - @TestMetadata("3.1.kt") - public void test3_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/3.1.kt"); - } - - @TestMetadata("3.2.kt") - public void test3_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/3.2.kt"); - } - - @TestMetadata("5.1.kt") - public void test5_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/5.1.kt"); - } - - @TestMetadata("5.2.kt") - public void test5_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/5.2.kt"); - } - - @TestMetadata("7.1.kt") - public void test7_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos/7.1.kt"); - } - - public void testAllFilesPresentInPos() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-7/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - } - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class P_9 extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInP_9() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Neg extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.1.kt"); - } - - @TestMetadata("1.2.kt") - public void test1_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.2.kt"); - } - - @TestMetadata("1.3.kt") - public void test1_3() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.3.kt"); - } - - @TestMetadata("1.4.kt") - public void test1_4() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg/1.4.kt"); - } - - public void testAllFilesPresentInNeg() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Pos extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.1.kt"); - } - - @TestMetadata("1.2.kt") - public void test1_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.2.kt"); - } - - @TestMetadata("1.3.kt") - public void test1_3() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.3.kt"); - } - - @TestMetadata("1.4.kt") - public void test1_4() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos/1.4.kt"); - } - - public void testAllFilesPresentInPos() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/s-16.30_when-expression/p-9/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } } } } diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerSpecTests.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerSpecTests.kt index 8d6578495ff..0baeab18915 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerSpecTests.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerSpecTests.kt @@ -11,7 +11,7 @@ import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTestSpec fun main(args: Array) { testGroup("compiler/tests-spec/tests", "compiler/tests-spec/testData") { testClass { - model("diagnostics") + model("diagnostics", excludeDirs = listOf("helpers")) } } } \ No newline at end of file diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/DiagnosticSpecTestValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/DiagnosticSpecTestValidator.kt deleted file mode 100644 index dc3553a5a16..00000000000 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/DiagnosticSpecTestValidator.kt +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.spec - -import org.jetbrains.kotlin.checkers.BaseDiagnosticsTest -import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.diagnostics.Severity -import java.io.File - -class DiagnosticSpecTestValidator(testDataFile: File) : SpecTestValidator(testDataFile, TestArea.DIAGNOSTICS) { - private lateinit var diagnostics: MutableList - private lateinit var diagnosticStats: MutableMap - private lateinit var diagnosticSeverityStats: MutableMap - - private fun collectDiagnosticStatistic() { - diagnosticSeverityStats = mutableMapOf() - - diagnostics.forEach { - val severity = it.factory.severity - - if (diagnosticSeverityStats.contains(severity)) { - diagnosticSeverityStats[severity] = diagnosticSeverityStats[severity]!! + 1 - } else { - diagnosticSeverityStats[severity] = 1 - } - } - } - - private fun computeTestType(): TestType { - return if (Severity.ERROR in diagnosticSeverityStats) TestType.NEGATIVE else TestType.POSITIVE - } - - private fun collectDiagnostics(files: List) { - diagnostics = mutableListOf() - diagnosticStats = mutableMapOf() - - files.forEach { - it.actualDiagnostics.forEach { - val diagnosticName = it.diagnostic.factory.name - - if (diagnosticStats.contains(diagnosticName)) { - diagnosticStats[diagnosticName] = diagnosticStats[diagnosticName]!! + 1 - } else { - diagnosticStats[diagnosticName] = 1 - } - - diagnostics.add(it.diagnostic) - } - } - - collectDiagnosticStatistic() - } - - fun validateTestType(files: List) { - if (!this::diagnostics.isInitialized) this.collectDiagnostics(files) - - validateTestType(computeTestType()) - } - - fun printDiagnosticStatistic() { - val diagnostics = if (diagnosticStats.isNotEmpty()) "$diagnosticSeverityStats | $diagnosticStats" else "does not contain" - - println("DIAGNOSTICS: $diagnostics") - } -} \ No newline at end of file diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/SpecTestValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/SpecTestValidator.kt deleted file mode 100644 index ab60ca069fe..00000000000 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/SpecTestValidator.kt +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.spec - -import java.io.File -import java.util.regex.Matcher -import java.util.regex.Pattern - -enum class TestType(val type: String) { - POSITIVE("pos"), - NEGATIVE("neg"); - - companion object { - private val map = TestType.values().associateBy(TestType::type) - fun fromValue(type: String) = map[type] - } -} - -enum class TestArea { - PSI, - DIAGNOSTICS, - CODEGEN -} - -interface SpecTestInfoElementType { - val valuePattern: Pattern? - val required: Boolean -} - -enum class SpecTestFileInfoElementType( - override val valuePattern: Pattern? = null, - override val required: Boolean = false -) : SpecTestInfoElementType { - SECTION( - valuePattern = Pattern.compile("""(?(?:${SpecTestValidator.INTEGER_REGEX})(?:\.${SpecTestValidator.INTEGER_REGEX})*)(?.*?)"""), - required = true - ), - PARAGRAPH(required = true), - SENTENCE( - valuePattern = Pattern.compile("""\[(?${SpecTestValidator.INTEGER_REGEX})\](?.*?)"""), - required = true - ), - NUMBER(required = true), - DESCRIPTION(required = true), - ISSUES(valuePattern = Pattern.compile("""(KT-[1-9]\d*)(,\s*KT-[1-9]\d*)*""")), - UNEXPECTED_BEHAVIOUR, - DISCUSSION, - NOTE -} - -enum class SpecTestCaseInfoElementType( - override val valuePattern: Pattern? = null, - override val required: Boolean = false -) : SpecTestInfoElementType { - CASE_DESCRIPTION(required = true), - ISSUES(valuePattern = SpecTestFileInfoElementType.ISSUES.valuePattern), - UNEXPECTED_BEHAVIOUR, - DISCUSSION, - NOTE -} - -data class SpecTestInfoElementContent( - val content: String, - val additionalMatcher: Matcher? = null -) - -data class SpecTestCase( - val number: Int, - val description: String, - val unexpectedBehavior: Boolean, - val issues: List? -) - -class SpecTest( - val testArea: TestArea, - val testType: TestType, - val sectionNumber: String, - val sectionName: String, - val paragraphNumber: Int, - val sentenceNumber: Int, - val sentence: String? = null, - val testNumber: Int, - val description: String? = null, - val cases: List? = null, - val unexpectedBehavior: Boolean? = null, - val issues: Set? = null -) { - fun checkConsistency(other: SpecTest): Boolean { - return this.testArea == other.testArea - && this.testType == other.testType - && this.sectionNumber == other.sectionNumber - && this.testNumber == other.testNumber - && this.paragraphNumber == other.paragraphNumber - && this.sentenceNumber == other.sentenceNumber - } -} - -enum class SpecTestValidationFailedReason(val description: String) { - FILENAME_NOT_VALID( - "Incorrect test filename or folder name.${SpecTestValidator.lineSeparator}" + - "It must match the following path pattern: " + - "testsData//s_/p-//_.kt " + - "(example: testsData/diagnostic/s-16.30_when-expression/p-3/pos/1.3.kt)" - ), - TESTINFO_NOT_VALID("Test info is incorrect."), - FILEPATH_AND_TESTINFO_IN_FILE_NOT_CONSISTENCY("Test info from filepath and file content is not consistency"), - TEST_IS_NOT_POSITIVE("Test is not positive because it contains error elements (PsiErrorElement or diagnostic with error severity)."), - TEST_IS_NOT_NEGATIVE("Test is not negative because it not contains error type elements (PsiErrorElement or diagnostic with error severity)."), - UNKNOWN("Unknown validation error.") -} - -class SpecTestValidationException(reason: SpecTestValidationFailedReason, details: String = "") : Exception() { - val description = "${reason.description} $details" -} - -typealias SpecTestInfoElements = Map - -abstract class SpecTestValidator(private val testDataFile: File, private val testArea: TestArea) { - private lateinit var testInfoByFilename: SpecTest - private lateinit var testInfoByContent: SpecTest - private val testInfo by lazy { testInfoByContent } - - companion object { - const val INTEGER_REGEX = """[1-9]\d*""" - private const val SINGLELINE_COMMENT_REGEX = """\/\/\s*%s""" - private const val MULTILINE_COMMENT_REGEX = """\/\*\s*%s\s+\*\/""" - - val lineSeparator: String = System.lineSeparator() - private val testCaseInfoRegex = """(?CASE DESCRIPTION:[\s\S]*?$lineSeparator)""" - private val testAreaRegex = """(?${TestArea.values().joinToString("|")})""" - private val testTypeRegex = """(?${TestType.values().joinToString("|")})""" - private val testInfoElementPattern: Pattern = Pattern.compile("""\s*(?[A-Z ]*?):\s*(?.*?)$lineSeparator""") - private val pathSeparator = Pattern.quote(File.separator) - - val testPathPattern: Pattern = - Pattern.compile("""^.*?$pathSeparator(?diagnostics|psi|codegen)${pathSeparator}s-(?(?:$INTEGER_REGEX)(?:\.$INTEGER_REGEX)*)_(?[\w-]+)${pathSeparator}p-(?$INTEGER_REGEX)$pathSeparator(?pos|neg)$pathSeparator(?$INTEGER_REGEX)\.(?$INTEGER_REGEX)\.kt$""") - val testInfoPattern: Pattern = - Pattern.compile(MULTILINE_COMMENT_REGEX.format("""KOTLIN $testAreaRegex SPEC TEST \($testTypeRegex\)$lineSeparator(?[\s\S]*?$lineSeparator)""")) - val testCaseInfoSinglelinePattern: Pattern = Pattern.compile(SINGLELINE_COMMENT_REGEX.format(testCaseInfoRegex)) - val testCaseInfoMultilinePattern: Pattern = Pattern.compile(MULTILINE_COMMENT_REGEX.format(testCaseInfoRegex)) - - private fun getTestInfo( - testInfoMatcher: Matcher, - testInfoElements: SpecTestInfoElements, - testCases: List, - unexpectedBehavior: Boolean = false, - issues: Set? = null - ): SpecTest { - val sectionMatcher = testInfoElements[SpecTestFileInfoElementType.SECTION]!!.additionalMatcher!! - val sentenceMatcher = testInfoElements[SpecTestFileInfoElementType.SENTENCE]!!.additionalMatcher!! - - return SpecTest( - TestArea.valueOf(testInfoMatcher.group("testArea").toUpperCase()), - TestType.valueOf(testInfoMatcher.group("testType")), - sectionMatcher.group("number"), - sectionMatcher.group("name"), - testInfoElements[SpecTestFileInfoElementType.PARAGRAPH]!!.content.toInt(), - sentenceMatcher.group("number").toInt(), - sentenceMatcher.group("text"), - testInfoElements[SpecTestFileInfoElementType.NUMBER]!!.content.toInt(), - testInfoElements[SpecTestFileInfoElementType.DESCRIPTION]!!.content, - testCases, - unexpectedBehavior, - issues - ) - } - - private fun getTestInfo(testInfoMatcher: Matcher): SpecTest { - return SpecTest( - TestArea.valueOf(testInfoMatcher.group("testArea").toUpperCase()), - TestType.fromValue(testInfoMatcher.group("testType"))!!, - testInfoMatcher.group("sectionNumber"), - testInfoMatcher.group("sectionName"), - testInfoMatcher.group("paragraphNumber").toInt(), - testInfoMatcher.group("sentenceNumber").toInt(), - testNumber = testInfoMatcher.group("testNumber").toInt() - ) - } - - private fun parseIssues(issues: SpecTestInfoElementContent?) = issues?.content?.split(",") - - private fun getSingleTestCase(testInfoElements: SpecTestInfoElements) = SpecTestCase( - 1, - description = testInfoElements[SpecTestFileInfoElementType.DESCRIPTION]!!.content, - unexpectedBehavior = testInfoElements.contains(SpecTestFileInfoElementType.UNEXPECTED_BEHAVIOUR), - issues = parseIssues(testInfoElements[SpecTestFileInfoElementType.ISSUES]) - ) - - private fun getTestCasesInfo(testCaseInfoMatcher: Matcher, infoElements: SpecTestInfoElements): List { - val testCases = mutableListOf() - var testCasesCounter = 1 - - while (testCaseInfoMatcher.find()) { - val caseInfoElements = getTestInfoElements(testCaseInfoMatcher.group("infoElements")) - - testCases.add( - SpecTestCase( - testCasesCounter++, - caseInfoElements[SpecTestCaseInfoElementType.CASE_DESCRIPTION]!!.content, - caseInfoElements.contains(SpecTestCaseInfoElementType.UNEXPECTED_BEHAVIOUR), - parseIssues(caseInfoElements[SpecTestCaseInfoElementType.ISSUES]) - ) - ) - } - - if (testCases.isEmpty()) testCases.add(getSingleTestCase(infoElements)) - - return testCases - } - - private inline fun > getTestInfoElements(testInfoElements: String): SpecTestInfoElements { - val testInfoElementsMap = mutableMapOf() - val testInfoElementMatcher = testInfoElementPattern.matcher(testInfoElements) - - while (testInfoElementMatcher.find()) { - val testInfoOriginalElementName = testInfoElementMatcher.group("name") - val testInfoElementName: SpecTestInfoElementType - try { - testInfoElementName = enumValueOf(testInfoOriginalElementName.replace(" ", "_")) as SpecTestInfoElementType - } catch (e: IllegalArgumentException) { - throw SpecTestValidationException( - SpecTestValidationFailedReason.TESTINFO_NOT_VALID, - "Unknown '$testInfoOriginalElementName' test info element name." - ) - } - val testInfoElementValue = testInfoElementMatcher.group("value") - val testInfoElementValueMatcher = testInfoElementName.valuePattern?.matcher(testInfoElementValue) - - if (testInfoElementValueMatcher != null && !testInfoElementValueMatcher.find()) - throw SpecTestValidationException( - SpecTestValidationFailedReason.TESTINFO_NOT_VALID, - "'$testInfoElementValue' in '$testInfoElementName' is not parsed." - ) - - testInfoElementsMap[testInfoElementName] = SpecTestInfoElementContent(testInfoElementValue, testInfoElementValueMatcher) - } - - enumValues().forEach { - it as SpecTestInfoElementType - if (it.required && !testInfoElementsMap.contains(it)) { - throw SpecTestValidationException( - SpecTestValidationFailedReason.TESTINFO_NOT_VALID, - "$it in case or test info is required." - ) - } - } - - return testInfoElementsMap - } - - private fun getIssues(testCases: List, testIssues: List?): Set { - val issues = mutableSetOf() - - testCases.forEach { - if (it.issues != null) issues.addAll(it.issues) - } - - if (testIssues != null) issues.addAll(testIssues) - - return issues - } - } - - fun parseTestInfo() { - val testInfoByFilenameMatcher = testPathPattern.matcher(testDataFile.path) - - if (!testInfoByFilenameMatcher.find()) - throw SpecTestValidationException(SpecTestValidationFailedReason.FILENAME_NOT_VALID) - - val fileContent = testDataFile.readText() - val testInfoByContentMatcher = testInfoPattern.matcher(fileContent) - - if (!testInfoByContentMatcher.find()) - throw SpecTestValidationException(SpecTestValidationFailedReason.TESTINFO_NOT_VALID) - - val testInfoElements = getTestInfoElements(testInfoByContentMatcher.group("infoElements")) - val testCases = getTestCasesInfo(testCaseInfoSinglelinePattern.matcher(fileContent), testInfoElements) + - getTestCasesInfo(testCaseInfoMultilinePattern.matcher(fileContent), testInfoElements) - - testInfoByFilename = getTestInfo(testInfoByFilenameMatcher) - testInfoByContent = getTestInfo( - testInfoByContentMatcher, - testInfoElements, - testCases = testCases, - unexpectedBehavior = testInfoElements.contains(SpecTestFileInfoElementType.UNEXPECTED_BEHAVIOUR) || testCases.any { it.unexpectedBehavior }, - issues = getIssues(testCases, parseIssues(testInfoElements[SpecTestFileInfoElementType.ISSUES])) - ) - - if (!testInfoByFilename.checkConsistency(testInfoByContent)) - throw SpecTestValidationException(SpecTestValidationFailedReason.FILEPATH_AND_TESTINFO_IN_FILE_NOT_CONSISTENCY) - } - - protected fun validateTestType(computedTestType: TestType) { - if (computedTestType != testInfo.testType) { - val isNotNegative = computedTestType == TestType.POSITIVE && testInfo.testType == TestType.NEGATIVE - val isNotPositive = computedTestType == TestType.NEGATIVE && testInfo.testType == TestType.POSITIVE - val reason = when { - isNotNegative -> SpecTestValidationFailedReason.TEST_IS_NOT_NEGATIVE - isNotPositive -> SpecTestValidationFailedReason.TEST_IS_NOT_POSITIVE - else -> SpecTestValidationFailedReason.UNKNOWN - } - throw SpecTestValidationException(reason) - } - } - - fun printTestInfo() { - println("--------------------------------------------------") - if (testInfoByContent.unexpectedBehavior!!) - println("(!!!) HAS UNEXPECTED BEHAVIOUR (!!!)") - println("$testArea ${testInfoByFilename.testType} SPEC TEST") - println("SECTION: ${testInfoByFilename.sectionNumber} ${testInfoByContent.sectionName} (paragraph: ${testInfoByFilename.paragraphNumber})") - println("SENTENCE ${testInfoByContent.sentenceNumber}: ${testInfoByContent.sentence}") - println("TEST NUMBER: ${testInfoByContent.testNumber}") - println("NUMBER OF TEST CASES: ${testInfoByContent.cases!!.size}") - println("DESCRIPTION: ${testInfoByContent.description}") - if (testInfoByContent.issues!!.isNotEmpty()) { - println("LINKED ISSUES: ${testInfoByContent.issues!!.joinToString(", ")}") - } - } -} \ No newline at end of file diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/AbstractSpecTestValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/AbstractSpecTestValidator.kt new file mode 100644 index 00000000000..d65d48b3b30 --- /dev/null +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/AbstractSpecTestValidator.kt @@ -0,0 +1,291 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.spec.validators + +import java.io.File +import java.util.regex.Matcher +import java.util.regex.Pattern + +enum class TestType(val type: String) { + POSITIVE("pos"), + NEGATIVE("neg"); + + companion object { + private val map = TestType.values().associateBy(TestType::type) + fun fromValue(type: String) = map[type] + } +} + +enum class TestArea { + PSI, + DIAGNOSTICS, + CODEGEN +} + +enum class SpecTestLinkedType { + LINKED, + NOT_LINKED +} + +interface SpecTestInfoElementType { + val valuePattern: Pattern? + val required: Boolean +} + +enum class SpecTestCaseInfoElementType( + override val valuePattern: Pattern? = null, + override val required: Boolean = false +) : SpecTestInfoElementType { + CASE_DESCRIPTION(required = true), + ISSUES(valuePattern = LinkedSpecTestFileInfoElementType.ISSUES.valuePattern), + UNEXPECTED_BEHAVIOUR, + DISCUSSION, + NOTE +} + +data class SpecTestInfoElementContent( + val content: String, + val additionalMatcher: Matcher? = null +) + +data class SpecTestCase( + val number: Int, + val description: String, + val unexpectedBehavior: Boolean, + val issues: List? +) + +enum class SpecTestValidationFailedReason(val description: String) { + FILENAME_NOT_VALID("Incorrect test filename or folder name."), + TESTINFO_NOT_VALID("Test info is incorrect."), + FILEPATH_AND_TESTINFO_IN_FILE_NOT_CONSISTENCY("Test info from filepath and file content is not consistency"), + TEST_IS_NOT_POSITIVE("Test is not positive because it contains error elements (PsiErrorElement or diagnostic with error severity)."), + TEST_IS_NOT_NEGATIVE("Test is not negative because it not contains error type elements (PsiErrorElement or diagnostic with error severity)."), + UNKNOWN("Unknown validation error.") +} + +class SpecTestValidationException(reason: SpecTestValidationFailedReason, details: String = "") : Exception() { + val description = "${reason.description} $details" +} + +typealias SpecTestInfoElements = Map + +interface SpecTestValidatorHelperObject { + val pathPartRegex: String + val filenameRegex: String + fun getPathPattern(): Pattern +} + +abstract class AbstractSpecTest( + val testArea: TestArea, + val testType: TestType, + val section: String, + val testNumber: Int, + val description: String? = null, + val cases: List? = null, + val unexpectedBehavior: Boolean? = null, + val issues: Set? = null +) { + abstract fun checkConsistency(other: AbstractSpecTest): Boolean +} + +abstract class AbstractSpecTestValidator(private val testDataFile: File) { + val testInfo by lazy { testInfoByContent } + + protected lateinit var testInfoByFilename: T + protected lateinit var testInfoByContent: T + abstract val testPathPattern: Pattern + abstract val testInfoPattern: Pattern + + companion object { + const val ISSUE_TRACKER = "https://youtrack.jetbrains.com/issue/" + const val INTEGER_REGEX = """[1-9]\d*""" + const val MULTILINE_COMMENT_REGEX = """\/\*\s*%s\s+\*\/\n*""" + private const val SINGLELINE_COMMENT_REGEX = """\/\/\s*%s\n*""" + + val pathSeparator: String = Pattern.quote(File.separator) + val lineSeparator: String = System.lineSeparator() + val testAreaRegex = """(?${TestArea.values().joinToString("|")})""" + val testTypeRegex = """(?${TestType.values().joinToString("|")})""" + val dirsByLinkedType = mapOf( + SpecTestLinkedType.LINKED to "linked", + SpecTestLinkedType.NOT_LINKED to "notLinked" + ) + private val testInfoElementPattern: Pattern = Pattern.compile("""\s*(?[A-Z ]+?)(?::\s*(?.*?))?$lineSeparator""") + private val testCaseInfoRegex = """(?CASE DESCRIPTION:[\s\S]*?$lineSeparator)$lineSeparator*""" + private val testPathBaseRegexTemplate = """^.*?$pathSeparator(?diagnostics|psi|codegen)$pathSeparator%s""" + val testPathRegexTemplate = """$testPathBaseRegexTemplate$pathSeparator(?pos|neg)/%s$""" + val testCaseInfoSingleLinePattern: Pattern = Pattern.compile(SINGLELINE_COMMENT_REGEX.format(testCaseInfoRegex)) + val testCaseInfoMultilinePattern: Pattern = Pattern.compile(MULTILINE_COMMENT_REGEX.format(testCaseInfoRegex)) + + fun getInstanceByType(testFile: File) = when { + Pattern.compile(testPathBaseRegexTemplate.format(LinkedSpecTestValidator.pathPartRegex)).matcher(testFile.absolutePath).find() -> + LinkedSpecTestValidator(testFile) + Pattern.compile(testPathBaseRegexTemplate.format(NotLinkedSpecTestValidator.pathPartRegex)).matcher(testFile.absolutePath).find() -> + NotLinkedSpecTestValidator(testFile) + else -> throw SpecTestValidationException(SpecTestValidationFailedReason.FILENAME_NOT_VALID) + } + + fun getInstanceByType(testPath: String) = getInstanceByType(File(testPath)) + + private fun getTestInfoElements( + testInfoElementRules: Array, + testInfoElements: String + ): SpecTestInfoElements { + val testInfoElementsMap = mutableMapOf() + val testInfoElementMatcher = testInfoElementPattern.matcher(testInfoElements) + + while (testInfoElementMatcher.find()) { + val testInfoOriginalElementName = testInfoElementMatcher.group("name") + val testInfoElementName = testInfoElementRules.find { + it as Enum<*> + it.name == testInfoOriginalElementName.replace(" ", "_") + } ?: throw SpecTestValidationException( + SpecTestValidationFailedReason.TESTINFO_NOT_VALID, + "Unknown '$testInfoOriginalElementName' test info element name." + ) + val testInfoElementValue = testInfoElementMatcher.group("value") + val testInfoElementValueMatcher = testInfoElementName.valuePattern?.matcher(testInfoElementValue) + + if (testInfoElementValueMatcher != null && !testInfoElementValueMatcher.find()) + throw SpecTestValidationException( + SpecTestValidationFailedReason.TESTINFO_NOT_VALID, + "'$testInfoElementValue' in '$testInfoElementName' is not parsed." + ) + + testInfoElementsMap[testInfoElementName] = + SpecTestInfoElementContent(testInfoElementValue ?: "", testInfoElementValueMatcher) + } + + testInfoElementRules.forEach { + if (it.required && !testInfoElementsMap.contains(it)) { + throw SpecTestValidationException( + SpecTestValidationFailedReason.TESTINFO_NOT_VALID, + "$it in case or test info is required." + ) + } + } + + return testInfoElementsMap + } + + private fun getIssues(testCases: List, testIssues: List?): Set { + val issues = mutableSetOf() + + testCases.forEach { + if (it.issues != null) issues.addAll(it.issues) + } + + if (testIssues != null) issues.addAll(testIssues) + + return issues + } + + fun parseIssues(issues: SpecTestInfoElementContent?) = issues?.content?.split(",") + } + + private fun getTestCasesInfo( + testCaseInfoMatcher: Matcher, + infoElements: SpecTestInfoElements + ): List { + val testCases = mutableListOf() + var testCasesCounter = 1 + + while (testCaseInfoMatcher.find()) { + val caseInfoElements = getTestInfoElements( + SpecTestCaseInfoElementType.values(), + testCaseInfoMatcher.group("infoElements") + ) + + testCases.add( + SpecTestCase( + testCasesCounter++, + caseInfoElements[SpecTestCaseInfoElementType.CASE_DESCRIPTION]!!.content, + caseInfoElements.contains(SpecTestCaseInfoElementType.UNEXPECTED_BEHAVIOUR), + parseIssues(caseInfoElements[SpecTestCaseInfoElementType.ISSUES]) + ) + ) + } + + if (testCases.isEmpty()) + testCases.add(getSingleTestCase(infoElements)) + + return testCases + } + + abstract fun getSingleTestCase(testInfoElements: SpecTestInfoElements) : SpecTestCase + + fun testInfoFilter(fileContent: String): String = + testInfoPattern.matcher(fileContent).replaceAll("").let { + testCaseInfoSingleLinePattern.matcher(it).replaceAll("").let { + testCaseInfoMultilinePattern.matcher(it).replaceAll("") + } + } + + abstract fun getTestInfo( + testInfoMatcher: Matcher, + testInfoElements: SpecTestInfoElements, + testCases: List, + unexpectedBehavior: Boolean = false, + issues: Set? = null + ): T + + abstract fun getTestInfo(testInfoMatcher: Matcher): T + + abstract fun parseTestInfo() + + abstract fun printTestInfo() + + fun parseTestInfo(testInfoElementsRules: Array) { + val testInfoByFilenameMatcher = testPathPattern.matcher(testDataFile.canonicalPath) + + if (!testInfoByFilenameMatcher.find()) + throw SpecTestValidationException(SpecTestValidationFailedReason.FILENAME_NOT_VALID) + + val fileContent = testDataFile.readText() + val testInfoByContentMatcher = testInfoPattern.matcher(fileContent) + + if (!testInfoByContentMatcher.find()) + throw SpecTestValidationException(SpecTestValidationFailedReason.TESTINFO_NOT_VALID) + + val testInfoElements = getTestInfoElements( + testInfoElementsRules, + testInfoByContentMatcher.group("infoElements") + ) + val testCases = getTestCasesInfo(testCaseInfoSingleLinePattern.matcher(fileContent), testInfoElements) + + getTestCasesInfo(testCaseInfoMultilinePattern.matcher(fileContent), testInfoElements) + + testInfoByFilename = getTestInfo(testInfoByFilenameMatcher) + testInfoByContent = getTestInfo( + testInfoByContentMatcher, + testInfoElements, + testCases = testCases, + unexpectedBehavior = testInfoElements.contains(LinkedSpecTestFileInfoElementType.UNEXPECTED_BEHAVIOUR) || testCases.any { it.unexpectedBehavior }, + issues = getIssues( + testCases, + parseIssues( + testInfoElements[LinkedSpecTestFileInfoElementType.ISSUES] + ) + ) + ) + + if (!testInfoByFilename.checkConsistency(testInfoByContent)) + throw SpecTestValidationException(SpecTestValidationFailedReason.FILEPATH_AND_TESTINFO_IN_FILE_NOT_CONSISTENCY) + } + + fun validateTestType(computedTestType: TestType) { + if (computedTestType != testInfo.testType) { + val isNotNegative = computedTestType == TestType.POSITIVE && testInfo.testType == TestType.NEGATIVE + val isNotPositive = computedTestType == TestType.NEGATIVE && testInfo.testType == TestType.POSITIVE + val reason = when { + isNotNegative -> SpecTestValidationFailedReason.TEST_IS_NOT_NEGATIVE + isNotPositive -> SpecTestValidationFailedReason.TEST_IS_NOT_POSITIVE + else -> SpecTestValidationFailedReason.UNKNOWN + } + throw SpecTestValidationException(reason) + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/DiagnosticTestTypeValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/DiagnosticTestTypeValidator.kt new file mode 100644 index 00000000000..e55b09575dc --- /dev/null +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/DiagnosticTestTypeValidator.kt @@ -0,0 +1,46 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.spec.validators + +import org.jetbrains.kotlin.checkers.BaseDiagnosticsTest +import org.jetbrains.kotlin.diagnostics.Diagnostic +import org.jetbrains.kotlin.diagnostics.Severity + +class DiagnosticTestTypeValidator(testFiles: List) { + private val diagnostics = mutableListOf() + private val diagnosticStats = mutableMapOf() + private val diagnosticSeverityStats = mutableMapOf() + + init { + collectDiagnostics(testFiles) + } + + private fun collectDiagnosticStatistic() { + diagnostics.forEach { + val severity = it.factory.severity + diagnosticSeverityStats.run { put(severity, getOrDefault(severity, 0) + 1) } + } + } + + private fun collectDiagnostics(files: List) { + files.forEach { + it.actualDiagnostics.forEach { + val diagnosticName = it.diagnostic.factory.name + diagnosticStats.run { put(diagnosticName, getOrDefault(diagnosticName, 0) + 1) } + diagnostics.add(it.diagnostic) + } + } + collectDiagnosticStatistic() + } + + fun computeTestType() = + if (Severity.ERROR in diagnosticSeverityStats) TestType.NEGATIVE else TestType.POSITIVE + + fun printDiagnosticStatistic() { + val diagnostics = if (diagnosticStats.isNotEmpty()) "$diagnosticSeverityStats | $diagnosticStats" else "does not contain" + println("DIAGNOSTICS: $diagnostics") + } +} \ No newline at end of file diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/LinkedSpecTestValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/LinkedSpecTestValidator.kt new file mode 100644 index 00000000000..b064329b1ae --- /dev/null +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/LinkedSpecTestValidator.kt @@ -0,0 +1,122 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.spec.validators + +import java.io.File +import java.util.regex.Matcher +import java.util.regex.Pattern + +enum class LinkedSpecTestFileInfoElementType( + override val valuePattern: Pattern? = null, + override val required: Boolean = false +) : SpecTestInfoElementType { + SECTION(required = true), + PARAGRAPH(required = true), + SENTENCE( + valuePattern = Pattern.compile("""\[(?${AbstractSpecTestValidator.INTEGER_REGEX})\](?.*?)"""), + required = true + ), + NUMBER(required = true), + DESCRIPTION(required = true), + ISSUES(valuePattern = Pattern.compile("""(KT-[1-9]\d*)(,\s*KT-[1-9]\d*)*""")), + UNEXPECTED_BEHAVIOUR, + DISCUSSION, + NOTE +} + +class LinkedSpecTest( + testArea: TestArea, + testType: TestType, + section: String, + val paragraphNumber: Int, + val sentenceNumber: Int, + val sentence: String? = null, + testNumber: Int, + description: String? = null, + cases: List? = null, + unexpectedBehavior: Boolean? = null, + issues: Set? = null +) : AbstractSpecTest(testArea, testType, section, testNumber, description, cases, unexpectedBehavior, issues) { + override fun checkConsistency(other: AbstractSpecTest) = + other is LinkedSpecTest + && this.section == other.section + && this.testArea == other.testArea + && this.testType == other.testType + && this.testNumber == other.testNumber + && this.paragraphNumber == other.paragraphNumber + && this.sentenceNumber == other.sentenceNumber +} + +class LinkedSpecTestValidator(testDataFile: File) : AbstractSpecTestValidator(testDataFile) { + override val testPathPattern = getPathPattern() + override val testInfoPattern: Pattern = + Pattern.compile(MULTILINE_COMMENT_REGEX.format("""KOTLIN $testAreaRegex SPEC TEST \($testTypeRegex\)$lineSeparator(?[\s\S]*?$lineSeparator)""")) + + companion object : SpecTestValidatorHelperObject { + override val pathPartRegex = + """${dirsByLinkedType[SpecTestLinkedType.LINKED]}$pathSeparator(?
[\w-]+)${pathSeparator}p-(?$INTEGER_REGEX)""" + override val filenameRegex = """(?$INTEGER_REGEX)\.(?$INTEGER_REGEX)\.kt""" + override fun getPathPattern(): Pattern = Pattern.compile(testPathRegexTemplate.format(pathPartRegex, filenameRegex)) + } + + override fun getTestInfo( + testInfoMatcher: Matcher, + testInfoElements: SpecTestInfoElements, + testCases: List, + unexpectedBehavior: Boolean, + issues: Set? + ): LinkedSpecTest { + val sentenceMatcher = testInfoElements[LinkedSpecTestFileInfoElementType.SENTENCE]!!.additionalMatcher!! + + return LinkedSpecTest( + TestArea.valueOf(testInfoMatcher.group("testArea").toUpperCase()), + TestType.valueOf(testInfoMatcher.group("testType")), + testInfoElements[LinkedSpecTestFileInfoElementType.SECTION]!!.content, + testInfoElements[LinkedSpecTestFileInfoElementType.PARAGRAPH]!!.content.toInt(), + sentenceMatcher.group("number").toInt(), + sentenceMatcher.group("text"), + testInfoElements[LinkedSpecTestFileInfoElementType.NUMBER]!!.content.toInt(), + testInfoElements[LinkedSpecTestFileInfoElementType.DESCRIPTION]!!.content, + testCases, + unexpectedBehavior, + issues + ) + } + + override fun getTestInfo(testInfoMatcher: Matcher) = + LinkedSpecTest( + TestArea.valueOf(testInfoMatcher.group("testArea").toUpperCase()), + TestType.fromValue(testInfoMatcher.group("testType"))!!, + testInfoMatcher.group("section"), + testInfoMatcher.group("paragraphNumber").toInt(), + testInfoMatcher.group("sentenceNumber").toInt(), + testNumber = testInfoMatcher.group("testNumber").toInt() + ) + + override fun parseTestInfo() = parseTestInfo(LinkedSpecTestFileInfoElementType.values()) + + override fun printTestInfo() { + println("--------------------------------------------------") + if (testInfoByContent.unexpectedBehavior!!) + println("(!!!) HAS UNEXPECTED BEHAVIOUR (!!!)") + println("${testInfoByFilename.testArea} ${testInfoByFilename.testType} SPEC TEST") + println("SECTION: ${testInfoByContent.section} (paragraph: ${testInfoByFilename.paragraphNumber})") + println("SENTENCE ${testInfoByContent.sentenceNumber}: ${testInfoByContent.sentence}") + println("TEST NUMBER: ${testInfoByContent.testNumber}") + println("NUMBER OF TEST CASES: ${testInfoByContent.cases!!.size}") + println("DESCRIPTION: ${testInfoByContent.description}") + if (testInfoByContent.issues!!.isNotEmpty()) + println("LINKED ISSUES: ${testInfoByContent.issues!!.map { ISSUE_TRACKER + it }.joinToString(", ")}") + } + + override fun getSingleTestCase(testInfoElements: SpecTestInfoElements) = + SpecTestCase( + 1, + description = testInfoElements[LinkedSpecTestFileInfoElementType.DESCRIPTION]!!.content, + unexpectedBehavior = testInfoElements.contains(LinkedSpecTestFileInfoElementType.UNEXPECTED_BEHAVIOUR), + issues = parseIssues(testInfoElements[LinkedSpecTestFileInfoElementType.ISSUES]) + ) +} diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/NotLinkedSpecTestValidator.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/NotLinkedSpecTestValidator.kt new file mode 100644 index 00000000000..23f0dcbf4f4 --- /dev/null +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/validators/NotLinkedSpecTestValidator.kt @@ -0,0 +1,112 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.spec.validators + +import java.io.File +import java.util.regex.Matcher +import java.util.regex.Pattern + +enum class NotLinkedSpecTestFileInfoElementType( + override val valuePattern: Pattern? = null, + override val required: Boolean = false +) : SpecTestInfoElementType { + SECTION(required = true), + CATEGORY( + valuePattern = Pattern.compile("""\w+(,\s+\w+)*"""), + required = true + ), + NUMBER(required = true), + DESCRIPTION(required = true), + ISSUES(valuePattern = LinkedSpecTestFileInfoElementType.ISSUES.valuePattern), + UNEXPECTED_BEHAVIOUR, + DISCUSSION, + NOTE +} + +class NotLinkedSpecTest( + testArea: TestArea, + testType: TestType, + section: String, + val categories: List, + testNumber: Int, + description: String? = null, + cases: List? = null, + unexpectedBehavior: Boolean? = null, + issues: Set? = null +) : AbstractSpecTest(testArea, testType, section, testNumber, description, cases, unexpectedBehavior, issues) { + override fun checkConsistency(other: AbstractSpecTest) = + other is NotLinkedSpecTest + && this.section == other.section + && this.testArea == other.testArea + && this.testType == other.testType + && this.categories.joinToString(",") == other.categories.joinToString(",") + && this.testNumber == other.testNumber +} + +class NotLinkedSpecTestValidator(testDataFile: File) : AbstractSpecTestValidator(testDataFile) { + override val testPathPattern = getPathPattern() + override val testInfoPattern: Pattern = + Pattern.compile(MULTILINE_COMMENT_REGEX.format("""KOTLIN $testAreaRegex NOT LINKED SPEC TEST \($testTypeRegex\)$lineSeparator(?[\s\S]*?$lineSeparator)""")) + + companion object : SpecTestValidatorHelperObject { + override val pathPartRegex = + """${dirsByLinkedType[SpecTestLinkedType.NOT_LINKED]}$pathSeparator(?
[\w-]+)$pathSeparator(?(?:[\w-]+)(?:/[\w-]+)*?)""" + override val filenameRegex = """(?$INTEGER_REGEX)\.kt""" + override fun getPathPattern(): Pattern = Pattern.compile(testPathRegexTemplate.format(pathPartRegex, filenameRegex)) + } + + override fun getTestInfo( + testInfoMatcher: Matcher, + testInfoElements: SpecTestInfoElements, + testCases: List, + unexpectedBehavior: Boolean, + issues: Set? + ) = + NotLinkedSpecTest( + TestArea.valueOf(testInfoMatcher.group("testArea").toUpperCase()), + TestType.valueOf(testInfoMatcher.group("testType")), + testInfoElements[NotLinkedSpecTestFileInfoElementType.SECTION]!!.content, + testInfoElements[NotLinkedSpecTestFileInfoElementType.CATEGORY]!!.content.split(Regex(""",\s*""")), + testInfoElements[NotLinkedSpecTestFileInfoElementType.NUMBER]!!.content.toInt(), + testInfoElements[NotLinkedSpecTestFileInfoElementType.DESCRIPTION]!!.content, + testCases, + unexpectedBehavior, + issues + ) + + override fun getTestInfo(testInfoMatcher: Matcher) = + NotLinkedSpecTest( + TestArea.valueOf(testInfoMatcher.group("testArea").toUpperCase()), + TestType.fromValue(testInfoMatcher.group("testType"))!!, + testInfoMatcher.group("section"), + testInfoMatcher.group("categories").split("/"), + testNumber = testInfoMatcher.group("testNumber").toInt() + ) + + override fun parseTestInfo() = parseTestInfo(NotLinkedSpecTestFileInfoElementType.values()) + + override fun printTestInfo() { + println("--------------------------------------------------") + if (testInfoByContent.unexpectedBehavior!!) + println("(!!!) HAS UNEXPECTED BEHAVIOUR (!!!)") + println("${testInfoByFilename.testArea} ${testInfoByFilename.testType} NOT LINKED SPEC TEST") + println("SECTION: ${testInfoByContent.section}") + println("CATEGORIES: ${testInfoByContent.categories.joinToString(", ")}") + println("TEST NUMBER: ${testInfoByContent.testNumber}") + println("NUMBER OF TEST CASES: ${testInfoByContent.cases!!.size}") + println("DESCRIPTION: ${testInfoByContent.description}") + if (testInfoByContent.issues!!.isNotEmpty()) + println("LINKED ISSUES: ${testInfoByContent.issues!!.map { ISSUE_TRACKER + it }.joinToString(", ")}") + } + + override fun getSingleTestCase(testInfoElements: SpecTestInfoElements) = + SpecTestCase( + 1, + description = testInfoElements[NotLinkedSpecTestFileInfoElementType.DESCRIPTION]!!.content, + unexpectedBehavior = testInfoElements.contains(NotLinkedSpecTestFileInfoElementType.UNEXPECTED_BEHAVIOUR), + issues = parseIssues(testInfoElements[NotLinkedSpecTestFileInfoElementType.ISSUES]) + ) +} \ No newline at end of file