diff options
| author | gingerBill <bill@gingerbill.org> | 2018-06-15 19:59:35 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-06-15 19:59:35 +0100 |
| commit | 5081ea1a0c2469ed77531a6a6718a9de86f1d140 (patch) | |
| tree | 1d66bd9a94fe6d97575dd7f4cb6d2d21e5871dac /src/types.cpp | |
| parent | e9e7ce2606ae18dd96fde356860fe613ff5c5430 (diff) | |
Fix type aliasing comparison; Fix gb_utf8_decode
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp index a28bbf608..a57058dbf 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1157,6 +1157,19 @@ bool is_type_comparable(Type *t) { return false; } +Type *strip_type_aliasing(Type *x) { + if (x == nullptr) { + return x; + } + if (x->kind == Type_Named) { + Entity *e = x->Named.type_name; + if (e != nullptr && e->kind == Entity_TypeName && e->TypeName.is_type_alias) { + return x->Named.base; + } + } + return x; +} + bool are_types_identical(Type *x, Type *y) { if (x == y) { return true; @@ -1167,6 +1180,9 @@ bool are_types_identical(Type *x, Type *y) { return false; } + x = strip_type_aliasing(x); + y = strip_type_aliasing(y); + switch (x->kind) { case Type_Generic: if (y->kind == Type_Generic) { |