I have ir ```FILE: LibC.kt public final typeal...
# compiler
s
I have ir
Copy code
FILE: LibC.kt
    public final typealias pid_t = R|kotlin/Long|
    public abstract interface LibC : R|kotlin/Any| {
        public abstract fun getpid(): R|{pid_t=} kotlin/Long|

        public final companion object Companion : R|kotlin/Any| {
            public final fun create(): R|kotlin/Unit|

            private constructor(): R|LibC.Companion| {
                super<R|kotlin/Any|>()
            }

        }

       public final companion object Companion : R|kotlin/Any| {
            public final val getpid: R|java/lang/foreign/MemorySegment|
                public get(): R|java/lang/foreign/MemorySegment|

            public final class Companion : R|kotlin/Any| {
                public final val getpid: R|java/lang/foreign/FunctionDescriptor|
                    public get(): R|java/lang/foreign/FunctionDescriptor|

            }

        }
    }
But when I tried to use statement
LibC.Proc.getpid
it errors
NO_COMPANION_OBJECT
what caused this error? (Proc is generated) It seems like
FirStandaloneQualifierChecker
runs before nested
FirDeclarationGenerationExtension
, how could I fix it?
d
> I have ir It's not an IR (backend IR), but FIR (frontend IR). > But when I tried to use statement LibC.Proc.getpid According to the dump, you've generated something like this
Copy code
interface LibC {
    companion object {
        fun create() {}
    }
    
    companion object {
        val getpid: MemorySegment
        
        class Companion {
            val getpid: FunctionDescriptor
        }
    }
}
I see there several problems: 1. there are duplicated companions 2. there is no
LibC.Proc
, so
LibC.Proc.getpid
is unresolved as expected 3. nested class
Companion
inside the second companion objects looks very suspicious So the problem most likely in your implementation of
FirDeclarationGenerationExtension
.
Also please use threads instead of writing everything directly in the channel