mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user