mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #83953 from Azoy/62-extended-existentials
[6.2] [AST & Runtime] Correctly mangle extended existentials with inverse requirements
This commit is contained in:
@@ -2352,12 +2352,7 @@ public:
|
||||
}
|
||||
|
||||
bool isCopyable() const {
|
||||
if (!hasGeneralizationSignature()) {
|
||||
return true;
|
||||
}
|
||||
auto *reqts = getGenSigRequirements();
|
||||
for (unsigned i = 0, e = getNumGenSigRequirements(); i < e; ++i) {
|
||||
auto &reqt = reqts[i];
|
||||
for (auto &reqt : getRequirementSignature().getRequirements()) {
|
||||
if (reqt.getKind() != GenericRequirementKind::InvertedProtocols) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -117,9 +117,24 @@ struct ExistentialLayout {
|
||||
|
||||
LayoutConstraint getLayoutConstraint() const;
|
||||
|
||||
/// Whether this layout has any inverses within its signature.
|
||||
bool hasInverses() const {
|
||||
return !inverses.empty();
|
||||
}
|
||||
|
||||
/// Whether this existential needs to have an extended existential shape. This
|
||||
/// is relevant for the mangler to mangle as a symbolic link where possible
|
||||
/// and for IRGen directly emitting some existentials.
|
||||
///
|
||||
/// If 'allowInverses' is false, then regardless of if this existential layout
|
||||
/// has inverse requirements those will not influence the need for having a
|
||||
/// shape.
|
||||
bool needsExtendedShape(bool allowInverses = true) const;
|
||||
|
||||
private:
|
||||
SmallVector<ProtocolDecl *, 4> protocols;
|
||||
SmallVector<ParameterizedProtocolType *, 4> parameterized;
|
||||
InvertibleProtocolSet inverses;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user