Add black box tests for objects inheritance problem (KT-25289)

This commit is contained in:
victor.petukhov
2018-12-14 13:45:15 +03:00
parent fc381e25c8
commit 8c0ad321e2
42 changed files with 680 additions and 2 deletions
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_1Kt.box(1.kt:18)
@@ -0,0 +1,21 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 1
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Bar(val x: Int)
open class Foo {
companion object : Bar(Foo.x)
}
fun box(): String? {
if (Foo() == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
Foo$A.<init>(10.kt:12)
@@ -0,0 +1,20 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 10
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(a: Any) {
object A : Foo(B)
object B : Foo(A)
}
fun box(): String? {
if (Foo.A == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_11Kt.box(11.kt:20)
@@ -0,0 +1,23 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 11
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
object MyObject : Foo(prop)
open class Foo(val x: MyObject) {
companion object {
val prop = MyObject
}
}
fun box(): String? {
if (MyObject == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.IllegalArgumentException: Parameter specified as non-null is null: method Foo.<init>, parameter x
Foo.<init>(12.kt)
@@ -0,0 +1,21 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 12
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
val prop = MyObject
object MyObject : Foo(prop)
open class Foo(val x: MyObject)
fun box(): String? {
if (MyObject == null) return null
return "OK"
}
@@ -0,0 +1,15 @@
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
Foo$Companion.<init>()V @2: checkcast
Reason:
Type uninitializedThis (current frame, stack[1]) is not assignable to 'java/lang/Object'
Current Frame:
bci: @2
flags: { flagThisUninit }
locals: { uninitializedThis }
stack: { uninitializedThis, uninitializedThis }
Bytecode:
0x0000000: 2a2a c000 02b6 000a b700 0db1
Foo.<clinit>(13.kt)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 13
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(val prop: Int) {
companion object : Foo(prop)
}
fun box(): String? {
if (Foo(42) == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_14Kt.box(14.kt:16)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 14
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(val prop: Int) {
companion object MyCompanion : Foo(Foo.prop)
}
fun box(): String? {
if (Foo(42) == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_15Kt.box(15.kt:16)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 15
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(val prop: Int) {
object MyObject : Foo(MyObject.prop)
}
fun box(): String? {
if (Foo.MyObject == null) return null
return "OK"
}
@@ -0,0 +1,15 @@
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
Foo$Companion.<init>()V @2: checkcast
Reason:
Type uninitializedThis (current frame, stack[1]) is not assignable to 'java/lang/Object'
Current Frame:
bci: @2
flags: { flagThisUninit }
locals: { uninitializedThis }
stack: { uninitializedThis, uninitializedThis }
Bytecode:
0x0000000: 2a2a c000 02b6 000a b700 0db1
Foo.<clinit>(16.kt)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 16
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(val prop: Int) {
companion object : Foo(prop)
}
fun box(): String? {
if (Foo(42) == null) return null
return "OK"
}
@@ -0,0 +1,15 @@
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
Foo$Companion.<init>()V @2: checkcast
Reason:
Type uninitializedThis (current frame, stack[1]) is not assignable to 'java/lang/Object'
Current Frame:
bci: @2
flags: { flagThisUninit }
locals: { uninitializedThis }
stack: { uninitializedThis, uninitializedThis }
Bytecode:
0x0000000: 2a2a c000 02b6 000a b700 0db1
Foo.<clinit>(17.kt)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 17
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(val prop: Int) {
companion object : Foo(this.prop)
}
fun box(): String? {
if (Foo(42) == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_18Kt.box(18.kt:16)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 18
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(val prop: Int) {
companion object : Foo(Companion.prop)
}
fun box(): String? {
if (Foo(42) == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_19Kt.box(19.kt:16)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 19
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(val prop: Int) {
object MyObject : Foo(MyObject.prop)
}
fun box(): String? {
if (Foo.MyObject == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_2Kt.box(2.kt:18)
@@ -0,0 +1,21 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 2
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Bar(val x: Int)
open class Foo {
companion object : Bar(Foo.Companion.x)
}
fun box(): String? {
if (Foo.Companion == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_3Kt.box(3.kt:18)
@@ -0,0 +1,21 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 3
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Bar(val x: Int)
open class Foo {
companion object : Bar(Companion.x)
}
fun box(): String? {
if (Foo.Companion == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_4Kt.box(4.kt:18)
@@ -0,0 +1,21 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 4
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Bar(val x: Int)
open class Foo {
object MyObject : Bar(MyObject.x)
}
fun box(): String? {
if (Foo.MyObject == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_5Kt.box(5.kt:20)
@@ -0,0 +1,23 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 5
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Bar(val x: Int)
open class Foo {
companion object : Bar(Foo.prop) {
val prop: Int = 10
}
}
fun box(): String? {
if (Foo() == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_6Kt.box(6.kt:20)
@@ -0,0 +1,23 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 6
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Bar(val x: Any)
open class Foo {
companion object : Bar(Foo.prop) {
private val prop: Any = object {}
}
}
fun box(): String? {
if (Foo() == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_7Kt.box(7.kt:16)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 7
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(val x: Int)
object MyObject : Foo(MyObject.x)
fun box(): String? {
if (MyObject == null) return null
return "OK"
}
@@ -0,0 +1,2 @@
java.lang.ExceptionInInitializerError
_8Kt.box(8.kt:16)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 8
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(a: Any) {
companion object : Foo(Companion)
}
fun box(): String? {
if (Foo.Companion == null) return null
return "OK"
}
@@ -0,0 +1,15 @@
java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
Foo$Companion.<init>()V @2: invokespecial
Reason:
Type uninitializedThis (current frame, stack[1]) is not assignable to 'java/lang/Object'
Current Frame:
bci: @2
flags: { flagThisUninit }
locals: { uninitializedThis }
stack: { uninitializedThis, uninitializedThis }
Bytecode:
0x0000000: 2a2a b700 09b1
Foo.<clinit>(9.kt)
@@ -0,0 +1,19 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 9
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Foo(a: Any) {
companion object : Foo(this)
}
fun box(): String? {
if (Foo.Companion == null) return null
return "OK"
}
@@ -0,0 +1,23 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (POSITIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 1
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Bar(val x: Int)
open class Foo {
companion object : Bar(Foo.prop) {
const val prop: Int = 10
}
}
fun box(): String? {
Foo()
return "OK"
}
@@ -0,0 +1,23 @@
/*
* KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (POSITIVE)
*
* SECTIONS: objects, inheritance
* NUMBER: 2
* DESCRIPTION: Access to class members in the super constructor call of an object.
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-25289
*/
open class Bar(val x: Int)
open class Foo {
companion object : Bar(Foo.prop) {
private val prop: Int = 10
}
}
fun box(): String? {
Foo()
return "OK"
}