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 PMEmpa
11/25/2025, 2:14 PM@Deprecated annotations to declarations annotated with our custom annotation, but currently only our annotation appears in the sources, and the @Deprecated one does not.
Am I supposed to use something else instead of a compiler plugin for this?Isaac Udy
11/29/2025, 3:18 AM@Composable () -> Unit lambda parameter: like this:
fun myGeneratedFunction() {
someOtherExternalFunction( parameter = { MyExternalComposableFunction() } )
}
But I can't figure out how to do this correctly. Attempting the generation in the IR phase leaves me with compiler errors related to unhandled intrinsics, and attempting the generation in the FIR phase is giving me grief about constructing the lambda/anonymous function call - it compiles fine, but then crashes at runtime because the anonymous function apparently isn't making it into the byte code.
Would love some help/tips if anyone has experience generating code that calls Composables in either IR or FIR in a compiler plugin. Thanks!Caleb B
11/29/2025, 8:14 PMCaleb B
11/29/2025, 9:23 PMZac Sweers
11/30/2025, 7:01 AMcontainingFileName APIs introduced to FIR in 2.3.0, and finding that it doesn't actually seem to be compatible with KGP's IC implementation 😞. Something seems to get lost in translation between how kotlinc understands this file path (which is relative/based on the package) and how KGP does (it expects an absolute path?)
KT-82809 [FIR][IC] New containingFileName parameter API is not actually compatible with ICIsaac Udy
12/01/2025, 7:54 AMval myProperty = MyClass::class
but I can't figure out how I'm supposed to do this between buildGetClassCall and buildClassReferenceExpression. Does anyone have any tips?Olaf Gottschalk
12/01/2025, 9:48 AMfun <O : Any> test(doIt: () -> O) {
TODO()
}
fun <O> test(doIt: () -> O?) {
TODO()
}
fun demo() {
test { "" }
test { null }
}
test must exist in two flavors:
• one where the lambda block can return anything that is nullable
• another that must be chosen if the return value cannot be null.
With my declaration as above, I think the compiler can find a matching method for the String and also for the null value: the first must resolve to the nun-nullable version, the second should (it's the only match!) resolve to the second implementation.
But the reality is different, sadly - the one returning null is getting a compiler error: Cannot infer type for type parameter 'O'. Specify it explicitly.
I tried every variation I could think of, nothing works.
Also tried @OverloadResolutionByLambdaReturnType but that also did not change anything.
Is there any trick I need to pull here to teach the compiler to take the second function for nullable lambda return types?Jakob Heher
12/01/2025, 1:35 PMJakob Heher
12/01/2025, 1:36 PMfun fnTakingUnitLambda(fn: ()->Unit) = ...
// this is legal, and i want it not to be:
fnTakingUnitLambda { 42 }
// this should still be legal:
fnTakingUnitLambda { Unit }
// this should also work:
fnTakingUnitLambda { someOtherFnThatReturnsUnit() }Caleb B
12/02/2025, 2:00 AMclass MyClass : MySuperClass() {
private fun <!SETTER_DECL_TARGET_PROPERTY_NOT_VISIBLE!>`set-someProperty`<!>(value: Int) {
someProperty = value.toString()
}
}
Log:
java.lang.IllegalStateException: SETTER_DECL_TARGET_PROPERTY_NOT_VISIBLE: Setter target ''var someProperty: String' defined in 'foo.MySuperClass'' is not visible in this scope. at MyClass.kt:(212,230)
at org.jetbrains.kotlin.test.backend.handlers.NoFirCompilationErrorsHandler.processModule(NoFirCompilationErrorsHandler.kt:54)
Does anyone know what's going on? I'm so close to getting this to work.Caleb B
12/02/2025, 8:35 PMbuildThing {
// ThingBuilder#defaultValue: () -> String
defaultValue = "literal string"
defaultValue = 0
defaultValue = { someExpensiveComputation() }
}
You can check it out here: https://github.com/cbrandt77/Kotlin-OverloadableSetters
I'm still working on publishing it and getting it on the plugin portal, but it's fully kitted out with diagnostics and should work as-is.
I'll be implementing more language features in the future, so keep an eye out! I've got a list that's like two pages long, lolRey (Kingg22)
12/04/2025, 12:19 PMRey (Kingg22)
12/04/2025, 12:33 PM