[K/N][tests] Added a reproducer for KT-59501
This commit is contained in:
@@ -3042,6 +3042,13 @@ standaloneTest("codegen_escapeAnalysis_string") {
|
||||
source = "codegen/escapeAnalysis/string.kt"
|
||||
}
|
||||
|
||||
standaloneTest("codegen_escapeAnalysis_negativeArraySize") {
|
||||
disabled = (cacheTesting != null) || // Cache is not compatible with -opt.
|
||||
project.globalTestArgs.contains('-g') // -g and -opt are incompatible
|
||||
flags = ['-opt', '-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']
|
||||
source = "codegen/escapeAnalysis/negativeArraySize.kt"
|
||||
}
|
||||
|
||||
tasks.register("memory_var1", KonanLocalTest) {
|
||||
source = "runtime/memory/var1.kt"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package codegen.escapeAnalysis.negativeArraySize
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
const val size = -42
|
||||
|
||||
fun foo() {
|
||||
val arr = IntArray(size) { it }
|
||||
for (x in arr) println(x)
|
||||
}
|
||||
|
||||
@Test fun runTest() {
|
||||
assertFailsWith<IllegalArgumentException> { foo() }
|
||||
}
|
||||
Reference in New Issue
Block a user