Fix type aliasing comparison; Fix gb_utf8_decode

This commit is contained in:
gingerBill
2018-06-15 19:59:35 +01:00
parent e9e7ce2606
commit 5081ea1a0c
5 changed files with 28 additions and 14 deletions
+16
View File
@@ -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) {