toadzky
11/17/2024, 5:38 AM@Annotation
fun myFunction(...) {
CoroutineScope(Dispatchers.Default).async {
// insert original function statements here
}
}
but the plugin context can't find either the CoroutineScope(CoroutineContext)
factory function or the async
extension function (though it's not particularly clear how to find extension functions since there's no docs). when i try to have the symbol provider look up top level functions for the coroutines package, it finds others, but not those (and not launch
either).
what's the correct way to go about finding those function symbols so i can have my plugin invoke them? this is what i'm currently doing:
pluginContext.referenceFunctions(CallableId(
packageName = StandardNames.COROUTINES_PACKAGE_FQ_NAME,
callableName = Name.identifier("CoroutineScope")
))
axeon
11/19/2024, 12:19 PMAbhimanyu
11/23/2024, 12:46 PMhho
11/27/2024, 2:26 PMEugen Martynov
11/29/2024, 7:35 AMAnirudh
12/11/2024, 1:05 PMXad Kile
12/11/2024, 2:14 PMmyLambda
passed to a function call like this one
fun outerFunction(){
someFunctionCall(myLambda = {...}, otherStuff)
}
Ideally, I would like to generate an entirely new lambda, and replace the current myLambda
. I have managed to do all that except for finding a declaration parent for my new lambda.
I am doing this within visitCall
and I think the correct parent should be whatever is calling someFunctionCall
, in this case that is outerFunction
.
However, I cannot find a way to get the declaration of outerFunction
from the IrCall
at visitCall
. Is this the proper way to find parent for my new lambda? Am I missing something here? Thank youEugen Martynov
12/18/2024, 12:46 PMOla Adolfsson
12/27/2024, 9:11 AMjsNodeDevelopmentLibraryDistribution
and jsNodeProductionLibraryDistribution
? I mean just that you should use production for production 🙂. I can't find any information. Is anyone faster, etc?gpopides
01/02/2025, 9:48 PMextraWarnings
option that shipped with 2.1 a package to be ignored?
Currently protobuf compilation adds modifiers in the compiled classes and we get the redundant modifier warning
Ideally we would like to ignore the package/directory that we output the classes toritesh
01/06/2025, 7:59 AMenableStrongSkippingMode
in my project for compose. It fails for a specific piece of code when running Junit tests for compose, the failure seems to be streaming from compose-compiler/plugin during the IR lowering phase. More in 🧵Priyabrata Naskar
01/09/2025, 7:58 AMMelih Aksoy
01/17/2025, 8:08 PMERROR
and autocompelete etc. does not work - I tried to load with different versions of AS as well as invalidate / restart / nuking .idea etc. but nothing except disabling k2 fixed it so far
any ideas ?Olaf Gottschalk
02/10/2025, 8:41 AMFrançois
02/24/2025, 10:08 AMflorent
04/25/2025, 1:10 PMwhen
. Is it something known? And of course, I have disabled * imports on the kotlin code style. Thanks for your time!martmists
04/29/2025, 6:07 PMnerses
05/06/2025, 11:41 PMopen class Parent(
open val numbers: List<Int>
) {
val sortedNumbers: List<Int> = numbers.sorted()
}
class Child(
override val numbers: List<Int>
): Parent(numbers)
fun main() {
println(Child(emptyList()).sortedNumbers)
}
it fails with
Exception in thread "main" java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.collections.CollectionsKt___CollectionsKt.sorted, parameter <this>
at kotlin.collections.CollectionsKt___CollectionsKt.sorted(_Collections.kt)
at Parent.<init>(Blah.kt:4)
at Child.<init>(Blah.kt:9)
at BlahKt.main(Blah.kt:12)
at BlahKt.main(Blah.kt)
aidanvii
05/07/2025, 8:10 AMINFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION
warning
It’s worth mentioning if you specify the types explicitly, it will result in a compiler error in 2.0+, but not with inferred types 🤷kevin.cianfarini
05/13/2025, 1:33 PM-Werror
on my project and it instructed me to delete an else
branch that was previously required for a when
statement with an expect enum class
as the subject.
I flagged in in the #C0B8H786P channel here, and after discussing, I think there’s two issues:
1. This code shouldn’t compile at all since expect enums can have less entries than their actual counterparts.
2. The else branch shouldn’t have been flagged as unnecessary by the compiler.
Does this seem like it’s an actual bug? Here’s the PR where I surfaced this inconsistency. cc @Anna KozlovaCies
05/14/2025, 8:10 AMCLOVIS
05/15/2025, 12:38 PMAndreas Martin Mørch
05/20/2025, 7:53 AMjava.lang.IllegalArgumentException: Only componentN functions should be cached this way, but got: hashCode
at org.jetbrains.kotlin.fir.backend.Fir2IrDeclarationStorage.cacheIrFunctionSymbol(Fir2IrDeclarationStorage.kt:426)
at org.jetbrains.kotlin.fir.backend.Fir2IrDeclarationStorage.getIrFunctionSymbol(Fir2IrDeclarationStorage.kt:1133)
at org.jetbrains.kotlin.fir.backend.Fir2IrDeclarationStorage.getIrFunctionSymbol$default(Fir2IrDeclarationStorage.kt:1101)
at org.jetbrains.kotlin.fir.backend.generators.Fir2IrDataClassGeneratedMemberBodyGenerator$MyDataClassMethodsGenerator$irDataClassMembersGenerator$1.getHashCodeFunctionInfo(Fir2IrDataClassMembersGenerator.kt:362)
at org.jetbrains.kotlin.ir.util.DataClassMembersGenerator.getHashCodeOf(DataClassMembersGenerator.kt:282)
at org.jetbrains.kotlin.ir.util.DataClassMembersGenerator$MemberFunctionBuilder.getHashCodeOfProperty(DataClassMembersGenerator.kt:229)
at org.jetbrains.kotlin.ir.util.DataClassMembersGenerator$MemberFunctionBuilder.generateHashCodeMethodBody(DataClassMembersGenerator.kt:211)
at org.jetbrains.kotlin.ir.util.IrBasedDataClassMembersGenerator.generateHashCodeMethod(DataClassMembersGenerator.kt:367)
I only found this issue where someone had a similar issue, but they get it by using the IJ debugger and evaluating an expression:
KT-70376 K2 IDE / Kotlin Debugger: IAE “Only componentN functions should be cached this way, but got: toString” on evaluating toString() method for value class
I tried a variety of versions from 2.0.x to 2.2.0-RC giving me the same error.
Is there any way to figure out which code this exception refers to? Maybe that will make it possible to create a minimal reproducerGiorgio Vespucci
05/29/2025, 1:12 PM"Unreachable Code"
with K2 Mode active.
Has anyone got the same issue?Eugen Martynov
06/30/2025, 4:22 PMMarharyta Nedzelska
07/01/2025, 8:09 AMMarharyta Nedzelska
07/02/2025, 2:01 PMX Jia
07/17/2025, 9:45 AMputValueArgument(0, expr)
I'm not clear on how to get "parameter.indexInParameters" in this case.
And where can I find "the API migration: KT-68003"?
Any help please.agrosner
07/24/2025, 7:04 PMsegunfamisa
07/31/2025, 4:41 PMfun foo() {
GlobalScope.launch {
// anonymous suspend function <===
try {
delay(1_000)
} catch (_: Exception) {
// general error handling
}
}
}
I need to be able to tell if the try-block is running within a suspend function (as is this case).
I have this so far:
// visitTryExpression
val function = expression.getParentOfType<KtFunction>(strict = true) ?: return
analyze(function) {
val symbol: KaAnonymousFunctionSymbol = function.symbol
// symbol.isSuspend does not exist
}
I noticed that KaAnonymousFunctionSymbol.isSuspend
does not exist, even though KaNamedFunctionSymbol.isSuspend
exists.
My question is: how does one get whether an anonymous function/lambda is a suspend function in the analysis API?e