throw type checker error when scalar cast to non-square matrix

This commit is contained in:
Jasper Geer
2022-10-21 15:41:58 -04:00
parent fd8956b8f4
commit 989107094c
+2 -1
View File
@@ -821,13 +821,14 @@ i64 check_distance_between_types(CheckerContext *c, Operand *operand, Type *type
if (are_types_identical(src, dst)) { if (are_types_identical(src, dst)) {
return 5; return 5;
} }
if (dst->Matrix.row_count == dst->Matrix.column_count) {
Type *dst_elem = base_array_type(dst); Type *dst_elem = base_array_type(dst);
i64 distance = check_distance_between_types(c, operand, dst_elem); i64 distance = check_distance_between_types(c, operand, dst_elem);
if (distance >= 0) { if (distance >= 0) {
return distance + 7; return distance + 7;
} }
} }
}
if (is_type_any(dst)) { if (is_type_any(dst)) {