From f053a4035992f9c9579c9bdf454e0061b43ef820 Mon Sep 17 00:00:00 2001 From: kalsprite Date: Tue, 11 Aug 2026 23:07:07 -0700 Subject: [PATCH] check_matrix_type_hint: require the element type and layout to match --- src/check_expr.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 2ca6e6df4..78c1c1144 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4215,8 +4215,9 @@ gb_internal Type *check_matrix_type_hint(Type *matrix, Type *type_hint) { } else if (xt->kind == Type_Matrix && th->kind == Type_Matrix) { if (!are_types_identical(xt->Matrix.elem, th->Matrix.elem)) { // ignore - } if (xt->Matrix.row_count == th->Matrix.row_count && - xt->Matrix.column_count == th->Matrix.column_count) { + } else if (xt->Matrix.row_count == th->Matrix.row_count && + xt->Matrix.column_count == th->Matrix.column_count && + xt->Matrix.is_row_major == th->Matrix.is_row_major) { return type_hint; } } else if (xt->kind == Type_Matrix && th->kind == Type_Array) {