diff --git a/compiler/fir/resolve/testData/resolve/stdlib/topLevelResolve.kt b/compiler/fir/resolve/testData/resolve/stdlib/topLevelResolve.kt index 3e97c622ef1..793f973a452 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/topLevelResolve.kt +++ b/compiler/fir/resolve/testData/resolve/stdlib/topLevelResolve.kt @@ -13,4 +13,22 @@ fun testPlus() { val stringAndList = "" + emptyList() val map = mapOf("" to 1, "." to 2) + (".." to 3) val mapAndMap = mapOf("-" to 4) + mapOf("_" to 5) +} + +fun id(arg: T): T = arg + +fun testMap() { + val first = listOf(1, 2, 3).map { it * 2 } + val second = intArrayOf(4, 5, 6).map { it * 2 } + val withId = listOf(1, 2, 3).map { id(it) } + val stringToInt = listOf("alpha", "omega").map { it.length } + val viaWith = with(listOf(42)) { + map { it * it } + } +} + +fun testWith() { + val length = with("") { length } + val indices = with("") { indices } + val indicesNoWith = "".indices } \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/stdlib/topLevelResolve.txt b/compiler/fir/resolve/testData/resolve/stdlib/topLevelResolve.txt index 70ec9d44799..544ae81e28b 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/topLevelResolve.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/topLevelResolve.txt @@ -15,3 +15,42 @@ FILE: topLevelResolve.kt lval map: R|kotlin/collections/Map| = R|kotlin/collections/mapOf|(String().R|kotlin/to|(Int(1)), String(.).R|kotlin/to|(Int(2))).R|kotlin/collections/plus|(String(..).R|kotlin/to|(Int(3))) lval mapAndMap: = #(String(-).R|kotlin/to|(Int(4))).#(#(String(_).R|kotlin/to|(Int(5)))) } + public final fun id(arg: R|T|): R|T| { + ^id R|/arg| + } + public final fun testMap(): R|kotlin/Unit| { + lval first: R|kotlin/collections/List| = R|kotlin/collections/listOf|(Int(1), Int(2), Int(3)).R|kotlin/collections/map|( = map@fun (it: R|kotlin/Int|): R|kotlin/Function1| { + R|/it|.R|kotlin/Int.times|(Int(2)) + } + ) + lval second: R|kotlin/collections/List| = R|kotlin/intArrayOf|(Int(4), Int(5), Int(6)).R|kotlin/collections/map|( = map@fun (it: R|kotlin/Int|): R|kotlin/Function1| { + R|/it|.R|kotlin/Int.times|(Int(2)) + } + ) + lval withId: R|kotlin/collections/List| = R|kotlin/collections/listOf|(Int(1), Int(2), Int(3)).R|kotlin/collections/map|( = map@fun (it: R|kotlin/Int|): R|kotlin/Function1| { + R|/id|(R|/it|) + } + ) + lval stringToInt: R|kotlin/collections/List| = R|kotlin/collections/listOf|(String(alpha), String(omega)).R|kotlin/collections/map|( = map@fun (it: R|kotlin/String|): R|kotlin/Function1| { + R|/it|.R|kotlin/String.length| + } + ) + lval viaWith: R|kotlin/Nothing| = R|kotlin/with||, R|kotlin/Nothing|>(R|kotlin/collections/listOf|(Int(42)), = with@fun R|kotlin/collections/List|.(it: R|kotlin/collections/List|): R|kotlin/Function2, kotlin/collections/List, kotlin/Nothing>| { + #( = map@fun .(): { + it#.times#(it#) + } + ) + } + ) + } + public final fun testWith(): R|kotlin/Unit| { + lval length: R|kotlin/Int| = R|kotlin/with|(String(), = with@fun R|kotlin/String|.(it: R|kotlin/String|): R|kotlin/Function2| { + R|kotlin/String.length| + } + ) + lval indices: R|kotlin/Nothing| = R|kotlin/with|(String(), = with@fun R|kotlin/String|.(it: R|kotlin/String|): R|kotlin/Function2| { + # + } + ) + lval indicesNoWith: R|kotlin/ranges/IntRange| = String().R|kotlin/text/indices| + }