CLOVIS
02/11/2025, 6:00 PM@JvmOverloads
but with slightly different rules. Ideally, at usage, I'd want something like:
@MyCustomOverloads
fun A<T>.foo(other: A<T>): T
to also generate
fun A<T>.foo(other: B<T>): T = this.foo(convertToA(other))
fun B<T>.foo(other: B<T>): T = convertToA(this).foo(convertToA(other))
fun B<T>.foo(other: A<T>): T = convertToA(this).foo(other)
where the generated functions are identical to the initial one in all other aspects (same annotations, same kdoc…).
My main use-case: as a library author, I'm providing a DSL that has many possible arguments for end-user convenience, but they all call the same function in the end. I want to avoid having to maintain all of these functions myself, so I'd like to get them in the library artifact. It's important that downstream users do not have to configure their build, from their point of view, these overloads shouldn't be different from the real version.
I don't know much about compiler plugins; would you say this is feasible with KSP? What would your recommendations be for where to get started implementing something like this?Javier
02/11/2025, 6:02 PMYoussef Shoaib [MOD]
02/11/2025, 6:13 PMTóth István Zoltán
02/11/2025, 6:13 PMJavier
02/11/2025, 6:14 PMI don't know if it's been solved but it wasn't possible to generate top level functions from FIR/IR compiler plugins. When I tried, the compiler crashed and the problem was somewhere in the compiler code.We were generating top level functions in Arrow Inject in the pass with no issues 🤔
Tóth István Zoltán
02/11/2025, 6:16 PMJavier
02/11/2025, 6:16 PMTóth István Zoltán
02/11/2025, 6:17 PMJavier
02/11/2025, 6:19 PMTóth István Zoltán
02/11/2025, 6:29 PMJavier
02/11/2025, 6:32 PMCLOVIS
02/11/2025, 8:09 PMYoussef Shoaib [MOD]
02/11/2025, 8:10 PMCLOVIS
02/11/2025, 8:10 PMCLOVIS
02/11/2025, 8:12 PMYoussef Shoaib [MOD]
02/11/2025, 8:14 PMCLOVIS
02/11/2025, 8:15 PMJavier
02/11/2025, 8:17 PMWell they're not even implemented yet.They are available since 2.1.20-Beta1
Javier
02/11/2025, 8:17 PMCLOVIS
02/11/2025, 8:18 PMYoussef Shoaib [MOD]
02/11/2025, 8:18 PMCLOVIS
02/11/2025, 8:19 PMYoussef Shoaib [MOD]
02/11/2025, 8:21 PMJavier
02/11/2025, 8:24 PMCLOVIS
02/11/2025, 8:26 PMCLOVIS
02/11/2025, 8:26 PMYoussef Shoaib [MOD]
02/11/2025, 8:27 PMJavier
02/11/2025, 8:28 PMthey're not mentioned in the blog postThere is no blog post or any announcement about you can try them in 2.1.20
Javier
02/11/2025, 8:28 PMJavier
02/11/2025, 8:28 PMCLOVIS
02/11/2025, 8:30 PMJavier
02/11/2025, 8:33 PMCLOVIS
02/11/2025, 8:35 PMYoussef Shoaib [MOD]
02/11/2025, 8:38 PMCLOVIS
02/11/2025, 8:41 PMCLOVIS
02/11/2025, 8:41 PMAlejandro Serrano.Mena
02/12/2025, 8:22 AMCLOVIS
02/12/2025, 1:13 PMAlejandro Serrano.Mena
02/12/2025, 1:20 PM