Skip to content

[GSB] Term rewriting for same-type constraints #14454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions include/swift/AST/GenericSignatureBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,13 @@ class GenericSignatureBuilder {
Type getTypeInContext(GenericSignatureBuilder &builder,
GenericEnvironment *genericEnv);

/// Dump a debugging representation of this equivalence class.
void dump(llvm::raw_ostream &out) const;
/// Dump a debugging representation of this equivalence class,
void dump(llvm::raw_ostream &out,
GenericSignatureBuilder *builder = nullptr) const;

LLVM_ATTRIBUTE_DEPRECATED(void dump() const,
"only for use in the debugger");
LLVM_ATTRIBUTE_DEPRECATED(
void dump(GenericSignatureBuilder *builder = nullptr) const,
"only for use in the debugger");

/// Caches.

Expand All @@ -271,9 +273,8 @@ class GenericSignatureBuilder {
/// The cached anchor itself.
Type anchor;

/// The number of members of the equivalence class when the archetype
/// anchor was cached.
unsigned numMembers;
/// The generation at which the anchor was last computed.
unsigned lastGeneration;
} archetypeAnchorCache;

/// Describes a cached nested type.
Expand Down Expand Up @@ -444,6 +445,11 @@ class GenericSignatureBuilder {
/// Note that we have added the nested type nestedPA
void addedNestedType(PotentialArchetype *nestedPA);

/// Add a rewrite rule for a same-type constraint between the given
/// types.
void addSameTypeRewriteRule(PotentialArchetype *type1,
PotentialArchetype *type2);

/// \brief Add a new conformance requirement specifying that the given
/// potential archetypes are equivalent.
ConstraintResult addSameTypeRequirementBetweenArchetypes(
Expand Down Expand Up @@ -802,6 +808,12 @@ class GenericSignatureBuilder {
/// Determine whether the two given types are in the same equivalence class.
bool areInSameEquivalenceClass(Type type1, Type type2);

/// Simplify the given dependent type down to its canonical representation.
///
/// \returns null if the type involved dependent member types that
/// don't have associated types.
Type getCanonicalTypeParameter(Type type);

/// Verify the correctness of the given generic signature.
///
/// This routine will test that the given generic signature is both minimal
Expand Down
Loading