From: Brendan Hansen Date: Sat, 25 Sep 2021 17:24:47 +0000 (-0500) Subject: bug fixes with operator overloading with anonymous struct literals X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=625a7b302f13635d64edd1b3a4dc4086e5689888;p=onyx.git bug fixes with operator overloading with anonymous struct literals --- diff --git a/bin/onyx b/bin/onyx index 7325797c..6989ac39 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/examples/14_overloaded_procs.onyx b/examples/14_overloaded_procs.onyx index d7c6df1a..3abe4deb 100644 --- a/examples/14_overloaded_procs.onyx +++ b/examples/14_overloaded_procs.onyx @@ -51,9 +51,9 @@ main :: (args: [] cstr) { // a datatype you made, or a map with keys of a datatype you made, you need to provide an overload // to core.hash.to_u32 for your datatype. In this program, that definition is at the end of the file. person_set := set.make(Person); - person_set << Person.{ "Joe", 38 }; - person_set << Person.{ "Jane", 36 }; - person_set << Person.{ "Joe", 38 }; + person_set << .{ "Joe", 38 }; + person_set << .{ "Jane", 36 }; + person_set << .{ "Joe", 38 }; // "Joe" will only be printed once. for person: set.iterator(^person_set) { diff --git a/src/checker.c b/src/checker.c index b948d7fa..9d790122 100644 --- a/src/checker.c +++ b/src/checker.c @@ -917,8 +917,8 @@ CheckStatus check_binaryop(AstBinaryOp** pbinop) { } // NOTE: Try operator overloading before checking everything else. - if ((binop->left->type != NULL && binop->right->type != NULL) && - (binop->left->type->kind != Type_Kind_Basic || binop->right->type->kind != Type_Kind_Basic)) { + if ((binop->left->type != NULL && binop->left->type->kind != Type_Kind_Basic) + || (binop->right->type != NULL && binop->right->type->kind != Type_Kind_Basic)) { AstCall *implicit_call = binaryop_try_operator_overload(binop); if (implicit_call == (AstCall *) &node_that_signals_a_yield) diff --git a/src/utils.c b/src/utils.c index fe4722c6..4abd861a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -565,6 +565,8 @@ AstFunction* macro_resolve_header(AstMacro* macro, Arguments* args, OnyxToken* c default: assert(("Bad macro body type.", 0)); } + + return NULL; } b32 entity_bring_to_state(Entity* ent, EntityState state) {