mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Improve error message for matrices with no rows or columns
This commit is contained in:
+14
-6
@@ -2859,15 +2859,23 @@ gb_internal void check_matrix_type(CheckerContext *ctx, Type **type, Ast *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (generic_row == nullptr && row_count < MATRIX_ELEMENT_COUNT_MIN) {
|
if (generic_row == nullptr && row_count < MATRIX_ELEMENT_COUNT_MIN) {
|
||||||
gbString s = expr_to_string(row.expr);
|
if (row.expr == nullptr) {
|
||||||
error(row.expr, "Invalid matrix row count, expected %d+ rows, got %s", MATRIX_ELEMENT_COUNT_MIN, s);
|
error(node, "Invalid matrix row count, got nothing");
|
||||||
gb_string_free(s);
|
} else {
|
||||||
|
gbString s = expr_to_string(row.expr);
|
||||||
|
error(row.expr, "Invalid matrix row count, expected %d+ rows, got %s", MATRIX_ELEMENT_COUNT_MIN, s);
|
||||||
|
gb_string_free(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generic_column == nullptr && column_count < MATRIX_ELEMENT_COUNT_MIN) {
|
if (generic_column == nullptr && column_count < MATRIX_ELEMENT_COUNT_MIN) {
|
||||||
gbString s = expr_to_string(column.expr);
|
if (column.expr == nullptr) {
|
||||||
error(column.expr, "Invalid matrix column count, expected %d+ rows, got %s", MATRIX_ELEMENT_COUNT_MIN, s);
|
error(node, "Invalid matrix column count, got nothing");
|
||||||
gb_string_free(s);
|
} else {
|
||||||
|
gbString s = expr_to_string(column.expr);
|
||||||
|
error(column.expr, "Invalid matrix column count, expected %d+ rows, got %s", MATRIX_ELEMENT_COUNT_MIN, s);
|
||||||
|
gb_string_free(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((generic_row == nullptr && generic_column == nullptr) && row_count*column_count > MATRIX_ELEMENT_COUNT_MAX) {
|
if ((generic_row == nullptr && generic_column == nullptr) && row_count*column_count > MATRIX_ELEMENT_COUNT_MAX) {
|
||||||
|
|||||||
Reference in New Issue
Block a user