From: Brendan Hansen Date: Mon, 18 Dec 2023 20:38:49 +0000 (-0600) Subject: fixed: broken test case and duplicate export nanes X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=461ec6e0a6a05451657b2197040373e7691c06e8;p=onyx.git fixed: broken test case and duplicate export nanes --- diff --git a/compiler/src/wasm_emit.c b/compiler/src/wasm_emit.c index e092579c..51f58831 100644 --- a/compiler/src/wasm_emit.c +++ b/compiler/src/wasm_emit.c @@ -4611,6 +4611,13 @@ static void emit_export_directive(OnyxWasmModule* mod, AstDirectiveExport* expor token_toggle_end(export->export_name); + if (shgeti(mod->exports, export->export_name->text) != -1) { + onyx_errors_print(export->token->pos, Error_Critical, "Duplicate export name, '%s'.", export->export_name->text); + token_toggle_end(export->export_name); + return; + } + + AstTyped *the_export = (AstTyped *) strip_aliases((AstNode *) export->export); assert(the_export); diff --git a/tests/map_enum_key b/tests/map_enum_key index 01f6893a..baafc462 100644 --- a/tests/map_enum_key +++ b/tests/map_enum_key @@ -1,9 +1,2 @@ -(/Users/brendan/.onyx/core/hash/hash.onyx:46,41) Failed to satisfy constraint where t is of type 'Fruit'. - 46 | macro (key: $T/type_is_enum) -> u32 { - ^ -(/Users/brendan/.onyx/core/container/map.onyx:19,66) Here is where the interface was used. - 19 | Map :: struct (Key_Type: type_expr, Value_Type: type_expr) where ValidKey(Key_Type) { - ^~~~~~~~ -(/Users/brendan/dev/onyx/tests/map_enum_key.onyx:18,18) Here is the code that caused this constraint to be checked. - 18 | m := make(Map(Fruit, str)); - ^ +{ Apple => "This is apple.", Banana => "This is banana.", Orange => "This is orange." } +{ Apple => "This is apple 64.", Banana => "This is banana 64.", Orange => "This is orange 64." }