Files
kotlin-fork/compiler/testData/ir/irText/expressions/funInterface/samConversionsWithSmartCasts.kt.txt
T
Dmitriy Dolovov 16d1e85932 IR text tests: Stable blank lines between declarations in class
Rework rendering of kt-like dump and signatures dump in order to avoid
unstable blank line between declarations of the same level:
1. No blank line for the first declaration inside the member scope of
the class.
2. Always a single blank line between each two subsequent declarations
inside the member scope of the class.
2023-11-30 08:32:35 +00:00

99 lines
1.8 KiB
Kotlin
Vendored

fun interface KRunnable {
abstract fun run()
}
fun <T : Any?> id(x: T): T {
return x
}
fun run1(r: KRunnable) {
}
fun run2(r1: KRunnable, r2: KRunnable) {
}
fun <T> test0(a: T) where T : KRunnable, T : Function0<Unit> {
run1(r = a)
}
fun test1(a: Function0<Unit>) {
when {
a is KRunnable -> { // BLOCK
run1(r = a /*as KRunnable */)
}
}
}
fun test2(a: KRunnable) {
a as Function0<Unit> /*~> Unit */
run1(r = a)
}
fun test3(a: Function0<Unit>) {
when {
a is KRunnable -> { // BLOCK
run2(r1 = a /*as KRunnable */, r2 = a /*as KRunnable */)
}
}
}
fun test4(a: Function0<Unit>, b: Function0<Unit>) {
when {
a is KRunnable -> { // BLOCK
run2(r1 = a /*as KRunnable */, r2 = b /*-> KRunnable */)
}
}
}
fun test5(a: Any) {
when {
a is KRunnable -> { // BLOCK
run1(r = a /*as KRunnable */)
}
}
}
fun test5x(a: Any) {
when {
a is KRunnable -> { // BLOCK
a as Function0<Unit> /*~> Unit */
run1(r = a /*as KRunnable */)
}
}
}
fun test6(a: Any) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
}
fun test7(a: Function1<Int, Int>) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
}
fun <T : Function1<Int, Int>> test7a(a: T) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
}
fun <T> test7b(a: T) where T : Function1<Int, Unit>, T : Function0<Unit> {
run1(r = a /*-> KRunnable */)
}
interface Unrelated {
}
fun <T> test7c(a: T) where T : Unrelated, T : Function0<Unit> {
run1(r = a /*-> KRunnable */)
}
fun test8(a: Function0<Unit>) {
run1(r = id<Function0<Unit>>(x = a) /*-> KRunnable */)
}
fun test9() {
run1(r = ::test9 /*-> KRunnable */)
}