PHondogo
04/15/2025, 8:02 AMif (e is Error
&& e !is AssertionError
&& e !is NotImplementedError // why compiler complains about "Check for instance is always 'true'." ?
) {
throw e
}
Alexander Ioffe
04/16/2025, 2:14 AMval getterSymbol = cls.getPropertyGetter(propertyName)
with (builder) {
irCall(getterSymbol).apply {
dispatchReceiver = parent
}
}
The error is:
Caused by: java.lang.IllegalStateException: IrFieldSymbolImpl is unbound. Signature: null
... 285 more
Strange thing is, it only happens when I do something like this:
doSomething {
val myClassInst = MyClass(myProperty = "foobar")
doSomethingElse {
callToTransform(myClassInst)
}
}
When the variables are lined up together like so:
doSomething {
doSomethingElse {
val myClassInst = MyClass(myProperty = "foobar")
callToTransform(myClassInst)
}
}
Then it's fine.
What am I missing here? Why does one situation work and not the other?Roman Rastiehaiev
04/16/2025, 10:58 PMkotlin-serialization
plugin as example for implementing my plugin but I couldn't find the code that "introduces" generated class & method to IDE. Could someone please point me to the place where to look?Joel Wilcox
04/17/2025, 1:30 AM@ContributesBinding(AppScope::class)
@ContributesBinding(AltScope::class)
@Inject
class ContributingClass : SomeInterface
I generate some nested classes in a FirDeclarationGenerationExtension
where we end up with
@ContributesBinding(AppScope::class)
@ContributesBinding(AltScope::class)
@Inject
class ContributingClass : SomeInterface {
@Contribution(AppScope::class)
class NestedContribution
@Contribution(AltScope::class)
class NestedContribution2
}
After ``FirDeclarationGenerationExtension#generateNestedClassLikeDeclaration` has run and generated both classes, we get to FirSupertypeGenerationExtension#computeAdditionalSupertypes
and I try to query for the nested classes but I'm not able to find them. Things I've tried include
⢠session.predicateBasedProvider.getSymbolsByPredicate(parentAnnotated(contributesBinding))
- this finds `ContributingClass`'s constructor
⢠session.predicateBasedProvider.getSymbolsByPredicate(annotated(contribution))
- this finds nothing
⢠Accessing `ContributingClass`'s declarationSymbols
-- this finds the constructor
Is it possible to access the nested generated classes here? Based on some older discussions I was thinking this should be possible so I'm not sure if perhaps I'm setting something up incorrectly, or that the generated nested classes are just not accessible yet at this phase.
Additional notes:
⢠I have all the predicates registered in the FirSupertypeGenerationExtension
⢠Right now this is for all code living in the same module/compilationdhkim
04/17/2025, 8:01 AMFudge
04/17/2025, 8:18 PMRaid Xu
04/18/2025, 5:52 AMXiming Chen
04/18/2025, 4:05 PMAmadey
04/21/2025, 8:01 AMJoel Wilcox
04/22/2025, 1:21 AM@ContributesBinding(AppScope::class, binding = binding<ContributedInterface>())
object Impl1 : ContributedInterface, OtherInterface
where I want to evaluate the binding
argument of ContributesBinding
inside a FirSupertypeGenerationExtension
. When the above snippet is defined with the rest of my code in a single module, the binding
arg is accessible as a FirFunctionCall
which allows me to get its parameterized type ContributedInterface
. Once I move the Impl1
snippet to a separate module and compilation, the FirSupertypeGenerationExtension
sees the binding
arg as a FirAnnotationImpl
rather than some type of call. This results in the binding arg coming back as null since we're not able to access the parameterized type.
Any ideas on additional changes I might need to make to support both use-cases and access the argument as a call-type? Also happy to provide more details if neededRoman Rastiehaiev
04/22/2025, 9:46 PMthramp
04/24/2025, 3:34 PMeygraber
04/25/2025, 4:49 PMWARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by org.jetbrains.kotlin.com.intellij.util.containers.Unsafe (file:/home/eli/workspace/myapp/tmp/ktlint-1.5.0)
WARNING: Please consider reporting this to the maintainers of class org.jetbrains.kotlin.com.intellij.util.containers.Unsafe
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
TwoClocks
04/27/2025, 7:00 PMlogDebug("name:{s} id:{d}", name, id)
I want to generate this function in the compiler plugin.Youssef Shoaib [MOD]
04/30/2025, 2:30 PMsuspend () -> A
I'm getting a TypeError: this.permutation0__1 is not a function
on JS. I seem to recall that function subclassing is not possible on JS? Is there an issue tracking this?
EDIT: Found it!OÄuzhan Soykan
04/30/2025, 3:16 PM2.2.0-Beta2
version bump, I am getting Identity-sensitive operation on an instance of value type 'Instant?' may cause unexpected behavior or errors.
warnings. And I have āAll warnings are errorsā configurations enabled, hence the build fails. How can I disable this specific warning? Iāve checked the blog post: https://kotlinlang.org/docs/whatsnew-eap.html but didnāt see specific option to disable those š¤suresh
04/30/2025, 7:12 PM2.2.0-Beta2
, compilation fails with the following erroranlex N
05/01/2025, 3:15 AMEugen Martynov
05/02/2025, 11:13 AMkevin.cianfarini
05/04/2025, 3:11 AM// An interface in code I define.
interface Thing { ... }
// A type from a third party library.
class SomeThirdPartyType
// An implementation of Thing based on the public API of SomeThirdPartyType that I own.
extension SomeThirdPartyType : Thing { ... }
A really naive implementation of this could generate some wrapper like SomeThirdPartyType$ThingImplWrapper
that, whenever an instance of SomeThirdPartyType
is referenced as a Thing, it is boxed by the generated wrapper.
Are there unsuspecting ways which something like this might actually be terrible?PHondogo
05/05/2025, 8:54 AMWaldemar Kornewald
05/05/2025, 2:17 PMDrew Hamilton
05/06/2025, 2:57 PMprocessAllDeclaredCallables
inside of generateFunctions
I get a recursive loop that ends in a StackOverflowError. Is it intended that I should opt-in to DirectDeclarationsAccess
in this case?Zac Sweers
05/06/2025, 5:05 PMJake Woods
05/08/2025, 10:55 PM@MyPlugin fun foo() {}
Is it possible to generate:
@MyPlugin fun foo() {
local fun callMyPlugin() {}
}
Youssef Shoaib [MOD]
05/09/2025, 2:42 PMClassGeneratorExtension
but for JS or Native? As in, I want to modify the final generated code.Alexander Ioffe
05/09/2025, 2:58 PM(x:Int) >= (x:Double)
it will insert a toDouble
making it (x:Int).toDouble() >= (x:Double)
. On the toDouble
IrCall instance, is there some way of knowing whether this is something that the user actually coded or if it was inserted by the compiler?Youssef Shoaib [MOD]
05/10/2025, 12:10 PMMarius Barbulescu
05/10/2025, 2:15 PMFirSessionFactoryHelper.INSTANCE.createSessionWithDependencies
when moving to Kotlin +2.1? The usage is in Openrewrite https://github.com/openrewrite/rewrite/blob/main/rewrite-kotlin/src/main/java/org/openrewrite/kotlin/KotlinParser.java#L475vladimirsitnikov
05/10/2025, 2:45 PMinline fun test(x: java.util.stream.Stream<out String>) {
x.map {
it.length
}
}