[K/N][tests] Added some file-check tests on KT-58654

This commit is contained in:
Igor Chevdar
2023-05-24 11:30:36 +03:00
committed by Space Team
parent 870527a4a3
commit 1ae0350ca5
2 changed files with 39 additions and 0 deletions
@@ -6422,6 +6422,11 @@ fileCheckTest("filecheck_kt49847_generic_receiver") {
enabled = project.globalTestArgs.contains('-opt')
}
fileCheckTest("filecheck_kt58654") {
annotatedSource = project.file('filecheck/kt58654.kt')
enabled = project.globalTestArgs.contains('-opt')
}
fileCheckTest("filecheck_kt53261_inline_unbox") {
annotatedSource = project.file('filecheck/kt53261/kt53261_inline_unbox.kt')
enabled = project.globalTestArgs.contains('-opt')
@@ -0,0 +1,34 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
// CHECK-LABEL: define i64 @"kfun:#foo(){}kotlin.Long"()
fun foo(): Long {
// CHECK-NOT: @LONG_CACHE
val data: Map<String, Any> = mapOf()
return data.getOrElse("id") { 0L } as Long
}
// CHECK: ret i64
inline fun <T> bar(x: T?, f: Boolean): Any {
when {
x != null -> return@bar x
f -> return@bar 0L
else -> return@bar 1UL
}
}
// CHECK-LABEL: define i64 @"kfun:#callBar(kotlin.Boolean){}kotlin.ULong"(i1 zeroext %0)
fun callBar(f: Boolean): ULong {
// CHECK: @LONG_CACHE
val data: Map<String, Any> = mapOf()
val x = data["id"]
return bar(x, f) as ULong
}
// CHECK: ret i64
fun main() {
println(foo())
println(callBar(true))
}