FIR resolve: add test for map and apply

This commit is contained in:
Simon Ogorodnik
2019-04-17 15:48:06 +03:00
committed by Mikhail Glukhikh
parent 206afde9cc
commit 572c9e7115
2 changed files with 23 additions and 4 deletions
+12 -2
View File
@@ -1,5 +1,15 @@
fun main() {
val x = List(10) {
"number = $it"
val x = emptyList<Int>()
val u = x.map { it + it }
u.applyX {
1 in this
contains(1)
}
}
inline fun <T> T.applyX(block: @ExtensionFunctionType Function1<T, Unit>): T {
TODO()
}
+11 -2
View File
@@ -1,7 +1,16 @@
FILE: mapList.kt
public final fun main(): R|kotlin/Unit| {
lval x: R|kotlin/collections/List<kotlin/String>| = R|kotlin/collections/List|<R|kotlin/String|>(Int(10), <L> = List@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/String| {
<strcat>(String(number = ), R|<local>/it|)
lval x: R|kotlin/collections/List<kotlin/Int>| = R|kotlin/collections/emptyList|<R|kotlin/Int|>()
lval u: R|kotlin/collections/List<kotlin/Int>| = R|<local>/x|.R|kotlin/collections/map|<R|kotlin/Int|, R|kotlin/Int|>(<L> = map@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Int| {
R|<local>/it|.R|kotlin/Int.plus|(R|<local>/it|)
}
)
R|<local>/u|.R|/applyX|<R|kotlin/collections/List<kotlin/Int>|>(<L> = applyX@fun R|kotlin/collections/List<kotlin/Int>|.<anonymous>(it: R|kotlin/collections/List<kotlin/Int>|): R|kotlin/Unit| {
this#.R|FakeOverride<kotlin/collections/List.contains: R|kotlin/Boolean|>|(Int(1))
R|FakeOverride<kotlin/collections/List.contains: R|kotlin/Boolean|>|(Int(1))
}
)
}
public final inline fun <T> R|T|.applyX(block: @R|kotlin/ExtensionFunctionType|() R|kotlin/Function1<T, kotlin/Unit>|): R|T| {
R|kotlin/TODO|()
}