Compare commits

...

10 Commits

Author SHA1 Message Date
anastasiia.spaseeva
e6332549ca [Spec tests] Add contracts tests 2021-02-18 13:00:08 +03:00
anastasiia.spaseeva
e24f245c5b [Spec tests] Add smartcast tests 2021-02-18 13:00:04 +03:00
anastasiia.spaseeva
343da01641 [Spec tests] Add annotation class declaration tests 2021-02-18 13:00:00 +03:00
anastasiia.spaseeva
b17565adf0 [Spec tests] Add property merging test 2021-02-18 12:59:56 +03:00
anastasiia.spaseeva
fee738980b [Spec tests] Add tests for enum class 2021-02-18 12:59:52 +03:00
anastasiia.spaseeva
222ad4071e [Spec tests] Actualize spec version to 1.4-rfc+0.3-603 2021-02-18 12:59:48 +03:00
anastasiia.spaseeva
c225a8af5d [Spec tests] Add tests for data classes 2021-02-18 12:59:43 +03:00
anastasiia.spaseeva
9817d27b45 [Spec tests] Add tests for overriding properties and functions of open classes 2021-02-18 12:59:38 +03:00
anastasiia.spaseeva
ab49b58d36 [Spec tests] Add tests for building the OCS (KT-40839) 2021-02-18 12:59:31 +03:00
anastasiia.spaseeva
472f7d63a7 [Spec tests] Add diagnostics tests for abstract classes 2021-02-18 12:59:23 +03:00
363 changed files with 16361 additions and 477 deletions

View File

@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_1_1Kt.box(1.1.kt:17)

View File

