Skip to content

Commit 31e385f

Browse files
committed
[Sema] WitnessMatching: Anchor ProtocolRequirement on the requrement declaration
Locators used to support only expressions which is no longer the case.
1 parent 1be8e86 commit 31e385f

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

include/swift/Sema/ConstraintLocator.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -820,18 +820,6 @@ class LocatorPathElt::Witness final : public StoredPointerElement<ValueDecl> {
820820
}
821821
};
822822

823-
class LocatorPathElt::ProtocolRequirement final : public StoredPointerElement<ValueDecl> {
824-
public:
825-
ProtocolRequirement(ValueDecl *decl)
826-
: StoredPointerElement(PathElementKind::ProtocolRequirement, decl) {}
827-
828-
ValueDecl *getDecl() const { return getStoredPointer(); }
829-
830-
static bool classof(const LocatorPathElt *elt) {
831-
return elt->getKind() == PathElementKind::ProtocolRequirement;
832-
}
833-
};
834-
835823
class LocatorPathElt::GenericParameter final : public StoredPointerElement<GenericTypeParamType> {
836824
public:
837825
GenericParameter(GenericTypeParamType *type)

include/swift/Sema/ConstraintLocatorPathElts.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ SIMPLE_LOCATOR_PATH_ELT(ParentType)
161161

162162
/// The requirement that we're matching during protocol conformance
163163
/// checking.
164-
CUSTOM_LOCATOR_PATH_ELT(ProtocolRequirement)
164+
SIMPLE_LOCATOR_PATH_ELT(ProtocolRequirement)
165165

166166
/// Type parameter requirements.
167167
ABSTRACT_LOCATOR_PATH_ELT(AnyRequirement)

lib/Sema/ConstraintLocator.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ void LocatorPathElt::dump(raw_ostream &out) const {
304304
break;
305305
}
306306
case ConstraintLocator::ProtocolRequirement: {
307-
auto reqElt = elt.castTo<LocatorPathElt::ProtocolRequirement>();
308-
out << "protocol requirement ";
309-
reqElt.getDecl()->dumpRef(out);
307+
out << "protocol requirement";
310308
break;
311309
}
312310
case ConstraintLocator::Witness: {

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,8 +1115,8 @@ swift::matchWitness(WitnessChecker::RequirementEnvironmentCache &reqEnvCache,
11151115
selfTy = syntheticEnv->mapTypeIntoContext(selfTy);
11161116

11171117
// Open up the type of the requirement.
1118-
reqLocator = cs->getConstraintLocator(
1119-
static_cast<Expr *>(nullptr), LocatorPathElt::ProtocolRequirement(req));
1118+
reqLocator =
1119+
cs->getConstraintLocator(req, ConstraintLocator::ProtocolRequirement);
11201120
OpenedTypeMap reqReplacements;
11211121
reqType = cs->getTypeOfMemberReference(selfTy, req, dc,
11221122
/*isDynamicResult=*/false,

0 commit comments

Comments
 (0)