Introduce isDecl and getDeclType

fix enum logic issue

fix tests

guard against null types
This commit is contained in:
Azoy
2021-04-18 01:27:46 -04:00
parent f75f5fe78d
commit 9ed732f0ab
62 changed files with 391 additions and 569 deletions

View File

@@ -294,11 +294,8 @@ bool ArrayAllocation::replaceAppendContentOf() {
ArraySemanticsCall AppendContentsOf(AppendContentOfCall);
assert(AppendContentsOf && "Must be AppendContentsOf call");
NominalTypeDecl *AppendSelfArray = AppendContentsOf.getSelf()->getType().
getASTType()->getAnyNominal();
// In case if it's not an Array, but e.g. an ContiguousArray
if (AppendSelfArray != Ctx.getArrayDecl())
if (!AppendContentsOf.getSelf()->getType().getASTType()->isArray())
continue;
SILType ArrayType = ArrayValue->getType();