Skip to content
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
4 changes: 2 additions & 2 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -1563,8 +1563,8 @@ ERROR(requires_generic_param_made_equal_to_concrete,none,
"same-type requirement makes generic parameter %0 non-generic",
(Type))
ERROR(requires_superclass_conflict,none,
"generic parameter %0 cannot be a subclass of both %1 and %2",
(Type, Type, Type))
"%select{generic parameter |protocol |}0%1 cannot be a subclass of both "
"%2 and %3", (unsigned, Type, Type, Type))
ERROR(recursive_type_reference,none,
"%0 %1 references itself", (DescriptiveDeclKind, Identifier))
ERROR(recursive_requirement_reference,none,
Expand Down
27 changes: 9 additions & 18 deletions include/swift/AST/GenericSignatureBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class RequirementSource : public llvm::FoldingSetNode {
/// The actual storage, described by \c storageKind.
union {
/// The type representation descibing where the requirement came from.
TypeRepr *typeRepr;
const TypeRepr *typeRepr;

/// Where a requirement came from.
const RequirementRepr *requirementRepr;
Expand Down Expand Up @@ -194,7 +194,7 @@ class RequirementSource : public llvm::FoldingSetNode {
}

RequirementSource(Kind kind, const RequirementSource *parent,
TypeRepr *typeRepr)
const TypeRepr *typeRepr)
: kind(kind), storageKind(StorageKind::TypeRepr), parent(parent) {
assert((static_cast<bool>(parent) != isRootKind(kind)) &&
"Root RequirementSource should not have parent (or vice versa)");
Expand Down Expand Up @@ -245,7 +245,7 @@ class RequirementSource : public llvm::FoldingSetNode {
/// Retrieve a requirement source representing an explicit requirement
/// stated in an 'inheritance' clause.
static const RequirementSource *forExplicit(GenericSignatureBuilder &builder,
TypeRepr *typeRepr);
const TypeRepr *typeRepr);

/// Retrieve a requirement source representing an explicit requirement
/// stated in an 'where' clause.
Expand All @@ -256,7 +256,7 @@ class RequirementSource : public llvm::FoldingSetNode {
/// inferred from some part of a generic declaration's signature, e.g., the
/// parameter or result type of a generic function.
static const RequirementSource *forInferred(GenericSignatureBuilder &builder,
TypeRepr *typeRepr);
const TypeRepr *typeRepr);

/// Retrieve a requirement source representing the requirement signature
/// computation for a protocol.
Expand Down Expand Up @@ -307,7 +307,7 @@ class RequirementSource : public llvm::FoldingSetNode {
int compare(const RequirementSource *other) const;

/// Retrieve the type representation for this requirement, if there is one.
TypeRepr *getTypeRepr() const {
const TypeRepr *getTypeRepr() const {
if (storageKind != StorageKind::TypeRepr) return nullptr;
return storage.typeRepr;
}
Expand Down Expand Up @@ -447,20 +447,11 @@ class GenericSignatureBuilder {
Type T1, Type T2, const RequirementSource *Source,
llvm::function_ref<void(Type, Type)> diagnoseMismatch);

/// Add the requirements placed on the given abstract type parameter
/// Add the requirements placed on the given type parameter
/// to the given potential archetype.
bool addAbstractTypeParamRequirements(
AbstractTypeParamDecl *decl,
PotentialArchetype *pa,
const RequirementSource *source,
llvm::SmallPtrSetImpl<ProtocolDecl *> &visited);

/// Visit all of the types that show up in the list of inherited
/// types.
///
/// \returns true if any of the invocations of \c visitor returned true.
bool visitInherited(ArrayRef<TypeLoc> inheritedTypes,
llvm::function_ref<bool(Type, SourceLoc)> visitor);
bool addInheritedRequirements(TypeDecl *decl, PotentialArchetype *pa,
const RequirementSource *parentSource,
llvm::SmallPtrSetImpl<ProtocolDecl *> &visited);

/// Visit all of the potential archetypes.
template<typename F>
Expand Down
Loading