backend/tests: add disabled tests memory_var{1..4}
This commit is contained in:
@@ -753,3 +753,23 @@ task expression_as_statement(type: RunKonanTest) {
|
||||
goldValue = "Ok\n"
|
||||
source = "codegen/basics/expression_as_statement.kt"
|
||||
}
|
||||
|
||||
task memory_var1(type: RunKonanTest) {
|
||||
disabled = true
|
||||
source = "runtime/memory/var1.kt"
|
||||
}
|
||||
|
||||
task memory_var2(type: RunKonanTest) {
|
||||
disabled = true
|
||||
source = "runtime/memory/var2.kt"
|
||||
}
|
||||
|
||||
task memory_var3(type: RunKonanTest) {
|
||||
disabled = true
|
||||
source = "runtime/memory/var3.kt"
|
||||
}
|
||||
|
||||
task memory_var4(type: RunKonanTest) {
|
||||
disabled = true
|
||||
source = "runtime/memory/var4.kt"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
class Integer(val value: Int) {
|
||||
operator fun inc() = Integer(value + 1)
|
||||
}
|
||||
|
||||
fun foo(x: Any, y: Any) {
|
||||
x.use()
|
||||
y.use()
|
||||
}
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
var x = Integer(0)
|
||||
|
||||
for (i in 0..1) {
|
||||
val c = Integer(0)
|
||||
if (i == 0) x = c
|
||||
}
|
||||
|
||||
// x refcount is 1.
|
||||
|
||||
foo(x, ++x)
|
||||
}
|
||||
|
||||
fun Any?.use() {
|
||||
var x = this
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
fun main(args : Array<String>) {
|
||||
var x = Any()
|
||||
|
||||
for (i in 0..1) {
|
||||
val c = Any()
|
||||
if (i == 0) x = c
|
||||
}
|
||||
|
||||
// x refcount is 1.
|
||||
|
||||
val y = try {
|
||||
x
|
||||
} finally {
|
||||
x = Any()
|
||||
}
|
||||
|
||||
y.use()
|
||||
}
|
||||
|
||||
fun Any?.use() {
|
||||
var x = this
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
fun main(args : Array<String>) {
|
||||
foo().use()
|
||||
}
|
||||
|
||||
fun foo(): Any {
|
||||
var x = Any()
|
||||
|
||||
for (i in 0..1) {
|
||||
val c = Any()
|
||||
if (i == 0) x = c
|
||||
}
|
||||
|
||||
// x refcount is 1.
|
||||
|
||||
try {
|
||||
return x
|
||||
} finally {
|
||||
x = Any()
|
||||
}
|
||||
}
|
||||
|
||||
fun Any?.use() {
|
||||
var x = this
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
fun main(args : Array<String>) {
|
||||
var x = Error()
|
||||
|
||||
for (i in 0..1) {
|
||||
val c = Error()
|
||||
if (i == 0) x = c
|
||||
}
|
||||
|
||||
// x refcount is 1.
|
||||
|
||||
try {
|
||||
try {
|
||||
throw x
|
||||
} finally {
|
||||
x = Error()
|
||||
}
|
||||
} catch (e: Error) {
|
||||
e.use()
|
||||
}
|
||||
}
|
||||
|
||||
fun Any?.use() {
|
||||
var x = this
|
||||
}
|
||||
Reference in New Issue
Block a user