Skip to content

Commit 4ae85ac

Browse files
committed
[GSB] Use Type instead of ProtocolDecl in a couple of diagnostics [NFC]
Not all redundant type constraints have an associated protocol decl, e.g 'T : Any'.
1 parent ef36f87 commit 4ae85ac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,11 +1913,11 @@ ERROR(requires_generic_param_same_type_does_not_conform,none,
19131913
ERROR(requires_same_concrete_type,none,
19141914
"generic signature requires types %0 and %1 to be the same", (Type, Type))
19151915
WARNING(redundant_conformance_constraint,none,
1916-
"redundant conformance constraint %0: %1", (Type, ProtocolDecl *))
1916+
"redundant conformance constraint %0: %1", (Type, Type))
19171917
NOTE(redundant_conformance_here,none,
19181918
"conformance constraint %1: %2 %select{written here|implied here|"
19191919
"inferred from type here}0",
1920-
(unsigned, Type, ProtocolDecl *))
1920+
(unsigned, Type, Type))
19211921

19221922
ERROR(unsupported_recursive_requirements, none,
19231923
"requirement involves recursion that is not currently supported", ())

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6292,7 +6292,7 @@ void GenericSignatureBuilder::checkConformanceConstraints(
62926292
// Remove any self-derived constraints.
62936293
removeSelfDerived(*this, entry.second, entry.first);
62946294

6295-
checkConstraintList<ProtocolDecl *, ProtocolDecl *>(
6295+
checkConstraintList<ProtocolDecl *, Type>(
62966296
genericParams, entry.second,
62976297
[](const Constraint<ProtocolDecl *> &constraint) {
62986298
return true;
@@ -6324,7 +6324,7 @@ void GenericSignatureBuilder::checkConformanceConstraints(
63246324
None,
63256325
diag::redundant_conformance_constraint,
63266326
diag::redundant_conformance_here,
6327-
[](ProtocolDecl *proto) { return proto; },
6327+
[](ProtocolDecl *proto) { return proto->getDeclaredType(); },
63286328
/*removeSelfDerived=*/false);
63296329
}
63306330
}

0 commit comments

Comments
 (0)