Temporarily remove isInitialized and tests, but keep the implementation
This is needed because we want the compiler code to stay as much the same in master and in 1.2 as possible
This commit is contained in:
Vendored
-35
@@ -1,35 +0,0 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// WITH_RUNTIME
|
||||
|
||||
open class Foo {
|
||||
lateinit var bar: String
|
||||
|
||||
private lateinit var baz: String
|
||||
|
||||
fun test(): String {
|
||||
val isBarInitialized: () -> Boolean = { this::bar.isInitialized }
|
||||
if (isBarInitialized()) return "Fail 1"
|
||||
bar = "bar"
|
||||
if (!isBarInitialized()) return "Fail 2"
|
||||
baz = "baz"
|
||||
return InnerSubclass().testInner()
|
||||
}
|
||||
|
||||
inner class InnerSubclass : Foo() {
|
||||
fun testInner(): String {
|
||||
// This is access to InnerSubclass.bar which is inherited from Foo.bar
|
||||
if (this::bar.isInitialized) return "Fail 3"
|
||||
bar = "OK"
|
||||
if (!this::bar.isInitialized) return "Fail 4"
|
||||
|
||||
// This is access to Foo.bar declared lexically above
|
||||
if (!this@Foo::bar.isInitialized) return "Fail 5"
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Foo().test()
|
||||
}
|
||||
Vendored
-21
@@ -1,21 +0,0 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Foo {
|
||||
lateinit var bar: String
|
||||
|
||||
fun test(): String {
|
||||
var state = 0
|
||||
if (run { state++; this }::bar.isInitialized) return "Fail 1"
|
||||
|
||||
bar = "A"
|
||||
if (!run { state++; this }::bar.isInitialized) return "Fail 3"
|
||||
|
||||
return if (state == 2) "OK" else "Fail: state=$state"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Foo().test()
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
public static void deinitialize(Foo foo) {
|
||||
foo.bar = null;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class Foo {
|
||||
lateinit var bar: String
|
||||
|
||||
fun test(): String {
|
||||
if (this::bar.isInitialized) return "Fail 1"
|
||||
J.deinitialize(this)
|
||||
if (this::bar.isInitialized) return "Fail 2"
|
||||
|
||||
bar = "A"
|
||||
if (!this::bar.isInitialized) return "Fail 3"
|
||||
J.deinitialize(this)
|
||||
if (this::bar.isInitialized) return "Fail 4"
|
||||
|
||||
bar = "OK"
|
||||
if (!this::bar.isInitialized) return "Fail 5"
|
||||
return bar
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Foo().test()
|
||||
}
|
||||
Vendored
-12
@@ -1,12 +0,0 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
// WITH_RUNTIME
|
||||
|
||||
lateinit var bar: String
|
||||
|
||||
fun box(): String {
|
||||
if (::bar.isInitialized) return "Fail 1"
|
||||
bar = "OK"
|
||||
if (!::bar.isInitialized) return "Fail 2"
|
||||
return bar
|
||||
}
|
||||
Reference in New Issue
Block a user