SwiftCompilerSources: better APIs for handling resilient nominal types

* add `NominalTypeDecl.isResilient`

* make the return type of `Type.getNominalFields` optional and return nil in case the nominal type is resilient.
This forces users of this API to think about what to do in case the nominal type is resilient.
This commit is contained in:
Erik Eckstein
2023-11-17 11:24:22 +01:00
parent 186f1b39e4
commit fc534e1c28
10 changed files with 45 additions and 12 deletions

View File

@@ -543,7 +543,9 @@ extension StringParser {
if !ty.isClass && !ty.isStruct {
try throwError("unknown kind of nominal type")
}
let nominalFields = ty.getNominalFields(in: function)
guard let nominalFields = ty.getNominalFields(in: function) else {
try throwError("resilient types are not supported")
}
guard let fieldIdx = nominalFields.getIndexOfField(withName: name) else {
try throwError("field not found")
}