bugfix with struct literals as struct member default values
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 20 Sep 2020 03:06:26 +0000 (22:06 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Sun, 20 Sep 2020 03:06:26 +0000 (22:06 -0500)
onyx
src/onyxsymres.c

diff --git a/onyx b/onyx
index 06eef3f0a9e66132fa468f7eb81cbd7aeb34fd99..416b2df40d2b511b0edd602000a36d5db96b7f7f 100755 (executable)
Binary files a/onyx and b/onyx differ
index 573470ddc8abcc4043f19f7b6a9fb5b829fb3c5f..1077fa2d66a396ae455c04d7a5e44a8559d873a1 100644 (file)
@@ -262,9 +262,9 @@ static void symres_unaryop(AstUnaryOp** unaryop) {
 
 static void symres_struct_literal(AstStructLiteral* sl) {
     if (sl->stnode != NULL) symres_expression(&sl->stnode);
-    if (sl->stnode == NULL || sl->stnode->kind == Ast_Kind_Error) return;
+    if (sl->stnode == NULL || sl->stnode->kind == Ast_Kind_Error || sl->stnode->kind == Ast_Kind_Symbol) return;
 
-    sl->type_node = (AstType *) sl->stnode;
+    sl->type_node = symres_type((AstType *) sl->stnode);
     sl->type = type_build_from_ast(semstate.allocator, sl->type_node);
 
     if (!type_is_structlike_strict(sl->type)) {