Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bendmorris opened this issue Jun 24, 2019 · 0 comments
Open

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

bendmorris opened this issue Jun 24, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@bendmorris
Copy link
Member

bendmorris commented Jun 24, 2019

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’
@bendmorris bendmorris added the bug Something isn't working label Jun 24, 2019
bendmorris added a commit to bendmorris/kit that referenced this issue Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant