diff options
| author | gingerBill <bill@gingerbill.org> | 2022-01-10 12:19:49 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-01-10 12:19:49 +0000 |
| commit | 80bd1eb615ba83727a57173a391ae2bb710f6533 (patch) | |
| tree | e266279a36b4dd175caae5f9c011f0948713b369 /src | |
| parent | fb53402914f0424cabbefde97c2be0536f28c94a (diff) | |
Fix polymorphic matrix element with a minor hack
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_type.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 282da4d0a..5389252b3 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2284,10 +2284,21 @@ void check_matrix_type(CheckerContext *ctx, Type **type, Ast *node) { } if (!is_type_valid_for_matrix_elems(elem)) { + if (elem == t_typeid) { + Entity *e = entity_of_node(mt->elem); + if (e && e->kind == Entity_TypeName && e->TypeName.is_type_alias) { + // HACK TODO(bill): This is to allow polymorphic parameters for matrix elements + // proc($T: typeid) -> matrix[2, 2]T + // + // THIS IS NEEDS TO BE FIXED AND NOT USE THIS HACK + goto type_assign; + } + } gbString s = type_to_string(elem); error(column.expr, "Matrix elements types are limited to integers, floats, and complex, got %s", s); gb_string_free(s); } +type_assign:; *type = alloc_type_matrix(elem, row_count, column_count, generic_row, generic_column); |