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:
Alexander Udalov
2017-09-13 16:16:32 +03:00
parent 7d80afbe63
commit 234148518e
14 changed files with 0 additions and 436 deletions
@@ -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()
}
@@ -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()
}
@@ -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()
}
@@ -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
}