diff options
| author | gingerBill <bill@gingerbill.org> | 2022-09-05 16:35:56 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-09-05 16:35:56 +0100 |
| commit | 4998cf80c15555849d1ad119be3b2d4ff5cd6e1f (patch) | |
| tree | c1af60886348b52e7742504dcf0cc4e06c1db3f8 /src/check_expr.cpp | |
| parent | 37e23133e9877c6d30604be8d586363b3cf412ed (diff) | |
Fix #2017 mismatched types in binary matrix expression for `flt * (mat * vec)`
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 959bbb078..f115dd6b2 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -3039,8 +3039,8 @@ void check_binary_matrix(CheckerContext *c, Token const &op, Operand *x, Operand x->type = xt; goto matrix_success; } else { - GB_ASSERT(is_type_matrix(yt)); GB_ASSERT(!is_type_matrix(xt)); + GB_ASSERT(is_type_matrix(yt)); if (op.kind == Token_Mul) { // NOTE(bill): no need to handle the matrix case here since it should be handled above @@ -3061,6 +3061,9 @@ void check_binary_matrix(CheckerContext *c, Token const &op, Operand *x, Operand x->type = alloc_type_matrix(yt->Matrix.elem, 1, yt->Matrix.column_count); } goto matrix_success; + } else if (are_types_identical(yt->Matrix.elem, xt)) { + x->type = check_matrix_type_hint(y->type, type_hint); + return; } } if (!are_types_identical(xt, yt)) { |