diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.1.kt index 11b2c823f7a..dd0accc540d 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.1.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,8 @@ * NUMBER: 1 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * UNEXPECTED BEHAVIOUR + * HELPERS: reflect */ open class `true` { diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.10.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.10.kt index c2e77b854e1..360748474a1 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.10.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.10.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 10 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the companionObject. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.11.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.11.kt index 91cbc301804..0c02d16b064 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.11.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.11.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 11 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the function. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ fun `true`(): Boolean { diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.12.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.12.kt index d5f341a55f1..ea648e0b76f 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.12.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.12.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 12 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the setter. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ class A { diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.13.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.13.kt index 2c2a2016979..c3d0fd2d508 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.13.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.13.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 13 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the simpleUserType. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.14.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.14.kt index 0693a2b10d1..93a70725d6b 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.14.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.14.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 14 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeParameter. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.15.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.15.kt index 75dcac9b221..58e377e449b 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.15.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.15.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 15 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the parameter. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ fun f1(`true`: Boolean) = !!!`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.16.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.16.kt index 6bdcf0acb06..495a5677dc5 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.16.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.16.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 16 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the fileAnnotationComplex. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ @file:[org.jetbrains.`true`.`false`() `true`] diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.17.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.17.kt index b283419826f..12f484dc745 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.17.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.17.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 17 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the object. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ open class A { diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.18.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.18.kt index b897aea94f3..56fcbbda298 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.18.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.18.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 18 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeAlias. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ typealias `true` = Boolean diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.26.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.26.kt index f1e2a676459..95a27240313 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.26.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.26.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 26 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the callableReference. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ val Boolean.`true`: Boolean diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.3.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.3.kt index 2f20322978d..fa959c1f1f6 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.3.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.3.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 3 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeConstraint. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ class A <`true`, `false`> diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.4.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.4.kt index ca2793aff95..2ae73d30f7d 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.4.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.4.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 4 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the fileAnnotationSimple. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ @file:`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.5.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.5.kt index c22a08cdae4..28b94a8dd8b 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.5.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.5.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 5 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the packageComplex. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.6.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.6.kt index 50bbda438e2..3c0cef2f6b2 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.6.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.6.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 6 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the packageSimple. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ package `true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.9.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.9.kt index a5aeb9c5f20..25df44d8d8b 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.9.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.9.kt @@ -1,5 +1,3 @@ -// HELPERS: REFLECT - /* * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * @@ -8,6 +6,7 @@ * NUMBER: 9 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the unescapedAnnotation. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/diagnostics/helpers/basicTypes.kt b/compiler/tests-spec/testData/diagnostics/helpers/basicTypes.kt deleted file mode 100644 index 1c7488c4ca3..00000000000 --- a/compiler/tests-spec/testData/diagnostics/helpers/basicTypes.kt +++ /dev/null @@ -1,29 +0,0 @@ -fun getInt(arg: Any = Any()) = arg.hashCode() -fun getShort(arg: Any = Any()) = arg.hashCode().toShort() -fun getLong(arg: Any = Any()) = arg.hashCode().toLong() -fun getFloat(arg: Any = Any()) = arg.hashCode().toFloat() -fun getDouble(arg: Any = Any()) = arg.hashCode().toDouble() -fun getByte(arg: Any = Any()) = arg.hashCode().toByte() -fun getChar(arg: Any = Any()) = arg.hashCode().toChar() -fun getString(arg: Any = Any()) = arg.hashCode().toString() -fun getBoolean(arg: Any = Any()) = arg.hashCode() % 2 == 0 -fun getNothing(): Nothing = throw Exception() -fun getUnit() = {} -fun getAny() = Any() -fun getList() = mutableListOf() - -class _BasicTypesProvider { - fun getInt(arg: Any = Any()) = arg.hashCode() - fun getShort(arg: Any = Any()) = arg.hashCode().toShort() - fun getLong(arg: Any = Any()) = arg.hashCode().toLong() - fun getFloat(arg: Any = Any()) = arg.hashCode().toFloat() - fun getDouble(arg: Any = Any()) = arg.hashCode().toDouble() - fun getByte(arg: Any = Any()) = arg.hashCode().toByte() - fun getChar(arg: Any = Any()) = arg.hashCode().toChar() - fun getString(arg: Any = Any()) = arg.hashCode().toString() - fun getBoolean(arg: Any = Any()) = arg.hashCode() % 2 == 0 - fun getNothing(): Nothing = throw Exception() - fun getUnit() = {} - fun getAny() = Any() - fun getList() = mutableListOf() -} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/helpers/classes.kt b/compiler/tests-spec/testData/diagnostics/helpers/classes.kt index 0dd45f058fc..e228e183569 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/classes.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/classes.kt @@ -1,19 +1,23 @@ -class _Class { +class Class { val prop_1 = 1 val prop_2 = 2 val prop_3 = 3 + val prop_4: Float? = 3f + val prop_5: Float = 3f + val prop_6: String = "..." + val prop_7: Nothing? = "..." fun fun_1(): (Int) -> (Int) -> Int = {number: Int -> { number * 5 }} 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() + operator fun contains(a: Int) = a > 30 + operator fun contains(a: Long) = a > 30L + operator fun contains(a: Char) = a > 30.toChar() - 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) + fun getIntArray() = intArrayOf(1, 2, 3, 4, 5) + fun getLongArray() = longArrayOf(1L, 2L, 3L, 4L, 5L) + fun getCharArray() = charArrayOf(1.toChar(), 2.toChar(), 3.toChar(), 4.toChar(), 5.toChar()) class _NestedClass { val prop_4 = 4 @@ -21,15 +25,56 @@ class _Class { } } -class _EmptyClass {} +class EmptyClass {} -class _ClassWithCompanionObject { +class ClassWithCompanionObject { companion object {} } -open class _ClassLevel1 {} -open class _ClassLevel2: _ClassLevel1() {} -open class _ClassLevel3: _ClassLevel2() {} -open class _ClassLevel4: _ClassLevel3() {} -open class _ClassLevel5: _ClassLevel4() {} -class _ClassLevel6: _ClassLevel5() {} +open class ClassLevel1 { + fun test1() {} +} +open class ClassLevel2: ClassLevel1() { + fun test2() {} +} +open class ClassLevel3: ClassLevel2() { + fun test3() {} +} +open class ClassLevel4: ClassLevel3() { + fun test4() {} +} +open class ClassLevel5: ClassLevel4() { + fun test5() {} +} +class ClassLevel6: ClassLevel5() { + fun test6() {} +} + +class Inv(val x: T = null as T) { + fun test() {} + fun get() = x + fun put(x: T) {} + fun getNullable(): T? = select(x, null) +} + +class In() { + fun put(x: T) {} + fun getWithUpperBoundT(): K = x as K +} + +class Out(val x: T = null as T) { + fun get() = x +} + +open class ClassWithTwoTypeParameters { + fun test1(): T? { return null } + fun test2(): K? { return null } +} + +class ClassWithThreeTypeParameters( + val x: K, + val y: L, + val z: M +) + +class ClassWithSixTypeParameters diff --git a/compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt b/compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt index e404053ec2f..27628baf300 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt @@ -1,9 +1,21 @@ -enum class _EnumClass { +enum class EnumClass { NORTH, SOUTH, WEST, EAST } -enum class _EnumClassSingle { +enum class EnumClassSingle { EVERYTHING } -enum class _EnumClassEmpty +enum class EnumClassEmpty + +enum class EnumClassWithNullableProperty(val prop_1: Int?) { + A(1), + B(5), + D(null) +} + +enum class EnumClassWithProperty(val prop_1: Int) { + A(1), + B(5), + D(6) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/helpers/functions.kt b/compiler/tests-spec/testData/diagnostics/helpers/functions.kt index 57e3c6bb6e5..d2723375730 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/functions.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/functions.kt @@ -1,7 +1,19 @@ -fun _funWithoutArgs(): Int { +fun funWithoutArgs(): Int { return Any().hashCode().toInt() } -fun _funWithAnyArg(value_1: Any): Int { +fun funWithAnyArg(value_1: Any): Int { return value_1.hashCode() } + +fun select(vararg x: K): K = x[0] + +fun expandInv(vararg x: Inv): K = x[0] as K +fun expandIn(vararg x: In): K = x[0] as K +fun expandOut(vararg x: Out): K = x[0] as K + +fun expandInvWithRemoveNullable(vararg x: Inv): K = x[0] as K +fun expandInWithRemoveNullable(vararg x: In): K = x[0] as K +fun expandOutWithRemoveNullable(vararg x: Out): K = x[0] as K + +fun removeNullable(vararg x: K?): K = x as K diff --git a/compiler/tests-spec/testData/diagnostics/helpers/interfaces.kt b/compiler/tests-spec/testData/diagnostics/helpers/interfaces.kt new file mode 100644 index 00000000000..3caf7fc98b4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/helpers/interfaces.kt @@ -0,0 +1,49 @@ +interface EmptyInterface + +interface Interface1 { + fun itest() {} + fun itest1() {} +} + +interface Interface2 { + fun itest() {} + fun itest2() {} +} + +interface Interface3 { + fun itest() {} + fun itest3() {} +} + +interface InterfaceWithOutParameter + +interface InterfaceWithTypeParameter1 { + fun ip1test1(): T? = null as T? +} + +interface InterfaceWithTypeParameter2 { + fun ip1test2(): T? = null as T? +} + +interface InterfaceWithTypeParameter3 { + fun ip1test3(): T? = null as T? +} + +interface InterfaceWithFiveTypeParameters1 { + fun itest() {} + fun itest1() {} +} + +interface InterfaceWithFiveTypeParameters2 { + fun itest() {} + fun itest2() {} +} + +interface InterfaceWithFiveTypeParameters3 { + fun itest() {} + fun itest3() {} +} + +interface InterfaceWithTwoTypeParameters { + fun ip2test(): T? = null as T? +} diff --git a/compiler/tests-spec/testData/diagnostics/helpers/objects.kt b/compiler/tests-spec/testData/diagnostics/helpers/objects.kt index ea795bd73e4..8dfc914af5a 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/objects.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/objects.kt @@ -1 +1,28 @@ -object _EmptyObject {} \ No newline at end of file +object EmptyObject {} + +object Object { + val prop_1: Number? = 1 + val prop_2: Number = 1 +} + +object DeepObject { + val prop_1 = null + var prop_2 = null + object A { + object B { + object C { + object D { + object E { + object F { + object G { + object J { + val x: Int? = 10 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/helpers/properties.kt b/compiler/tests-spec/testData/diagnostics/helpers/properties.kt new file mode 100644 index 00000000000..9c670c2b14d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/helpers/properties.kt @@ -0,0 +1,16 @@ +val nullableNumberProperty: Number? = null + +val stringProperty: String = "" +val nullableStringProperty: String? = null + +val intProperty: Int = "" +val nullableIntProperty: Int? = null + +val implicitNullableNothingProperty = null +val nullableNothingProperty: Nothing? = null + +val anonymousTypeProperty = object {} + +val nullableAnonymousTypeProperty = if (true) object {} else null + +val nullableOut: Out? = null diff --git a/compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt b/compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt index 9309c664286..b692c13e582 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt @@ -1,36 +1,36 @@ -sealed class _SealedClass -data class _SealedChild1(val number: Int) : _SealedClass() -data class _SealedChild2(val e1: Int, val e2: Int) : _SealedClass() -data class _SealedChild3(val m1: Int, val m2: Int) : _SealedClass() +sealed class SealedClass +data class SealedChild1(val number: Int) : SealedClass() +data class SealedChild2(val e1: Int, val e2: Int) : SealedClass() +data class SealedChild3(val m1: Int, val m2: Int) : SealedClass() -sealed class _SealedClassWithObjects -object _SealedWithObjectsChild1 : _SealedClassWithObjects() -object _SealedWithObjectsChild2 : _SealedClassWithObjects() -object _SealedWithObjectsChild3 : _SealedClassWithObjects() +sealed class SealedClassWithObjects +object SealedWithObjectsChild1 : SealedClassWithObjects() +object SealedWithObjectsChild2 : SealedClassWithObjects() +object SealedWithObjectsChild3 : SealedClassWithObjects() -sealed class _SealedClassSingle -data class _SealedSingleChild1(val number: Int) : _SealedClassSingle() +sealed class SealedClassSingle +data class SealedSingleChild1(val number: Int) : SealedClassSingle() -sealed class _SealedClassSingleWithObject -object _SealedSingleWithObjectChild1: Expr3() {} +sealed class SealedClassSingleWithObject +object SealedSingleWithObjectChild1: Expr3() {} -sealed class _SealedClassEmpty +sealed class SealedClassEmpty -sealed class _SealedClassWithMethods -class _SealedWithMethodsChild1() : _SealedClassWithMethods() { +sealed class SealedClassWithMethods +class SealedWithMethodsChild1() : SealedClassWithMethods() { fun m1() = this.hashCode().toString() } -class _SealedWithMethodsChild2() : _SealedClassWithMethods() { +class SealedWithMethodsChild2() : SealedClassWithMethods() { fun m2() = this.hashCode().toString() } -class _SealedWithMethodsChild3() : _SealedClassWithMethods() { +class SealedWithMethodsChild3() : SealedClassWithMethods() { fun m3() = this.hashCode().toString() } -sealed class _SealedClassMixed -data class _SealedMixedChild1(val number: Int) : _SealedClassMixed() -data class _SealedMixedChild2(val e1: Int, val e2: Int) : _SealedClassMixed() -data class _SealedMixedChild3(val m1: Int, val m2: Int) : _SealedClassMixed() -object _SealedMixedChildObject1 : _SealedClassMixed() -object _SealedMixedChildObject2 : _SealedClassMixed() -object _SealedMixedChildObject3 : _SealedClassMixed() \ No newline at end of file +sealed class SealedClassMixed +data class SealedMixedChild1(val number: Int) : SealedClassMixed() +data class SealedMixedChild2(val e1: Int, val e2: Int) : SealedClassMixed() +data class SealedMixedChild3(val m1: Int, val m2: Int) : SealedClassMixed() +object SealedMixedChildObject1 : SealedClassMixed() +object SealedMixedChildObject2 : SealedClassMixed() +object SealedMixedChildObject3 : SealedClassMixed() \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/helpers/typeAliases.kt b/compiler/tests-spec/testData/diagnostics/helpers/typeAliases.kt index 4fca9796c09..57ca6c63e35 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/typeAliases.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/typeAliases.kt @@ -1,4 +1,9 @@ -typealias _TypeAliasAny = Any -typealias _TypeAliasUnit = Unit -typealias _TypeAliasNothing = Nothing -typealias _TypeAliasInt = Int +typealias TypealiasAny = Any +typealias TypealiasUnit = Unit +typealias TypealiasNothing = Nothing +typealias TypealiasNullableNothing = Nothing? +typealias TypealiasInt = Int +typealias TypealiasFloat = Float +typealias TypealiasString = String +typealias TypealiasNullableString = String? +typealias TypealiasNullableStringIndirect = TypealiasNullableString diff --git a/compiler/tests-spec/testData/diagnostics/helpers/typesProvider.kt b/compiler/tests-spec/testData/diagnostics/helpers/typesProvider.kt new file mode 100644 index 00000000000..36d9d6f1846 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/helpers/typesProvider.kt @@ -0,0 +1,29 @@ +fun getInt() = Any().hashCode() +fun getShort() = Any().hashCode().toShort() +fun getLong() = Any().hashCode().toLong() +fun getFloat() = Any().hashCode().toFloat() +fun getDouble() = Any().hashCode().toDouble() +fun getByte() = Any().hashCode().toByte() +fun getChar() = Any().hashCode().toChar() +fun getString() = Any().hashCode().toString() +fun getBoolean() = Any().hashCode() % 2 == 0 +fun getNothing(): Nothing = throw Exception() +fun getUnit() = {} +fun getAny() = Any() +fun getList() = listOf() + +class TypesProvider { + fun getInt() = Any().hashCode() + fun getShort() = Any().hashCode().toShort() + fun getLong() = Any().hashCode().toLong() + fun getFloat() = Any().hashCode().toFloat() + fun getDouble() = Any().hashCode().toDouble() + fun getByte() = Any().hashCode().toByte() + fun getChar() = Any().hashCode().toChar() + fun getString() = Any().hashCode().toString() + fun getBoolean() = Any().hashCode() % 2 == 0 + fun getNothing(): Nothing = throw Exception() + fun getUnit() = {} + fun getAny() = Any() + fun getList() = listOf() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt index 7d6c56ec20e..9ed56f64cd3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/6.1.kt @@ -1,5 +1,4 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -// !WITH_SEALED_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -8,46 +7,47 @@ * PLACE: when-expression -> paragraph 11 -> sentence 6 * NUMBER: 1 * DESCRIPTION: Checking for not exhaustive 'when' when not covered by all possible subtypes or 'when' does not have bound value. + * HELPERS: sealedClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _SealedClass): String = when(value_1) { - is _SealedChild1 -> "" - is _SealedChild2 -> "" +fun case_1(value_1: SealedClass): String = when(value_1) { + is SealedChild1 -> "" + is SealedChild2 -> "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _SealedClass): String = when(value_1) { - is _SealedChild1, is _SealedChild2 -> "" +fun case_2(value_1: SealedClass): String = when(value_1) { + is SealedChild1, is SealedChild2 -> "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _SealedClassMixed): String = when(value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - _SealedMixedChildObject1 -> "" +fun case_3(value_1: SealedClassMixed): String = when(value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + SealedMixedChildObject1 -> "" } // TESTCASE NUMBER: 4 -fun case_4(value_1: _SealedClassMixed): String = when(value_1) { - _SealedMixedChildObject1, is _SealedMixedChild2, is _SealedMixedChild1 -> "" +fun case_4(value_1: SealedClassMixed): String = when(value_1) { + SealedMixedChildObject1, is SealedMixedChild2, is SealedMixedChild1 -> "" } // TESTCASE NUMBER: 5 -fun case_5(value_1: _SealedClassMixed): String = when(value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - is _SealedMixedChild3 -> "" +fun case_5(value_1: SealedClassMixed): String = when(value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + is SealedMixedChild3 -> "" } // TESTCASE NUMBER: 6 -fun case_6(value_1: _SealedClassMixed): Int = when(value_1) { } +fun case_6(value_1: SealedClassMixed): Int = when(value_1) { } // TESTCASE NUMBER: 7 -fun case_7(value_1: _SealedClassSingleWithObject): Int = when(value_1) { } +fun case_7(value_1: SealedClassSingleWithObject): Int = when(value_1) { } // TESTCASE NUMBER: 8 -fun case_8(value_1: _SealedClassEmpty): String = when (value_1) { } +fun case_8(value_1: SealedClassEmpty): String = when (value_1) { } // TESTCASE NUMBER: 9 fun case_9(value_1: Number): String = when (value_1) { @@ -68,15 +68,15 @@ fun case_10(value_1: Any): String = when (value_1) { } // TESTCASE NUMBER: 11 -fun case_11(value_1: _SealedClass): String = when { - value_1 is _SealedChild1 -> "" - value_1 is _SealedChild2 -> "" - value_1 is _SealedChild3 -> "" +fun case_11(value_1: SealedClass): String = when { + value_1 is SealedChild1 -> "" + value_1 is SealedChild2 -> "" + value_1 is SealedChild3 -> "" } // TESTCASE NUMBER: 12 -fun case_12(value_1: _SealedClassMixed): String = when(value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - is _SealedMixedChild3 -> "" +fun case_12(value_1: SealedClassMixed): String = when(value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + is SealedMixedChild3 -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt index 336232cb065..3b8ab62f3ab 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/7.1.kt @@ -1,5 +1,4 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -// !WITH_ENUM_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -8,43 +7,44 @@ * PLACE: when-expression -> paragraph 11 -> sentence 7 * NUMBER: 1 * DESCRIPTION: Checking for not exhaustive when when not covered by all enumerated values. + * HELPERS: enumClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _EnumClass): String = when(value_1) { - _EnumClass.EAST -> "" - _EnumClass.SOUTH -> "" - _EnumClass.NORTH -> "" +fun case_1(value_1: EnumClass): String = when(value_1) { + EnumClass.EAST -> "" + EnumClass.SOUTH -> "" + EnumClass.NORTH -> "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _EnumClass): String = when(value_1) { - _EnumClass.EAST, _EnumClass.SOUTH, _EnumClass.NORTH -> "" +fun case_2(value_1: EnumClass): String = when(value_1) { + EnumClass.EAST, EnumClass.SOUTH, EnumClass.NORTH -> "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _EnumClass): String = when(value_1) { - _EnumClass.EAST -> "" +fun case_3(value_1: EnumClass): String = when(value_1) { + EnumClass.EAST -> "" } // TESTCASE NUMBER: 4 -fun case_4(value_1: _EnumClass): String = when(value_1) { } +fun case_4(value_1: EnumClass): String = when(value_1) { } // TESTCASE NUMBER: 5 -fun case_5(value_1: _EnumClassSingle): String = when(value_1) { } +fun case_5(value_1: EnumClassSingle): String = when(value_1) { } /* * TESTCASE NUMBER: 6 * DISCUSSION: maybe use const propagation here? * ISSUES: KT-25265 */ -fun case_6(value_1: _EnumClass): String { - val west = _EnumClass.WEST +fun case_6(value_1: EnumClass): String { + val west = EnumClass.WEST return when (value_1) { - _EnumClass.EAST -> "" - _EnumClass.SOUTH -> "" - _EnumClass.NORTH -> "" + EnumClass.EAST -> "" + EnumClass.SOUTH -> "" + EnumClass.NORTH -> "" west -> "" } } @@ -54,4 +54,4 @@ fun case_6(value_1: _EnumClass): String { * DISCUSSION * ISSUES: KT-26044 */ -fun case_7(value_1: _EnumClassEmpty): String = when (value_1) { } +fun case_7(value_1: EnumClassEmpty): String = when (value_1) { } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt index 07b01db537b..5ecd039986b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.2.kt @@ -1,5 +1,4 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -// !WITH_SEALED_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -8,59 +7,60 @@ * PLACE: when-expression -> paragraph 11 -> sentence 8 * NUMBER: 2 * DESCRIPTION: Checking for not exhaustive 'when' on the nullable sealed classes (and several checks for not sealed). + * HELPERS: sealedClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _SealedClass?): String = when(value_1) { - is _SealedChild1 -> "" - is _SealedChild2 -> "" - is _SealedChild3 -> "" +fun case_1(value_1: SealedClass?): String = when(value_1) { + is SealedChild1 -> "" + is SealedChild2 -> "" + is SealedChild3 -> "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _SealedClassMixed?): String = when(value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - _SealedMixedChildObject1 -> "" +fun case_2(value_1: SealedClassMixed?): String = when(value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + SealedMixedChildObject1 -> "" null -> "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _SealedClassMixed?): String = when(value_1) { - null, is _SealedMixedChild1, is _SealedMixedChild2, _SealedMixedChildObject1 -> "" +fun case_3(value_1: SealedClassMixed?): String = when(value_1) { + null, is SealedMixedChild1, is SealedMixedChild2, SealedMixedChildObject1 -> "" } // TESTCASE NUMBER: 4 -fun case_4(value_1: _SealedClassMixed?): String = when(value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - is _SealedMixedChild3 -> "" - _SealedMixedChildObject1 -> "" - _SealedMixedChildObject2 -> "" - _SealedMixedChildObject3 -> "" +fun case_4(value_1: SealedClassMixed?): String = when(value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + is SealedMixedChild3 -> "" + SealedMixedChildObject1 -> "" + SealedMixedChildObject2 -> "" + SealedMixedChildObject3 -> "" } // TESTCASE NUMBER: 5 -fun case_5(value_1: _SealedClassMixed?): String = when(value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - is _SealedMixedChild3 -> "" +fun case_5(value_1: SealedClassMixed?): String = when(value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + is SealedMixedChild3 -> "" } // TESTCASE NUMBER: 6 -fun case_6(value_1: _SealedClassMixed?): Int = when(value_1) {} +fun case_6(value_1: SealedClassMixed?): Int = when(value_1) {} // TESTCASE NUMBER: 7 -fun case_7(value_1: _SealedClassMixed?): String = when(value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2-> "" - is _SealedMixedChild3 -> "" +fun case_7(value_1: SealedClassMixed?): String = when(value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2-> "" + is SealedMixedChild3 -> "" null -> "" } // TESTCASE NUMBER: 8 -fun case_8(value_1: _SealedClassMixed?): String = when(value_1) { - _SealedMixedChildObject1 -> "" +fun case_8(value_1: SealedClassMixed?): String = when(value_1) { + SealedMixedChildObject1 -> "" } /* @@ -77,4 +77,4 @@ fun case_9(value_1: Any?): String = when (value_1) { * DISCUSSION * ISSUES: KT-26044 */ -fun case_10(value: _SealedClassEmpty): String = when (value) {} +fun case_10(value: SealedClassEmpty): String = when (value) {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt index 1e5641c76c9..6bc8a5126e9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/neg/8.3.kt @@ -1,5 +1,4 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -// !WITH_ENUM_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -8,38 +7,39 @@ * PLACE: when-expression -> paragraph 11 -> sentence 8 * NUMBER: 3 * DESCRIPTION: Checking for not exhaustive 'when' on the nullable enums. + * HELPERS: enumClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _EnumClass?): String = when(value_1) { - _EnumClass.EAST -> "" - _EnumClass.SOUTH -> "" - _EnumClass.NORTH -> "" - _EnumClass.WEST -> "" +fun case_1(value_1: EnumClass?): String = when(value_1) { + EnumClass.EAST -> "" + EnumClass.SOUTH -> "" + EnumClass.NORTH -> "" + EnumClass.WEST -> "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _EnumClass?): String = when(value_1) { - _EnumClass.EAST -> "" - _EnumClass.SOUTH -> "" - _EnumClass.NORTH -> "" +fun case_2(value_1: EnumClass?): String = when(value_1) { + EnumClass.EAST -> "" + EnumClass.SOUTH -> "" + EnumClass.NORTH -> "" null -> "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _EnumClass?): String = when(value_1) { - _EnumClass.EAST, null, _EnumClass.SOUTH, _EnumClass.NORTH -> "" +fun case_3(value_1: EnumClass?): String = when(value_1) { + EnumClass.EAST, null, EnumClass.SOUTH, EnumClass.NORTH -> "" } // TESTCASE NUMBER: 4 -fun case_4(value_1: _EnumClassSingle): Int = when(value_1) {} +fun case_4(value_1: EnumClassSingle): Int = when(value_1) {} // TESTCASE NUMBER: 5 -fun case_5(value_1: _EnumClassSingle?): String = when(value_1) { - _EnumClassSingle.EVERYTHING -> "" +fun case_5(value_1: EnumClassSingle?): String = when(value_1) { + EnumClassSingle.EVERYTHING -> "" } // TESTCASE NUMBER: 6 -fun case_6(value_1: _EnumClassSingle?): String = when(value_1) { +fun case_6(value_1: EnumClassSingle?): String = when(value_1) { null -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt index b399773305b..1fee755ddd9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/1.3.kt @@ -1,5 +1,3 @@ -// !WITH_ENUM_CLASSES -// !WITH_SEALED_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -8,23 +6,24 @@ * PLACE: when-expression -> paragraph 11 -> sentence 1 * NUMBER: 3 * DESCRIPTION: Check when exhaustive via else entry (when with bound value, redundant else). + * HELPERS: enumClasses, sealedClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _EnumClass): String = when (value_1) { - _EnumClass.EAST -> "" - _EnumClass.NORTH -> "" - _EnumClass.SOUTH -> "" - _EnumClass.WEST -> "" +fun case_1(value_1: EnumClass): String = when (value_1) { + EnumClass.EAST -> "" + EnumClass.NORTH -> "" + EnumClass.SOUTH -> "" + EnumClass.WEST -> "" else -> "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _EnumClass?): String = when (value_1) { - _EnumClass.EAST -> "" - _EnumClass.NORTH -> "" - _EnumClass.SOUTH -> "" - _EnumClass.WEST -> "" +fun case_2(value_1: EnumClass?): String = when (value_1) { + EnumClass.EAST -> "" + EnumClass.NORTH -> "" + EnumClass.SOUTH -> "" + EnumClass.WEST -> "" null -> "" else -> "" } @@ -45,31 +44,31 @@ fun case_4(value_1: Boolean?): String = when (value_1) { } // TESTCASE NUMBER: 5 -fun case_5(value_1: _SealedClass): String = when (value_1) { - is _SealedChild1 -> "" - is _SealedChild2 -> "" - is _SealedChild3 -> "" +fun case_5(value_1: SealedClass): String = when (value_1) { + is SealedChild1 -> "" + is SealedChild2 -> "" + is SealedChild3 -> "" else -> "" } // TESTCASE NUMBER: 6 -fun case_6(value_1: _SealedClass?): String = when (value_1) { - is _SealedChild1 -> "" - is _SealedChild2 -> "" - is _SealedChild3 -> "" +fun case_6(value_1: SealedClass?): String = when (value_1) { + is SealedChild1 -> "" + is SealedChild2 -> "" + is SealedChild3 -> "" null -> "" else -> "" } // TESTCASE NUMBER: 7 -fun case_7(value_1: _SealedClassSingle): String = when (value_1) { - is _SealedClassSingle -> "" +fun case_7(value_1: SealedClassSingle): String = when (value_1) { + is SealedClassSingle -> "" else -> "" } // TESTCASE NUMBER: 8 -fun case_8(value_1: _SealedClassSingle?): String = when (value_1) { - is _SealedClassSingle -> "" +fun case_8(value_1: SealedClassSingle?): String = when (value_1) { + is SealedClassSingle -> "" null -> "" else -> "" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt index 89dd8516182..bd02d4c00d5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/6.1.kt @@ -1,5 +1,4 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -// !WITH_SEALED_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -8,59 +7,60 @@ * PLACE: when-expression -> paragraph 11 -> sentence 6 * NUMBER: 1 * DESCRIPTION: Check when exhaustive when possible subtypes of the sealed class are covered. + * HELPERS: sealedClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _SealedClass): Int = when (value_1) { - is _SealedChild1 -> value_1.number - is _SealedChild2 -> value_1.e1 + value_1.e2 - is _SealedChild3 -> value_1.m1 + value_1.m2 +fun case_1(value_1: SealedClass): Int = when (value_1) { + is SealedChild1 -> value_1.number + is SealedChild2 -> value_1.e1 + value_1.e2 + is SealedChild3 -> value_1.m1 + value_1.m2 } // TESTCASE NUMBER: 2 -fun case_2(value_1: _SealedClass): String = when (value_1) { - is _SealedClass -> "" +fun case_2(value_1: SealedClass): String = when (value_1) { + is SealedClass -> "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _SealedClassWithMethods): String = when (value_1) { - is _SealedWithMethodsChild1 -> value_1.m1() - is _SealedWithMethodsChild2 -> value_1.m2() - is _SealedWithMethodsChild3 -> value_1.m3() +fun case_3(value_1: SealedClassWithMethods): String = when (value_1) { + is SealedWithMethodsChild1 -> value_1.m1() + is SealedWithMethodsChild2 -> value_1.m2() + is SealedWithMethodsChild3 -> value_1.m3() } // TESTCASE NUMBER: 4 -fun case_4(value_1: _SealedClassWithObjects): String = when (value_1) { - _SealedWithObjectsChild1 -> "" - _SealedWithObjectsChild2 -> "" - _SealedWithObjectsChild3 -> "" +fun case_4(value_1: SealedClassWithObjects): String = when (value_1) { + SealedWithObjectsChild1 -> "" + SealedWithObjectsChild2 -> "" + SealedWithObjectsChild3 -> "" } // TESTCASE NUMBER: 5 -fun case_5(value_1: _SealedClassMixed): String = when (value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - is _SealedMixedChild3 -> "" - _SealedMixedChildObject1 -> "" - _SealedMixedChildObject2 -> "" - _SealedMixedChildObject3 -> "" +fun case_5(value_1: SealedClassMixed): String = when (value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + is SealedMixedChild3 -> "" + SealedMixedChildObject1 -> "" + SealedMixedChildObject2 -> "" + SealedMixedChildObject3 -> "" } /* * TESTCASE NUMBER: 6 * DISCUSSION: is it correct that objects can be checked using the type checking operator? */ -fun case_6(value_1: _SealedClassMixed): String = when (value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - is _SealedMixedChild3 -> "" - is _SealedMixedChildObject1 -> "" - is _SealedMixedChildObject2 -> "" - is _SealedMixedChildObject3 -> "" +fun case_6(value_1: SealedClassMixed): String = when (value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + is SealedMixedChild3 -> "" + is SealedMixedChildObject1 -> "" + is SealedMixedChildObject2 -> "" + is SealedMixedChildObject3 -> "" } // TESTCASE NUMBER: 7 -fun case_7(value_1: _SealedClassEmpty): String = when (value_1) { +fun case_7(value_1: SealedClassEmpty): String = when (value_1) { else -> "" } @@ -69,8 +69,8 @@ fun case_7(value_1: _SealedClassEmpty): String = when (value_1) { * UNEXPECTED BEHAVIOUR: must be exhaustive * ISSUES: KT-22996 */ -fun case_8(value: _SealedClass?): String = when (value) { - is _SealedChild1, !is _SealedChild3?, is _SealedChild3? -> "" +fun case_8(value: SealedClass?): String = when (value) { + is SealedChild1, !is SealedChild3?, is SealedChild3? -> "" } /* @@ -78,7 +78,7 @@ fun case_8(value: _SealedClass?): String = when (value) { * UNEXPECTED BEHAVIOUR: must be exhaustive * ISSUES: KT-22996 */ -fun case_9(value: _SealedClass?): String = when (value) { - is _SealedChild1, !is _SealedChild3 -> "" - is _SealedChild3? -> "" +fun case_9(value: SealedClass?): String = when (value) { + is SealedChild1, !is SealedChild3 -> "" + is SealedChild3? -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt index 7d6f614e819..b589cf3b1d7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/7.1.kt @@ -1,4 +1,3 @@ -// !WITH_ENUM_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -7,17 +6,18 @@ * PLACE: when-expression -> paragraph 11 -> sentence 7 * NUMBER: 1 * DESCRIPTION: Check when exhaustive when all enumerated values are checked. + * HELPERS: enumClasses */ // TESTCASE NUMBER: 1 -fun case_1(dir: _EnumClass): String = when (dir) { - _EnumClass.EAST -> "" - _EnumClass.NORTH -> "" - _EnumClass.SOUTH -> "" - _EnumClass.WEST -> "" +fun case_1(dir: EnumClass): String = when (dir) { + EnumClass.EAST -> "" + EnumClass.NORTH -> "" + EnumClass.SOUTH -> "" + EnumClass.WEST -> "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _EnumClassSingle): String = when (value_1) { - _EnumClassSingle.EVERYTHING -> "" +fun case_2(value_1: EnumClassSingle): String = when (value_1) { + EnumClassSingle.EVERYTHING -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt index 4b240e881bb..8d1950b0d51 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.2.kt @@ -1,4 +1,3 @@ -// !WITH_ENUM_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -7,20 +6,21 @@ * PLACE: when-expression -> paragraph 11 -> sentence 8 * NUMBER: 2 * DESCRIPTION: Check when exhaustive when enumerated values are checked and contains a null check. + * HELPERS: enumClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _EnumClass?): String = when (value_1) { - _EnumClass.EAST -> "" - _EnumClass.NORTH -> "" - _EnumClass.SOUTH -> "" - _EnumClass.WEST -> "" +fun case_1(value_1: EnumClass?): String = when (value_1) { + EnumClass.EAST -> "" + EnumClass.NORTH -> "" + EnumClass.SOUTH -> "" + EnumClass.WEST -> "" null -> "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _EnumClassSingle?): String = when (value_1) { - _EnumClassSingle.EVERYTHING -> "" +fun case_2(value_1: EnumClassSingle?): String = when (value_1) { + EnumClassSingle.EVERYTHING -> "" null -> "" } @@ -29,6 +29,6 @@ fun case_2(value_1: _EnumClassSingle?): String = when (value_1) { * UNEXPECTED BEHAVIOUR * ISSUES: KT-26044 */ -fun case_3(value_1: _EnumClassEmpty?): String = when(value_1) { +fun case_3(value_1: EnumClassEmpty?): String = when(value_1) { null -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt index ffece961b2b..a6398f68cec 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-11/pos/8.3.kt @@ -1,4 +1,3 @@ -// !WITH_SEALED_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -7,46 +6,47 @@ * PLACE: when-expression -> paragraph 11 -> sentence 8 * NUMBER: 3 * DESCRIPTION: Check when exhaustive when possible subtypes of the sealed class are covered and contains a null check. + * HELPERS: sealedClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _SealedClass?): Int = when (value_1) { - is _SealedChild1 -> value_1.number - is _SealedChild2 -> value_1.e1 + value_1.e2 - is _SealedChild3 -> value_1.m1 + value_1.m2 +fun case_1(value_1: SealedClass?): Int = when (value_1) { + is SealedChild1 -> value_1.number + is SealedChild2 -> value_1.e1 + value_1.e2 + is SealedChild3 -> value_1.m1 + value_1.m2 null -> 0 } // TESTCASE NUMBER: 2 -fun case_2(value_1: _SealedClass?): String = when (value_1) { - is _SealedClass -> "" +fun case_2(value_1: SealedClass?): String = when (value_1) { + is SealedClass -> "" null -> "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _SealedClassWithMethods?): String = when (value_1) { - is _SealedWithMethodsChild1 -> value_1.m1() - is _SealedWithMethodsChild2 -> value_1.m2() - is _SealedWithMethodsChild3 -> value_1.m3() +fun case_3(value_1: SealedClassWithMethods?): String = when (value_1) { + is SealedWithMethodsChild1 -> value_1.m1() + is SealedWithMethodsChild2 -> value_1.m2() + is SealedWithMethodsChild3 -> value_1.m3() null -> "" } // TESTCASE NUMBER: 4 -fun case_4(value_1: _SealedClassWithObjects?): String = when (value_1) { - _SealedWithObjectsChild1 -> "" - _SealedWithObjectsChild2 -> "" - _SealedWithObjectsChild3 -> "" +fun case_4(value_1: SealedClassWithObjects?): String = when (value_1) { + SealedWithObjectsChild1 -> "" + SealedWithObjectsChild2 -> "" + SealedWithObjectsChild3 -> "" null -> "" } // TESTCASE NUMBER: 5 -fun case_5(value_1: _SealedClassMixed?): String = when (value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - is _SealedMixedChild3 -> "" - _SealedMixedChildObject1 -> "" - _SealedMixedChildObject2 -> "" - _SealedMixedChildObject3 -> "" +fun case_5(value_1: SealedClassMixed?): String = when (value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + is SealedMixedChild3 -> "" + SealedMixedChildObject1 -> "" + SealedMixedChildObject2 -> "" + SealedMixedChildObject3 -> "" null -> "" } @@ -54,13 +54,13 @@ fun case_5(value_1: _SealedClassMixed?): String = when (value_1) { * TESTCASE NUMBER: 6 * DISCUSSION: is it correct that objects can be checked using the type checking operator? */ -fun case_6(value_1: _SealedClassMixed?): String = when (value_1) { - is _SealedMixedChild1 -> "" - is _SealedMixedChild2 -> "" - is _SealedMixedChild3 -> "" - is _SealedMixedChildObject1 -> "" - is _SealedMixedChildObject2 -> "" - is _SealedMixedChildObject3 -> "" +fun case_6(value_1: SealedClassMixed?): String = when (value_1) { + is SealedMixedChild1 -> "" + is SealedMixedChild2 -> "" + is SealedMixedChild3 -> "" + is SealedMixedChildObject1 -> "" + is SealedMixedChildObject2 -> "" + is SealedMixedChildObject3 -> "" null -> "" } @@ -69,6 +69,6 @@ fun case_6(value_1: _SealedClassMixed?): String = when (value_1) { * UNEXPECTED BEHAVIOUR: must be exhaustive * ISSUES: KT-26044 */ -fun case_7(value: _SealedClassEmpty?): String = when (value) { +fun case_7(value: SealedClassEmpty?): String = when (value) { null -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt index c7df2c9c714..e5c24891c54 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.1.kt @@ -1,4 +1,3 @@ -// !WITH_BASIC_TYPES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -7,10 +6,11 @@ * PLACE: when-expression -> paragraph 3 -> sentence 2 * NUMBER: 1 * DESCRIPTION: 'When' without bound value and with not boolean condition in 'when condition'. + * HELPERS: typesProvider */ // TESTCASE NUMBER: 1 -fun case_1(value_1: Int, value_2: String, value_3: _BasicTypesProvider): String { +fun case_1(value_1: Int, value_2: String, value_3: TypesProvider): String { when { .012f / value_1 -> return "" "$value_2..." -> return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt index 1b7d62dc971..63f52cb9973 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/neg/2.2.kt @@ -1,4 +1,3 @@ -// !WITH_BASIC_TYPES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -7,14 +6,15 @@ * PLACE: when-expression -> paragraph 3 -> sentence 2 * NUMBER: 2 * DESCRIPTION: 'When' without bound value and not allowed comma in when entry. + * HELPERS: typesProvider, classes */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _BasicTypesProvider) { +fun case_1(value_1: TypesProvider) { when { getBoolean(), value_1.getBoolean() -> return value_1.getBoolean() && getBoolean(), getLong() == 1000L -> return - value_1.getList(), getLong(), {}, Any(), throw Exception() -> return + Out(), getLong(), {}, Any(), throw Exception() -> return } return diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt index 03c90af8eee..1b6828662cb 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/1.1.kt @@ -1,7 +1,4 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -DEBUG_INFO_SMARTCAST -// !WITH_BASIC_TYPES -// !WITH_CLASSES -// !WITH_FUNCTIONS /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -10,6 +7,7 @@ * PLACE: when-expression -> paragraph 3 -> sentence 1 * NUMBER: 1 * DESCRIPTION: 'When' without bound value and with different variants of expressions in the control structure body. + * HELPERS: typesProvider, classes, functions */ // TESTCASE NUMBER: 1 @@ -25,11 +23,11 @@ fun case_1(value_1: Int) { } // TESTCASE NUMBER: 2 -fun case_2(value_1: Int, value_2: Byte, value_3: _BasicTypesProvider) { +fun case_2(value_1: Int, value_2: Byte, value_3: TypesProvider) { when { value_1 == 1 -> -.09 % 10L value_1 == 3 -> value_2 / -5 - value_1 == 2 -> value_3.getChar(99) - 11 + 90 + value_1 == 2 -> value_3.getChar() - 11 + 90 } } @@ -39,8 +37,8 @@ fun case_3(value_1: Int, value_2: Boolean, value_3: Long) { value_1 == 1 -> value_2 value_1 == 2 -> !value_2 value_1 == 3 -> getBoolean() && value_2 - value_1 == 5 -> getChar(10) != 'a' - value_1 == 6 -> getList() === getAny() + value_1 == 5 -> getChar() != 'a' + value_1 == 6 -> Out() === getAny() value_1 == 7 -> value_3 <= 11 } } @@ -145,8 +143,8 @@ fun case_11(value_1: Int) { // TESTCASE NUMBER: 12 fun case_12(value_1: Int, value_2: Collection, value_3: Collection?) { when { - value_1 == 1 -> value_2 as MutableList - value_1 == 2 -> value_2 as? MutableList + value_1 == 1 -> value_2 as List + value_1 == 2 -> value_2 as? List value_1 == 3 -> value_3 as? MutableMap value_1 == 4 -> (value_2 as? Map) as MutableMap } @@ -185,11 +183,11 @@ fun case_15(value_1: Int, value_2: List, value_3: List> } // TESTCASE NUMBER: 16 -fun case_16(value_1: Int, value_2: _Class, value_3: _Class?, value_4: Int) { +fun case_16(value_1: Int, value_2: Class, value_3: Class?, value_4: Int) { fun __fun_1(): () -> Unit { return fun() { } } when { - value_1 == 1 -> _funWithoutArgs() + value_1 == 1 -> funWithoutArgs() value_1 == 2 -> __fun_1()() value_1 == 3 -> value_2.fun_2(value_4) value_1 == 4 -> value_3?.fun_2(value_4) @@ -198,7 +196,7 @@ fun case_16(value_1: Int, value_2: _Class, value_3: _Class?, value_4: Int) { } // TESTCASE NUMBER: 17 -fun case_17(value_1: Int, value_2: _Class, value_3: _Class?) { +fun case_17(value_1: Int, value_2: Class, value_3: Class?) { when { value_1 == 1 -> value_2.prop_1 value_1 == 2 -> value_3?.prop_1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt index 0a0845d0a18..0052d41f123 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.1.kt @@ -1,6 +1,3 @@ -// !WITH_BASIC_TYPES -// !WITH_SEALED_CLASSES -// !WITH_ENUM_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -9,6 +6,7 @@ * PLACE: when-expression -> paragraph 3 -> sentence 2 * NUMBER: 1 * DESCRIPTION: 'When' without bound value and different variants of the boolean conditions (logical, equality, comparison, type checking operator, containment operator). + * HELPERS: typesProvider, enumClasses, sealedClasses, classes */ // TESTCASE NUMBER: 1 @@ -16,8 +14,8 @@ fun case_1(value_1: Boolean, value_2: Long): Int { return when { value_1 -> 1 getBoolean() && value_1 -> 2 - getChar(10) != 'a' -> 3 - getList() === getAny() -> 4 + getChar() != 'a' -> 3 + Out() === getAny() -> 4 value_2 <= 11 -> 5 !value_1 -> 6 else -> 7 @@ -28,12 +26,12 @@ fun case_1(value_1: Boolean, value_2: Long): Int { * TESTCASE NUMBER: 2 * NOTE: for a potential analysys of exhaustiveness by enums in whens without a bound value. */ -fun case_2(value_1: _EnumClass) { +fun case_2(value_1: EnumClass) { when { - value_1 == _EnumClass.NORTH -> {} - value_1 == _EnumClass.SOUTH -> {} - value_1 == _EnumClass.WEST -> {} - value_1 == _EnumClass.EAST -> {} + value_1 == EnumClass.NORTH -> {} + value_1 == EnumClass.SOUTH -> {} + value_1 == EnumClass.WEST -> {} + value_1 == EnumClass.EAST -> {} } } @@ -105,11 +103,11 @@ fun case_7(value_1: Any) { * TESTCASE NUMBER: 8 * NOTE: for a potential analysys of exhaustiveness by enums in whens without a bound value. */ -fun case_8(value_1: _SealedClass) { +fun case_8(value_1: SealedClass) { when { - value_1 is _SealedChild1 -> {} - value_1 is _SealedChild2 -> {} - value_1 is _SealedChild3 -> {} + value_1 is SealedChild1 -> {} + value_1 is SealedChild2 -> {} + value_1 is SealedChild3 -> {} } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt index 1b7385b774f..bf7b1891fd7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-3/pos/2.3.kt @@ -1,4 +1,3 @@ -// !WITH_BASIC_TYPES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -9,10 +8,11 @@ * DESCRIPTION: 'When' without bound value and with Nothing in condition (subtype of Boolean). * DISCUSSION * ISSUES: KT-25948 + * HELPERS: typesProvider */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _BasicTypesProvider) { +fun case_1(value_1: TypesProvider) { when { return -> return return == return -> return @@ -23,7 +23,7 @@ fun case_1(value_1: _BasicTypesProvider) { } // TESTCASE NUMBER: 2 -fun case_2(value_1: _BasicTypesProvider) { +fun case_2(value_1: TypesProvider) { when { throw Exception() -> return (throw Exception()) == (throw Exception()) -> return @@ -34,7 +34,7 @@ fun case_2(value_1: _BasicTypesProvider) { } // TESTCASE NUMBER: 3 -fun case_3(value_1: _BasicTypesProvider) { +fun case_3(value_1: TypesProvider) { loop1@ while (true) { loop2@ while (true) { loop3@ while (true) { @@ -49,7 +49,7 @@ fun case_3(value_1: _BasicTypesProvider) { } // TESTCASE NUMBER: 4 -fun case_4(value_1: _BasicTypesProvider): String { +fun case_4(value_1: TypesProvider): String { loop1@ while (true) { loop2@ while (true) { loop3@ while (true) { @@ -64,7 +64,7 @@ fun case_4(value_1: _BasicTypesProvider): String { } // TESTCASE NUMBER: 6 -fun case_6(value_1: Nothing, value_2: _BasicTypesProvider): String { +fun case_6(value_1: Nothing, value_2: TypesProvider): String { when { value_1 -> return "" value_2.getNothing() -> return "" @@ -76,7 +76,7 @@ fun case_6(value_1: Nothing, value_2: _BasicTypesProvider } // TESTCASE NUMBER: 5 -fun case_5(value_1: _BasicTypesProvider, value_2: Nothing) { +fun case_5(value_1: TypesProvider, value_2: Nothing) { loop1@ while (true) { loop2@ while (true) { loop3@ while (true) { diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt index 2a73895fe04..063eafbbc28 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-6/pos/1.1.kt @@ -1,7 +1,4 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -// !WITH_BASIC_TYPES -// !WITH_FUNCTIONS -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -10,6 +7,7 @@ * PLACE: when-expression -> paragraph 6 -> sentence 1 * NUMBER: 1 * DESCRIPTION: 'When' with bound value and with different variants of expressions in the control structure body. + * HELPERS: typesProvider, classes, functions */ // TESTCASE NUMBER: 1 @@ -25,11 +23,11 @@ fun case_1(value_1: Int) { } // TESTCASE NUMBER: 2 -fun case_2(value_1: Int, value_2: Byte, value_3: _BasicTypesProvider) { +fun case_2(value_1: Int, value_2: Byte, value_3: TypesProvider) { when (value_1) { 1 -> -.09 % 10L 3 -> value_2 / -5 - 2 -> value_3.getChar(99) - 11 + 90 + 2 -> value_3.getChar() - 11 + 90 4 -> 100 } } @@ -40,7 +38,7 @@ fun case_3(value_1: Int, value_2: Boolean, value_3: Long) { 1 -> value_2 2 -> !value_2 3 -> getBoolean() && value_2 - 5 -> getChar(10) != 'a' + 5 -> getChar() != 'a' 6 -> getList() === getAny() 7 -> value_3 <= 11 } @@ -148,8 +146,8 @@ fun case_11(value_1: Int) { // TESTCASE NUMBER: 12 fun case_12(value_1: Int, value_2: Collection, value_3: Collection?) { when (value_1) { - 1 -> value_2 as MutableList - 2 -> value_2 as? MutableList + 1 -> value_2 as List + 2 -> value_2 as? List 3 -> value_3 as? MutableMap 4 -> (value_2 as? Map) as MutableMap } @@ -188,11 +186,11 @@ fun case_15(value_1: Int, value_2: List, value_3: List> } // TESTCASE NUMBER: 16 -fun case_16(value_1: Int, value_2: _Class, value_3: _Class?, value_4: Int) { +fun case_16(value_1: Int, value_2: Class, value_3: Class?, value_4: Int) { fun __fun_1(): () -> Unit { return fun() { } } when (value_1) { - 1 -> _funWithoutArgs() + 1 -> funWithoutArgs() 2 -> __fun_1()() 3 -> value_2.fun_2(value_4) 4 -> value_3?.fun_2(value_4) @@ -201,7 +199,7 @@ fun case_16(value_1: Int, value_2: _Class, value_3: _Class?, value_4: Int) { } // TESTCASE NUMBER: 17 -fun case_17(value_1: Int, value_2: _Class, value_3: _Class?) { +fun case_17(value_1: Int, value_2: Class, value_3: Class?) { when (value_1) { 1 -> value_2.prop_1 2 -> value_3?.prop_1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt index c94d610d465..b183421cba3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.1.kt @@ -1,4 +1,3 @@ -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -7,12 +6,13 @@ * PLACE: when-expression -> paragraph 7 -> sentence 1 * NUMBER: 1 * DESCRIPTION: 'When' with bound value and type test condition (without companion object in classes), but without type checking operator. + * HELPERS: classes */ // TESTCASE NUMBER: 1 fun case_1(value_1: Any): String { when (value_1) { - _EmptyClass -> return "" + EmptyClass -> return "" } return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt index 6a3d2f68c1e..57fab04ec7b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/1.2.kt @@ -1,4 +1,3 @@ -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -7,6 +6,7 @@ * PLACE: when-expression -> paragraph 7 -> sentence 1 * NUMBER: 2 * DESCRIPTION: 'When' with bound value and type test condition on the non-type operand of the type checking operator. + * HELPERS: classes */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt index c43893c64ed..1dea19e83f4 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.1.kt @@ -1,4 +1,3 @@ -// !WITH_BASIC_TYPES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -7,10 +6,11 @@ * PLACE: when-expression -> paragraph 7 -> sentence 3 * NUMBER: 1 * DESCRIPTION: 'When' with bound value and 'when condition' with range expression, but without containment checking operator. + * HELPERS: typesProvider */ // TESTCASE NUMBER: 1 -fun case_1(value_1: Int, value_2: _BasicTypesProvider): String { +fun case_1(value_1: Int, value_2: TypesProvider): String { when (value_1) { -1000L..100 -> return "" value_2.getInt()..getLong() -> return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt index 285f0023507..75c9aa0480e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/neg/3.2.kt @@ -1,5 +1,4 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -8,10 +7,11 @@ * PLACE: when-expression -> paragraph 7 -> sentence 3 * NUMBER: 2 * DESCRIPTION: 'When' with bound value and 'when condition' with contains operator and type without defined contains operator. + * HELPERS: classes */ // TESTCASE NUMBER: 1 -fun case_1(value_1: Int, value_2: _EmptyClass, value_3: Int, value_4: Any): String { +fun case_1(value_1: Int, value_2: EmptyClass, value_3: Int, value_4: Any): String { when (value_1) { in value_2 -> return "" in value_3 -> return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt index c8491de6eab..5939c5ff633 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.1.kt @@ -1,5 +1,3 @@ -// !WITH_CLASSES -// !WITH_OBJECTS /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -8,6 +6,7 @@ * PLACE: when-expression -> paragraph 7 -> sentence 1 * NUMBER: 1 * DESCRIPTION: 'When' with bound value and type test condition. + * HELPERS: classes, objects */ // TESTCASE NUMBER: 1 @@ -61,8 +60,8 @@ fun case_5(value_1: Any?): String = when (value_1) { // TESTCASE NUMBER: 6 fun case_6(value_1: Any): String { when (value_1) { - is _EmptyObject -> return "" - is _ClassWithCompanionObject.Companion -> return "" + is EmptyObject -> return "" + is ClassWithCompanionObject.Companion -> return "" } return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt index 00957565948..cb78aa13793 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.2.kt @@ -1,6 +1,3 @@ -// !WITH_SEALED_CLASSES -// !WITH_CLASSES -// !WITH_OBJECTS /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -9,13 +6,14 @@ * PLACE: when-expression -> paragraph 7 -> sentence 1 * NUMBER: 2 * DESCRIPTION: 'When' with bound value and type test condition (invert type checking operator). + * HELPERS: classes, sealedClasses, objects */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _SealedClass) = when (value_1) { - !is _SealedChild1 -> {} - !is _SealedChild2 -> {} - !is _SealedChild3 -> {} +fun case_1(value_1: SealedClass) = when (value_1) { + !is SealedChild1 -> {} + !is SealedChild2 -> {} + !is SealedChild3 -> {} } /* @@ -23,16 +21,16 @@ fun case_1(value_1: _SealedClass) = when (value_1) { * UNEXPECTED BEHAVIOUR * ISSUES: KT-22996 */ -fun case_2(value_1: _SealedClass?): String = when (value_1) { - !is _SealedChild2 -> "" // including null - is _SealedChild2 -> "" +fun case_2(value_1: SealedClass?): String = when (value_1) { + !is SealedChild2 -> "" // including null + is SealedChild2 -> "" null -> "" // redundant } // TESTCASE NUMBER: 3 -fun case_3(value_1: _SealedClass?): String = when (value_1) { - !is _SealedChild2? -> "" // null isn't included - is _SealedChild2 -> "" +fun case_3(value_1: SealedClass?): String = when (value_1) { + !is SealedChild2? -> "" // null isn't included + is SealedChild2 -> "" null -> "" } @@ -41,18 +39,18 @@ fun case_3(value_1: _SealedClass?): String = when (value_1) { * UNEXPECTED BEHAVIOUR * ISSUES: KT-22996 */ -fun case_4(value_1: _SealedClass?) { +fun case_4(value_1: SealedClass?) { when (value_1) { - !is _SealedChild2 -> {} // including null - is _SealedChild2? -> {} // redundant nullable type check + !is SealedChild2 -> {} // including null + is SealedChild2? -> {} // redundant nullable type check } } // TESTCASE NUMBER: 5 fun case_5(value_1: Any): String { when (value_1) { - is _EmptyObject -> return "" - !is _ClassWithCompanionObject.Companion -> return "" + is EmptyObject -> return "" + !is ClassWithCompanionObject.Companion -> return "" } return "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt index b891ebe5c3f..f80a65176b6 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.3.kt @@ -1,6 +1,3 @@ -// !WITH_CLASSES -// !WITH_SEALED_CLASSES -// !WITH_OBJECTS /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -9,6 +6,7 @@ * PLACE: when-expression -> paragraph 7 -> sentence 1 * NUMBER: 3 * DESCRIPTION: 'When' with bound value and enumaration of type test conditions. + * HELPERS: classes, sealedClasses, objects */ // TESTCASE NUMBER: 1 @@ -21,8 +19,8 @@ fun case_1(value_1: Any) = when (value_1) { // TESTCASE NUMBER: 2 fun case_2(value_1: Any?) = when (value_1) { - is Float, is Char, is _SealedClass? -> "" // if value is null then this branch will be executed - is Double, is Boolean, is _ClassWithCompanionObject.Companion -> "" + is Float, is Char, is SealedClass? -> "" // if value is null then this branch will be executed + is Double, is Boolean, is ClassWithCompanionObject.Companion -> "" else -> "" } @@ -33,7 +31,7 @@ fun case_2(value_1: Any?) = when (value_1) { */ fun case_3(value_1: Any?) = when (value_1) { is Float, is Char, is Int? -> "" // if value is null then this branch will be executed - is _SealedChild2, is Boolean?, is String -> "" // redundant nullable type check + is SealedChild2, is Boolean?, is String -> "" // redundant nullable type check else -> "" } @@ -44,7 +42,7 @@ fun case_3(value_1: Any?) = when (value_1) { */ fun case_4(value_1: Any?) = when (value_1) { is Float, is Char?, is Int? -> "" // double nullable type check in the one branch - is _SealedChild1, is Boolean, is String -> "" + is SealedChild1, is Boolean, is String -> "" else -> "" } @@ -56,7 +54,7 @@ fun case_4(value_1: Any?) = when (value_1) { fun case_5(value_1: Any?): String { when (value_1) { is Float, is Char?, is Int -> return "" - is Double, is _EmptyObject, is String -> return "" + is Double, is EmptyObject, is String -> return "" null -> return "" // null-check redundant else -> return "" } @@ -70,7 +68,7 @@ fun case_5(value_1: Any?): String { fun case_6(value_1: Any?): String { when (value_1) { is Float, is Char?, null, is Int -> return "" // double nullable type check in the one branch - is Double, is _EmptyObject, is String -> return "" + is Double, is EmptyObject, is String -> return "" else -> return "" } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt index e4c0b669545..f954141f876 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/1.4.kt @@ -1,4 +1,3 @@ -// !WITH_SEALED_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -7,32 +6,33 @@ * PLACE: when-expression -> paragraph 7 -> sentence 1 * NUMBER: 4 * DESCRIPTION: 'When' with bound value and enumaration of type test conditions (with invert type checking operator). + * HELPERS: sealedClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _SealedClass): String = when (value_1) { - is _SealedChild1, !is _SealedChild3 -> "" - is _SealedChild3 -> "" +fun case_1(value_1: SealedClass): String = when (value_1) { + is SealedChild1, !is SealedChild3 -> "" + is SealedChild3 -> "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _SealedClass) = when (value_1) { - !is _SealedChild1, !is _SealedChild2, !is _SealedChild3 -> {} +fun case_2(value_1: SealedClass) = when (value_1) { + !is SealedChild1, !is SealedChild2, !is SealedChild3 -> {} } // TESTCASE NUMBER: 3 -fun case_3(value_1: _SealedClass): String = when (value_1) { - is _SealedChild2, !is _SealedChild2 -> "" +fun case_3(value_1: SealedClass): String = when (value_1) { + is SealedChild2, !is SealedChild2 -> "" } // TESTCASE NUMBER: 4 -fun case_4(value_1: _SealedClass): String = when (value_1) { - !is _SealedChild1, is _SealedChild1 -> "" +fun case_4(value_1: SealedClass): String = when (value_1) { + !is SealedChild1, is SealedChild1 -> "" } // TESTCASE NUMBER: 5 fun case_5(value_1: Any?): String = when (value_1) { - is _SealedChild3, !is _SealedChild3? -> "" + is SealedChild3, !is SealedChild3? -> "" else -> "" } @@ -42,8 +42,8 @@ fun case_5(value_1: Any?): String = when (value_1) { * ISSUES: KT-22996 */ fun case_6(value_1: Any?): String = when (value_1) { - is Boolean?, !is _SealedChild3 -> "" // double nullable type check in the one branch - is _SealedChild3 -> "" + is Boolean?, !is SealedChild3 -> "" // double nullable type check in the one branch + is SealedChild3 -> "" else -> "" } @@ -53,6 +53,6 @@ fun case_6(value_1: Any?): String = when (value_1) { * ISSUES: KT-22996 */ fun case_7(value_1: Any?): String = when (value_1) { - is Number?, null, !is _SealedChild3 -> "" // triple nullable type check in the one branch + is Number?, null, !is SealedChild3 -> "" // triple nullable type check in the one branch else -> "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt index d86673fe56b..3885f4b6531 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.1.kt @@ -1,5 +1,3 @@ -// !WITH_BASIC_TYPES -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -8,6 +6,7 @@ * PLACE: when-expression -> paragraph 7 -> sentence 3 * NUMBER: 1 * DESCRIPTION: 'When' with bound value and containment operator. + * HELPERS: typesProvider, classes */ // TESTCASE NUMBER: 1 @@ -23,9 +22,9 @@ fun case_1(value_1: Int, value_2: Int, value_3: Short): String { } // TESTCASE NUMBER: 2 -fun case_2(value_1: Int, value_2: List, value_3: _Class) = when (value_1) { +fun case_2(value_1: Int, value_2: List, value_3: Class) = when (value_1) { in value_2[0] -> "" !in listOf(0, 1, 2, 3, 4) -> "" - !in value_3.getIntArray(90) -> "" + !in value_3.getIntArray() -> "" else -> "" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt index 7b7079b5dd3..ed884d37a64 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/3.2.kt @@ -1,5 +1,3 @@ -// !WITH_BASIC_TYPES -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -8,6 +6,7 @@ * PLACE: when-expression -> paragraph 7 -> sentence 3 * NUMBER: 2 * DESCRIPTION: 'When' with bound value and enumeration of the containment operators. + * HELPERS: typesProvider, classes */ // TESTCASE NUMBER: 1 @@ -21,7 +20,7 @@ fun case_1(value_1: Int, value_2: Int, value_3: Short): String { } // TESTCASE NUMBER: 2 -fun case_2(value_1: Int, value_2: List, value_3: _Class) = when (value_1) { - !in value_2[0], !in listOf(0, 1, 2, 3, 4), !in value_3.getIntArray(90) -> "" +fun case_2(value_1: Int, value_2: List, value_3: Class) = when (value_1) { + !in value_2[0], !in listOf(0, 1, 2, 3, 4), !in value_3.getIntArray() -> "" else -> "" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt index d16f8124a88..c74793fb31b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.1.kt @@ -1,6 +1,3 @@ -// !WITH_BASIC_TYPES -// !WITH_FUNCTIONS -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -9,6 +6,7 @@ * PLACE: when-expression -> paragraph 7 -> sentence 5 * NUMBER: 1 * DESCRIPTION: 'When' with enumeration of the different variants of expressions in 'when condition'. + * HELPERS: typesProvider, classes, functions */ // TESTCASE NUMBER: 1 @@ -28,7 +26,7 @@ fun case_2(value_1: Number, value_2: Int) { when (value_1) { -.09 % 10L -> {} value_2 / -5 -> {} - getByte(99) - 11 + 90 -> {} + getByte() - 11 + 90 -> {} } } @@ -38,7 +36,7 @@ fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) { value_2 -> {} !value_2 -> {} getBoolean() && value_2 -> {} - getChar(10) != 'a' -> {} + getChar() != 'a' -> {} getList() === getAny() -> {} value_3 <= 11 -> {} } @@ -113,8 +111,8 @@ fun case_9(value_1: Any) { // TESTCASE NUMBER: 10 fun case_10(value_1: Collection, value_2: Collection, value_3: Collection?) { when (value_1) { - value_2 as MutableList -> {} - value_2 as? MutableList -> {} + value_2 as List -> {} + value_2 as? List -> {} value_3 as? MutableMap -> {} (value_2 as? Map) as MutableMap -> {} } @@ -153,11 +151,11 @@ fun case_13(value_1: Int, value_2: List, value_3: List> } // TESTCASE NUMBER: 14 -fun case_14(value_1: Any, value_2: _Class, value_3: _Class?, value_4: Int) { +fun case_14(value_1: Any, value_2: Class, value_3: Class?, value_4: Int) { fun __fun_1(): () -> Any { return fun() { } } when (value_1) { - _funWithoutArgs() -> {} + funWithoutArgs() -> {} __fun_1()() -> {} value_2.fun_2(value_4) -> {} value_3?.fun_2(value_4) -> {} @@ -166,7 +164,7 @@ fun case_14(value_1: Any, value_2: _Class, value_3: _Class?, value_4: Int) { } // TESTCASE NUMBER: 15 -fun case_15(value_1: Int, value_2: _Class, value_3: _Class?) { +fun case_15(value_1: Int, value_2: Class, value_3: Class?) { when (value_1) { value_2.prop_1 -> {} value_3?.prop_2 -> {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt index 98a62e75721..5309f7fec55 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-7/pos/5.2.kt @@ -1,6 +1,3 @@ -// !WITH_BASIC_TYPES -// !WITH_CLASSES -// !WITH_FUNCTIONS /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -9,6 +6,7 @@ * PLACE: when-expression -> paragraph 7 -> sentence 5 * NUMBER: 2 * DESCRIPTION: 'When' with different variants of the arithmetic expressions (additive expression and multiplicative expression) in 'when condition'. + * HELPERS: typesProvider, classes, functions */ // TESTCASE NUMBER: 1 @@ -22,14 +20,14 @@ fun case_1(value_1: Any?) { // TESTCASE NUMBER: 2 fun case_2(value_1: Number, value_2: Int) { when (value_1) { - -.09 % 10L, value_2 / -5, getByte(99) - 11 + 90 -> {} + -.09 % 10L, value_2 / -5, getByte() - 11 + 90 -> {} } } // TESTCASE NUMBER: 3 fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) { when (value_1) { - value_2, !value_2, getBoolean() && value_2, getChar(10) != 'a' -> {} + value_2, !value_2, getBoolean() && value_2, getChar() != 'a' -> {} getList() === getAny(), value_3 <= 11 -> {} } } @@ -90,7 +88,7 @@ fun case_9(value_1: Any) { // TESTCASE NUMBER: 10 fun case_10(value_1: Collection, value_2: Collection, value_3: Collection?) { when (value_1) { - value_2 as MutableList, value_2 as? MutableList -> {} + value_2 as List, value_2 as? List -> {} value_3 as? MutableMap, (value_2 as? Map) as MutableMap -> {} } } @@ -123,17 +121,17 @@ fun case_13(value_1: Int, value_2: List, value_3: List> } // TESTCASE NUMBER: 14 -fun case_14(value_1: Any, value_2: _Class, value_3: _Class?, value_4: Int) { +fun case_14(value_1: Any, value_2: Class, value_3: Class?, value_4: Int) { fun __fun_1(): () -> Unit { return fun() { } } when (value_1) { - _funWithoutArgs(), __fun_1()(), value_2.fun_2(value_4) -> {} + funWithoutArgs(), __fun_1()(), value_2.fun_2(value_4) -> {} value_3?.fun_2(value_4), value_3!!.fun_2(value_4) -> {} } } // TESTCASE NUMBER: 15 -fun case_15(value_1: Int, value_2: _Class, value_3: _Class?) { +fun case_15(value_1: Int, value_2: Class, value_3: Class?) { when (value_1) { value_2.prop_1, value_3?.prop_2 -> {} value_2::prop_1.get(), value_3!!::prop_3.get() -> {} @@ -256,7 +254,7 @@ fun case_25(value_1: Boolean) = when (value_1) { * UNEXPECTED BEHAVIOUR * ISSUES: KT-26045 */ -fun case_26(value_1: Int?, value_2: _Class, value_3: _Class?) { +fun case_26(value_1: Int?, value_2: Class, value_3: Class?) { when (value_1) { value_2.prop_1, value_3?.prop_1 -> {} 10 -> {} diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt index 355b94af12e..f19584f8bf8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.1.kt @@ -1,5 +1,4 @@ // !CHECK_TYPE -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -8,24 +7,25 @@ * PLACE: when-expression -> paragraph 9 -> sentence 1 * NUMBER: 1 * DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via else branch). + * HELPERS: classes */ // TESTCASE NUMBER: 1 fun case_1(value_1: Int): String { val whenValue = when { - value_1 == 0 -> _ClassLevel2() - value_1 > 0 && value_1 <= 10 -> _ClassLevel3() - value_1 > 10 && value_1 <= 100 -> _ClassLevel4() - else -> _ClassLevel5() + value_1 == 0 -> ClassLevel2() + value_1 > 0 && value_1 <= 10 -> ClassLevel3() + value_1 > 10 && value_1 <= 100 -> ClassLevel4() + else -> ClassLevel5() } - whenValue checkType { _<_ClassLevel1>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel5>() } - checkSubtype<_ClassLevel3>(whenValue) - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel5>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } @@ -33,19 +33,19 @@ fun case_1(value_1: Int): String { // TESTCASE NUMBER: 2 fun case_2(value_1: Int): String { val whenValue = when (value_1) { - 0 -> _ClassLevel2() - 1 -> _ClassLevel3() - 2 -> _ClassLevel4() - else -> _ClassLevel5() + 0 -> ClassLevel2() + 1 -> ClassLevel3() + 2 -> ClassLevel4() + else -> ClassLevel5() } - whenValue checkType { _<_ClassLevel1>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel5>() } - checkSubtype<_ClassLevel3>(whenValue) - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel5>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt index 4c921dd6565..be0e17f4a95 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.2.kt @@ -1,6 +1,4 @@ // !CHECK_TYPE -// !WITH_ENUM_CLASSES -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -9,58 +7,59 @@ * PLACE: when-expression -> paragraph 9 -> sentence 1 * NUMBER: 2 * DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via enum). + * HELPERS: classes, enumClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _EnumClass): String { +fun case_1(value_1: EnumClass): String { val whenValue = when (value_1) { - _EnumClass.EAST -> _ClassLevel2() - _EnumClass.NORTH -> _ClassLevel3() - _EnumClass.SOUTH -> _ClassLevel4() - _EnumClass.WEST -> _ClassLevel5() + EnumClass.EAST -> ClassLevel2() + EnumClass.NORTH -> ClassLevel3() + EnumClass.SOUTH -> ClassLevel4() + EnumClass.WEST -> ClassLevel5() } - whenValue checkType { _<_ClassLevel1>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel5>() } - checkSubtype<_ClassLevel3>(whenValue) - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel5>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _EnumClass?): String { +fun case_2(value_1: EnumClass?): String { val whenValue = when (value_1) { - _EnumClass.EAST -> _ClassLevel2() - _EnumClass.NORTH -> _ClassLevel3() - _EnumClass.SOUTH -> _ClassLevel4() - _EnumClass.WEST -> _ClassLevel5() - null -> _ClassLevel6() + EnumClass.EAST -> ClassLevel2() + EnumClass.NORTH -> ClassLevel3() + EnumClass.SOUTH -> ClassLevel4() + EnumClass.WEST -> ClassLevel5() + null -> ClassLevel6() } - whenValue checkType { _<_ClassLevel1>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel5>() } - whenValue checkType { _<_ClassLevel6>() } - checkSubtype<_ClassLevel3>(whenValue) - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel5>(whenValue) - checkSubtype<_ClassLevel6>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _EnumClass): String { +fun case_3(value_1: EnumClass): String { val whenValue = when (value_1) { - _EnumClass.EAST -> 10 - _EnumClass.NORTH -> "" - _EnumClass.SOUTH -> {{}} - _EnumClass.WEST -> object {} + EnumClass.EAST -> 10 + EnumClass.NORTH -> "" + EnumClass.SOUTH -> {{}} + EnumClass.WEST -> object {} } whenValue checkType { _() } @@ -74,12 +73,12 @@ fun case_3(value_1: _EnumClass): String { } // TESTCASE NUMBER: 4 -fun case_4(value_1: _EnumClass?): String { +fun case_4(value_1: EnumClass?): String { val whenValue = when (value_1) { - _EnumClass.EAST -> 10 - _EnumClass.NORTH -> "" - _EnumClass.SOUTH -> {{}} - _EnumClass.WEST -> object {} + EnumClass.EAST -> 10 + EnumClass.NORTH -> "" + EnumClass.SOUTH -> {{}} + EnumClass.WEST -> object {} null -> false } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt index 645e2b0594f..e7816cdd3f1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.3.kt @@ -1,5 +1,4 @@ // !CHECK_TYPE -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -8,20 +7,21 @@ * PLACE: when-expression -> paragraph 9 -> sentence 1 * NUMBER: 3 * DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via boolean bound value). + * HELPERS: classes */ // TESTCASE NUMBER: 1 fun case_1(value_1: Boolean): String { val whenValue = when (value_1) { - true -> _ClassLevel2() - false -> _ClassLevel3() + true -> ClassLevel2() + false -> ClassLevel3() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel1>() } - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel3>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } @@ -29,16 +29,16 @@ fun case_1(value_1: Boolean): String { // TESTCASE NUMBER: 2 fun case_2(value_1: Boolean?): String { val whenValue = when (value_1) { - true -> _ClassLevel2() - false -> _ClassLevel3() - null -> _ClassLevel4() + true -> ClassLevel2() + false -> ClassLevel3() + null -> ClassLevel4() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel1>() } - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel3>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt index 118e69cd401..f5eacd6ef15 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/neg/1.4.kt @@ -1,6 +1,4 @@ // !CHECK_TYPE -// !WITH_SEALED_CLASSES -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) @@ -9,51 +7,52 @@ * PLACE: when-expression -> paragraph 9 -> sentence 1 * NUMBER: 4 * DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via sealed class). + * HELPERS: classes, sealedClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _SealedClass): String { +fun case_1(value_1: SealedClass): String { val whenValue = when (value_1) { - is _SealedChild1 -> _ClassLevel2() - is _SealedChild2 -> _ClassLevel3() - is _SealedChild3 -> _ClassLevel4() + is SealedChild1 -> ClassLevel2() + is SealedChild2 -> ClassLevel3() + is SealedChild3 -> ClassLevel4() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel1>() } - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel3>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _SealedClass?): String { +fun case_2(value_1: SealedClass?): String { val whenValue = when (value_1) { - is _SealedChild1 -> _ClassLevel2() - is _SealedChild2 -> _ClassLevel3() - is _SealedChild3 -> _ClassLevel4() - null -> _ClassLevel5() + is SealedChild1 -> ClassLevel2() + is SealedChild2 -> ClassLevel3() + is SealedChild3 -> ClassLevel4() + null -> ClassLevel5() } - whenValue checkType { _<_ClassLevel5>() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel1>() } - checkSubtype<_ClassLevel5>(whenValue) - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel3>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _SealedClass): String { +fun case_3(value_1: SealedClass): String { val whenValue = when (value_1) { - is _SealedChild1 -> 10 - is _SealedChild2 -> "" - is _SealedChild3 -> object {} + is SealedChild1 -> 10 + is SealedChild2 -> "" + is SealedChild3 -> object {} } whenValue checkType { _() } @@ -65,11 +64,11 @@ fun case_3(value_1: _SealedClass): String { } // TESTCASE NUMBER: 4 -fun case_4(value_1: _SealedClass?): String { +fun case_4(value_1: SealedClass?): String { val whenValue = when (value_1) { - is _SealedChild1 -> 10 - is _SealedChild2 -> "" - is _SealedChild3 -> object {} + is SealedChild1 -> 10 + is SealedChild2 -> "" + is SealedChild3 -> object {} null -> {{}} } @@ -84,48 +83,48 @@ fun case_4(value_1: _SealedClass?): String { } // TESTCASE NUMBER: 5 -fun case_5(value_1: _SealedClassWithObjects): String { +fun case_5(value_1: SealedClassWithObjects): String { val whenValue = when (value_1) { - _SealedWithObjectsChild1 -> _ClassLevel2() - _SealedWithObjectsChild2 -> _ClassLevel3() - _SealedWithObjectsChild3 -> _ClassLevel4() + SealedWithObjectsChild1 -> ClassLevel2() + SealedWithObjectsChild2 -> ClassLevel3() + SealedWithObjectsChild3 -> ClassLevel4() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel1>() } - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel3>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 6 -fun case_6(value_1: _SealedClassWithObjects?): String { +fun case_6(value_1: SealedClassWithObjects?): String { val whenValue = when (value_1) { - _SealedWithObjectsChild1 -> _ClassLevel2() - _SealedWithObjectsChild2 -> _ClassLevel3() - _SealedWithObjectsChild3 -> _ClassLevel4() - null -> _ClassLevel5() + SealedWithObjectsChild1 -> ClassLevel2() + SealedWithObjectsChild2 -> ClassLevel3() + SealedWithObjectsChild3 -> ClassLevel4() + null -> ClassLevel5() } - whenValue checkType { _<_ClassLevel5>() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel1>() } - checkSubtype<_ClassLevel5>(whenValue) - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel3>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 7 -fun case_7(value_1: _SealedClassWithObjects): String { +fun case_7(value_1: SealedClassWithObjects): String { val whenValue = when (value_1) { - _SealedWithObjectsChild1 -> 10 - _SealedWithObjectsChild2 -> "" - _SealedWithObjectsChild3 -> object {} + SealedWithObjectsChild1 -> 10 + SealedWithObjectsChild2 -> "" + SealedWithObjectsChild3 -> object {} } whenValue checkType { _() } @@ -137,11 +136,11 @@ fun case_7(value_1: _SealedClassWithObjects): String { } // TESTCASE NUMBER: 8 -fun case_8(value_1: _SealedClassWithObjects?): String { +fun case_8(value_1: SealedClassWithObjects?): String { val whenValue = when (value_1) { - _SealedWithObjectsChild1 -> 10 - _SealedWithObjectsChild2 -> "" - _SealedWithObjectsChild3 -> object {} + SealedWithObjectsChild1 -> 10 + SealedWithObjectsChild2 -> "" + SealedWithObjectsChild3 -> object {} null -> {{}} } @@ -156,19 +155,19 @@ fun case_8(value_1: _SealedClassWithObjects?): String { } // TESTCASE NUMBER: 9 -fun case_9(value_1: _SealedClassWithObjects?): String { +fun case_9(value_1: SealedClassWithObjects?): String { val whenValue = when (value_1) { - is _SealedClassWithObjects -> _ClassLevel2() - else -> _ClassLevel3() + is SealedClassWithObjects -> ClassLevel2() + else -> ClassLevel3() } - whenValue checkType { _<_ClassLevel5>() } - whenValue checkType { _<_ClassLevel4>() } - whenValue checkType { _<_ClassLevel3>() } - whenValue checkType { _<_ClassLevel1>() } - checkSubtype<_ClassLevel5>(whenValue) - checkSubtype<_ClassLevel4>(whenValue) - checkSubtype<_ClassLevel3>(whenValue) + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + whenValue checkType { _() } + checkSubtype(whenValue) + checkSubtype(whenValue) + checkSubtype(whenValue) return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt index 341a41b5be2..ddcf4845a46 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.1.kt @@ -1,5 +1,4 @@ // !CHECK_TYPE -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -8,19 +7,20 @@ * PLACE: when-expression -> paragraph 9 -> sentence 1 * NUMBER: 1 * DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via else branch). + * HELPERS: classes */ // TESTCASE NUMBER: 1 fun case_1(value_1: Int): String { val whenValue = when { - value_1 == 0 -> _ClassLevel2() - value_1 > 0 && value_1 <= 10 -> _ClassLevel3() - value_1 > 10 && value_1 <= 100 -> _ClassLevel4() - else -> _ClassLevel5() + value_1 == 0 -> ClassLevel2() + value_1 > 0 && value_1 <= 10 -> ClassLevel3() + value_1 > 10 && value_1 <= 100 -> ClassLevel4() + else -> ClassLevel5() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } @@ -28,14 +28,14 @@ fun case_1(value_1: Int): String { // TESTCASE NUMBER: 2 fun case_2(value_1: Int): String { val whenValue = when (value_1) { - 0 -> _ClassLevel2() - 1 -> _ClassLevel3() - 2 -> _ClassLevel4() - else -> _ClassLevel5() + 0 -> ClassLevel2() + 1 -> ClassLevel3() + 2 -> ClassLevel4() + else -> ClassLevel5() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt index caba697dd5b..f695692fb87 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.2.kt @@ -1,6 +1,4 @@ // !CHECK_TYPE -// !WITH_CLASSES -// !WITH_ENUM_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -9,46 +7,47 @@ * PLACE: when-expression -> paragraph 9 -> sentence 1 * NUMBER: 2 * DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via enum). + * HELPERS: classes, enumClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _EnumClass): String { +fun case_1(value_1: EnumClass): String { val whenValue = when (value_1) { - _EnumClass.EAST -> _ClassLevel2() - _EnumClass.NORTH -> _ClassLevel3() - _EnumClass.SOUTH -> _ClassLevel4() - _EnumClass.WEST -> _ClassLevel5() + EnumClass.EAST -> ClassLevel2() + EnumClass.NORTH -> ClassLevel3() + EnumClass.SOUTH -> ClassLevel4() + EnumClass.WEST -> ClassLevel5() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _EnumClass?): String { +fun case_2(value_1: EnumClass?): String { val whenValue = when (value_1) { - _EnumClass.EAST -> _ClassLevel2() - _EnumClass.NORTH -> _ClassLevel3() - _EnumClass.SOUTH -> _ClassLevel4() - _EnumClass.WEST -> _ClassLevel5() - null -> _ClassLevel6() + EnumClass.EAST -> ClassLevel2() + EnumClass.NORTH -> ClassLevel3() + EnumClass.SOUTH -> ClassLevel4() + EnumClass.WEST -> ClassLevel5() + null -> ClassLevel6() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _EnumClass): String { +fun case_3(value_1: EnumClass): String { val whenValue = when (value_1) { - _EnumClass.EAST -> 10 - _EnumClass.NORTH -> "" - _EnumClass.SOUTH -> {{}} - _EnumClass.WEST -> object {} + EnumClass.EAST -> 10 + EnumClass.NORTH -> "" + EnumClass.SOUTH -> {{}} + EnumClass.WEST -> object {} } whenValue checkType { _() } @@ -58,12 +57,12 @@ fun case_3(value_1: _EnumClass): String { } // TESTCASE NUMBER: 4 -fun case_4(value_1: _EnumClass?): String { +fun case_4(value_1: EnumClass?): String { val whenValue = when (value_1) { - _EnumClass.EAST -> 10 - _EnumClass.NORTH -> "" - _EnumClass.SOUTH -> {{}} - _EnumClass.WEST -> object {} + EnumClass.EAST -> 10 + EnumClass.NORTH -> "" + EnumClass.SOUTH -> {{}} + EnumClass.WEST -> object {} null -> false } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt index ccb129b9d12..a0db2b01c74 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.3.kt @@ -1,5 +1,4 @@ // !CHECK_TYPE -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -8,17 +7,18 @@ * PLACE: when-expression -> paragraph 9 -> sentence 1 * NUMBER: 3 * DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via boolean bound value). + * HELPERS: classes */ // TESTCASE NUMBER: 1 fun case_1(value_1: Boolean): String { val whenValue = when (value_1) { - true -> _ClassLevel2() - false -> _ClassLevel3() + true -> ClassLevel2() + false -> ClassLevel3() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } @@ -26,13 +26,13 @@ fun case_1(value_1: Boolean): String { // TESTCASE NUMBER: 2 fun case_2(value_1: Boolean?): String { val whenValue = when (value_1) { - true -> _ClassLevel2() - false -> _ClassLevel3() - null -> _ClassLevel4() + true -> ClassLevel2() + false -> ClassLevel3() + null -> ClassLevel4() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt index 6202cc8828c..38225b1e647 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/when-expression/p-9/pos/1.4.kt @@ -1,6 +1,4 @@ // !CHECK_TYPE -// !WITH_SEALED_CLASSES -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) @@ -9,43 +7,44 @@ * PLACE: when-expression -> paragraph 9 -> sentence 1 * NUMBER: 4 * DESCRIPTION: 'When' least upper bound of the types check (when exhaustive via sealed class). + * HELPERS: classes, sealedClasses */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _SealedClass): String { +fun case_1(value_1: SealedClass): String { val whenValue = when (value_1) { - is _SealedChild1 -> _ClassLevel2() - is _SealedChild2 -> _ClassLevel3() - is _SealedChild3 -> _ClassLevel4() + is SealedChild1 -> ClassLevel2() + is SealedChild2 -> ClassLevel3() + is SealedChild3 -> ClassLevel4() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 2 -fun case_2(value_1: _SealedClass?): String { +fun case_2(value_1: SealedClass?): String { val whenValue = when (value_1) { - is _SealedChild1 -> _ClassLevel2() - is _SealedChild2 -> _ClassLevel3() - is _SealedChild3 -> _ClassLevel4() - null -> _ClassLevel5() + is SealedChild1 -> ClassLevel2() + is SealedChild2 -> ClassLevel3() + is SealedChild3 -> ClassLevel4() + null -> ClassLevel5() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 3 -fun case_3(value_1: _SealedClass): String { +fun case_3(value_1: SealedClass): String { val whenValue = when (value_1) { - is _SealedChild1 -> 10 - is _SealedChild2 -> "" - is _SealedChild3 -> object {} + is SealedChild1 -> 10 + is SealedChild2 -> "" + is SealedChild3 -> object {} } whenValue checkType { _() } @@ -55,11 +54,11 @@ fun case_3(value_1: _SealedClass): String { } // TESTCASE NUMBER: 4 -fun case_4(value_1: _SealedClass?): String { +fun case_4(value_1: SealedClass?): String { val whenValue = when (value_1) { - is _SealedChild1 -> 10 - is _SealedChild2 -> "" - is _SealedChild3 -> object {} + is SealedChild1 -> 10 + is SealedChild2 -> "" + is SealedChild3 -> object {} null -> {{}} } @@ -70,40 +69,40 @@ fun case_4(value_1: _SealedClass?): String { } // TESTCASE NUMBER: 5 -fun case_5(value_1: _SealedClassWithObjects): String { +fun case_5(value_1: SealedClassWithObjects): String { val whenValue = when (value_1) { - _SealedWithObjectsChild1 -> _ClassLevel2() - _SealedWithObjectsChild2 -> _ClassLevel3() - _SealedWithObjectsChild3 -> _ClassLevel4() + SealedWithObjectsChild1 -> ClassLevel2() + SealedWithObjectsChild2 -> ClassLevel3() + SealedWithObjectsChild3 -> ClassLevel4() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 6 -fun case_6(value_1: _SealedClassWithObjects?): String { +fun case_6(value_1: SealedClassWithObjects?): String { val whenValue = when (value_1) { - _SealedWithObjectsChild1 -> _ClassLevel2() - _SealedWithObjectsChild2 -> _ClassLevel3() - _SealedWithObjectsChild3 -> _ClassLevel4() - null -> _ClassLevel5() + SealedWithObjectsChild1 -> ClassLevel2() + SealedWithObjectsChild2 -> ClassLevel3() + SealedWithObjectsChild3 -> ClassLevel4() + null -> ClassLevel5() } - whenValue checkType { _<_ClassLevel2>() } - checkSubtype<_ClassLevel1>(whenValue) + whenValue checkType { _() } + checkSubtype(whenValue) return "" } // TESTCASE NUMBER: 7 -fun case_7(value_1: _SealedClassWithObjects): String { +fun case_7(value_1: SealedClassWithObjects): String { val whenValue = when (value_1) { - _SealedWithObjectsChild1 -> 10 - _SealedWithObjectsChild2 -> "" - _SealedWithObjectsChild3 -> object {} + SealedWithObjectsChild1 -> 10 + SealedWithObjectsChild2 -> "" + SealedWithObjectsChild3 -> object {} } whenValue checkType { _() } @@ -113,11 +112,11 @@ fun case_7(value_1: _SealedClassWithObjects): String { } // TESTCASE NUMBER: 8 -fun case_8(value_1: _SealedClassWithObjects?): String { +fun case_8(value_1: SealedClassWithObjects?): String { val whenValue = when (value_1) { - _SealedWithObjectsChild1 -> 10 - _SealedWithObjectsChild2 -> "" - _SealedWithObjectsChild3 -> object {} + SealedWithObjectsChild1 -> 10 + SealedWithObjectsChild2 -> "" + SealedWithObjectsChild3 -> object {} null -> {{}} } @@ -128,9 +127,9 @@ fun case_8(value_1: _SealedClassWithObjects?): String { } // TESTCASE NUMBER: 9 -fun case_9(value_1: _SealedClassWithObjects): String { +fun case_9(value_1: SealedClassWithObjects): String { val whenValue = when (value_1) { - is _SealedClassWithObjects -> 10 + is SealedClassWithObjects -> 10 } whenValue checkType { _() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/2.kt index 645229a114c..2d1c7adac9e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/common/pos/2.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, common * NUMBER: 2 * DESCRIPTION: Recursion in the lambda of contract function. + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt index b2bc171918d..fa3c0a812b6 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, initialization * NUMBER: 1 * DESCRIPTION: val/var reassignment and/or uninitialized variable usages based on CallsInPlace effect with wrong invocation kind + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.kt index d7ce0fb0c61..c1230cb18d2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/2.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, initialization * NUMBER: 2 * DESCRIPTION: val/var reassignment and/or uninitialized variable usages based on nested CallsInPlace effects with wrong invocation kind + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.kt index f109765eab1..3b21d74239d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.kt @@ -1,6 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS -// !WITH_ENUM_CLASSES // SKIP_TXT /* @@ -9,16 +7,17 @@ * SECTIONS: contracts, analysis, controlFlow, initialization * NUMBER: 3 * DESCRIPTION: val/var reassignment and/or uninitialized variable usages with compelx control flow inside/outside lambda of contract function with CallsInPlace effect + * HELPERS: enumClasses, contractFunctions */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _EnumClass?) { +fun case_1(value_1: EnumClass?) { val value_2: Int when (value_1) { - _EnumClass.NORTH -> funWithExactlyOnceCallsInPlace { value_2 = 1 } - _EnumClass.SOUTH -> funWithExactlyOnceCallsInPlace { value_2 = 2 } - _EnumClass.EAST -> funWithExactlyOnceCallsInPlace { value_2 = 4 } + EnumClass.NORTH -> funWithExactlyOnceCallsInPlace { value_2 = 1 } + EnumClass.SOUTH -> funWithExactlyOnceCallsInPlace { value_2 = 2 } + EnumClass.EAST -> funWithExactlyOnceCallsInPlace { value_2 = 4 } null -> funWithExactlyOnceCallsInPlace { value_2 = 5 } } @@ -62,12 +61,12 @@ class case_3(value_1: Any?) { } // TESTCASE NUMBER: 4 -fun case_4(value_1: _EnumClassSingle?) { +fun case_4(value_1: EnumClassSingle?) { var value_2: Int funWithAtMostOnceCallsInPlace { when (value_1) { - _EnumClassSingle.EVERYTHING -> { + EnumClassSingle.EVERYTHING -> { funWithExactlyOnceCallsInPlace { value_2 = 1 } ++value_2 } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.kt index 8c0a0c81e09..0c262254322 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/4.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, initialization * NUMBER: 4 * DESCRIPTION: CallsInPlace contract functions with name shadowing and wrong invocation kind + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.kt index b8b2e1324a8..88df1048fe5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/5.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, initialization * NUMBER: 5 * DESCRIPTION: CallsInPlace contract functions with invalid lambda passing to function parameter. + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/6.kt index 44cb6aec63d..a5144d533cf 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/6.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -10,6 +9,7 @@ * DESCRIPTION: Check the lack of CallsInPlace effect on the lambda in the parentheses. * UNEXPECTED BEHAVIOUR * ISSUES: KT-26229 + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt index fceb8e91a0b..6000bb677e0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, initialization * NUMBER: 1 * DESCRIPTION: val/var assignments using contract functions with CallsInPlace effect + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/2.kt index e6cc3859c59..fea7b55abda 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/2.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, initialization * NUMBER: 2 * DESCRIPTION: Nested val/var assignments using contract functions with CallsInPlace effect + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.kt index 7a5cac06c38..05014b3ced8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.kt @@ -1,6 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS -// !WITH_ENUM_CLASSES // SKIP_TXT /* @@ -9,17 +7,18 @@ * SECTIONS: contracts, analysis, controlFlow, initialization * NUMBER: 3 * DESCRIPTION: val/var assignments or subsequent usages with compelx control flow inside/outside lambda of contract function with CallsInPlace effect + * HELPERS: enumClasses, contractFunctions */ // TESTCASE NUMBER: 1 -fun case_1(value_1: _EnumClass?) { +fun case_1(value_1: EnumClass?) { val value_2: Int when (value_1) { - _EnumClass.NORTH -> funWithExactlyOnceCallsInPlace { value_2 = 1 } - _EnumClass.SOUTH -> funWithExactlyOnceCallsInPlace { value_2 = 2 } - _EnumClass.WEST -> funWithExactlyOnceCallsInPlace { value_2 = 3 } - _EnumClass.EAST -> funWithExactlyOnceCallsInPlace { value_2 = 4 } + EnumClass.NORTH -> funWithExactlyOnceCallsInPlace { value_2 = 1 } + EnumClass.SOUTH -> funWithExactlyOnceCallsInPlace { value_2 = 2 } + EnumClass.WEST -> funWithExactlyOnceCallsInPlace { value_2 = 3 } + EnumClass.EAST -> funWithExactlyOnceCallsInPlace { value_2 = 4 } null -> funWithExactlyOnceCallsInPlace { value_2 = 5 } } @@ -63,12 +62,12 @@ class case_3(value_1: Any?) { } // TESTCASE NUMBER: 4 -fun case_4(value_1: _EnumClassSingle?) { +fun case_4(value_1: EnumClassSingle?) { var value_2: Int funWithAtMostOnceCallsInPlace { when (value_1) { - _EnumClassSingle.EVERYTHING -> { + EnumClassSingle.EVERYTHING -> { funWithExactlyOnceCallsInPlace { value_2 = 1 } ++value_2 } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.kt index b9234ded667..330b4b5fdaf 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/4.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, initialization * NUMBER: 4 * DESCRIPTION: CallsInPlace contract functions with name shadowing + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.kt index 2cbd3d2240c..3d8a52ee6d0 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/6.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) @@ -9,6 +8,7 @@ * DESCRIPTION: Check the lack of CallsInPlace effect on the lambda in the parentheses. * UNEXPECTED BEHAVIOUR * ISSUES: KT-26229 + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt index 4c08550d2ab..e84799e1974 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/neg/1.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, unreachableCode * NUMBER: 1 * DESCRIPTION: Using not allowed break and continue inside lambda of contract function + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.kt index 34bb6c0250c..1df8e11ba4f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/1.kt @@ -1,6 +1,5 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -9,6 +8,7 @@ * SECTIONS: contracts, analysis, controlFlow, unreachableCode * NUMBER: 1 * DESCRIPTION: Unreachable code detection using contract function with CallsInPlace effect + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/2.kt index 525275e9c15..aed4243c01d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/2.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, unreachableCode * NUMBER: 2 * DESCRIPTION: Check for lack of unreachable code report when 'at most once' and 'unknown' invokations in CallsInPlace effect used. + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.kt index bffefa7177c..1f99af08d14 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/3.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, unreachableCode * NUMBER: 3 * DESCRIPTION: Unreachable code detection using local functions or labdas combined with contract functions with CallsInPlace effect + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.kt index 3ac06d77619..78bf1a90790 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/4.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, unreachableCode * NUMBER: 4 * DESCRIPTION: Unreachable code detection using nested contract functions with CallsInPlace effect + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.kt index 1eb1bf9da22..bb6e03fd6ca 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/5.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, unreachableCode * NUMBER: 5 * DESCRIPTION: Unreachable code detection using contract functions with complex control flow inside + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.kt index ae04c8acb32..fd6694ab199 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/unreachableCode/pos/6.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, controlFlow, unreachableCode * NUMBER: 6 * DESCRIPTION: Check for lack of unreachable code report when in complex control flow of contract function lambda not all branches are doing non-local return + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.kt index 7e98cef4df8..e276ae6ae48 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/1.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 1 * DESCRIPTION: Smartcasts using Returns effects with simple type checking, not-null conditions and custom condition (condition for smartcast outside contract). + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.kt index 15ca4b43520..f3382e5a11c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/10.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) @@ -8,6 +7,7 @@ * NUMBER: 10 * DESCRIPTION: Check smartcasts using double negation (returnsFalse/invert type checking/not operator). * ISSUES: KT-26176 + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.kt index bd095d75a81..f891836cfa5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/11.kt @@ -1,4 +1,3 @@ -// !WITH_CONTRACT_FUNCTIONS // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts /* @@ -7,6 +6,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 11 * DESCRIPTION: Smartcast using many of the various Returns effects on the same values. + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.kt index 91035813118..492648e66d1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/13.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) @@ -7,6 +6,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 13 * DESCRIPTION: Smartcast using many of the various Returns effects on the same values. + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/14.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/14.kt index 00207c1447b..6afb0291ebe 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/14.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/14.kt @@ -1,4 +1,3 @@ -// !WITH_CONTRACT_FUNCTIONS // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts /* @@ -7,6 +6,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 14 * DESCRIPTION: Smartcast using many of the various Returns effects on the same values. + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.kt index e559b576d4d..699c367cbca 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/15.kt @@ -1,4 +1,3 @@ -// !WITH_CONTRACT_FUNCTIONS // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts /* @@ -8,6 +7,7 @@ * NUMBER: 15 * DESCRIPTION: Check smartcasts working if type checking for contract function is used * ISSUES: KT-27241 + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.kt index e12283a3137..8926651bb9d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/2.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 2 * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions outside contract (custom condition). + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.kt index 476bfd483aa..3eb68ff4455 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/8.kt @@ -1,4 +1,3 @@ -// !WITH_CONTRACT_FUNCTIONS // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts /* @@ -7,6 +6,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 8 * DESCRIPTION: Smartcasts using some Returns effects. + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt index 72caab06cf5..556d63abd85 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/neg/9.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 9 * DESCRIPTION: Check the lack of smartcasts after non-null assertions or not-null value assignment in lambdas of contract function with 'unknown' or 'at most once' CallsInPlace effects. + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.kt index f96fb22aca1..0772c653bc1 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/1.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 1 * DESCRIPTION: Smartcasts using Returns effects with simple type checking, not-null conditions and custom condition (condition for smartcast outside contract). + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.kt index 6f65215ca2e..4820e337d30 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/10.kt @@ -1,4 +1,3 @@ -// !WITH_CONTRACT_FUNCTIONS // !DIAGNOSTICS: -UNUSED_PARAMETER // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts @@ -9,6 +8,7 @@ * NUMBER: 10 * DESCRIPTION: Smartcasts with correspond contract function with default value in last parameter. * ISSUES: KT-26444 + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.kt index cef80fef6fa..dfe08aec548 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/11.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) @@ -8,6 +7,7 @@ * NUMBER: 11 * DESCRIPTION: Check smartcasts with passing same fields of instances of the same class in contract function with conjunction not-null condition. * ISSUES: KT-26300 + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.kt index 9f51862ae78..b2cb8fbe8c6 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/12.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -10,6 +9,7 @@ * DESCRIPTION: Smartcasts after non-null assertions or not-null value assignment in lambdas of contract function with 'exactly once' or 'at least once' CallsInPlace effects. * UNEXPECTED BEHAVIOUR * ISSUES: KT-26148 + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt index d25e5a5df58..040b0448705 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/2.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CONTRACT_FUNCTIONS // SKIP_TXT /* @@ -8,6 +7,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 2 * DESCRIPTION: Smartcasts using Returns effects with complex (conjunction/disjunction) type checking and not-null conditions outside contract (custom condition). + * HELPERS: contractFunctions */ // TESTCASE NUMBER: 1 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt index 4efcbdf4e77..0b1de9ec267 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/8.kt @@ -1,4 +1,3 @@ -// !WITH_CONTRACT_FUNCTIONS // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts /* @@ -7,6 +6,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 8 * DESCRIPTION: Smartcasts using some Returns effects. + * HELPERS: contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.kt index 18bc90b3c37..17a4b2c0567 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.kt @@ -1,5 +1,3 @@ -// !WITH_CONTRACT_FUNCTIONS -// !WITH_BASIC_TYPES // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts /* @@ -8,6 +6,7 @@ * SECTIONS: contracts, analysis, smartcasts * NUMBER: 9 * DESCRIPTION: Smartcast using complex condition with some contract functions (Returns effect). + * HELPERS: typesProvider, contractFunctions */ // FILE: contracts.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.txt index 7d24c0cdee6..685ca589047 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/smartcasts/pos/9.txt @@ -121,34 +121,34 @@ public inline fun funWithUnknownCallsInPlace(/*0*/ block: () -> kotlin.Unit): ko CallsInPlace(block, UNKNOWN) public fun getAny(): kotlin.Any -public fun getBoolean(/*0*/ arg: kotlin.Any = ...): kotlin.Boolean -public fun getByte(/*0*/ arg: kotlin.Any = ...): kotlin.Byte -public fun getChar(/*0*/ arg: kotlin.Any = ...): kotlin.Char -public fun getDouble(/*0*/ arg: kotlin.Any = ...): kotlin.Double -public fun getFloat(/*0*/ arg: kotlin.Any = ...): kotlin.Float -public fun getInt(/*0*/ arg: kotlin.Any = ...): kotlin.Int -public fun getList(): kotlin.collections.MutableList -public fun getLong(/*0*/ arg: kotlin.Any = ...): kotlin.Long +public fun getBoolean(): kotlin.Boolean +public fun getByte(): kotlin.Byte +public fun getChar(): kotlin.Char +public fun getDouble(): kotlin.Double +public fun getFloat(): kotlin.Float +public fun getInt(): kotlin.Int +public fun getList(): kotlin.collections.List +public fun getLong(): kotlin.Long public fun getNothing(): kotlin.Nothing -public fun getShort(/*0*/ arg: kotlin.Any = ...): kotlin.Short -public fun getString(/*0*/ arg: kotlin.Any = ...): kotlin.String +public fun getShort(): kotlin.Short +public fun getString(): kotlin.String public fun getUnit(): () -> kotlin.Unit -public final class _BasicTypesProvider { - public constructor _BasicTypesProvider() +public final class TypesProvider { + public constructor TypesProvider() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun getAny(): kotlin.Any - public final fun getBoolean(/*0*/ arg: kotlin.Any = ...): kotlin.Boolean - public final fun getByte(/*0*/ arg: kotlin.Any = ...): kotlin.Byte - public final fun getChar(/*0*/ arg: kotlin.Any = ...): kotlin.Char - public final fun getDouble(/*0*/ arg: kotlin.Any = ...): kotlin.Double - public final fun getFloat(/*0*/ arg: kotlin.Any = ...): kotlin.Float - public final fun getInt(/*0*/ arg: kotlin.Any = ...): kotlin.Int - public final fun getList(): kotlin.collections.MutableList - public final fun getLong(/*0*/ arg: kotlin.Any = ...): kotlin.Long + public final fun getBoolean(): kotlin.Boolean + public final fun getByte(): kotlin.Byte + public final fun getChar(): kotlin.Char + public final fun getDouble(): kotlin.Double + public final fun getFloat(): kotlin.Float + public final fun getInt(): kotlin.Int + public final fun getList(): kotlin.collections.List + public final fun getLong(): kotlin.Long public final fun getNothing(): kotlin.Nothing - public final fun getShort(/*0*/ arg: kotlin.Any = ...): kotlin.Short - public final fun getString(/*0*/ arg: kotlin.Any = ...): kotlin.String + public final fun getShort(): kotlin.Short + public final fun getString(): kotlin.String public final fun getUnit(): () -> kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.kt index 360bd49bf88..4ea6a987285 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.kt @@ -1,6 +1,5 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_FUNCTIONS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) @@ -10,6 +9,7 @@ * DESCRIPTION: Contract is first statement in control flow terms, but not in tokens order terms. * UNEXPECTED BEHAVIOUR * ISSUES: KT-26153 + * HELPERS: functions */ import kotlin.contracts.* @@ -57,7 +57,7 @@ inline fun case_6(block: () -> Unit) { // TESTCASE NUMBER: 7 inline fun case_7(block: () -> Unit) { - _funWithAnyArg(contract { + funWithAnyArg(contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.txt index 12ffd99098b..54c214481bd 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.txt @@ -1,7 +1,5 @@ package -public fun _funWithAnyArg(/*0*/ value_1: kotlin.Any): kotlin.Int -public fun _funWithoutArgs(): kotlin.Int public inline fun case_1(/*0*/ block: () -> kotlin.Unit): kotlin.Unit public fun case_2(): kotlin.Unit public inline fun case_3(/*0*/ block: () -> kotlin.Unit): kotlin.Unit @@ -9,3 +7,13 @@ public inline fun case_4(/*0*/ block: () -> kotlin.Unit): kotlin.Unit public inline fun case_5(/*0*/ block: () -> kotlin.Unit): kotlin.Unit public inline fun case_6(/*0*/ block: () -> kotlin.Unit): kotlin.Unit public inline fun case_7(/*0*/ block: () -> kotlin.Unit): kotlin.Unit +public fun expandIn(/*0*/ vararg x: [ERROR : In] /*kotlin.Array]>*/): K +public fun expandInWithRemoveNullable(/*0*/ vararg x: [ERROR : In] /*kotlin.Array]>*/): K +public fun expandInv(/*0*/ vararg x: [ERROR : Inv] /*kotlin.Array]>*/): K +public fun expandInvWithRemoveNullable(/*0*/ vararg x: [ERROR : Inv] /*kotlin.Array]>*/): K +public fun expandOut(/*0*/ vararg x: [ERROR : Out] /*kotlin.Array]>*/): K +public fun expandOutWithRemoveNullable(/*0*/ vararg x: [ERROR : Out] /*kotlin.Array]>*/): K +public fun funWithAnyArg(/*0*/ value_1: kotlin.Any): kotlin.Int +public fun funWithoutArgs(): kotlin.Int +public fun removeNullable(/*0*/ vararg x: K? /*kotlin.Array*/): K +public fun select(/*0*/ vararg x: K /*kotlin.Array*/): K diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.kt index d00af514b6e..e5efc735343 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.kt @@ -1,6 +1,5 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_BASIC_TYPES /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) @@ -8,6 +7,7 @@ * SECTIONS: contracts, declarations, contractBuilder, common * NUMBER: 6 * DESCRIPTION: contracts with not function parameters in implies. + * HELPERS: typesProvider */ import kotlin.contracts.* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.txt index f0818fcf962..f6772eaba14 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.txt @@ -1,34 +1,34 @@ package public fun getAny(): kotlin.Any -public fun getBoolean(/*0*/ arg: kotlin.Any = ...): kotlin.Boolean -public fun getByte(/*0*/ arg: kotlin.Any = ...): kotlin.Byte -public fun getChar(/*0*/ arg: kotlin.Any = ...): kotlin.Char -public fun getDouble(/*0*/ arg: kotlin.Any = ...): kotlin.Double -public fun getFloat(/*0*/ arg: kotlin.Any = ...): kotlin.Float -public fun getInt(/*0*/ arg: kotlin.Any = ...): kotlin.Int -public fun getList(): kotlin.collections.MutableList -public fun getLong(/*0*/ arg: kotlin.Any = ...): kotlin.Long +public fun getBoolean(): kotlin.Boolean +public fun getByte(): kotlin.Byte +public fun getChar(): kotlin.Char +public fun getDouble(): kotlin.Double +public fun getFloat(): kotlin.Float +public fun getInt(): kotlin.Int +public fun getList(): kotlin.collections.List +public fun getLong(): kotlin.Long public fun getNothing(): kotlin.Nothing -public fun getShort(/*0*/ arg: kotlin.Any = ...): kotlin.Short -public fun getString(/*0*/ arg: kotlin.Any = ...): kotlin.String +public fun getShort(): kotlin.Short +public fun getString(): kotlin.String public fun getUnit(): () -> kotlin.Unit -public final class _BasicTypesProvider { - public constructor _BasicTypesProvider() +public final class TypesProvider { + public constructor TypesProvider() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun getAny(): kotlin.Any - public final fun getBoolean(/*0*/ arg: kotlin.Any = ...): kotlin.Boolean - public final fun getByte(/*0*/ arg: kotlin.Any = ...): kotlin.Byte - public final fun getChar(/*0*/ arg: kotlin.Any = ...): kotlin.Char - public final fun getDouble(/*0*/ arg: kotlin.Any = ...): kotlin.Double - public final fun getFloat(/*0*/ arg: kotlin.Any = ...): kotlin.Float - public final fun getInt(/*0*/ arg: kotlin.Any = ...): kotlin.Int - public final fun getList(): kotlin.collections.MutableList - public final fun getLong(/*0*/ arg: kotlin.Any = ...): kotlin.Long + public final fun getBoolean(): kotlin.Boolean + public final fun getByte(): kotlin.Byte + public final fun getChar(): kotlin.Char + public final fun getDouble(): kotlin.Double + public final fun getFloat(): kotlin.Float + public final fun getInt(): kotlin.Int + public final fun getList(): kotlin.collections.List + public final fun getLong(): kotlin.Long public final fun getNothing(): kotlin.Nothing - public final fun getShort(/*0*/ arg: kotlin.Any = ...): kotlin.Short - public final fun getString(/*0*/ arg: kotlin.Any = ...): kotlin.String + public final fun getShort(): kotlin.Short + public final fun getString(): kotlin.String public final fun getUnit(): () -> kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.kt index 97855708140..13a71476394 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.kt @@ -1,6 +1,5 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_BASIC_TYPES /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) @@ -9,6 +8,7 @@ * NUMBER: 7 * DESCRIPTION: Contract function with 'this' labeled by not current extensible object * ISSUES: KT-26149 + * HELPERS: typesProvider */ import kotlin.contracts.* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.txt index e41314319cb..fa4f1c8537c 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/7.txt @@ -1,35 +1,35 @@ package public fun getAny(): kotlin.Any -public fun getBoolean(/*0*/ arg: kotlin.Any = ...): kotlin.Boolean -public fun getByte(/*0*/ arg: kotlin.Any = ...): kotlin.Byte -public fun getChar(/*0*/ arg: kotlin.Any = ...): kotlin.Char -public fun getDouble(/*0*/ arg: kotlin.Any = ...): kotlin.Double -public fun getFloat(/*0*/ arg: kotlin.Any = ...): kotlin.Float -public fun getInt(/*0*/ arg: kotlin.Any = ...): kotlin.Int -public fun getList(): kotlin.collections.MutableList -public fun getLong(/*0*/ arg: kotlin.Any = ...): kotlin.Long +public fun getBoolean(): kotlin.Boolean +public fun getByte(): kotlin.Byte +public fun getChar(): kotlin.Char +public fun getDouble(): kotlin.Double +public fun getFloat(): kotlin.Float +public fun getInt(): kotlin.Int +public fun getList(): kotlin.collections.List +public fun getLong(): kotlin.Long public fun getNothing(): kotlin.Nothing -public fun getShort(/*0*/ arg: kotlin.Any = ...): kotlin.Short -public fun getString(/*0*/ arg: kotlin.Any = ...): kotlin.String +public fun getShort(): kotlin.Short +public fun getString(): kotlin.String public fun getUnit(): () -> kotlin.Unit public fun T?.case_1(): kotlin.Unit -public final class _BasicTypesProvider { - public constructor _BasicTypesProvider() +public final class TypesProvider { + public constructor TypesProvider() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun getAny(): kotlin.Any - public final fun getBoolean(/*0*/ arg: kotlin.Any = ...): kotlin.Boolean - public final fun getByte(/*0*/ arg: kotlin.Any = ...): kotlin.Byte - public final fun getChar(/*0*/ arg: kotlin.Any = ...): kotlin.Char - public final fun getDouble(/*0*/ arg: kotlin.Any = ...): kotlin.Double - public final fun getFloat(/*0*/ arg: kotlin.Any = ...): kotlin.Float - public final fun getInt(/*0*/ arg: kotlin.Any = ...): kotlin.Int - public final fun getList(): kotlin.collections.MutableList - public final fun getLong(/*0*/ arg: kotlin.Any = ...): kotlin.Long + public final fun getBoolean(): kotlin.Boolean + public final fun getByte(): kotlin.Byte + public final fun getChar(): kotlin.Char + public final fun getDouble(): kotlin.Double + public final fun getFloat(): kotlin.Float + public final fun getInt(): kotlin.Int + public final fun getList(): kotlin.collections.List + public final fun getLong(): kotlin.Long public final fun getNothing(): kotlin.Nothing - public final fun getShort(/*0*/ arg: kotlin.Any = ...): kotlin.Short - public final fun getString(/*0*/ arg: kotlin.Any = ...): kotlin.String + public final fun getShort(): kotlin.Short + public final fun getString(): kotlin.String public final fun getUnit(): () -> kotlin.Unit public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.kt index 7549be2e9cf..05b847c932d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_OBJECTS /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) @@ -8,6 +7,7 @@ * NUMBER: 3 * DESCRIPTION: Using reference equality in implies. * ISSUES: KT-26177 + * HELPERS: objects */ import kotlin.contracts.* @@ -15,7 +15,7 @@ import kotlin.contracts.* // TESTCASE NUMBER: 1 fun case_1(x: Any?): Boolean { contract { - returns(true) implies (x === _EmptyObject) // should be not allowed + returns(true) implies (x === EmptyObject) // should be not allowed } - return x === _EmptyObject + return x === EmptyObject } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.txt index 5c2549c2e28..e8cf9b57838 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.txt @@ -2,8 +2,83 @@ package public fun case_1(/*0*/ x: kotlin.Any?): kotlin.Boolean -public object _EmptyObject { - private constructor _EmptyObject() +public object DeepObject { + private constructor DeepObject() + public final val prop_1: kotlin.Nothing? = null + public final var prop_2: kotlin.Nothing? + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public object A { + private constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public object B { + private constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public object C { + private constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public object D { + private constructor D() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public object E { + private constructor E() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public object F { + private constructor F() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public object G { + private constructor G() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public object J { + private constructor J() + public final val x: kotlin.Int? = 10 + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + } + } + } + } + } + } +} + +public object EmptyObject { + private constructor EmptyObject() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public object Object { + private constructor Object() + public final val prop_1: kotlin.Number? = 1 + public final val prop_2: kotlin.Number = 1 public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt index 84d013385d5..7295e6ea0d5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.kt @@ -1,6 +1,5 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts // !DIAGNOSTICS: -FINAL_UPPER_BOUND -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) @@ -8,6 +7,7 @@ * SECTIONS: contracts, declarations, contractBuilder, effects, returns * NUMBER: 1 * DESCRIPTION: Returns effect with simple conditions. + * HELPERS: classes */ import kotlin.contracts.* @@ -50,8 +50,8 @@ fun Any?.case_7() { // TESTCASE NUMBER: 8 fun T?.case_8() { - contract { returns() implies (this@case_8 !is _ClassLevel3?) } - if (this is _ClassLevel3?) throw Exception() + contract { returns() implies (this@case_8 !is ClassLevel3?) } + if (this is ClassLevel3?) throw Exception() } // TESTCASE NUMBER: 9 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.txt index b35b151b6ce..fd9eb18191a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.txt @@ -31,16 +31,20 @@ public fun kotlin.Any?.case_7(): kotlin.Unit Returns(WILDCARD) -> is Number public fun T?.case_8(): kotlin.Unit - Returns(WILDCARD) -> !is _ClassLevel3? + Returns(WILDCARD) -> !is ClassLevel3? public fun T.case_9(): kotlin.Boolean? Returns(NULL) -> is Byte? -public final class _Class { - public constructor _Class() +public final class Class { + public constructor Class() public final val prop_1: kotlin.Int = 1 public final val prop_2: kotlin.Int = 2 public final val prop_3: kotlin.Int = 3 + public final val prop_4: kotlin.Float? = 3.0.toFloat() + public final val prop_5: kotlin.Float = 3.0.toFloat() + public final val prop_6: kotlin.String = "..." + public final val prop_7: kotlin.Nothing? = "..." public final operator fun contains(/*0*/ a: kotlin.Char): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Int): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Long): kotlin.Boolean @@ -48,9 +52,9 @@ public final class _Class { public final fun fun_1(): (kotlin.Int) -> (kotlin.Int) -> kotlin.Int public final fun fun_2(/*0*/ value_1: kotlin.Int): kotlin.Int public final fun fun_3(/*0*/ value_1: kotlin.Int): (kotlin.Int) -> kotlin.Int - public final fun getCharArray(/*0*/ value_1: kotlin.Char): kotlin.CharArray - public final fun getIntArray(/*0*/ value_1: kotlin.Int): kotlin.IntArray - public final fun getLongArray(/*0*/ value_1: kotlin.Long): kotlin.LongArray + public final fun getCharArray(): kotlin.CharArray + public final fun getIntArray(): kotlin.IntArray + public final fun getLongArray(): kotlin.LongArray public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -64,50 +68,71 @@ public final class _Class { } } -public open class _ClassLevel1 { - public constructor _ClassLevel1() +public open class ClassLevel1 { + public constructor ClassLevel1() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test1(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel2 : _ClassLevel1 { - public constructor _ClassLevel2() +public open class ClassLevel2 : ClassLevel1 { + public constructor ClassLevel2() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test2(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel3 : _ClassLevel2 { - public constructor _ClassLevel3() +public open class ClassLevel3 : ClassLevel2 { + public constructor ClassLevel3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final fun test3(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel4 : _ClassLevel3 { - public constructor _ClassLevel4() +public open class ClassLevel4 : ClassLevel3 { + public constructor ClassLevel4() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final fun test4(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel5 : _ClassLevel4 { - public constructor _ClassLevel5() +public open class ClassLevel5 : ClassLevel4 { + public constructor ClassLevel5() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit + public final fun test5(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class _ClassLevel6 : _ClassLevel5 { - public constructor _ClassLevel6() +public final class ClassLevel6 : ClassLevel5 { + public constructor ClassLevel6() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test5(): kotlin.Unit + public final fun test6(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class _ClassWithCompanionObject { - public constructor _ClassWithCompanionObject() +public final class ClassWithCompanionObject { + public constructor ClassWithCompanionObject() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -120,9 +145,65 @@ public final class _ClassWithCompanionObject { } } -public final class _EmptyClass { - public constructor _EmptyClass() +public final class ClassWithSixTypeParameters { + public constructor ClassWithSixTypeParameters() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } + +public final class ClassWithThreeTypeParameters { + public constructor ClassWithThreeTypeParameters(/*0*/ x: K, /*1*/ y: L, /*2*/ z: M) + public final val x: K + public final val y: L + public final val z: M + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithTwoTypeParameters { + public constructor ClassWithTwoTypeParameters() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test1(): [ERROR : T]? + public final fun test2(): K? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class EmptyClass { + public constructor EmptyClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class In { + public constructor In() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun getWithUpperBoundT(): K + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun put(/*0*/ x: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Inv { + public constructor Inv(/*0*/ x: T = ...) + public final val x: T + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun get(): T + public final fun getNullable(): T? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun put(/*0*/ x: T): kotlin.Unit + public final fun test(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Out { + public constructor Out(/*0*/ x: T = ...) + public final val x: T + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun get(): T + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.kt index 656a26582af..b720f6ff474 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.kt @@ -1,6 +1,5 @@ // !DIAGNOSTICS: -FINAL_UPPER_BOUND // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) @@ -8,6 +7,7 @@ * SECTIONS: contracts, declarations, contractBuilder, effects, returns * NUMBER: 2 * DESCRIPTION: Returns effect with complex conditions (using conjunction and disjuntion). + * HELPERS: classes */ import kotlin.contracts.* diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.txt index 9bc9a2c52f6..aaab2714d35 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.txt @@ -12,11 +12,15 @@ public fun case_3(/*0*/ value_1: kotlin.Any?, /*1*/ value_2: kotlin.Any?, /*2*/ public fun T.case_4(): kotlin.Boolean Returns(FALSE) -> is Char || == null -public final class _Class { - public constructor _Class() +public final class Class { + public constructor Class() public final val prop_1: kotlin.Int = 1 public final val prop_2: kotlin.Int = 2 public final val prop_3: kotlin.Int = 3 + public final val prop_4: kotlin.Float? = 3.0.toFloat() + public final val prop_5: kotlin.Float = 3.0.toFloat() + public final val prop_6: kotlin.String = "..." + public final val prop_7: kotlin.Nothing? = "..." public final operator fun contains(/*0*/ a: kotlin.Char): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Int): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Long): kotlin.Boolean @@ -24,9 +28,9 @@ public final class _Class { public final fun fun_1(): (kotlin.Int) -> (kotlin.Int) -> kotlin.Int public final fun fun_2(/*0*/ value_1: kotlin.Int): kotlin.Int public final fun fun_3(/*0*/ value_1: kotlin.Int): (kotlin.Int) -> kotlin.Int - public final fun getCharArray(/*0*/ value_1: kotlin.Char): kotlin.CharArray - public final fun getIntArray(/*0*/ value_1: kotlin.Int): kotlin.IntArray - public final fun getLongArray(/*0*/ value_1: kotlin.Long): kotlin.LongArray + public final fun getCharArray(): kotlin.CharArray + public final fun getIntArray(): kotlin.IntArray + public final fun getLongArray(): kotlin.LongArray public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -40,50 +44,71 @@ public final class _Class { } } -public open class _ClassLevel1 { - public constructor _ClassLevel1() +public open class ClassLevel1 { + public constructor ClassLevel1() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test1(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel2 : _ClassLevel1 { - public constructor _ClassLevel2() +public open class ClassLevel2 : ClassLevel1 { + public constructor ClassLevel2() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test2(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel3 : _ClassLevel2 { - public constructor _ClassLevel3() +public open class ClassLevel3 : ClassLevel2 { + public constructor ClassLevel3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final fun test3(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel4 : _ClassLevel3 { - public constructor _ClassLevel4() +public open class ClassLevel4 : ClassLevel3 { + public constructor ClassLevel4() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final fun test4(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel5 : _ClassLevel4 { - public constructor _ClassLevel5() +public open class ClassLevel5 : ClassLevel4 { + public constructor ClassLevel5() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit + public final fun test5(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class _ClassLevel6 : _ClassLevel5 { - public constructor _ClassLevel6() +public final class ClassLevel6 : ClassLevel5 { + public constructor ClassLevel6() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test5(): kotlin.Unit + public final fun test6(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class _ClassWithCompanionObject { - public constructor _ClassWithCompanionObject() +public final class ClassWithCompanionObject { + public constructor ClassWithCompanionObject() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -96,9 +121,65 @@ public final class _ClassWithCompanionObject { } } -public final class _EmptyClass { - public constructor _EmptyClass() +public final class ClassWithSixTypeParameters { + public constructor ClassWithSixTypeParameters() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } + +public final class ClassWithThreeTypeParameters { + public constructor ClassWithThreeTypeParameters(/*0*/ x: K, /*1*/ y: L, /*2*/ z: M) + public final val x: K + public final val y: L + public final val z: M + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithTwoTypeParameters { + public constructor ClassWithTwoTypeParameters() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test1(): [ERROR : T]? + public final fun test2(): K? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class EmptyClass { + public constructor EmptyClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class In { + public constructor In() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun getWithUpperBoundT(): K + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun put(/*0*/ x: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Inv { + public constructor Inv(/*0*/ x: T = ...) + public final val x: T + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun get(): T + public final fun getNullable(): T? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun put(/*0*/ x: T): kotlin.Unit + public final fun test(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Out { + public constructor Out(/*0*/ x: T = ...) + public final val x: T + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun get(): T + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.kt index ae66ba32458..c6fb4565222 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.kt @@ -1,5 +1,4 @@ // !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts -// !WITH_CLASSES /* * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) @@ -8,6 +7,7 @@ * NUMBER: 2 * DESCRIPTION: Check report about use contracts in literal functions, lambdas or not top-level functions. * ISSUES: KT-26149 + * HELPERS: classes */ import kotlin.contracts.* @@ -46,10 +46,10 @@ object case_3 { * TESTCASE NUMBER: 4 * ISSUES: KT-26244 */ -class case_4 : _ClassLevel3() { +class case_4 : ClassLevel3() { fun T.case_4_1(): Boolean { - contract { returns(false) implies (this@case_4 !is _ClassLevel1) } + contract { returns(false) implies (this@case_4 !is ClassLevel1) } return this == null } @@ -70,30 +70,30 @@ class case_4 : _ClassLevel3() { fun T.case_4_5_wrap() { fun case_4_5_contract() { - contract { returns() implies (this@case_4_5_wrap is _ClassLevel1) } - if (this@case_4_5_wrap !is _ClassLevel1) throw Exception() + contract { returns() implies (this@case_4_5_wrap is ClassLevel1) } + if (this@case_4_5_wrap !is ClassLevel1) throw Exception() } case_4_5_contract() println("!") } - fun case_4_5() = _ClassLevel3().case_4_5_wrap() + fun case_4_5() = ClassLevel3().case_4_5_wrap() } /* * TESTCASE NUMBER: 5 * ISSUES: KT-26244 */ -class case_5 : _ClassLevel5() { +class case_5 : ClassLevel5() { inner class case_5_1 { fun K.case_5_1_1() { - contract { returns() implies (this@case_5_1 !is _ClassLevel1 && this@case_5_1 != null || this@case_5 is _ClassLevel1 && this@case_5_1_1 is Float) } - if (!(this@case_5_1 !is _ClassLevel1 && this@case_5_1 != null || this@case_5 is _ClassLevel1 && this is Float)) throw Exception() + contract { returns() implies (this@case_5_1 !is ClassLevel1 && this@case_5_1 != null || this@case_5 is ClassLevel1 && this@case_5_1_1 is Float) } + if (!(this@case_5_1 !is ClassLevel1 && this@case_5_1 != null || this@case_5 is ClassLevel1 && this is Float)) throw Exception() } fun case_5_1_2() { - contract { returns() implies (this@case_5_1 !is _ClassLevel1 || this@case_5 is _ClassLevel1 || this@case_5_1 == null) } - if (!(this@case_5_1 !is _ClassLevel1 || this@case_5 is _ClassLevel1 || this@case_5_1 == null)) throw Exception() + contract { returns() implies (this@case_5_1 !is ClassLevel1 || this@case_5 is ClassLevel1 || this@case_5_1 == null) } + if (!(this@case_5_1 !is ClassLevel1 || this@case_5 is ClassLevel1 || this@case_5_1 == null)) throw Exception() } } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.txt index 56722e3ee11..3774f6f0698 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.txt @@ -3,11 +3,15 @@ package public fun case_1(): kotlin.Unit public fun case_2(): kotlin.Unit -public final class _Class { - public constructor _Class() +public final class Class { + public constructor Class() public final val prop_1: kotlin.Int = 1 public final val prop_2: kotlin.Int = 2 public final val prop_3: kotlin.Int = 3 + public final val prop_4: kotlin.Float? = 3.0.toFloat() + public final val prop_5: kotlin.Float = 3.0.toFloat() + public final val prop_6: kotlin.String = "..." + public final val prop_7: kotlin.Nothing? = "..." public final operator fun contains(/*0*/ a: kotlin.Char): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Int): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Long): kotlin.Boolean @@ -15,9 +19,9 @@ public final class _Class { public final fun fun_1(): (kotlin.Int) -> (kotlin.Int) -> kotlin.Int public final fun fun_2(/*0*/ value_1: kotlin.Int): kotlin.Int public final fun fun_3(/*0*/ value_1: kotlin.Int): (kotlin.Int) -> kotlin.Int - public final fun getCharArray(/*0*/ value_1: kotlin.Char): kotlin.CharArray - public final fun getIntArray(/*0*/ value_1: kotlin.Int): kotlin.IntArray - public final fun getLongArray(/*0*/ value_1: kotlin.Long): kotlin.LongArray + public final fun getCharArray(): kotlin.CharArray + public final fun getIntArray(): kotlin.IntArray + public final fun getLongArray(): kotlin.LongArray public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -31,50 +35,71 @@ public final class _Class { } } -public open class _ClassLevel1 { - public constructor _ClassLevel1() +public open class ClassLevel1 { + public constructor ClassLevel1() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test1(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel2 : _ClassLevel1 { - public constructor _ClassLevel2() +public open class ClassLevel2 : ClassLevel1 { + public constructor ClassLevel2() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test2(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel3 : _ClassLevel2 { - public constructor _ClassLevel3() +public open class ClassLevel3 : ClassLevel2 { + public constructor ClassLevel3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final fun test3(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel4 : _ClassLevel3 { - public constructor _ClassLevel4() +public open class ClassLevel4 : ClassLevel3 { + public constructor ClassLevel4() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final fun test4(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public open class _ClassLevel5 : _ClassLevel4 { - public constructor _ClassLevel5() +public open class ClassLevel5 : ClassLevel4 { + public constructor ClassLevel5() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit + public final fun test5(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class _ClassLevel6 : _ClassLevel5 { - public constructor _ClassLevel6() +public final class ClassLevel6 : ClassLevel5 { + public constructor ClassLevel6() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test5(): kotlin.Unit + public final fun test6(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class _ClassWithCompanionObject { - public constructor _ClassWithCompanionObject() +public final class ClassWithCompanionObject { + public constructor ClassWithCompanionObject() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -87,13 +112,69 @@ public final class _ClassWithCompanionObject { } } -public final class _EmptyClass { - public constructor _EmptyClass() +public final class ClassWithSixTypeParameters { + public constructor ClassWithSixTypeParameters() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } +public final class ClassWithThreeTypeParameters { + public constructor ClassWithThreeTypeParameters(/*0*/ x: K, /*1*/ y: L, /*2*/ z: M) + public final val x: K + public final val y: L + public final val z: M + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithTwoTypeParameters { + public constructor ClassWithTwoTypeParameters() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test1(): [ERROR : T]? + public final fun test2(): K? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class EmptyClass { + public constructor EmptyClass() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class In { + public constructor In() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun getWithUpperBoundT(): K + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun put(/*0*/ x: T): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Inv { + public constructor Inv(/*0*/ x: T = ...) + public final val x: T + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun get(): T + public final fun getNullable(): T? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun put(/*0*/ x: T): kotlin.Unit + public final fun test(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Out { + public constructor Out(/*0*/ x: T = ...) + public final val x: T + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun get(): T + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + public object case_3 { private constructor case_3() public final fun case_3(/*0*/ block: () -> kotlin.Unit): kotlin.Unit @@ -102,12 +183,15 @@ public object case_3 { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class case_4 : _ClassLevel3 { +public final class case_4 : ClassLevel3 { public constructor case_4() public final fun case_4_2(/*0*/ number: kotlin.Int?): kotlin.Boolean public final fun case_4_5(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public final fun T.case_4_1(): kotlin.Boolean public final fun T?.case_4_3(): kotlin.Boolean @@ -115,10 +199,15 @@ public final class case_4 : _ClassLevel3 { public final fun T.case_4_5_wrap(): kotlin.Unit } -public final class case_5 : _ClassLevel5 { +public final class case_5 : ClassLevel5 { public constructor case_5() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test2(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test3(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test4(): kotlin.Unit + public final override /*1*/ /*fake_override*/ fun test5(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public final inner class case_5_1 /*captured type parameters: /*0*/ T*/ { 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 fcb4dc64846..7d7a7f9704f 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestSpec.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTestSpec.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.checkers +import com.intellij.openapi.util.io.FileUtil import org.jetbrains.kotlin.TestExceptionsComparator import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl @@ -18,22 +19,9 @@ import org.jetbrains.kotlin.test.* import org.junit.Assert import java.io.File import java.util.regex.Matcher -import java.util.regex.Pattern abstract class AbstractDiagnosticsTestSpec : AbstractDiagnosticsTest() { companion object { - // map of pairs: source helper filename - target helper filename - private val directives = mapOf( - "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 val withoutDescriptorsTestGroups = listOf( "linked/when-expression" ) @@ -41,8 +29,6 @@ abstract class AbstractDiagnosticsTestSpec : AbstractDiagnosticsTest() { 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 val exceptionPattern = - Pattern.compile("""Exception while analyzing expression at \((?\d+),(?\d+)\) in /(?.*?)$""") } lateinit var specTest: AbstractSpecTest @@ -67,13 +53,14 @@ abstract class AbstractDiagnosticsTestSpec : AbstractDiagnosticsTest() { override fun getKtFiles(testFiles: List, includeExtras: Boolean): List { val ktFiles = super.getKtFiles(testFiles, includeExtras) as ArrayList - if (includeExtras) { - for ((name, filename) in directives) { - if (checkDirective(name, testFiles)) { - val declarations = File("$HELPERS_PATH/$filename").readText() - ktFiles.add(KotlinTestUtils.createFile(filename, declarations, project)) - } - } + if (specTest.helpers == null) return ktFiles + + specTest.helpers?.forEach { + val filename = "$it.kt" + val helperContent = FileUtil.loadFile(File("$HELPERS_PATH/$filename"), true) + ktFiles.add( + KotlinTestUtils.createFile(filename, helperContent, project) + ) } return ktFiles diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTestSpec.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTestSpec.kt index a079efdc6c8..689b813fa2c 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTestSpec.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTestSpec.kt @@ -7,12 +7,12 @@ package org.jetbrains.kotlin.codegen import com.intellij.openapi.util.io.FileUtil import org.jetbrains.kotlin.TestExceptionsComparator +import org.jetbrains.kotlin.spec.models.AbstractSpecTest import org.jetbrains.kotlin.spec.parsers.CommonParser import org.jetbrains.kotlin.spec.parsers.CommonPatterns.packagePattern import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH import org.jetbrains.kotlin.spec.validators.BlackBoxTestTypeValidator import org.jetbrains.kotlin.spec.validators.SpecTestValidationException -import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.junit.Assert import java.io.* @@ -21,31 +21,25 @@ abstract class AbstractBlackBoxCodegenTestSpec : AbstractBlackBoxCodegenTest() { private const val CODEGEN_BOX_TESTDATA_PATH = "$TESTDATA_PATH/codegen/box" private const val HELPERS_PATH = "$CODEGEN_BOX_TESTDATA_PATH/helpers" private const val HELPERS_PACKAGE_VARIABLE = "" - private const val HELPERS_DIRECTIVE = "// HELPERS:" - - // map of pairs: source helper filename - target helper filename - private val helperDirectives = mapOf( - "REFLECT" to "reflect.kt" - ) } private fun addPackageDirectiveToHelperFile(helperContent: String, packageName: String?) = helperContent.replace(HELPERS_PACKAGE_VARIABLE, if (packageName == null) "" else "package $packageName") - private fun includeHelpers(wholeFile: File, files: MutableList) { + private fun includeHelpers(wholeFile: File, files: MutableList, specTest: AbstractSpecTest) { + if (specTest.helpers == null) return + val fileContent = FileUtil.loadFile(wholeFile, true) - val helpersSpecified = InTextDirectivesUtils.findListWithPrefixes(fileContent, HELPERS_DIRECTIVE) val packageName = packagePattern.matcher(fileContent).let { if (it.find()) it.group("packageName") else null } - helpersSpecified.forEach { - if (helperDirectives.contains(it)) { - val helperContent = FileUtil.loadFile(File("$HELPERS_PATH/${helperDirectives[it]}"), true) - files.add( - TestFile(helperDirectives[it]!!, addPackageDirectiveToHelperFile(helperContent, packageName)) - ) - } + specTest.helpers.forEach { + val filename = "$it.kt" + val helperContent = FileUtil.loadFile(File("$HELPERS_PATH/$filename"), true) + files.add( + TestFile(filename, addPackageDirectiveToHelperFile(helperContent, packageName)) + ) } } @@ -65,7 +59,7 @@ abstract class AbstractBlackBoxCodegenTestSpec : AbstractBlackBoxCodegenTest() { println(specTest) - includeHelpers(wholeFile, files) + includeHelpers(wholeFile, files, specTest) TestExceptionsComparator(wholeFile).runAndCompareWithExpected { super.doMultiFileTest(wholeFile, files, javaFilesDir) diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/AbstractSpecTest.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/AbstractSpecTest.kt index e1a486543be..ecbb7dbb59a 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/AbstractSpecTest.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/AbstractSpecTest.kt @@ -30,7 +30,8 @@ enum class CommonSpecTestFileInfoElementType( override val required: Boolean = false ) : SpecTestInfoElementType { NUMBER(required = true), - DESCRIPTION(required = true) + DESCRIPTION(required = true), + HELPERS } enum class SpecTestCaseInfoElementType( @@ -49,7 +50,8 @@ abstract class AbstractSpecTest( val description: String, val cases: SpecTestCasesSet, val unexpectedBehavior: Boolean, - val issues: Set + val issues: Set, + val helpers: Set? ) { companion object { private fun issuesToString(issues: Set) = issues.joinToString(", ") { CommonPatterns.ISSUE_TRACKER + it } diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/LinkedSpecTest.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/LinkedSpecTest.kt index 4797a4b1f3c..fd94d86e07e 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/LinkedSpecTest.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/LinkedSpecTest.kt @@ -43,8 +43,9 @@ class LinkedSpecTest( description: String, cases: SpecTestCasesSet, unexpectedBehavior: Boolean, - issues: Set -) : AbstractSpecTest(testArea, testType, place.sections, testNumber, description, cases, unexpectedBehavior, issues) { + issues: Set, + helpers: Set? +) : AbstractSpecTest(testArea, testType, place.sections, testNumber, description, cases, unexpectedBehavior, issues, helpers) { override fun checkPathConsistency(pathMatcher: Matcher) = testArea == TestArea.valueOf(pathMatcher.group("testArea").withUnderscores()) && testType == TestType.fromValue(pathMatcher.group("testType"))!! diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/NotLinkedSpecTest.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/NotLinkedSpecTest.kt index 09219914f91..0edb669aab0 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/NotLinkedSpecTest.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/models/NotLinkedSpecTest.kt @@ -32,8 +32,9 @@ class NotLinkedSpecTest( description: String, cases: SpecTestCasesSet, unexpectedBehavior: Boolean, - issues: Set -) : AbstractSpecTest(testArea, testType, sections, testNumber, description, cases, unexpectedBehavior, issues) { + issues: Set, + helpers: Set? +) : AbstractSpecTest(testArea, testType, sections, testNumber, description, cases, unexpectedBehavior, issues, helpers) { override fun checkPathConsistency(pathMatcher: Matcher) = testArea == TestArea.valueOf(pathMatcher.group("testArea").withUnderscores()) && testType == TestType.fromValue(pathMatcher.group("testType"))!! diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/parsers/CommonParser.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/parsers/CommonParser.kt index 3fb8e8ef6f1..015117d10cb 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/parsers/CommonParser.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/parsers/CommonParser.kt @@ -70,7 +70,8 @@ object CommonParser { parsedTestFile.testDescription, parsedTestFile.testCasesSet, parsedTestFile.unexpectedBehavior, - parsedTestFile.issues + parsedTestFile.issues, + parsedTestFile.helpers ) } @@ -87,7 +88,8 @@ object CommonParser { parsedTestFile.testDescription, parsedTestFile.testCasesSet, parsedTestFile.unexpectedBehavior, - parsedTestFile.issues + parsedTestFile.issues, + parsedTestFile.helpers ) } diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/parsers/TestInfoParser.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/parsers/TestInfoParser.kt index 7423eb0fcfa..ba7f90f65e9 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/parsers/TestInfoParser.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/parsers/TestInfoParser.kt @@ -23,7 +23,8 @@ data class ParsedTestFile( val testInfoElements: SpecTestInfoElements, val testCasesSet: SpecTestCasesSet, val unexpectedBehavior: Boolean, - val issues: Set + val issues: Set, + val helpers: Set? ) fun parseTestInfo(testFilePath: String, testFiles: TestFiles, linkedTestType: SpecTestLinkedType): ParsedTestFile { @@ -42,6 +43,7 @@ fun parseTestInfo(testFilePath: String, testFiles: TestFiles, linkedTestType: Sp arrayOf(*CommonInfoElementType.values(), *CommonSpecTestFileInfoElementType.values(), *linkedTestType.infoElements.value), testInfoByContentMatcher.group("infoElements") ) + val helpers = testInfoElements[CommonSpecTestFileInfoElementType.HELPERS]?.content?.splitByComma()?.toSet() return ParsedTestFile( testArea = TestArea.valueOf(testInfoByContentMatcher.group("testArea").withUnderscores()), @@ -51,6 +53,7 @@ fun parseTestInfo(testFilePath: String, testFiles: TestFiles, linkedTestType: Sp testInfoElements = testInfoElements, testCasesSet = parseTestCases(testFiles), unexpectedBehavior = testInfoElements.contains(CommonInfoElementType.UNEXPECTED_BEHAVIOUR), - issues = CommonParser.parseIssues(testInfoElements[CommonInfoElementType.ISSUES]) + issues = CommonParser.parseIssues(testInfoElements[CommonInfoElementType.ISSUES]), + helpers = helpers ) }