Skip to content

"Incomplete type" when generic enum instantiates generic struct #134

Open
@bendmorris

Description

@bendmorris

Describe the problem. What did you see? What did you expect to see?

A generic enum whose variants include generic structs with the same parameter triggers a ton of "incomplete type" errors during C compilation, as either they don't point to the right struct monomorphs or the struct monomorphs were never created.

If this is a code issue, provide a minimal code example:

struct Struct[A] {
    var value: A;
}

enum Enum[A] {
    Variant(a: Struct[A]);
}

function main() {
    var e: Enum[Int];
    puts("hi");
}
Error: In file included from build/lib/kit_main.c:1:0:
build/include/main.h:151:50: error: field ‘a’ has incomplete type
     struct test_Struct__2a867e0193ff634180614473 a;
                                                  ^
cc1: warning: unrecognized command line option ‘-Wno-shift-op-parentheses’

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions