diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-08-31 18:29:51 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-08-31 18:29:51 +0100 |
| commit | ff6e21cb879397982cddf3cf5f47bba681271a2c (patch) | |
| tree | 2efa735b9ae420868013da55f38e3c20338cf4a3 /src/checker/expr.cpp | |
| parent | 5399463d9d9f94a20fb6b80814318e2b154b199a (diff) | |
Fix subtype polymorphism
Diffstat (limited to 'src/checker/expr.cpp')
| -rw-r--r-- | src/checker/expr.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/checker/expr.cpp b/src/checker/expr.cpp index 0b9c056ef..81a8a3d10 100644 --- a/src/checker/expr.cpp +++ b/src/checker/expr.cpp @@ -15,7 +15,7 @@ void update_expr_type (Checker *c, AstNode *e, Type *type, b32 fina -b32 check_is_assignable_to_using_subtype(Checker *c, Type *dst, Type *src) { +b32 check_is_assignable_to_using_subtype(Type *dst, Type *src) { Type *prev_src = src; // Type *prev_dst = dst; src = get_base_type(type_deref(src)); @@ -35,6 +35,10 @@ b32 check_is_assignable_to_using_subtype(Checker *c, Type *dst, Type *src) { return true; } } + b32 ok = check_is_assignable_to_using_subtype(dst, f->type); + if (ok) { + return true; + } } } } @@ -91,7 +95,7 @@ b32 check_is_assignable_to(Checker *c, Operand *operand, Type *type, b32 is_argu if (is_argument) { // NOTE(bill): Polymorphism for subtyping - if (check_is_assignable_to_using_subtype(c, type, src)) { + if (check_is_assignable_to_using_subtype(type, src)) { return true; } } |