Caleb B
11/10/2025, 3:38 PMmartmists
11/10/2025, 4:40 PMCaused by: java.lang.AssertionError: Unexpected IR element found during code generation. Either code generation for it is not implemented, or it should have been lowered:
FUN name:<anonymous> visibility:public modality:FINAL <> (it:kotlin.Any) returnType:kotlin.Any
How do I fix this? I'm trying to build a lambda, and in the parent declaration (see thread) the generated IR largely seems fine to me.y9san9
11/11/2025, 8:26 AMCaleb B
11/11/2025, 10:55 PMZac Sweers
11/12/2025, 6:38 PMCaleb B
11/12/2025, 10:06 PMcrowforkotlin
11/14/2025, 2:01 AMJonas
11/14/2025, 8:38 AMJavier
11/14/2025, 3:07 PMFqName, right? So the only workaround about this is that the Gradle Plugin uses something like Classgraph to find those references and pass them to the compiler when syncing/building?martmists
11/15/2025, 10:44 PMnull.INSTANCE, what could be the cause of this? Sample snippet where I pass a ctor reference:
val result = irCall(apply).apply {
typeArguments[0] = klass.defaultType
dispatchReceiver = product
arguments.addAll(1,
listOf(
builder,
IrFunctionReferenceImpl(
klass.startOffset,
klass.endOffset,
pluginContext.irBuiltIns.functionN(ctor.nonDispatchParameters.size).typeWith(*ctor.nonDispatchParameters.map { it.type }.toTypedArray(), klass.defaultType),
ctor.symbol,
0,
)
)
)
}Fergus Hewson
11/16/2025, 10:01 PMWARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.intellij.util.containers.Unsafe (file:/Users/fergushewson/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler/2.2.20/cdea4080fdae6867e9826af835df82e7f2b48a16/kotlin-compiler-2.2.20.jar)
WARNING: Please consider reporting this to the maintainers of class com.intellij.util.containers.Unsafe
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
I'm getting this message when writing a compiler plugin, where/how should I report this?Caleb B
11/17/2025, 12:22 AMconstexpr interpreter?martmists
11/18/2025, 12:45 AMUnexpected IR element found during code generation. Either code generation for it is not implemented, or it should have been lowered:
FUNCTION_REFERENCE 'private final fun _init_$0 (receiver: com.martmists.serialization.TestData): <http://kotlin.Int|kotlin.Int> declared in com.martmists.serialization.TestData.Companion' type=@[FlexibleNullability] java.util.function.Function<@[FlexibleNullability] O of com.mojang.serialization.MapCodec.forGetter?, @[FlexibleNullability] A of com.mojang.serialization.MapCodec?>? origin=LAMBDA reflectionTarget=null
What am I doing wrong? Pastebin link: https://pastebin.com/FCSX76GE (uses kotlin types, and crashes when the lambda is cast to Function)Javier
11/18/2025, 3:20 PMModule Module <CommonOne> doesn't contain package <http://com.foo.dev.app|com.foo.dev.app>
It is throwed inside this function:
override fun getPackage(fqName: FqName): PackageViewDescriptor {
val symbolProvider = session.symbolProvider
if (symbolProvider.hasPackage(fqName)) {
return FirPackageViewDescriptor(fqName, this)
}
error("Module $moduleData doesn't contain package $fqName")
}
The test file is
// MODULE: CommonOne
// file: CommonOneFooDao.kt
package com.foo.common.one
import androidx.room.Dao
@Dao
interface CommonOneFooDao {
fun foo()
}
// MODULE: FeatureOne(CommonOne)
// file: FeatureOneFooDao.kt
package com.foo.feature.one
import androidx.room.Dao
@Dao
interface FeatureOneFooDao {
fun foo()
}
// MODULE: DevApp(FeatureOne, CommonOne)
// file: main.kt
package com.foo.dev.app.feature.one
fun main() {
}Caleb B
11/18/2025, 8:16 PMANNOTATION_CLASS as an allowed target.martmists
11/18/2025, 11:36 PMtypealias CMyType = @CustomAnnotation(...) MyType but inspecting the IrType shows no annotation and printing the fq name just shows MyType. using the expanded form instead of the type alias works fine.
I checked in parent declarations and dumping them always shows the original type without annotations.Fergus Hewson
11/19/2025, 7:36 AMFirDeclarationGenerationExtension that I am using to generate a nested class with the same params as a data class plus custom setters, flows for each property and and all flow.
Is the correct process to generate callables for each method/property in getCallableNamesForClass and the generate properties and functions in generateProperties and generateFunctions?
To do this I have to parse the constructor for the supertype twice or cache callable information in the extensions and to generate the method signatures I need? Am I missing something about how this extension should work? If anyone has similar work. I could read I would really appreciate it too!Javier
11/19/2025, 12:23 PMbuildArrayliteral {} to populate an array of an annotation
I am trying to build this:
@Database(
entities = [
OneEntity::class,
TwoEntity:class,
]
)
abstract class FooDatabase : RoomDatabase()
Everything is created, but building the arrow with the function above fails due `Expected expression FirArrayLiteralImpl to be resolved`. But I do not find a way to resolve this expression.Caleb B
11/19/2025, 5:17 PMFirPropertySymbol or FirNamedReference), how do you get the class that "owns" said property? (The receiver if it's an extension, or the actual owning class if it's a standard property.)
I have R|<local>/inst|.R|/MyClass.bar|, I just can't figure out how to go one level up to R|<local>/inst|.R|/MyClass|.Caleb B
11/19/2025, 7:41 PMthis@R|/MyClass|.R|/MyClass.bar| = R|<local>/value|?
I'm assuming it's through buildVariableAssignment, but I can't figure out what builders to wire into the LValue and RValue.Oliver.O
11/20/2025, 11:34 AMkotlin("multiplatform"), but not kotlin("jvm"). Is this a known situation and will it change?tapchicoma
11/20/2025, 3:23 PMcompileOnly dependencies by devkit plugin
• optional bootstrap for Gradle and Maven plugins
The project will publish a set of publications for API + implementation for every supported Kotlin compiler version with additional (Gradle or some way) attribute. Based on this attribute Kotlin build plugins could select proper publication for used in the project Kotlin compiler version.
What do you think about it?Javier
11/20/2025, 4:18 PMkotlin.k2.only.bundled.compiler.plugins.enabled.
Am I missing something?mikehearn
11/20/2025, 4:56 PMCaleb B
11/20/2025, 5:36 PMFirClassSymbol<*>#declaredX only gives class members.
This is specifically for diagnostics, so it should be resolved at that point, right?Pablichjenkov
11/20/2025, 10:41 PMmartmists
11/23/2025, 1:00 PM@Target(AnnotationTarget.TYPE)
@Retention(AnnotationRetention.SOURCE)
annotation class CodecLocation(val klass: KClass<*>, val field: String) // Ideally I could do CodecLocation(val prop: KProperty<*>) to specify as @CodecLocation(Codecs::B_CODEC) but that doesn't seem to work
@Codec
data class A(
val b: @CodecLocation(Codecs::class, "B_CODEC") B
)
typealias CodecB = @CodecLocation(Codecs::class, "B_CODEC") B
@Codec
data class A2(
val b: CodecB
)
In A I can grab param.type.annotations[0] to get the CodecLocation annotation, but in A2 it seems to just resolve as B with no annotations present. How can I still get the annotation in A2?Fergus Hewson
11/24/2025, 3:38 AMDevanshu Pathsariya
11/24/2025, 7:48 AMFergus Hewson
11/24/2025, 5:53 PM