Files
kotlin-fork/compiler/testData/codegen/box/ranges/contains/inRangeLiteralComposition.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

27 lines
792 B
Kotlin
Vendored

// WITH_STDLIB
val i1 = 1
val i2 = 2
val i3 = 3
fun box(): String {
if (!(i2 in i1 .. i3 && i1 !in i2 .. i3)) return "Fail 1 &&"
if (!(i2 in i1 .. i3 || i1 !in i2 .. i3)) return "Fail 1 ||"
// const-folded in JVM BE
if (!(2 in 1 .. 3 && 1 !in 2 .. 3)) return "Fail 2 &&"
if (!(2 in 1 .. 3 || 1 !in 2 .. 3)) return "Fail 2 ||"
val xs = listOf(1, 2, 3)
if (!(1 in xs && 10 !in xs)) return "Fail 3 &&"
if (!(1 in xs || 10 !in xs)) return "Fail 3 ||"
val iarr = intArrayOf(1, 2, 3)
if (!(1 in iarr && 10 !in iarr)) return "Fail 4 &&"
if (!(1 in iarr || 10 !in iarr)) return "Fail 4 ||"
if (!("b" in "a" .. "c" && "a" !in "b" .. "c")) return "Fail 5 &&"
if (!("b" in "a" .. "c" || "a" !in "b" .. "c")) return "Fail 5 ||"
return "OK"
}