Skip to content

Commit 617d746

Browse files
authored
Merge pull request #12592 from DougGregor/gsb-flatten-same-type-constraints
2 parents 44cef72 + 642b458 commit 617d746

File tree

3 files changed

+218
-284
lines changed

3 files changed

+218
-284
lines changed

include/swift/AST/GenericSignatureBuilder.h

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,8 @@ class GenericSignatureBuilder {
120120
llvm::MapVector<ProtocolDecl *, std::vector<Constraint<ProtocolDecl *>>>
121121
conformsTo;
122122

123-
/// Same-type constraints between each potential archetype and any other
124-
/// archetype in its equivalence class.
125-
llvm::MapVector<PotentialArchetype *,
126-
std::vector<Constraint<PotentialArchetype *>>>
127-
sameTypeConstraints;
123+
/// Same-type constraints within this equivalence class.
124+
std::vector<Constraint<PotentialArchetype *>> sameTypeConstraints;
128125

129126
/// Concrete type to which this equivalence class is equal.
130127
///
@@ -218,8 +215,7 @@ class GenericSignatureBuilder {
218215
///
219216
/// \returns true if this same-type constraint merges two equivalence
220217
/// classes, and false otherwise.
221-
bool recordSameTypeConstraint(GenericSignatureBuilder &builder,
222-
PotentialArchetype *type1,
218+
bool recordSameTypeConstraint(PotentialArchetype *type1,
223219
PotentialArchetype *type2,
224220
const RequirementSource *source);
225221

@@ -1669,18 +1665,6 @@ class GenericSignatureBuilder::PotentialArchetype {
16691665
/// potential archetype computations.
16701666
PotentialArchetype *getArchetypeAnchor(GenericSignatureBuilder &builder);
16711667

1672-
/// Retrieve the same-type constraints.
1673-
ArrayRef<Constraint<PotentialArchetype *>> getSameTypeConstraints() const {
1674-
if (auto equivClass = getEquivalenceClassIfPresent()) {
1675-
auto known = equivClass->sameTypeConstraints.find(
1676-
const_cast<PotentialArchetype *>(this));
1677-
if (known == equivClass->sameTypeConstraints.end()) return { };
1678-
return known->second;
1679-
}
1680-
1681-
return { };
1682-
}
1683-
16841668
/// \brief Retrieve (or create) a nested type that is the current best
16851669
/// nested archetype anchor (locally) with the given name.
16861670
///

0 commit comments

Comments
 (0)