diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg/2.1.exceptions.runtime.txt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg/2.1.exceptions.runtime.txt new file mode 100644 index 00000000000..0e98a88dce6 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg/2.1.exceptions.runtime.txt @@ -0,0 +1,2 @@ +java.lang.Exception +_2_1Kt.throwException(2.1.kt:14) diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg/2.1.kt new file mode 100644 index 00000000000..cbcc298cba2 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg/2.1.kt @@ -0,0 +1,28 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 2 -> sentence 2 + * RELEVANT PLACES: expressions, try-expression -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter. + * EXCEPTION: runtime + */ + +fun throwException(b: Boolean) = run { if (b) throw Exception() } +class ExcA() : Exception() + + +fun box() { + + var flag = false + try { + throwException(true) + flag = true + } catch (e: ExcA) { + + } + //result java.lang.Exception cos of type mismatch +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.1.kt new file mode 100644 index 00000000000..96d19a175f1 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.1.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 2 -> sentence 2 + * RELEVANT PLACES: expressions, try-expression -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter. + */ + +fun throwException(b: Boolean) = run { if (b) throw Exception() } + + +fun box(): String { + var flag = false + try { + throwException(true) + flag = true + } catch (e: Exception) { + if (!flag) + return "OK" + } + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.2.kt new file mode 100644 index 00000000000..81404a6beb0 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.2.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 2 -> sentence 2 + * RELEVANT PLACES: expressions, try-expression -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter. + */ + +fun throwExceptionB(b: Boolean) = run { if (b) throw ExcB() } + + +class ExcA() : Exception() +class ExcB() : Exception() + +fun box(): String { + + var flag = false + try { + throwExceptionB(true) + flag = true + } catch (e: ExcA) { + return "NOK" + } catch (e: ExcB) { + return if (flag) + "NOK" + else "OK" + } + return "NOK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.3.kt new file mode 100644 index 00000000000..146104552d7 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.3.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 2 -> sentence 2 + * RELEVANT PLACES: expressions, try-expression -> paragraph 2 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter. + */ + +fun throwExceptionB(b: Boolean) = run { if (b) throw ExcB() } + + +class ExcA() : Exception() +class ExcB() : Exception() + +fun box(): String { + + var flag = false + try { + throwExceptionB(true) + flag = true + } catch (e: ExcA) { + return "NOK" + } catch (e: Exception) { + return if (flag) + "NOK" + else "OK" + } + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/3.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/3.1.kt new file mode 100644 index 00000000000..25a561184dc --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/3.1.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 2 -> sentence 3 + * NUMBER: 1 + * DESCRIPTION: If there are several catch blocks which match the exception type, the first one is picked. + */ +fun throwExceptionB(b: Boolean) = run { if (b) throw ExcB() } + + +class ExcA() : Exception() +class ExcB() : Exception() + +fun box(): String { + + var flag = false + try { + throwExceptionB(true) + flag = true + } catch (e: ExcA) { + return "NOK" + } catch (e: Exception) { + return if (flag) + "NOK" + else "OK" + }catch (e : ExcB){ + return "NOK" + } + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/3.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/3.2.kt new file mode 100644 index 00000000000..ec1e242de74 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/3.2.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 2 -> sentence 3 + * NUMBER: 2 + * DESCRIPTION: If there are several catch blocks which match the exception type, the first one is picked. + */ + +fun throwExceptionB(b: Boolean) = run { if (b) throw ExcB() } + + +class ExcA() : Exception() +class ExcB() : Exception() + +fun box(): String { + + var flag = false + try { + throwExceptionB(true) + flag = true + } catch (e: ExcA) { + return "NOK" + } catch (e: ExcB) { + return if (flag) + "NOK" + else "OK" + }catch (e : Exception){ + return "NOK" + } + return "NOK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg/3.1.exceptions.runtime.txt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg/3.1.exceptions.runtime.txt new file mode 100644 index 00000000000..5f2b45d1430 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg/3.1.exceptions.runtime.txt @@ -0,0 +1,2 @@ +ExcA +_3_1Kt.throwExceptionA(3.1.kt:15) diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg/3.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg/3.1.kt new file mode 100644 index 00000000000..e316d533e30 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg/3.1.kt @@ -0,0 +1,28 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 5 -> sentence 3 + * RELEVANT PLACES: expressions, try-expression -> paragraph 4 -> sentence 1 + * exceptions, catching-exceptions -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack + * EXCEPTION: runtime + */ + +fun throwExceptionA(b: Boolean) = run { if (b) throw ExcA() } + +class ExcA() : Exception() +class ExcB() : Exception() + +fun box() { + try { + throwExceptionA(true) + } catch (e: ExcB) { + + } finally { + + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/1.1.kt new file mode 100644 index 00000000000..081590a2550 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/1.1.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 5 -> sentence 1 + * RELEVANT PLACES: expressions, try-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If no exception is thrown during the evaluation of the try body, no catch blocks are executed, the finally block is evaluated after the try body, and the program execution continues as normal. + */ + + +fun box(): String { + var isTryExecuted = false + var isCatched = false + var isFinallyExecuted = false + var isExecutedFully = false + try { + isTryExecuted = true + } catch (e: Exception) { + isCatched = true + } finally { + isFinallyExecuted = true + } + isExecutedFully = true + return if (isTryExecuted && !isCatched && isFinallyExecuted && isExecutedFully) "OK" + else "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/2.1.kt new file mode 100644 index 00000000000..4d71417e66a --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/2.1.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 5 -> sentence 2 + * RELEVANT PLACES: expressions, try-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: the finally block is evaluated after the evaluation of the matching catch block. + */ + +fun throwException(b: Boolean) = run { if (b) throw Exception() } + +fun box(): String { + var isTryExecuted = false + var isCatched = false + var isFinallyExecuted = false + var isExecutedFully = false + try { + isTryExecuted = true + throwException(true) + } catch (e: Exception) { + isCatched = true + } finally { + isFinallyExecuted = true + } + isExecutedFully = true + return if (isTryExecuted &&isCatched && isFinallyExecuted && isExecutedFully) "OK" + else "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/3.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/3.1.kt new file mode 100644 index 00000000000..1b5a849016a --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/3.1.kt @@ -0,0 +1,46 @@ +// SKIP_TXT + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 5 -> sentence 3 + * RELEVANT PLACES: expressions, try-expression -> paragraph 4 -> sentence 1 + * exceptions, catching-exceptions -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack + */ +fun throwExceptionA(b: Boolean) = run { if (b) throw ExcA() } + +class ExcA() : Exception() +class ExcB() : Exception() + +fun box(): String { + var isTryExecuted = false + var isCatched = false + var isFinallyExecuted = false + var isExecutedFully = false + var isTryExpressionPropagated = false + + try { + try { + isTryExecuted = true + throwExceptionA(true) + } catch (e: ExcB) { + isCatched = true + } finally { + isFinallyExecuted = true + } + } catch (e: ExcA) { + isTryExpressionPropagated = true + } + + isExecutedFully = true + return if (isTryExecuted && + !isCatched && + isFinallyExecuted && + isTryExpressionPropagated && + isExecutedFully + ) "OK" + else "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-6/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-6/pos/1.1.kt new file mode 100644 index 00000000000..fcfe6ba4313 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-6/pos/1.1.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 6 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION:The value of the try-expression is the same as the value of the last expression of the try or catch block + */ + +fun box(): String { + var a = 1 + val tryVal1 = try { 3 } catch (e: Exception) { 5 } + val tryVal2 = try { 3 ; throw Exception() } catch (e: Exception) { 5 } + if (tryVal1 == 3 && tryVal2 == 5) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-7/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-7/pos/1.1.kt new file mode 100644 index 00000000000..d946eda9faf --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-7/pos/1.1.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 7 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: finally block has no effect on the value returned by the try-expression + */ + +fun box(): String { + var a = 1 + val tryVal1 = try { 3 } catch (e: Exception) { 5 } finally { 100} + val tryVal2 = try { 3; throw Exception() } catch (e: Exception) { 5 } finally { 100 } + if (tryVal1 == 3 && tryVal2 == 5) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/testsMap.json new file mode 100644 index 00000000000..3bf797005ed --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/testsMap.json @@ -0,0 +1,182 @@ +{ + "7": { + "pos": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "finally block has no effect on the value returned by the try-expression", + "unexpectedBehaviour": false + } + ] + } + }, + "6": { + "pos": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "The value of the try-expression is the same as the value of the last expression of the try or catch block", + "unexpectedBehaviour": false + } + ] + } + }, + "2": { + "neg": { + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "unexpectedBehaviour": false + } + ], + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg/2.1.kt", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "unexpectedBehaviour": false + } + ], + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.3.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.2.kt", + "unexpectedBehaviour": false + } + ], + "3": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "If there are several catch blocks which match the exception type, the first one is picked.", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "If there are several catch blocks which match the exception type, the first one is picked.", + "unexpectedBehaviour": false + } + ] + } + }, + "5": { + "neg": { + "3": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "the finally block is evaluated after the evaluation of the matching catch block.", + "unexpectedBehaviour": false + } + ], + "3": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack", + "unexpectedBehaviour": false + } + ], + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "If no exception is thrown during the evaluation of the try body, no catch blocks are executed, the finally block is evaluated after the try body, and the program execution continues as normal.", + "unexpectedBehaviour": false + } + ] + } + }, + "4": { + "neg": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg/3.1.kt", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "the finally block is evaluated after the evaluation of the matching catch block.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/2.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/3.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "If no exception is thrown during the evaluation of the try body, no catch blocks are executed, the finally block is evaluated after the try body, and the program execution continues as normal.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/1.1.kt new file mode 100644 index 00000000000..f68743852b3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/1.1.kt @@ -0,0 +1,35 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE:expressions, try-expression -> paragraph 1 -> sentence 1 + * RELEVANT PLACES: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: try-expression has to start with a try body + */ +fun throwException(): Nothing = throw Exception() + + +// TESTCASE NUMBER: 1 + +fun case1() { + try throwException() +} + +// TESTCASE NUMBER: 2 + +fun case2() { + try = throwException() +} + +// TESTCASE NUMBER: 3 + +fun case3() { + try + val a = "" +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.kt new file mode 100644 index 00000000000..2fb357432ce --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.kt @@ -0,0 +1,75 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 1 -> sentence 3 + * RELEVANT PLACES: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: try-expression has to start with a try body and continue with zero ore more catch blocks + */ +fun throwException(): Nothing = throw Exception() + +class ExcA() : Exception() +class ExcB() : Exception() + +// TESTCASE NUMBER: 1 + +fun case1() { + try val a = "" + catch(e: Exception) {} + } + +// TESTCASE NUMBER: 2 + +fun case2() { + try { + val a = "" + } catch (e: Exception) +} + +// TESTCASE NUMBER: 3 + +fun case3() { + try { + val a = "" + throwException() + } catch (e: java.lang.IllegalArgumentException) { + + } catch (e: ExcB) +} + +// TESTCASE NUMBER: 4 + +fun case4() { + try { + throwException() + } catch () { + + } +} + +// TESTCASE NUMBER: 5 + +fun case5() { + try { + throwException() + } catch (e: ExcA, e2 : ExcB) + {} +} + + +// TESTCASE NUMBER: 6 + +fun case6() { + try { + val a = "" + throwException() + } catch (e: java.lang.IllegalArgumentException) { + } catch (e: ExcA) + catch (e: ExcB) { + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.kt new file mode 100644 index 00000000000..bca3f0b256d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.kt @@ -0,0 +1,79 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 1 -> sentence 4 + * RELEVANT PLACES: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: try-expression has to start with a try body, catch blocks and finally block + */ +fun throwException(): Nothing = throw Exception() + +class ExcA() : Exception() +class ExcB() : Exception() + +// TESTCASE NUMBER: 1 + +fun case1() { + try { + throwException() + } catch (e: ExcA) { + } finally { + } catch (e: ExcB) { + } +} + +// TESTCASE NUMBER: 2 + +fun case2() { + try { + throwException() + } catch (e: ExcB) { + } finally +} + +// TESTCASE NUMBER: 3 + +fun case3() { + try { + throwException() + } finally +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/5.1.kt new file mode 100644 index 00000000000..0ef72c65447 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/5.1.kt @@ -0,0 +1,31 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 1 -> sentence 5 + * RELEVANT PLACES: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: A valid try-expression must have at least one catch or finally block. + */ + +fun throwException(): Nothing = throw Exception() + +// TESTCASE NUMBER: 1 + +fun case1() { + try { + throwException() + } +} + +// TESTCASE NUMBER: 2 + +fun case2() { + try { + val a = "foo" + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/1.1.kt new file mode 100644 index 00000000000..f45204df820 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/1.1.kt @@ -0,0 +1,36 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE:expressions, try-expression -> paragraph 1 -> sentence 1 + * RELEVANT PLACES: expressions, try-expression -> paragraph 1 -> sentence 2 + * expressions, try-expression -> paragraph 1 -> sentence 5 + * NUMBER: 1 + * DESCRIPTION: try-expression has to start with a try body + */ +fun throwException(): Nothing = throw Exception() + + +// TESTCASE NUMBER: 1 + +fun case1() { + try { + throwException() + }finally { + "a" + } +} + +// TESTCASE NUMBER: 2 + +fun case2() { + try { + val a = throwException() + }catch (e: Exception) { + "a" + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.1.kt new file mode 100644 index 00000000000..318811e384b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.1.kt @@ -0,0 +1,38 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 1 -> sentence 3 + * RELEVANT PLACES: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: try-expression has to start with a try body and continue with zero ore more catch blocks + */ +fun throwException(): Nothing = throw Exception() + +// TESTCASE NUMBER: 1 + +fun case1() { + try { + val a = "" + } catch (e: Exception) { + } +} + +// TESTCASE NUMBER: 2 + +fun case2() { + try { + val a = "" + throwException() + } catch (e: IllegalArgumentException) { + } catch (e: ExcA) { + } catch (e: ExcB) { + } +} + +class ExcA() : Exception() +class ExcB() : Exception() \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.2.kt new file mode 100644 index 00000000000..2f0a45c9210 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.2.kt @@ -0,0 +1,61 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 1 -> sentence 3 + * RELEVANT PLACES: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: catch is a soft keyword + */ +fun throwException(): Nothing = throw Exception() + +// TESTCASE NUMBER: 1 +class Case1 { + fun catch(e: Exception) {} + + fun case1() { + catch(Exception()) + } +} + +// TESTCASE NUMBER: 2 +class Case2 { + class catch(e: Exception) {} + + fun case2() { + val c = catch(Exception()) + } +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun catch() {} + + fun case3() { + catch() + } +} + +// TESTCASE NUMBER: 4 +class Case4 { + class catch() {} + + fun case4() { + val c = catch() + } +} + +// TESTCASE NUMBER: 5 + +class Case5() { + interface catch + + fun case5(){ + val c = object :catch{} + } +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.1.kt new file mode 100644 index 00000000000..bd7a74d4770 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.1.kt @@ -0,0 +1,36 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 1 -> sentence 4 + * RELEVANT PLACES: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: try-expression has to start with a try body, catch blocks and finally block + */ +fun throwException(): Nothing = throw Exception() +class ExcA() : Exception() +class ExcB() : Exception() + +// TESTCASE NUMBER: 1 + +fun case1() { + try { + throwException() + } catch (e: ExcA) { + } catch (e: ExcB) { + } finally { + } +} + +// TESTCASE NUMBER: 2 + +fun case2() { + try { + throwException() + } finally { + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.2.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.2.kt new file mode 100644 index 00000000000..7d1e1743f00 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.2.kt @@ -0,0 +1,61 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 1 -> sentence 4 + * RELEVANT PLACES: expressions, try-expression -> paragraph 1 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: finally is a soft keyword + */ +fun throwException(): Nothing = throw Exception() + +// TESTCASE NUMBER: 1 +class Case1 { + fun finally(e: Exception) {} + + fun case1() { + finally(Exception()) + } +} + +// TESTCASE NUMBER: 2 +class Case2 { + class finally(e: Exception) {} + + fun case2() { + val c = finally(java.lang.Exception()) + } +} + +// TESTCASE NUMBER: 3 +class Case3 { + fun finally() {} + + fun case3() { + finally() + } +} + +// TESTCASE NUMBER: 4 +class Case4 { + class finally() {} + + fun case4() { + val c = finally() + } +} + +// TESTCASE NUMBER: 5 + +class Case5() { + interface finally + + fun case5(){ + val c = object :finally{} + } +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos/2.1.kt new file mode 100644 index 00000000000..ec3d9980c41 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos/2.1.kt @@ -0,0 +1,25 @@ +// !LANGUAGE: +NewInference +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 2 -> sentence 2 + * RELEVANT PLACES: expressions, try-expression -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter. + */ + + +// TESTCASE NUMBER: 1 + +fun case1() { + var flag = false + try { + throw Exception() + flag = true + } catch (e: Exception) { + assert(!flag) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/1.1.kt new file mode 100644 index 00000000000..c115925c78a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/1.1.kt @@ -0,0 +1,27 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 5 -> sentence 1 + * RELEVANT PLACES: expressions, try-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If no exception is thrown during the evaluation of the try body, no catch blocks are executed, the finally block is evaluated after the try body, and the program execution continues as normal. + */ + +// TESTCASE NUMBER: 1 + +fun case1(): String { + var flag = false + try { + flag = true + } catch (e: Exception) { + return "foo" + } finally { + return "FINALLY" + } + return "return" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/2.1.kt new file mode 100644 index 00000000000..d92e6cbcb6c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/2.1.kt @@ -0,0 +1,31 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 5 -> sentence 2 + * RELEVANT PLACES: expressions, try-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack. + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-23680 + */ +fun case1(): Int { + var a = 1 + try { + throw Exception() //invalid UNREACHABLE_CODE diagnostic + } catch (e: Exception) { + a = 5 + return++a + } finally { + return a + } + return 0 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.kt new file mode 100644 index 00000000000..1283b46d3e7 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.kt @@ -0,0 +1,66 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_VARIABLE -UNUSED_PARAMETER -FINAL_UPPER_BOUND +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 8 -> sentence 1 + * RELEVANT PLACES: expressions, try-expression -> paragraph 9 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The type of the try-expression is the least upper bound of the types of the last expressions of the try body and the last expressions of all the catch blocks + */ +fun throwExceptionA(b: Boolean) = run { if (b) throw ExcA() } + +open class A(var data: T) { + fun foo(d: A) {} +} + +class B(data: T) : A(data) + +// TESTCASE NUMBER: 1 + +fun case1() { + val tryVal: B = + try { + throwExceptionA(false) + A("") + } catch (e: Exception) { + B("") + } + + +} + +// TESTCASE NUMBER: 2 + +fun case2() { + val tryVal: A = + try { + throwExceptionA(false) + A("") + } catch (e: Exception) { + null + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-35494 + */ +fun case3() { + val tryVal: A = + try { + throwExceptionA(false) + A(2) + } catch (e: ExcA) { + A(null) //diag duplication + } catch (e: ExcB) { + B(null) //diag duplication + } +} + +class ExcA() : Exception() +class ExcB() : Exception() diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/pos/1.1.kt new file mode 100644 index 00000000000..2345ea75868 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/pos/1.1.kt @@ -0,0 +1,70 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, try-expression -> paragraph 8 -> sentence 1 + * RELEVANT PLACES: expressions, try-expression -> paragraph 9 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The type of the try-expression is the least upper bound of the types of the last expressions of the try body and the last expressions of all the catch blocks + * HELPERS: checkType + */ + +fun throwExceptionA(b: Boolean) = run { if (b) throw ExcA() } + +open class A(var data: T) {} + +class B(data: T) : A(data) + +// TESTCASE NUMBER: 1 + +fun case1() { + val tryVal = + try { + throwExceptionA(false) + A("") + } catch (e: Exception) { + B("") + } + + ")!>tryVal + tryVal checkType { check>() } +} + +// TESTCASE NUMBER: 2 + +fun case2() { + val tryVal = + try { + throwExceptionA(false) + A("") + } catch (e: Exception) { + null + } + ?")!>tryVal + tryVal checkType { check?>() } + +} + +// TESTCASE NUMBER: 3 + +fun case3() { + val tryVal = + try { + throwExceptionA(false) + A(2) + } catch (e: ExcA) { + A(0) + } catch (e: ExcB) { + B(null) + } + + ")!>tryVal + tryVal checkType { check>() } +} + +class ExcA() : Exception() +class ExcB() : Exception() \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/testsMap.json new file mode 100644 index 00000000000..1b3e110ecfe --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/testsMap.json @@ -0,0 +1,244 @@ +{ + "1": { + "neg": { + "3": [ + { + "specVersion": "0.1-218", + "casesNumber": 6, + "description": "try-expression has to start with a try body and continue with zero ore more catch blocks", + "unexpectedBehaviour": false + } + ], + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 6, + "description": "try-expression has to start with a try body and continue with zero ore more catch blocks", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 3, + "description": "try-expression has to start with a try body, catch blocks and finally block", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "A valid try-expression must have at least one catch or finally block.", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/5.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 3, + "description": "try-expression has to start with a try body", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/1.1.kt", + "unexpectedBehaviour": false + } + ], + "4": [ + { + "specVersion": "0.1-218", + "casesNumber": 3, + "description": "try-expression has to start with a try body, catch blocks and finally block", + "unexpectedBehaviour": false + } + ], + "5": [ + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "A valid try-expression must have at least one catch or finally block.", + "unexpectedBehaviour": false + } + ], + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 3, + "description": "try-expression has to start with a try body", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "3": [ + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "try-expression has to start with a try body and continue with zero ore more catch blocks", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 5, + "description": "catch is a soft keyword", + "unexpectedBehaviour": false + } + ], + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "try-expression has to start with a try body and continue with zero ore more catch blocks", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "try-expression has to start with a try body, catch blocks and finally block", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 5, + "description": "finally is a soft keyword", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 5, + "description": "catch is a soft keyword", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "try-expression has to start with a try body", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/1.1.kt", + "unexpectedBehaviour": false + } + ], + "4": [ + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "try-expression has to start with a try body, catch blocks and finally block", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 5, + "description": "finally is a soft keyword", + "unexpectedBehaviour": false + } + ], + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "try-expression has to start with a try body", + "unexpectedBehaviour": false + } + ] + } + }, + "8": { + "neg": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "The type of the try-expression is the least upper bound of the types of the last expressions of the try body and the last expressions of all the catch blocks", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 3, + "description": "The type of the try-expression is the least upper bound of the types of the last expressions of the try body and the last expressions of all the catch blocks", + "unexpectedBehaviour": false + } + ] + } + }, + "4": { + "neg": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "The type of the try-expression is the least upper bound of the types of the last expressions of the try body and the last expressions of all the catch blocks", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.kt", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 3, + "description": "The type of the try-expression is the least upper bound of the types of the last expressions of the try body and the last expressions of all the catch blocks", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/pos/1.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 1, + "description": "If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack.", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/2.1.kt", + "unexpectedBehaviour": true + }, + { + "specVersion": "0.1-218", + "casesNumber": 1, + "description": "If no exception is thrown during the evaluation of the try body, no catch blocks are executed, the finally block is evaluated after the try body, and the program execution continues as normal.", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "2": { + "pos": { + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 1, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "unexpectedBehaviour": false + } + ], + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 1, + "description": "catch block is evaluated immediately after the exception is thrown and the exception itself is passed inside the catch block as the corresponding parameter.", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos/2.1.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "5": { + "pos": { + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 1, + "description": "If an exception was thrown, but no catch block matched its type, the finally block is evaluated before propagating the exception up the call stack.", + "unexpectedBehaviour": true + } + ], + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 1, + "description": "If no exception is thrown during the evaluation of the try body, no catch blocks are executed, the finally block is evaluated after the try body, and the program execution continues as normal.", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java index 22f1a24ddbf..26f5edfdac3 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java @@ -1509,6 +1509,219 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Try_expression extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInTry_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/1.1.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/3.1.kt"); + } + + @TestMetadata("4.1.kt") + public void test4_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/4.1.kt"); + } + + @TestMetadata("5.1.kt") + public void test5_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg/5.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/1.1.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.1.kt"); + } + + @TestMetadata("3.2.kt") + public void test3_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/3.2.kt"); + } + + @TestMetadata("4.1.kt") + public void test4_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.1.kt"); + } + + @TestMetadata("4.2.kt") + public void test4_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos/4.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-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, this, testDataFilePath); + } + + public void testAllFilesPresentInP_2() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-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, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos/2.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-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, this, testDataFilePath); + } + + public void testAllFilesPresentInP_5() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-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, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/1.1.kt"); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos/2.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-5/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_8 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_8() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/try-expression/p-8/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java index eedf31bf36f..ea544fdf2f5 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java @@ -1126,6 +1126,209 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Try_expression extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInTry_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_2 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_2() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg/2.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.2.kt"); + } + + @TestMetadata("2.3.kt") + public void test2_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/2.3.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/3.1.kt"); + } + + @TestMetadata("3.2.kt") + public void test3_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos/3.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_5 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_5() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg/3.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/1.1.kt"); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/2.1.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos/3.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-5/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-6") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_6 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_6() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-6"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-6/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-6/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-6/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-7") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_7 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_7() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-7"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-7/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-7/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/try-expression/p-7/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)