Caleb B
05/01/2026, 3:19 PMYoussef Shoaib [MOD]
05/01/2026, 3:28 PMCaleb B
05/01/2026, 3:48 PMYoussef Shoaib [MOD]
05/01/2026, 3:51 PMCaleb B
05/01/2026, 3:52 PMCaleb B
05/01/2026, 3:53 PMlistOf("").asSequence().map(...).downstreamAction() into for (el in listOf("")) { map(el) { downstreamAction(it) } }Caleb B
05/01/2026, 3:54 PMflatten<Iterable<T>> and flatten<Array<T>>Youssef Shoaib [MOD]
05/01/2026, 3:55 PMYoussef Shoaib [MOD]
05/01/2026, 3:56 PMI think you can access type parameters in IR, so this should be doable. However, I'd instead recommend you create multiple functions in FIR, one for each collection type you support (you'll likely only have 2-3 anyways), and thus their bodies can be trivial.andflatten<Iterable<T>>flatten<Array<T>>
Caleb B
05/01/2026, 4:00 PMCaleb B
05/01/2026, 4:01 PMYoussef Shoaib [MOD]
05/01/2026, 4:15 PMYoussef Shoaib [MOD]
05/01/2026, 6:10 PMCaleb B
05/01/2026, 6:11 PMCaleb B
05/01/2026, 6:12 PMYoussef Shoaib [MOD]
05/01/2026, 6:20 PMsuspend
Is the problem here that you want to take one look at list.asInlineSequence().drop(1) in IR and immediately have access to the apt inline fun drop?Caleb B
05/01/2026, 6:24 PMCaleb B
05/01/2026, 6:25 PMCaleb B
05/01/2026, 6:25 PMYoussef Shoaib [MOD]
05/01/2026, 6:26 PMInlineSequence extension. Then, you simply use referenceFunctions or whatever it's called to look up functions by their FQN, and simply filter them by the callable idCaleb B
05/01/2026, 6:27 PMreferenceFunctions takes in that callable id and returns every single overloadCaleb B
05/01/2026, 6:27 PMYoussef Shoaib [MOD]
05/01/2026, 6:28 PMChoose dsl, which gives you list comprehensions and more.Youssef Shoaib [MOD]
05/01/2026, 6:42 PM// annotation added in IR
@MyCustomId(1)
fun InlineSequence<T>.drop(n: Int) = ...
// created in IR
@MyCustomId(1)
fun drop(...)
// now consider in a different lib we see this call
list.inlineSequence().drop(1)
// we now have the callable id of `InlineSequence<T>.drop`, so we use that to look up all `drop` functions in the same package
// we also have the id from the annotation, so we can filter the results to only get the single function with the correct IDCaleb B
05/01/2026, 7:12 PMCaleb B
05/01/2026, 7:16 PMCaleb B
05/01/2026, 7:19 PM// MODULE: lib1
package libpkg;
@MyCustomId(1)
fun drop(x)
// MODULE: lib2
package libpkg;
@MyCustomId(1)
fun drop(y)
// MODULE: main(lib1, lib2)
import libpkg.drop
list.inlineStream().drop(x) // have same CallableId, but also same custom ID because they were compiled separatelyCaleb B
05/01/2026, 7:23 PMYoussef Shoaib [MOD]
05/01/2026, 7:49 PMCaleb B
05/01/2026, 8:08 PMYoussef Shoaib [MOD]
05/01/2026, 8:09 PMCaleb B
05/01/2026, 10:09 PMYoussef Shoaib [MOD]
05/01/2026, 11:29 PM