vbsteven
04/16/2023, 3:15 PMalloc
extension function. On some classes it manages to "find" and "import" the alloc extension fine, while on other classes it does not, and it generates something like Box(nativeHeap.kotlinx.cinterop.alloc<,,,>().ptr
.
Any idea what could be the reason for the member not being recognized in some classes but recognized in others? Any tips on debugging this?vbsteven
04/16/2023, 3:17 PMpublic fun allocateHeap(): Box =
Box(nativeHeap.kotlinx.cinterop.alloc<graphene_box_t>().ptr)
and when I manually fix the code to this while also in IntelliJ <Alt>Enter
on alloc to add the import, it works
public fun allocateHeap(): Box =
Box(nativeHeap.alloc<graphene_box_t>().ptr)
ephemient
04/16/2023, 3:25 PMYou just need to make sure the member can be imported without simple name collisions, otherwise importing will fail and the code generator output will not pass compilation.
vbsteven
04/16/2023, 3:25 PMalloc
function in the same companion object as the one I am generating my problematic function in.
So it looks like KP is not importing the extension member when it finds a similarly named member in the same Spec, am I doing something wrong by using MemberName
for extension functions?ephemient
04/16/2023, 3:26 PMalloc
require manual disambiguationvbsteven
04/16/2023, 3:28 PM