Skip to content

Commit 3414d6b

Browse files
committed
Sema: Remove GenericRequirementsCheckListener
1 parent 498ef31 commit 3414d6b

File tree

4 files changed

+2
-83
lines changed

4 files changed

+2
-83
lines changed

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,24 +1981,6 @@ void ParentConditionalConformance::diagnoseConformanceStack(
19811981
}
19821982
}
19831983

1984-
GenericRequirementsCheckListener::~GenericRequirementsCheckListener() {}
1985-
1986-
bool GenericRequirementsCheckListener::shouldCheck(RequirementKind kind,
1987-
Type first, Type second) {
1988-
return true;
1989-
}
1990-
1991-
void GenericRequirementsCheckListener::satisfiedConformance(
1992-
Type depTy, Type replacementTy,
1993-
ProtocolConformanceRef conformance) {
1994-
}
1995-
1996-
bool GenericRequirementsCheckListener::diagnoseUnsatisfiedRequirement(
1997-
const Requirement &req, Type first, Type second,
1998-
ArrayRef<ParentConditionalConformance> parents) {
1999-
return false;
2000-
}
2001-
20021984
namespace {
20031985
/// Produce any additional syntactic diagnostics for the body of a function
20041986
/// that had a function builder applied.

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,6 @@ RequirementCheckResult TypeChecker::checkGenericArguments(
750750
TypeArrayView<GenericTypeParamType> genericParams,
751751
ArrayRef<Requirement> requirements,
752752
TypeSubstitutionFn substitutions,
753-
GenericRequirementsCheckListener *listener,
754753
SubstOptions options) {
755754
bool valid = true;
756755

@@ -805,8 +804,6 @@ RequirementCheckResult TypeChecker::checkGenericArguments(
805804
}
806805

807806
bool requirementFailure = false;
808-
if (listener && !listener->shouldCheck(kind, firstType, secondType))
809-
continue;
810807

811808
Diag<Type, Type, Type> diagnostic;
812809
Diag<Type, Type, StringRef> diagnosticNote;
@@ -818,12 +815,6 @@ RequirementCheckResult TypeChecker::checkGenericArguments(
818815
auto conformance = module->lookupConformance(firstType, proto->getDecl());
819816

820817
if (conformance) {
821-
// Report the conformance.
822-
if (listener && valid && current.Parents.empty()) {
823-
listener->satisfiedConformance(rawFirstType, firstType,
824-
conformance);
825-
}
826-
827818
auto conditionalReqs = conformance.getConditionalRequirements();
828819
if (!conditionalReqs.empty()) {
829820
auto history = current.Parents;
@@ -879,11 +870,6 @@ RequirementCheckResult TypeChecker::checkGenericArguments(
879870
if (!requirementFailure)
880871
continue;
881872

882-
if (listener &&
883-
listener->diagnoseUnsatisfiedRequirement(rawReq, firstType,
884-
secondType, current.Parents))
885-
return RequirementCheckResult::Failure;
886-
887873
if (loc.isValid()) {
888874
// FIXME: Poor source-location information.
889875
ctx.Diags.diagnose(loc, diagnostic, owner, firstType, secondType);

lib/Sema/TypeCheckProtocolInference.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ bool AssociatedTypeInference::checkCurrentTypeWitnesses(
10701070
{ proto->getSelfInterfaceType() },
10711071
sanitizedRequirements,
10721072
QuerySubstitutionMap{substitutions},
1073-
nullptr, options);
1073+
options);
10741074
switch (result) {
10751075
case RequirementCheckResult::Failure:
10761076
++NumSolutionStatesFailedCheck;
@@ -1117,7 +1117,7 @@ bool AssociatedTypeInference::checkConstrainedExtension(ExtensionDecl *ext) {
11171117
ext->getGenericSignature()->getGenericParams(),
11181118
ext->getGenericSignature()->getRequirements(),
11191119
QueryTypeSubstitutionMap{subs},
1120-
nullptr, options)) {
1120+
options)) {
11211121
case RequirementCheckResult::Success:
11221122
case RequirementCheckResult::SubstitutionFailure:
11231123
return false;

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -278,52 +278,6 @@ struct ParentConditionalConformance {
278278
ArrayRef<ParentConditionalConformance> conformances);
279279
};
280280

281-
/// An abstract interface that is used by `checkGenericArguments`.
282-
class GenericRequirementsCheckListener {
283-
public:
284-
virtual ~GenericRequirementsCheckListener();
285-
286-
/// Callback invoked before trying to check generic requirement placed
287-
/// between given types. Note: if either of the types assigned to the
288-
/// requirement is generic parameter or dependent member, this callback
289-
/// method is going to get their substitutions.
290-
///
291-
/// \param kind The kind of generic requirement to check.
292-
///
293-
/// \param first The left-hand side type assigned to the requirement,
294-
/// possibly represented by its generic substitute.
295-
///
296-
/// \param second The right-hand side type assigned to the requirement,
297-
/// possibly represented by its generic substitute.
298-
///
299-
///
300-
/// \returns true if it's ok to validate requirement, false otherwise.
301-
virtual bool shouldCheck(RequirementKind kind, Type first, Type second);
302-
303-
/// Callback to report the result of a satisfied conformance requirement.
304-
///
305-
/// \param depTy The dependent type, from the signature.
306-
/// \param replacementTy The type \c depTy was replaced with.
307-
/// \param conformance The conformance itself.
308-
virtual void satisfiedConformance(Type depTy, Type replacementTy,
309-
ProtocolConformanceRef conformance);
310-
311-
/// Callback to diagnose problem with unsatisfied generic requirement.
312-
///
313-
/// \param req The unsatisfied generic requirement.
314-
///
315-
/// \param first The left-hand side type assigned to the requirement,
316-
/// possibly represented by its generic substitute.
317-
///
318-
/// \param second The right-hand side type assigned to the requirement,
319-
/// possibly represented by its generic substitute.
320-
///
321-
/// \returns true if problem has been diagnosed, false otherwise.
322-
virtual bool diagnoseUnsatisfiedRequirement(
323-
const Requirement &req, Type first, Type second,
324-
ArrayRef<ParentConditionalConformance> parents);
325-
};
326-
327281
/// The result of `checkGenericRequirement`.
328282
enum class RequirementCheckResult {
329283
Success, Failure, SubstitutionFailure
@@ -633,13 +587,10 @@ std::string gatherGenericParamBindingsText(
633587
/// \param requirements The requirements against which the generic arguments
634588
/// should be checked.
635589
/// \param substitutions Substitutions from interface types of the signature.
636-
/// \param listener The generic check listener used to pick requirements and
637-
/// notify callers about diagnosed errors.
638590
RequirementCheckResult checkGenericArguments(
639591
DeclContext *dc, SourceLoc loc, SourceLoc noteLoc, Type owner,
640592
TypeArrayView<GenericTypeParamType> genericParams,
641593
ArrayRef<Requirement> requirements, TypeSubstitutionFn substitutions,
642-
GenericRequirementsCheckListener *listener = nullptr,
643594
SubstOptions options = None);
644595

645596
/// Add any implicitly-defined constructors required for the given

0 commit comments

Comments
 (0)