Skip to content

[NCGenerics] Serialization for noncopyable generic types. #70180

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 3 commits into from
Dec 13, 2023
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
17 changes: 11 additions & 6 deletions include/swift/AST/Requirement.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

#include "swift/AST/LayoutConstraint.h"
#include "swift/AST/RequirementKind.h"
#include "swift/AST/KnownProtocols.h"
#include "swift/AST/Type.h"
#include "swift/Basic/Debug.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/Support/ErrorHandling.h"

namespace swift {

enum class InvertibleProtocolKind : uint8_t;
class GenericContext;

/// Return type of Requirement::checkRequirement().
enum class CheckRequirementResult : uint8_t {
Expand Down Expand Up @@ -230,6 +230,7 @@ struct StructuralRequirement {
bool fromDefault = false;
};

/// An "anti-conformance" requirement `Subject: ~Protocol`.
struct InverseRequirement {
Type subject;
ProtocolDecl *protocol;
Expand All @@ -239,13 +240,17 @@ struct InverseRequirement {

InvertibleProtocolKind getKind() const;

static void enumerateDefaultedParams(TypeDecl *decl,
/// Adds the type parameters of this generic context to the result if
/// it has default requirements.
static void enumerateDefaultedParams(GenericContext *decl,
SmallVectorImpl<Type> &result);

static void expandDefault(Type gp,
SourceLoc loc,
SmallVectorImpl<StructuralRequirement> &result);
/// \returns the protocols that are required by default for the given type
/// parameter. These are not inverses themselves.
static InvertibleProtocolSet expandDefault(Type gp);

/// Appends additional requirements corresponding to defaults for the given
/// generic parameters.
static void expandDefaults(ASTContext &ctx,
ArrayRef<Type> gps,
SmallVectorImpl<StructuralRequirement> &result);
Expand Down
Loading