Files
kotlin-fork/compiler/testData/loadJava/compiledKotlinWithStdlib/contracts/recursion.kt
T
2021-09-10 16:29:16 +03:00

14 lines
382 B
Kotlin
Vendored

// !LANGUAGE: +AllowContractsForCustomFunctions +ReadDeserializedContracts
// !OPT_IN: kotlin.contracts.ExperimentalContracts
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package test
import kotlin.contracts.*
fun foo(n: Int, x: Any?): Boolean {
contract {
returns(true) implies (x is String)
}
return if (n == 0) x is String else foo(n - 1, x)
}