diff options
| author | gingerBill <bill@gingerbill.org> | 2017-11-18 20:56:53 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-11-18 20:56:53 +0000 |
| commit | 0c06a8d15426c6a67c76fa8afbe9d967c46b571b (patch) | |
| tree | 3b1d0166eb3e0a1f88d1669b7f094878a473e3fb /src | |
| parent | b0e3a4e27655cff42b3645ba4be2ad3a602997b9 (diff) | |
Fix issue #146 regarding polymorphic type parametersv0.7.0
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_expr.cpp | 4 | ||||
| -rw-r--r-- | src/types.cpp | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 707baaaf7..4c52ca400 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -767,7 +767,9 @@ bool is_polymorphic_type_assignable(Checker *c, Type *poly, Type *source, bool c if (check_type_specialization_to(c, poly, source, compound, modify_type)) { return true; } - if (compound) return are_types_identical(poly, source); + if (compound || !is_type_generic(poly)) { + return are_types_identical(poly, source); + } return check_is_assignable_to(c, &o, poly); } diff --git a/src/types.cpp b/src/types.cpp index 087f9208e..f5acd073b 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -836,6 +836,12 @@ Type *base_array_type(Type *t) { return t; } +bool is_type_generic(Type *t) { + t = base_type(t); + return t->kind == Type_Generic; +} + + Type *core_array_or_vector_type(Type *t) { for (;;) { Type *prev = t; |