Add regression tests for obsolete issues

#KT-50909
 #KT-50974
 #KT-51888
This commit is contained in:
Alexander Udalov
2022-09-23 22:06:30 +02:00
parent e7b5e74f78
commit 4baa74f396
11 changed files with 142 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
data class Parent(val child: Parent.Child?) {
val result =
if (this.child == null) foo(this.child)
else "Fail"
@JvmInline
value class Child(val value: String)
}
fun foo(x: String?): String =
x ?: "OK"
fun box(): String =
Parent(null).result
@@ -0,0 +1,29 @@
// IGNORE_LIGHT_ANALYSIS
// IGNORE_BACKEND: JVM
// WITH_STDLIB
// MODULE: lib
// FILE: lib.kt
public class WhateverUseCase : UseCaseWithParameter<Result<Int>, Int> {
override operator fun invoke(param: Result<Int>): Result<Int> {
return param.onFailure {
return if (it is NumberFormatException)
Result.success(0)
else
Result.failure(it)
}
}
}
interface UseCaseWithParameter<P, R> {
operator fun invoke(param: P) : Result<R>
}
// MODULE: main(lib)
// FILE: main.kt
fun box(): String {
val useCase = WhateverUseCase()
return if (useCase(Result.failure(NumberFormatException())) == Result.success(0)) "OK"
else "Fail"
}
@@ -0,0 +1,26 @@
// TARGET_BACKEND: JVM_IR
// JVM_TARGET: 1.8
// MODULE: lib
// !JVM_DEFAULT_MODE: all
// FILE: P.java
public interface P {
default String test() {
return "OK";
}
}
// FILE: kotlin.kt
abstract class A : P
interface B : P
// MODULE: main(lib)
// !JVM_DEFAULT_MODE: disable
// FILE: main.kt
abstract class C : A(), P, B
fun box(): String {
return object : C() {}.test()
}