Provide intrinsic generators for in/!in expression
TODO some tests should fail because range of comparables (e.g., '"Alpha" .. "Omega"') is currently not implemented
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun box(): String = when {
|
||||
0 in intArrayOf(1, 2, 3) -> "fail 1"
|
||||
1 !in intArrayOf(1, 2, 3) -> "fail 2"
|
||||
else -> "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
val charSeq: String = "123"
|
||||
|
||||
fun box(): String = when {
|
||||
'0' in charSeq -> "fail 1"
|
||||
'1' !in charSeq -> "fail 2"
|
||||
else -> "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
val iterable: Iterable<Int> = listOf(1, 2, 3)
|
||||
|
||||
fun box(): String = when {
|
||||
0 in iterable -> "fail 1"
|
||||
1 !in iterable -> "fail 2"
|
||||
else -> "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
val progression = 1 .. 3 step 2
|
||||
|
||||
fun box(): String = when {
|
||||
0 in progression -> "fail 1"
|
||||
1 !in progression -> "fail 2"
|
||||
else -> "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
val range = 1 .. 3
|
||||
|
||||
fun box(): String = when {
|
||||
0 in range -> "fail 1"
|
||||
1 !in range -> "fail 2"
|
||||
else -> "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user