Youssef Shoaib [MOD]
09/30/2025, 4:54 PMFirFunctionCallRefinementExtension is acting very weird (on Kotlin 2.2.20). I'm getting a lot of calls where intercept is called, but transform isn't. The culprit seems to be that its return value is immediately used as an argument for another statement:
Foo(x.someCallThatShouldGetRefined())
This is resulting in ill-formed IR, among other things. Why is my transform not being called? I know it's an experimental extension and everything, but this feels like an issue that might thus plague DataFrame as well.
EDIT: The culprit seems to be this check because reference is FirNamedReferenecWithCandidate for some reason.
I think most uses of DataFrame don't run into this because FirNamedReferenecWithCandidate only happens (I think) when you have a function call surrounded by another function call, but the natural pattern for DataFrame is to use extension methods.
Is this intended behaviour?Youssef Shoaib [MOD]
09/30/2025, 5:07 PMYoussef Shoaib [MOD]
09/30/2025, 5:18 PMFirNamedReferenecWithCandidate means that the call is not guaranteed to have been chosen yet, but I'd then expect transform to be called eventually elsewhere.Nikita Klimenko [JB]
10/03/2025, 7:29 AMfun <T> take(value: T): T = value
fun box(): String {
val df = take(dataFrameOf("a" to columnOf(42)).add("test") { "str" })
df.a
df.test
return "OK"
}
Foo(x.someCallThatShouldGetRefined()) compiles if you disable the plugin?Youssef Shoaib [MOD]
10/03/2025, 5:14 PMintercept returns a type that includes a type parameter of the function, and that type parameter must only show up in the return type of a lambda.
In other words, consider a dumb intercept that always returns the same type as the one passed in.
Then, this would cause the issue:
fun <T> foo(block: () -> T): T = block()
with(foo { "hi" }) { }
But, if intercept never incorporates those type parameters in its return type, which seems to be the case for DataFrame, then the problem never manifests