diff options
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) { |