mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 15:53:46 +00:00
Split up Result API boxing tests
This commit is contained in:
committed by
Alexander Udalov
parent
2e53e36fd5
commit
49efa5fbc4
12
compiler/testData/codegen/bytecodeText/inlineClasses/resultApiDoesntCallSpecializedEquals.kt
vendored
Normal file
12
compiler/testData/codegen/bytecodeText/inlineClasses/resultApiDoesntCallSpecializedEquals.kt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// !API_VERSION: 1.3
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
fun test() {
|
||||
val result = Result.success("yes!")
|
||||
val other = Result.success("nope")
|
||||
if (result == other) println("==")
|
||||
if (result != other) println("!=")
|
||||
}
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 INVOKESTATIC kotlin/Result.equals-impl0
|
||||
@@ -1,6 +1,4 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_COROUTINES
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
fun test() {
|
||||
val result = Result.success("yes!")
|
||||
@@ -12,21 +10,8 @@ fun test() {
|
||||
println(failure.getOrNull())
|
||||
println(failure.exceptionOrNull())
|
||||
|
||||
val other = Result.success("nope")
|
||||
if (result == other) println("==")
|
||||
if (result != other) println("!=")
|
||||
if (result.equals(other)) println("equals") // Boxes (JVM, JVM_IR)
|
||||
if (!result.equals(other)) println("!equals") // Boxes (JVM, JVM_IR)
|
||||
|
||||
println(result.hashCode())
|
||||
println(result.toString())
|
||||
println("$result") // Boxes (JVM_IR)
|
||||
|
||||
val ans1 = runCatching { 42 }
|
||||
println(ans1) // Boxes (JVM, JVM_IR)
|
||||
|
||||
val ans2 = 42.runCatching { this }
|
||||
println(ans2) // Boxes (JVM, JVM_IR)
|
||||
|
||||
println(result.getOrElse { "oops" })
|
||||
println(result.getOrDefault("oops"))
|
||||
|
||||
14
compiler/testData/codegen/bytecodeText/inlineClasses/resultApiEqualsDoesntBox.kt
vendored
Normal file
14
compiler/testData/codegen/bytecodeText/inlineClasses/resultApiEqualsDoesntBox.kt
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// !API_VERSION: LATEST
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
fun test() {
|
||||
val result = Result.success("yes!")
|
||||
val other = Result.success("nope")
|
||||
if (result == other) println("==")
|
||||
if (result != other) println("!=")
|
||||
}
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 INVOKESTATIC kotlin/Result.box-impl
|
||||
// 0 INVOKEVIRTUAL kotlin/Result.unbox-impl
|
||||
// 2 INVOKESTATIC kotlin/Result.equals-impl0
|
||||
16
compiler/testData/codegen/bytecodeText/inlineClasses/resultApiRunCatchingDoesntBox.kt
vendored
Normal file
16
compiler/testData/codegen/bytecodeText/inlineClasses/resultApiRunCatchingDoesntBox.kt
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// IGNORE_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
fun test() {
|
||||
val ans1 = runCatching { 42 }
|
||||
println(ans1)
|
||||
|
||||
val ans2 = 42.runCatching { this }
|
||||
println(ans2)
|
||||
}
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 INVOKESTATIC kotlin/Result.box-impl
|
||||
// 0 INVOKEVIRTUAL kotlin/Result.unbox-impl
|
||||
// 0 Result\$Failure
|
||||
11
compiler/testData/codegen/bytecodeText/inlineClasses/resultApiStringInterpolationDoesntBox.kt
vendored
Normal file
11
compiler/testData/codegen/bytecodeText/inlineClasses/resultApiStringInterpolationDoesntBox.kt
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
fun test() {
|
||||
val result = Result.success("yes!")
|
||||
println("$result")
|
||||
}
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 INVOKESTATIC kotlin/Result.box-impl
|
||||
// 0 INVOKEVIRTUAL kotlin/Result.unbox-impl
|
||||
Reference in New Issue
Block a user