@@ -6852,28 +6852,6 @@ void GenericSignatureBuilder::processDelayedRequirements() {
6852
6852
} while (anySolved);
6853
6853
}
6854
6854
6855
- template <typename T>
6856
- Constraint<T> GenericSignatureBuilder::checkConstraintList (
6857
- TypeArrayView<GenericTypeParamType> genericParams,
6858
- std::vector<Constraint<T>> &constraints,
6859
- RequirementKind kind,
6860
- llvm::function_ref<bool (const Constraint<T> &)>
6861
- isSuitableRepresentative,
6862
- llvm::function_ref<
6863
- ConstraintRelation (const Constraint<T>&)>
6864
- checkConstraint,
6865
- Optional<Diag<unsigned , Type, T, T>>
6866
- conflictingDiag,
6867
- Diag<Type, T> redundancyDiag,
6868
- Diag<unsigned , Type, T> otherNoteDiag) {
6869
- return checkConstraintList<T, T>(genericParams, constraints, kind,
6870
- isSuitableRepresentative, checkConstraint,
6871
- conflictingDiag, redundancyDiag,
6872
- otherNoteDiag,
6873
- [](const T& value) { return value; },
6874
- /* removeSelfDerived=*/ true );
6875
- }
6876
-
6877
6855
namespace {
6878
6856
// / Remove self-derived sources from the given vector of constraints.
6879
6857
// /
@@ -6957,7 +6935,7 @@ namespace {
6957
6935
}
6958
6936
} // end anonymous namespace
6959
6937
6960
- template <typename T, typename DiagT >
6938
+ template <typename T>
6961
6939
Constraint<T> GenericSignatureBuilder::checkConstraintList (
6962
6940
TypeArrayView<GenericTypeParamType> genericParams,
6963
6941
std::vector<Constraint<T>> &constraints,
@@ -6967,16 +6945,11 @@ Constraint<T> GenericSignatureBuilder::checkConstraintList(
6967
6945
llvm::function_ref<
6968
6946
ConstraintRelation (const Constraint<T>&)>
6969
6947
checkConstraint,
6970
- Optional<Diag<unsigned , Type, DiagT, DiagT >>
6948
+ Optional<Diag<unsigned , Type, T, T >>
6971
6949
conflictingDiag,
6972
- Diag<Type, DiagT> redundancyDiag,
6973
- Diag<unsigned , Type, DiagT> otherNoteDiag,
6974
- llvm::function_ref<DiagT (const T&)> diagValue,
6975
- bool removeSelfDerived) {
6950
+ Diag<Type, T> redundancyDiag,
6951
+ Diag<unsigned , Type, T> otherNoteDiag) {
6976
6952
assert (!constraints.empty () && " No constraints?" );
6977
- if (removeSelfDerived) {
6978
- ::removeSelfDerived (*this , constraints, /* proto=*/ nullptr );
6979
- }
6980
6953
6981
6954
// Sort the constraints, so we get a deterministic ordering of diagnostics.
6982
6955
std::sort (constraints.begin (), constraints.end ());
@@ -6995,7 +6968,7 @@ Constraint<T> GenericSignatureBuilder::checkConstraintList(
6995
6968
representativeConstraint->source ->classifyDiagKind (),
6996
6969
representativeConstraint->getSubjectDependentType (
6997
6970
genericParams),
6998
- diagValue ( representativeConstraint->value ) );
6971
+ representativeConstraint->value );
6999
6972
};
7000
6973
7001
6974
// Go through the concrete constraints looking for redundancies.
@@ -7041,8 +7014,8 @@ Constraint<T> GenericSignatureBuilder::checkConstraintList(
7041
7014
getSubjectType (constraint.getSubjectDependentType (genericParams));
7042
7015
Diags.diagnose (constraint.source ->getLoc (), *conflictingDiag,
7043
7016
subject.first , subject.second ,
7044
- diagValue ( constraint.value ) ,
7045
- diagValue ( representativeConstraint->value ) );
7017
+ constraint.value ,
7018
+ representativeConstraint->value );
7046
7019
7047
7020
noteRepresentativeConstraint ();
7048
7021
break ;
@@ -7060,8 +7033,8 @@ Constraint<T> GenericSignatureBuilder::checkConstraintList(
7060
7033
Diags.diagnose (representativeConstraint->source ->getLoc (),
7061
7034
*conflictingDiag,
7062
7035
subject.first , subject.second ,
7063
- diagValue ( representativeConstraint->value ) ,
7064
- diagValue ( constraint.value ) );
7036
+ representativeConstraint->value ,
7037
+ constraint.value );
7065
7038
7066
7039
diagnosedConflictingRepresentative = true ;
7067
7040
break ;
@@ -7078,7 +7051,7 @@ Constraint<T> GenericSignatureBuilder::checkConstraintList(
7078
7051
Diags.diagnose (constraint.source ->getLoc (),
7079
7052
redundancyDiag,
7080
7053
constraint.getSubjectDependentType (genericParams),
7081
- diagValue ( constraint.value ) );
7054
+ constraint.value );
7082
7055
7083
7056
noteRepresentativeConstraint ();
7084
7057
}
@@ -7935,7 +7908,7 @@ void GenericSignatureBuilder::checkSameTypeConstraints(
7935
7908
for (auto &constraints : intracomponentEdges) {
7936
7909
if (constraints.empty ()) continue ;
7937
7910
7938
- checkConstraintList<Type, Type >(
7911
+ checkConstraintList<Type>(
7939
7912
genericParams, constraints, RequirementKind::SameType,
7940
7913
[](const Constraint<Type> &) { return true ; },
7941
7914
[](const Constraint<Type> &constraint) {
@@ -7948,11 +7921,7 @@ void GenericSignatureBuilder::checkSameTypeConstraints(
7948
7921
},
7949
7922
None,
7950
7923
diag::redundant_same_type_constraint,
7951
- diag::previous_same_type_constraint,
7952
- [&](Type type) {
7953
- return type;
7954
- },
7955
- /* removeSelfDerived=*/ false );
7924
+ diag::previous_same_type_constraint);
7956
7925
}
7957
7926
7958
7927
// Diagnose redundant same-type constraints across components. First,
@@ -8128,6 +8097,11 @@ void GenericSignatureBuilder::checkConcreteTypeConstraints(
8128
8097
Type resolvedConcreteType =
8129
8098
getCanonicalTypeInContext (equivClass->concreteType , genericParams);
8130
8099
8100
+ removeSelfDerived (*this , equivClass->concreteTypeConstraints ,
8101
+ /* proto=*/ nullptr ,
8102
+ /* dropDerivedViaConcrete=*/ true ,
8103
+ /* allCanBeSelfDerived=*/ true );
8104
+
8131
8105
checkConstraintList<Type>(
8132
8106
genericParams, equivClass->concreteTypeConstraints , RequirementKind::SameType,
8133
8107
[&](const ConcreteConstraint &constraint) {
0 commit comments