Fix nil comparisons for soa slices and dynamic arrays

This commit is contained in:
gingerBill
2019-12-01 11:56:08 +00:00
parent 3fd5c3cd85
commit 7fbe0a6f23
4 changed files with 49 additions and 6 deletions

View File

@@ -1585,6 +1585,13 @@ bool type_has_nil(Type *t) {
case Type_Union:
return !t->Union.no_nil;
case Type_Struct:
if (is_type_soa_struct(t)) {
switch (t->Struct.soa_kind) {
case StructSoa_Fixed: return false;
case StructSoa_Slice: return true;
case StructSoa_Dynamic: return true;
}
}
return false;
case Type_Opaque:
return true;