Gleb Minaev
10/31/2026, 6:30 PMval benchmarkClass = irFactory.buildClass {
origin = pluginDeclarationOrigin
name = Name.identifier("KoneBenchmarkClassFor${subdeclaration.name.identifier.replaceFirstChar { it.uppercaseChar() }}")
kind = CLASS
modality = OPEN
visibility = DescriptorVisibilities.PUBLIC
}
val setupFunction = benchmarkClass.addFunction {
origin = pluginDeclarationOrigin
name = Name.identifier("setup")
visibility = DescriptorVisibilities.PUBLIC
returnType = pluginContext.irBuiltIns.unitType
}.apply {
addValueParameter {
origin = pluginDeclarationOrigin
name = SpecialNames.THIS
visibility = DescriptorVisibilities.PUBLIC
kind = DispatchReceiver
type = benchmarkClass.symbol.defaultType
}
}
I thought that the only criterion of a function (setupFunction here) to be a method (instead of static member) is to have a dispatch receiver. But this does not work for me. After compiling some code with the plugin I find the function to be static member in JVM bytecode. What should I do in such a case?Youssef Shoaib [MOD]
10/31/2026, 7:53 PMinternal-test-framework, then using a debugger in my IrGenerationExtension and exploring the IR's structure that wayGleb Minaev
10/31/2026, 7:59 PMGleb Minaev
10/31/2026, 8:55 PMYoussef Shoaib [MOD]
10/31/2026, 8:58 PMaddDispatchParameter or something like that. Maybe look for usages of IrParameterKind.DispatchReceiverGleb Minaev
10/31/2026, 8:59 PMGleb Minaev
10/31/2026, 9:06 PMbuildReceiverParameter is what we are looking for. But I would never guess it was called just RECEIVER parameter...Gleb Minaev
10/31/2026, 9:30 PM