@@ -0,0 +1,28 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, classifier-initialization -> paragraph 8 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, classifier-initialization -> paragraph 9 -> sentence 1
* NUMBER: 1
* DESCRIPTION: entry initialization an enum class with a property call
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-41124
* EXCEPTION: runtime
*/
fun box(): String {
Case1.VAL1
return "NOK"
}
enum class Case1(var x: Int) {
VAL1(1),
VAL2(2);
init {
Case1.VAL1.x // NPE
}
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: UNINITIALIZED_ENUM_ENTRY: Enum entry 'VAL1' is uninitialized here (26,9) in /1.2.kt

View File

@@ -0,0 +1,28 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, classifier-initialization -> paragraph 8 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, classifier-initialization -> paragraph 9 -> sentence 1
* NUMBER: 2
* DESCRIPTION: entry initialization an enum class with a property call
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-41124
* EXCEPTION: compiletime
*/
fun box(): String {
Case1.VAL1
return "NOK"
}
enum class Case1(var x: Int) {
VAL1(1),
VAL2(2);
init {
VAL1.x // uninitialized enum entry
}
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: UNINITIALIZED_ENUM_ENTRY: Enum entry 'VAL1' is uninitialized here (25,9) in /1.3.kt

View File

@@ -0,0 +1,28 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, classifier-initialization -> paragraph 8 -> sentence 1
* NUMBER: 3
* DESCRIPTION: entry initialization an enum class
* EXCEPTION: compiletime
*/
fun box(): String {
Case1.VAL1
return "NOK"
}
enum class Case1 {
VAL1,
VAL2;
init {
VAL1 // uninitialized enum entry
}
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: UNINITIALIZED_ENUM_ENTRY: Enum entry 'VAL1' is uninitialized here (26,15) in /1.4.kt

View File

@@ -0,0 +1,28 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION
// SKIP_TXT
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, classifier-initialization -> paragraph 8 -> sentence 1
* NUMBER: 4
* DESCRIPTION: entry initialization an enum class
* EXCEPTION: compiletime
*/
fun box(): String {
Case1.VAL1
return "NOK"
}
enum class Case1 {
VAL1,
VAL2;
init {
Case1.VAL1 // uninitialized enum entry
}
}

View File

@@ -0,0 +1,62 @@
{
"8": {
"neg": {
"1": [
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "entry initialization an enum class with a property call",
"path": "compiler/tests-spec/testData/codegen/box/linked/declarations/classifier-declaration/classifier-initialization/p-8/neg/1.2.kt",
"unexpectedBehaviour": true,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "entry initialization an enum class",
"path": "compiler/tests-spec/testData/codegen/box/linked/declarations/classifier-declaration/classifier-initialization/p-8/neg/1.3.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "entry initialization an enum class",
"path": "compiler/tests-spec/testData/codegen/box/linked/declarations/classifier-declaration/classifier-initialization/p-8/neg/1.4.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "entry initialization an enum class with a property call",
"path": "compiler/tests-spec/testData/codegen/box/linked/declarations/classifier-declaration/classifier-initialization/p-8/neg/1.1.kt",
"unexpectedBehaviour": true,
"linkType": "main"
}
]
}
},
"9": {
"neg": {
"1": [
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "entry initialization an enum class with a property call",
"path": "compiler/tests-spec/testData/codegen/box/linked/declarations/classifier-declaration/classifier-initialization/p-8/neg/1.2.kt",
"unexpectedBehaviour": true,
"linkType": "primary"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "entry initialization an enum class with a property call",
"path": "compiler/tests-spec/testData/codegen/box/linked/declarations/classifier-declaration/classifier-initialization/p-8/neg/1.1.kt",
"unexpectedBehaviour": true,
"linkType": "primary"
}
]
}
}
}

View File

@@ -0,0 +1,29 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* NUMBER: 1
* DESCRIPTION: equals and hashcode
*/
data class A(val a: Int, val b: String)
fun box(): String {
val x: A = A(1, "str")
val y: A = A(1, "str")
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,40 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 11
* DESCRIPTION: equals and hashcode. Class includes regular property declarations in its body
*/
data class A(val a: Int, val b: String) {
var prop1: Int
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun box(): String {
val x: A = A(1, "str")
val y: A = A(1, "str")
x.prop1 = 2
y.prop1 = 3
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,51 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 12
* DESCRIPTION: equals and hashcode. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int, override val b: String) : B(a, b) {
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun box(): String {
val x = A(1, "str") as B
val y: A = A(1, "str")
y.prop1 = 3
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,58 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 13
* DESCRIPTION: equals and hashcode with HashCode declared in supertype. Class includes regular property declarations in its body
*/
const val TMP_HASH_CODE = 555;
open class B(open val a: Int, open val b: Any){
override fun hashCode(): Int {
return TMP_HASH_CODE
}
}
data class A(override val a: Int, override val b: String) : B(a, b) {
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun box(): String {
val x = A(1, "str") as B
val y: A = A(1, "str")
y.prop1 = 3
if (x.hashCode() == TMP_HASH_CODE || y.hashCode() == TMP_HASH_CODE)
return "Fail: hashCode is not generated at Data class"
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,52 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 14
* DESCRIPTION: data class with default parameters at primary constructor. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int = 1, override val b: String = "str") : B(a, b) {
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun box(): String {
val x = A(1, "str")
val y = A()
x.prop1 = 2
y.prop1 = 3
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,52 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 15
* DESCRIPTION: data class with default parameters at primary constructor. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int = 1, override val b: String = "str") : B(a, b) {
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun box(): String {
val x = A()
val y = A(b = "str", a = 1)
x.prop1 = 2
y.prop1 = 3
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,66 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 16
* DESCRIPTION: data class with default parameters at primary constructor. Class includes regular property declarations in its body
*/
fun box(): String {
val x = A() as B
val y: A = A(a = 1)
y.prop1 = 3
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
val B_VAL = B(8, "string")
data class A(override val a: Int = 1, override val b: B = B_VAL) : B(a, b) {
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else {
println("a prop equals: " + (x.a == y.a))
println("b prop equals: " + (x.b == y.b))
return "props are not equal"
}
} else return "not equals"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)

View File

@@ -0,0 +1,65 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 17
* DESCRIPTION: data class with default parameters at primary constructor. Class includes regular property declarations in its body
*/
fun box(): String {
val x = A() as B
val y: A = A(a = 1)
y.prop1 = 3
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class C(val x: Int)
data class A(override val a: Int = 1, override val b: C = C(1)) : B(a, b) {
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else {
println("a prop equals: " + (x.a == y.a))
println("b prop equals: " + (x.b == y.b))
return "props are not equal"
}
} else return "not equals"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)

View File

@@ -0,0 +1,63 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 18
* DESCRIPTION: data class with default parameters at primary constructor. Class includes regular property declarations in its body
*/
fun box(): String {
val x = A() as B
val y: A = A(a = 1, String.Companion)
y.prop1 = 3
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: Any = String) : B(a, b) {
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else {
println("a prop equals: " + (x.a == y.a))
println("b prop equals: " + (x.b == y.b))
return "props are not equal"
}
} else return "not equals"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)

View File

@@ -0,0 +1,40 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* NUMBER: 2
* DESCRIPTION: equals and hashcode
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int, override val b: String) : B(a, b)
fun box(): String {
val x = A(1, "str") as B
val y: A = A(1, "str")
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,47 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* NUMBER: 3
* DESCRIPTION: equals and hashcode with HashCode declared in supertype
*/
const val TMP_HASH_CODE = 555;
open class B(open val a: Int, open val b: Any){
override fun hashCode(): Int {
return TMP_HASH_CODE
}
}
data class A(override val a: Int, override val b: String) : B(a, b)
fun box(): String {
val x = A(1, "str") as B
val y: A = A(1, "str")
if (x.hashCode() == TMP_HASH_CODE || y.hashCode() == TMP_HASH_CODE)
return "Fail: hashCode is not generated at Data class"
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,40 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* NUMBER: 4
* DESCRIPTION: data class with default parameters at primary constructor
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int = 1, override val b: String = "str") : B(a, b)
fun box(): String {
val x = A(1, "str")
val y = A()
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,40 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* NUMBER: 5
* DESCRIPTION: data class with default parameters at primary constructor
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int = 1, override val b: String = "str") : B(a, b)
fun box(): String {
val x = A()
val y = A(b = "str", a = 1)
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else return "props are not equal"
} else return "not equals"
}

View File

@@ -0,0 +1,55 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* NUMBER: 6
* DESCRIPTION: data class with default parameters at primary constructor
*/
fun box(): String {
val x = A() as B
val y: A = A(a = 1)
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
val B_VAL = B(8, "string")
data class A(override val a: Int = 1, override val b: B = B_VAL) : B(a, b)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else {
println("a prop equals: " + (x.a == y.a))
println("b prop equals: " + (x.b == y.b))
return "props are not equal"
}
} else return "not equals"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)

View File

@@ -0,0 +1,54 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* NUMBER: 7
* DESCRIPTION: data class with default parameters at primary constructor
*/
fun box(): String {
val x = A() as B
val y: A = A(a = 1)
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class C(val x: Int)
data class A(override val a: Int = 1, override val b: C = C(1)) : B(a, b)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else {
println("a prop equals: " + (x.a == y.a))
println("b prop equals: " + (x.b == y.b))
return "props are not equal"
}
} else return "not equals"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)

View File

@@ -0,0 +1,52 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 1
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 2
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 3
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 4
* declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 5
* NUMBER: 8
* DESCRIPTION: data class with default parameters at primary constructor
*/
fun box(): String {
val x = A() as B
val y: A = A(a = 1, String.Companion)
return if (checkRuntimeTypeIsSame(x, y))
checkEquality(x, y)
else "NOK"
}
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: Any = String) : B(a, b)
fun <X : B, Y : B> checkEquality(x: X, y: Y): String {
if (x.equals(y)) {
if (x.a == y.a && x.b == y.b) {
if (x.hashCode() == y.hashCode())
return "OK"
else return "hashCode are not equal"
} else {
println("a prop equals: " + (x.a == y.a))
println("b prop equals: " + (x.b == y.b))
return "props are not equal"
}
} else return "not equals"
}
fun <X : B, Y : B> checkRuntimeTypeIsSame(x: X, y: Y): Boolean = (x is A && y is A)

View File

@@ -0,0 +1,22 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* NUMBER: 1
* DESCRIPTION: copy with defaults
*/
data class A(val a: Int, val b: String)
fun box(): String {
val x: A = A(1, "str")
val y = x.copy()
if (y.a == x.a && y.b == x.b) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,34 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 11
* DESCRIPTION: copy with defaults. Class includes regular property declarations in its body
*/
data class A(val a: Int, val b: String) {
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun box(): String {
val x: A = A(1, "str")
x.prop1 = 5
val y = x.copy()
if (y.a == x.a && y.b == x.b
&& x.prop1 != y.prop1
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,36 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 12
* DESCRIPTION: copy with defaults. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int, override val b: C) : B(a, b){
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
class C
fun box(): String {
val x = A(1, C())
x.prop1 = 5
val y = x.copy()
if (y.a == x.a && y.b == x.b
&& x.prop1 != y.prop1
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,42 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 13
* DESCRIPTION: copy with defaults. Class includes regular property declarations in its body
*/
const val TMP_HASH_CODE = 555;
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return TMP_HASH_CODE
}
}
data class A(override val a: Int, override val b: String) : B(a, b){
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun box(): String {
val x = A(1, "str")
x.prop1 = 5
val y = x.copy()
if (y.a == x.a && y.b == x.b
&& x.prop1 != y.prop1
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,45 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 14
* DESCRIPTION: copy with defaults. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any)
data class A(
override val a: Int = 1,
override val b: C = C(
3.0,
listOf(D(1, 1), D(2, 2))
)
) : B(a, b){
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
data class C(val c1: Double = 2.0, var c2: List<D>)
class D(val d1: Int, d2: Int)
fun box(): String {
val x = A(1)
x.prop1 = 5
val y = x.copy()
if (y.a == x.a && y.b == x.b
&& x.prop1 != y.prop1
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,45 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 15
* DESCRIPTION: copy with defaults. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any)
data class A(
override val a: Int = 1,
override val b: C = C(
3.0,
mutableListOf(D(1, 1), D(2, 2))
)
) : B(a, b){
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
data class C(val c1: Double = 2.0, var c2: MutableCollection<D>)
class D(val d1: Int, d2: Int)
fun box(): String {
val x = A()
x.prop1 = 5
val y = x.copy()
if (y.a == x.a && y.b == x.b
&& x.prop1 != y.prop1
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,44 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 16
* DESCRIPTION: copy with defaults. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: B = B_VAL) : B(a, b){
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
val B_VAL = B(8, "string")
fun box(): String {
val x = A(a = 2)
x.prop1 = 5
val y = x.copy()
if (y.a == x.a && y.b == x.b
&& x.prop1 != y.prop1
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,43 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 17
* DESCRIPTION: copy with defaults. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
class C(val x: Int)
data class A(override val a: Int = 1, override val b: C = C(1)) : B(a, b){
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun box(): String {
val x = A(10)
x.prop1 = 5
val y = x.copy()
if (y.a == x.a && y.b == x.b
&& x.prop1 != y.prop1
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,41 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 18
* DESCRIPTION: copy with defaults. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: Any = String) : B(a, b){
var prop1: Int;
val prop2: Int
init {
prop1 = 1;
prop2 = 1;
}
}
fun box(): String {
val x: A = A(a = 1, String.Companion)
x.prop1 = 5
val y = x.copy()
if (y.a == x.a && y.b == x.b
&& x.prop1 != y.prop1
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,24 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* NUMBER: 2
* DESCRIPTION: copy with defaults
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int, override val b: C) : B(a, b)
class C
fun box(): String {
val x = A(1, C())
val y =x.copy()
if (y.a == x.a && y.b == x.b) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,30 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* NUMBER: 3
* DESCRIPTION: copy with defaults
*/
const val TMP_HASH_CODE = 555;
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return TMP_HASH_CODE
}
}
data class A(override val a: Int, override val b: String) : B(a, b)
fun box(): String {
val x = A(1, "str")
val y = x.copy()
if (y.a == x.a && y.b == x.b) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,33 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* NUMBER: 4
* DESCRIPTION: copy with defaults
*/
open class B(open val a: Int, open val b: Any)
data class A(
override val a: Int = 1,
override val b: C = C(
3.0,
listOf(D(1, 1), D(2, 2))
)
) : B(a, b)
data class C(val c1: Double = 2.0, var c2: List<D>)
class D(val d1: Int, d2: Int)
fun box(): String {
val x = A(1)
val y = x.copy()
if (y.a == x.a && y.b == x.b) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,32 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* NUMBER: 5
* DESCRIPTION: copy with defaults
*/
open class B(open val a: Int, open val b: Any)
data class A(
override val a: Int = 1,
override val b: C = C(
3.0,
mutableListOf(D(1, 1), D(2, 2))
)
) : B(a, b)
data class C(val c1: Double = 2.0, var c2: MutableCollection<D>)
class D(val d1: Int, d2: Int)
fun box(): String {
val x = A()
val y = x.copy()
if (y.a == x.a && y.b == x.b) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,31 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* NUMBER: 6
* DESCRIPTION: copy with defaults
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: B = B_VAL) : B(a, b)
val B_VAL = B(8, "string")
fun box(): String {
val x = A(a = 2)
val y = x.copy()
if (y.a == x.a && y.b == x.b) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,30 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* NUMBER: 7
* DESCRIPTION: copy with defaults
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
class C(val x: Int)
data class A(override val a: Int = 1, override val b: C = C(1)) : B(a, b)
fun box(): String {
val x = A(10)
val y = x.copy()
if (y.a == x.a && y.b == x.b) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,28 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 10
* SECONDARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 7
* NUMBER: 8
* DESCRIPTION: copy with defaults
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: Any = String) : B(a, b)
fun box(): String {
val x: A = A(a = 1, String.Companion)
val y = x.copy()
if (y.a == x.a && y.b == x.b) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,24 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* NUMBER: 1
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property
*/
data class A(val a: Int, val b: String)
fun box(): String {
val x: A = A(1, "str")
if (x.component1() is Int
&& x.component2() is String
&& x.component1() == 1 &&
x.component2() == "str"
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,31 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 11
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property. Class includes regular property declarations in its body
*/
data class A(val a: Int, val b: String){
var prop1: Set<Any>;
init {
prop1 = emptySet();
}
}
fun box(): String {
val x: A = A(1, "str")
if (x.component1() is Int
&& x.component2() is String
&& x.component1() == 1 &&
x.component2() == "str"
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,34 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 12
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int, override val b: C) : B(a, b){
var prop1: Set<Any>;
init {
prop1 = emptySet();
}
}
class C
fun box(): String {
val c = C()
val x = A(1, c)
if (x.component1() is Int
&& x.component2() is C
&& x.component1() == 1 &&
x.component2() == c
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,39 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 13
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property. Class includes regular property declarations in its body
*/
const val TMP_HASH_CODE = 555;
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return TMP_HASH_CODE
}
}
data class A(override val a: Int, override val b: String) : B(a, b){
var prop1: Set<Any>;
init {
prop1 = emptySet();
}
}
fun box(): String {
val x = A(1, "str")
if (x.component1() is Int
&& x.component2() is String
&& x.component1() == 1 &&
x.component2() == "str"
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,43 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 14
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any)
data class A(
override val a: Int = 1,
override val b: C = C(
3.0,
listOf(D(1, 1), D(2, 2))
)
) : B(a, b){
var prop1: Set<Any>;
init {
prop1 = emptySet();
}
}
class C(val c1: Double = 2.0, var c2: List<D>)
class D(val d1: Int, d2: Int)
fun box(): String {
val x = A(2)
if (x.component1() is Int
&& x.component2() is C
&& x.component1() == x.a
&& x.component1() == 2
&& x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,41 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 15
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any)
data class A(
override val a: Int = 1,
override val b: C = C(
3.0,
mutableListOf(D(1, 1), D(2, 2))
)
) : B(a, b){
var prop1: Set<Any>;
init {
prop1 = emptySet();
}
}
data class C(val c1: Double = 2.0, var c2: MutableCollection<D>)
class D(val d1: Int, d2: Int)
fun box(): String {
val x = A()
if (x.component1() is Int
&& x.component2() is C
&& x.component1() == x.a &&
x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,40 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 16
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: B = B_VAL) : B(a, b){
var prop1: Set<Any>;
init {
prop1 = emptySet();
}
}
val B_VAL = B(8, "string")
fun box(): String {
val x = A(a = 2)
if (x.component1() is Int
&& x.component2() is B
&& x.component1() == 2
&& x.component2() == B_VAL
&& x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,39 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 17
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
class C(val x: Int)
data class A(override val a: Int = 1, override val b: C = C(1)) : B(a, b){
var prop1: Set<Any>;
init {
prop1 = emptySet();
}
}
fun box(): String {
val x = A(10)
if (x.component1() is Int
&& x.component2() is C
&& x.component1() == x.a &&
x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,37 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* PRIMARY LINKS: declarations, classifier-declaration, data-class-declaration -> paragraph 3 -> sentence 1
* NUMBER: 18
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property. Class includes regular property declarations in its body
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: Any = "String") : B(a, b){
var prop1: Set<Any>;
init {
prop1 = emptySet();
}
}
fun box(): String {
val x: A = A(b= String.Companion, a = 1)
if (x.component1() is Int
&& x.component2() is String.Companion
&& x.component1() == x.a &&
x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,27 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* NUMBER: 2
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property
*/
open class B(open val a: Int, open val b: Any)
data class A(override val a: Int, override val b: C) : B(a, b)
class C
fun box(): String {
val c = C()
val x = A(1, c)
if (x.component1() is Int
&& x.component2() is C
&& x.component1() == 1 &&
x.component2() == c
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,32 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* NUMBER: 3
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property
*/
const val TMP_HASH_CODE = 555;
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return TMP_HASH_CODE
}
}
data class A(override val a: Int, override val b: String) : B(a, b)
fun box(): String {
val x = A(1, "str")
if (x.component1() is Int
&& x.component2() is String
&& x.component1() == 1 &&
x.component2() == "str"
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,36 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* NUMBER: 4
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property
*/
open class B(open val a: Int, open val b: Any)
data class A(
override val a: Int = 1,
override val b: C = C(
3.0,
listOf(D(1, 1), D(2, 2))
)
) : B(a, b)
class C(val c1: Double = 2.0, var c2: List<D>)
class D(val d1: Int, d2: Int)
fun box(): String {
val x = A(2)
if (x.component1() is Int
&& x.component2() is C
&& x.component1() == x.a
&& x.component1() == 2
&& x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,34 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* NUMBER: 5
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property
*/
open class B(open val a: Int, open val b: Any)
data class A(
override val a: Int = 1,
override val b: C = C(
3.0,
mutableListOf(D(1, 1), D(2, 2))
)
) : B(a, b)
data class C(val c1: Double = 2.0, var c2: MutableCollection<D>)
class D(val d1: Int, d2: Int)
fun box(): String {
val x = A()
if (x.component1() is Int
&& x.component2() is C
&& x.component1() == x.a &&
x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,33 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* NUMBER: 6
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: B = B_VAL) : B(a, b)
val B_VAL = B(8, "string")
fun box(): String {
val x = A(a = 2)
if (x.component1() is Int
&& x.component2() is B
&& x.component1() == 2
&& x.component2() == B_VAL
&& x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,32 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* NUMBER: 7
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
class C(val x: Int)
data class A(override val a: Int = 1, override val b: C = C(1)) : B(a, b)
fun box(): String {
val x = A(10)
if (x.component1() is Int
&& x.component2() is C
&& x.component1() == x.a &&
x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -0,0 +1,30 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: declarations, classifier-declaration, data-class-declaration -> paragraph 2 -> sentence 12
* NUMBER: 8
* DESCRIPTION: generated component function has the same type as this property and returns the value of this property
*/
open class B(open val a: Int, open val b: Any) {
override fun hashCode(): Int {
return 555
}
}
data class A(override val a: Int = 1, override val b: Any = "String") : B(a, b)
fun box(): String {
val x: A = A(b= String.Companion, a = 1)
if (x.component1() is Int
&& x.component2() is String.Companion
&& x.component1() == x.a &&
x.component2() == x.b
) {
return "OK"
} else return "nok"
}

View File

@@ -5,7 +5,6 @@
*
* SPEC VERSION: 0.1-222
* MAIN LINK: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 1
* PRIMARY LINKS: expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1
* NUMBER: 1
* DESCRIPTION:
*/

View File

@@ -5,7 +5,6 @@
*
* SPEC VERSION: 0.1-222
* MAIN LINK: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 1
* PRIMARY LINKS: expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1
* NUMBER: 2
* DESCRIPTION:
*/

View File

@@ -6,7 +6,6 @@
* SPEC VERSION: 0.1-222
* MAIN LINK: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 1
* PRIMARY LINKS: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 2
* expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1
* NUMBER: 3
* DESCRIPTION:
*/

View File

@@ -7,7 +7,6 @@
* MAIN LINK: expressions, jump-expressions, return-expressions -> paragraph 3 -> sentence 2
* PRIMARY LINKS: expressions, jump-expressions, return-expressions -> paragraph 2 -> sentence 1
* expressions, jump-expressions, return-expressions -> paragraph 3 -> sentence 3
* expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1
* NUMBER: 1
* DESCRIPTION: If several declarations match one name, the return is considered to be from the nearest matching function;
*/

View File

@@ -7,7 +7,6 @@
* MAIN LINK: expressions, jump-expressions, return-expressions -> paragraph 3 -> sentence 3
* PRIMARY LINKS: expressions, jump-expressions, return-expressions -> paragraph 2 -> sentence 1
* expressions, jump-expressions, return-expressions -> paragraph 3 -> sentence 2
* expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1
* NUMBER: 1
* DESCRIPTION: If return@Context is inside a lambda expression body, the name of the function using this lambda expression as its argument may be used as Context to refer to the lambda literal itself
*/

View File

@@ -39,52 +39,6 @@
]
}
},
"5": {
"pos": {
"1": [
{
"specVersion": "0.1-222",
"casesNumber": 0,
"description": "",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.2.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
},
{
"specVersion": "0.1-222",
"casesNumber": 0,
"description": "",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.3.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
},
{
"specVersion": "0.1-222",
"casesNumber": 0,
"description": "",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
},
{
"specVersion": "0.1-313",
"casesNumber": 0,
"description": "If several declarations match one name, the return is considered to be from the nearest matching function;",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/2.1.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
},
{
"specVersion": "0.1-313",
"casesNumber": 0,
"description": "If return@Context is inside a lambda expression body, the name of the function using this lambda expression as its argument may be used as Context to refer to the lambda literal itself",
"path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/3.1.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
}
]
}
},
"3": {
"pos": {
"2": [

View File

@@ -0,0 +1,64 @@
{
"1": {
"neg": {
"1": [
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "Type-checking is + not-null assertion expressions",
"path": "compiler/tests-spec/testData/codegen/box/linked/type-inference/smart-casts/smart-cast-types/p-9/neg/7.2.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "Type-checking is + not-null assertion expressions",
"path": "compiler/tests-spec/testData/codegen/box/linked/type-inference/smart-casts/smart-cast-types/p-9/neg/7.1.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
}
],
"2": [
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "Type-checking is + not-null assertion expressions",
"path": "compiler/tests-spec/testData/codegen/box/linked/type-inference/smart-casts/smart-cast-types/p-9/neg/7.2.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "Type-checking is + not-null assertion expressions",
"path": "compiler/tests-spec/testData/codegen/box/linked/type-inference/smart-casts/smart-cast-types/p-9/neg/7.1.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
}
]
},
"pos": {
"1": [
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "Type-checking is + not-null assertion expressions",
"path": "compiler/tests-spec/testData/codegen/box/linked/type-inference/smart-casts/smart-cast-types/p-9/pos/7.1.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
}
],
"3": [
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "Type-checking is + not-null assertion expressions",
"path": "compiler/tests-spec/testData/codegen/box/linked/type-inference/smart-casts/smart-cast-types/p-9/pos/7.1.kt",
"unexpectedBehaviour": false,
"linkType": "primary"
}
]
}
}
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: RETURN_TYPE_MISMATCH_ON_OVERRIDE: Return type of 'toString' is not a subtype of the return type of the overridden member 'public open fun toString(): String defined in BaseCase1' (16,30) in /1.1.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 8 -> sentence 1
* NUMBER: 1
* DESCRIPTION: toString(): return type of a child override function is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(val a: Int, val b: CharSequence)
open class ChildCase1 : BaseCase1(1, "") {
override fun toString(): CharSequence = "TODO()" //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.toString() //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: RETURN_TYPE_MISMATCH_ON_OVERRIDE: Return type of 'equals' is not a subtype of the return type of the overridden member 'public open fun equals(other: Any?): Boolean defined in BaseCase1' (16,39) in /1.2.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 8 -> sentence 1
* NUMBER: 2
* DESCRIPTION: equals(): return type of a child override function is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1()
open class ChildCase1 : BaseCase1() {
override fun equals(other: Any?): Any = "TODO()" //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.equals("") //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: RETURN_TYPE_MISMATCH_ON_OVERRIDE: Return type of 'hashCode' is not a subtype of the return type of the overridden member 'public open fun hashCode(): Int defined in BaseCase1' (16,30) in /1.3.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 8 -> sentence 1
* NUMBER: 3
* DESCRIPTION: hashCode(): return type of a child override function is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(val a: Int, val b: CharSequence)
open class ChildCase1 : BaseCase1(1, "") {
override fun hashCode(): Any = 1 //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.hashCode() //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: RETURN_TYPE_MISMATCH_ON_OVERRIDE: Return type of 'foo' is not a subtype of the return type of the overridden member 'public open fun foo(): Int defined in BaseCase1' (18,25) in /1.4.kt

View File

@@ -0,0 +1,25 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 8 -> sentence 1
* NUMBER: 4
* DESCRIPTION: custom function: return type of a child override prop is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(){
open fun foo(): Int = TODO()
}
open class ChildCase1 : BaseCase1(1, "") {
override fun foo(): Any = 1 //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.foo() //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: OVERRIDING_FINAL_MEMBER: 'a' in 'BaseCase1' is final and cannot be overridden (16,5) in /1.5.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 8 -> sentence 1
* NUMBER: 5
* DESCRIPTION: custom value: return type of a child override prop is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(val a: Int)
open class ChildCase1 : BaseCase1(1) {
override val a: Any = 1 //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.a //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: VIRTUAL_MEMBER_HIDDEN: 'a' hides member of supertype 'BaseCase1' and needs 'override' modifier (16,9) in /1.6.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 8 -> sentence 1
* NUMBER: 6
* DESCRIPTION: custom variable: return type of a child override prop is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(var a: Int)
open class ChildCase1 : BaseCase1(1) {
var a: Any = 1 //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.a //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: VIRTUAL_MEMBER_HIDDEN: 'toString' hides member of supertype 'BaseCase1' and needs 'override' modifier (16,9) in /1.1.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 9 -> sentence 1
* NUMBER: 1
* DESCRIPTION: toString(): return type of a child override function is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(val a: Int, val b: CharSequence)
open class ChildCase1 : BaseCase1(1, "") {
fun toString(): String = "TODO()" //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.toString() //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: VIRTUAL_MEMBER_HIDDEN: 'equals' hides member of supertype 'BaseCase1' and needs 'override' modifier (16,9) in /1.2.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 9 -> sentence 1
* NUMBER: 2
* DESCRIPTION: equals(): return type of a child override function is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1()
open class ChildCase1 : BaseCase1() {
fun equals(other: Any?): Boolean = true //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.equals("") //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: VIRTUAL_MEMBER_HIDDEN: 'hashCode' hides member of supertype 'BaseCase1' and needs 'override' modifier (16,9) in /1.3.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 9 -> sentence 1
* NUMBER: 3
* DESCRIPTION: hashCode(): return type of a child override function is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(val a: Int, val b: CharSequence)
open class ChildCase1 : BaseCase1(1, "") {
fun hashCode(): Int = 1 //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.hashCode() //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: VIRTUAL_MEMBER_HIDDEN: 'foo' hides member of supertype 'BaseCase1' and needs 'override' modifier (18,9) in /1.4.kt

View File

@@ -0,0 +1,25 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 9 -> sentence 1
* NUMBER: 4
* DESCRIPTION: custom function: return type of a child override prop is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(){
open fun foo(): Int = TODO()
}
open class ChildCase1 : BaseCase1(1, "") {
fun foo(): Int = 1 //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.foo() //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: VIRTUAL_MEMBER_HIDDEN: 'a' hides member of supertype 'BaseCase1' and needs 'override' modifier (16,9) in /1.5.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 9 -> sentence 1
* NUMBER: 5
* DESCRIPTION: custom value: return type of a child override prop is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(val a: Int)
open class ChildCase1 : BaseCase1(1) {
val a: Int = 1 //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.a //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1 @@
java.lang.IllegalStateException: VIRTUAL_MEMBER_HIDDEN: 'a' hides member of supertype 'BaseCase1' and needs 'override' modifier (16,9) in /1.6.kt

View File

@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: inheritance, overriding -> paragraph 9 -> sentence 1
* NUMBER: 6
* DESCRIPTION: custom variable: return type of a child override prop is not a subtype of return type of a base class
* EXCEPTION: compiletime
*/
open class BaseCase1(var a: Int)
open class ChildCase1 : BaseCase1(1) {
var a: Int = 1 //(1)
}
fun box(): String {
val childCase1 = ChildCase1()
childCase1.a //resolves to (1)
return "NOK"
}

View File

@@ -0,0 +1,110 @@
{
"9": {
"neg": {
"1": [
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "custom variable: return type of a child override prop is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-9/neg/1.6.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "equals(): return type of a child override function is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-9/neg/1.2.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "hashCode(): return type of a child override function is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-9/neg/1.3.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "custom function: return type of a child override prop is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-9/neg/1.4.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "custom value: return type of a child override prop is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-9/neg/1.5.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "toString(): return type of a child override function is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-9/neg/1.1.kt",
"unexpectedBehaviour": false,
"linkType": "main"
}
]
}
},
"8": {
"neg": {
"1": [
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "custom variable: return type of a child override prop is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-8/neg/1.6.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "equals(): return type of a child override function is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-8/neg/1.2.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "hashCode(): return type of a child override function is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-8/neg/1.3.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "custom function: return type of a child override prop is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-8/neg/1.4.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "custom value: return type of a child override prop is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-8/neg/1.5.kt",
"unexpectedBehaviour": false,
"linkType": "main"
},
{
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "toString(): return type of a child override function is not a subtype of return type of a base class",
"path": "compiler/tests-spec/testData/codegen/box/linked/inheritance/overriding/p-8/neg/1.1.kt",
"unexpectedBehaviour": false,
"linkType": "main"
}
]
}
}
}

View File

@@ -3,7 +3,7 @@
"neg": {
"2": [
{
"specVersion": "0.1-488",
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "nullable receiver and infix functions",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.5.kt",
@@ -11,7 +11,7 @@
"linkType": "main"
},
{
"specVersion": "0.1-488",
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "nullable receiver and infix functions",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/neg/2.6.kt",
@@ -23,7 +23,7 @@
"pos": {
"2": [
{
"specVersion": "0.1-488",
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "nullable receiver and infix functions",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.5.kt",
@@ -31,7 +31,7 @@
"linkType": "main"
},
{
"specVersion": "0.1-488",
"specVersion": "1.4-rfc+0.3-603",
"casesNumber": 0,
"description": "nullable receiver and infix functions",
"path": "compiler/tests-spec/testData/codegen/box/linked/overload-resolution/building-the-overload-candidate-set-ocs/operator-call/p-1/pos/2.6.kt",

View File

@@ -3,7 +3,7 @@
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-488
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2
* SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1
* statements, assignments, operator-assignments -> paragraph 2 -> sentence 2

View File

@@ -3,7 +3,7 @@
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-488
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2
* SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1
* statements, assignments, operator-assignments -> paragraph 2 -> sentence 2

View File

@@ -3,7 +3,7 @@
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-488
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2
* SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1
* statements, assignments, operator-assignments -> paragraph 2 -> sentence 2

View File

@@ -3,7 +3,7 @@
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-488
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2
* SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1
* statements, assignments, operator-assignments -> paragraph 2 -> sentence 2

View File

@@ -3,7 +3,7 @@
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-488
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2
* SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1
* statements, assignments, operator-assignments -> paragraph 2 -> sentence 2

View File

@@ -3,7 +3,7 @@
/*
* KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE)
*
* SPEC VERSION: 0.1-488
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2
* SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1
* statements, assignments, operator-assignments -> paragraph 2 -> sentence 2

View File

@@ -3,7 +3,7 @@
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-488
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2
* PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3
* SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1

View File

@@ -3,7 +3,7 @@
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-488
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2
* PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3
* SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1

View File

@@ -3,7 +3,7 @@
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-488
* SPEC VERSION: 1.4-rfc+0.3-603
* MAIN LINK: overload-resolution, building-the-overload-candidate-set-ocs, operator-call -> paragraph 1 -> sentence 2
* PRIMARY LINKS: overload-resolution, choosing-the-most-specific-candidate-from-the-overload-candidate-set, algorithm-of-msc-selection -> paragraph 3 -> sentence 3
* SECONDARY LINKS: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1

Some files were not shown because too many files have changed in this diff Show More