mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[AST] NFC: Fold PackConformance::isInvalid into ProtocolConformanceRef::isInvalid
Instead of making callers responsible for that (like in other cases), let's fold the code check `isInvalid` to make mistakes less likely.
This commit is contained in:
committed by
Pavel Yaskevich
parent
658f0ea3c8
commit
fe8fd91307
@@ -42,6 +42,16 @@ ProtocolConformanceRef::ProtocolConformanceRef(ProtocolDecl *protocol,
|
||||
}
|
||||
}
|
||||
|
||||
bool ProtocolConformanceRef::isInvalid() const {
|
||||
if (!Union)
|
||||
return true;
|
||||
|
||||
if (auto pack = Union.dyn_cast<PackConformance *>())
|
||||
return pack->isInvalid();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ProtocolDecl *ProtocolConformanceRef::getRequirement() const {
|
||||
assert(!isInvalid());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user