Merge pull request #37440 from slavapestov/clean-up-generic-requirement-checking

Clean up duplicate logic for checking if generic requirements are satisfied
This commit is contained in:
Slava Pestov
2021-05-17 19:28:18 -04:00
committed by GitHub
41 changed files with 713 additions and 625 deletions

View File

@@ -25,6 +25,7 @@ class raw_ostream;
namespace swift {
class DeclContext;
class ModuleDecl;
class NominalTypeDecl;
class SubstitutionMap;
@@ -33,7 +34,7 @@ class SubstitutionMap;
bool areTypesEqual(Type type1, Type type2);
/// Determine whether the given type is suitable as a concurrent value type.
bool isSendableType(const DeclContext *dc, Type type);
bool isSendableType(ModuleDecl *module, Type type);
/// Describes the actor isolation of a given declaration, which determines
/// the actors with which it can interact.

View File

@@ -76,6 +76,21 @@ public:
ProtocolDecl *getProtocolDecl() const;
/// Determines if this substituted requirement is satisfied.
///
/// \param conditionalRequirements An out parameter initialized to an
/// array of requirements that the caller must check to ensure this
/// requirement is completely satisfied.
bool isSatisfied(ArrayRef<Requirement> &conditionalRequirements) const;
/// Determines if this substituted requirement can ever be satisfied,
/// possibly with additional substitutions.
///
/// For example, if 'T' is unconstrained, then a superclass requirement
/// 'T : C' can be satisfied; however, if 'T' already has an unrelated
/// superclass requirement, 'T : C' cannot be satisfied.
bool canBeSatisfied() const;
SWIFT_DEBUG_DUMP;
void dump(raw_ostream &out) const;
void print(raw_ostream &os, const PrintOptions &opts) const;