utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
637 stars 46 forks source link

Entry gen incompatible with kotlin `1.5.0` #231

Closed chippmann closed 3 years ago

chippmann commented 3 years ago

The entry gen is incompatible with kotlin 1.5.0 The incompatibility of the entry gen with 1.5.0 comes down to one function call: getReferenceTargets(bindingContext). with some context:

// expression: KtDotQualifiedExpression <- is a function parameter and the following is in the function body:
val receiver = expression.receiverExpression
val receiverRef = receiver.getReferenceTargets(bindingContext).firstOrNull() //returned a list with a intance derived from `FunctionDescriptor` in kotlin 1.4.32, and returns an empty list in kotlin `1.5.0`

So it seems either the "knowledge" of the BindingContext or the behaviour of getReferenceTargets has changed between 1.4.32 and 1.5.0 . Other than that everything else seems to work. I opened an issue on youtrack (https://youtrack.jetbrains.com/issue/KT-46547) to ask if this behaviour change was intended or not. Because to me it seems getReferenceTargets is now useless. Looking at the source code of both BindingContext and getReferenceTargets it's not obvious to me what causes the issue.

As an alternative I already started to test if I can generate everything needed with KSP (https://github.com/google/ksp). Probably the rework of the entry gen has to be done now rather than later as i don't think the issue above can be fixed easily. Related to #225

piiertho commented 3 years ago

Solved with https://github.com/utopia-rise/godot-kotlin-jvm/pull/244