Skip to content

Commit 6d2ebb3

Browse files
committed
RequirementMachine: Allow mismatch in verify mode if there is a conflict
Having the Requirement Machine produce the same output as the GenericSignatureBuilder when there are conflicting requirements is difficult. It is also pointless, since invalid code does not have a stable ABI. Instead, just skip verification if the Requirement Machine reported that there were conflicting rules in the current minimization domain.
1 parent f5b3d19 commit 6d2ebb3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8275,7 +8275,8 @@ AbstractGenericSignatureRequest::evaluate(
82758275
if (!rqmResult.getPointer() && !gsbResult.getPointer())
82768276
return rqmResult;
82778277

8278-
if (!rqmResult.getPointer()->isEqual(gsbResult.getPointer())) {
8278+
if (!rqmResult.getInt().contains(GenericSignatureErrorFlags::HasConflict) &&
8279+
!rqmResult.getPointer()->isEqual(gsbResult.getPointer())) {
82798280
PrintOptions opts;
82808281
opts.ProtocolQualifiedDependentMemberTypes = true;
82818282

@@ -8487,7 +8488,8 @@ InferredGenericSignatureRequest::evaluate(
84878488
if (!rqmResult.getPointer() && !gsbResult.getPointer())
84888489
return rqmResult;
84898490

8490-
if (!rqmResult.getPointer()->isEqual(gsbResult.getPointer())) {
8491+
if (!rqmResult.getInt().contains(GenericSignatureErrorFlags::HasConflict) &&
8492+
!rqmResult.getPointer()->isEqual(gsbResult.getPointer())) {
84918493
PrintOptions opts;
84928494
opts.ProtocolQualifiedDependentMemberTypes = true;
84938495

@@ -8689,7 +8691,9 @@ RequirementSignatureRequest::evaluate(Evaluator &evaluator,
86898691
auto rqmResult = buildViaRQM();
86908692
auto gsbResult = buildViaGSB();
86918693

8692-
if (!compare(rqmResult.getRequirements(), gsbResult.getRequirements())) {
8694+
if (!rqmResult.getErrors().contains(GenericSignatureErrorFlags::HasConflict) &&
8695+
!compare(rqmResult.getRequirements(),
8696+
gsbResult.getRequirements())) {
86938697
PrintOptions opts;
86948698
opts.ProtocolQualifiedDependentMemberTypes = true;
86958699

0 commit comments

Comments
 (0)