bugfix: polymorphing with multi-pointing
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 23 Mar 2023 16:06:36 +0000 (11:06 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 23 Mar 2023 16:06:36 +0000 (11:06 -0500)
compiler/src/polymorph.h
core/runtime/info/helper.onyx

index 78e443f4db16f33c88dd9d2898dd4d7a39e4720b..7abab457b14588f68d33a4bd639e5ffc43f402c8 100644 (file)
@@ -271,7 +271,7 @@ static PolySolveResult solve_poly_type(AstNode* target, AstType* type_expr, Type
 
         switch (elem.type_expr->kind) {
             case Ast_Kind_Pointer_Type: {
-                if (elem.actual->kind != Type_Kind_Pointer) break;
+                if (elem.actual->kind != Type_Kind_Pointer && elem.actual->kind != Type_Kind_MultiPointer) break;
 
                 bh_arr_push(elem_queue, ((PolySolveElem) {
                     .type_expr = ((AstPointerType *) elem.type_expr)->elem,
index e063f1a01b630686f56121e55c69fb45d2a3d4d7..ffa6c3fe140669485d2144a50379b7121f7e0381 100644 (file)
@@ -324,7 +324,7 @@ populate_struct_vtable :: (table: &$Table_Type, struct_type: type_expr, safe :=
         if struct_method == null do continue;
         if safe && struct_method.type != member.type do continue;
 
-        dest := cast(&()->void) (cast(&u8) table + member.offset);
+        dest := cast(&()->void) (cast([&] u8) table + member.offset);
         *dest = *cast(&()->void) struct_method.data;
     }
 }