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

@@ -292,8 +292,7 @@ deriveBodyRawRepresentable_init(AbstractFunctionDecl *initDecl, void *) {
assert(rawTy);
rawTy = initDecl->mapTypeIntoContext(rawTy);
bool isStringEnum =
(rawTy->getNominalOrBoundGenericNominal() == C.getStringDecl());
bool isStringEnum = rawTy->isString();
llvm::SmallVector<Expr *, 16> stringExprs;
Type enumType = parentDC->getDeclaredTypeInContext();