Esya Bekasova
10/20/2026, 3:37 PMnewKind for a fakeElement() when generating properties/functions in FirDeclarationGenerationExtension ?
Whats developer writes:
package com.example
import compiled.library.SomeClass
@ASomeClass()
class SomeClassMixin {
@B fun iwannabeext() {}
}
-> generated virtual:
package compiled.library
fun SomeClass.iwannabeext() {}
-> to call it later:
fun foo(bar: SomeClass) { bar.iwannabeext() }
So, I need to bind:
Virtual top-level function with receiver
-
Original member function in a class (without receiver).
Note that real dispatch receiver is not same as virtual extension receiver.
I notice that the choice of kind leads to various unpredictable behaviors.
• For functions: I use FromUseSiteTarget. I have all the IDE integration working except I can't rename the original at call site.
• For properties: I use PropertyTypeFromGetterReturnType. After a lot of trial and error, this kind finally stopped triggering false positive unused imports, but I still haven't gotten a working "go to declaration" (from call to original).
Does anyone have any suggestions for a different kind?
I should also mention that in the future I'm going to make an IDEA plugin because I want a custom color for calls.Esya Bekasova
10/20/2026, 3:40 PMEsya Bekasova
10/20/2026, 3:59 PMYoussef Shoaib [MOD]
10/20/2026, 3:59 PMPluginGenerated, unless you really really know what you're doing, and even then, probably should use PluginGenerated anywayEsya Bekasova
10/20/2026, 4:00 PMEsya Bekasova
10/20/2026, 4:03 PMEsya Bekasova
10/20/2026, 4:04 PMYoussef Shoaib [MOD]
10/20/2026, 4:04 PMthis@label or something like that, using GeneratedLambdaLabel I believeYoussef Shoaib [MOD]
10/20/2026, 4:06 PMEsya Bekasova
10/20/2026, 4:06 PMYoussef Shoaib [MOD]
10/20/2026, 4:08 PMEsya Bekasova
10/20/2026, 4:08 PMEsya Bekasova
10/20/2026, 4:08 PMYoussef Shoaib [MOD]
10/20/2026, 4:11 PMEsya Bekasova
10/20/2026, 4:13 PMYoussef Shoaib [MOD]
10/20/2026, 4:13 PMFromUseSiteTarget would work pretty well thenEsya Bekasova
10/20/2026, 4:15 PMEsya Bekasova
10/20/2026, 4:16 PMEsya Bekasova
10/20/2026, 4:16 PMYoussef Shoaib [MOD]
10/20/2026, 4:17 PMKaModule etc) just means Kotlin Analysis I believe, so it's a different name for Analysis APIEsya Bekasova
10/20/2026, 4:18 PMEsya Bekasova
10/20/2026, 4:22 PMEsya Bekasova
10/20/2026, 5:02 PMItLambdaParameter would be an ideal candidate since it is the only fake that makes Go to definition work, but for properties this results in a false positive unused import (interestingly, there is no such problem for imported functions)Youssef Shoaib [MOD]
10/20/2026, 5:04 PMEsya Bekasova
10/20/2026, 5:08 PMEsya Bekasova
10/20/2026, 5:08 PMYoussef Shoaib [MOD]
10/20/2026, 5:10 PMEsya Bekasova
10/20/2026, 5:10 PMEsya Bekasova
10/20/2026, 5:10 PMYoussef Shoaib [MOD]
10/20/2026, 5:14 PMEsya Bekasova
10/20/2026, 5:29 PMEsya Bekasova
10/20/2026, 5:44 PMEsya Bekasova
10/20/2026, 5:47 PMcopy() generated, tomorrow