Skip to content

rock generates invalid C code when trying to access an interface's generic type #996

@alexnask

Description

@alexnask
CraaazyInterface: interface <T> {
    gimme: func -> T

    doCraaazyThings: func {
        T name println()
    }
}

Generated code:

void test__CraaazyInterface_doCraaazyThings_impl(CraaazyInterface__reference this) {
    #line 5 "C:\\dev\\test.ooc"
    lang_String__String_println(this->T->name);
}

// Somewhere in a header file
struct _CraaazyInterface__reference {
    test__CraaazyInterfaceClass* impl;
    lang_types__Object* obj;
};

struct _test__CraaazyInterfaceClass {
    struct _lang_types__ClassClass __super__;
    void (*gimme)(void*, uint8_t*);
    void (*doCraaazyThings)(void*);
};

Basically, there is no way to get to T from an interface reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions