Skip to content

Commit a7e21d4

Browse files
authored
Merge pull request #13309 from DougGregor/rdar-35832679-4.1
[4.1] [Type checker] Don't check near-miss candidates of the wrong kind.
2 parents 8314a55 + 6aac2e3 commit a7e21d4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6479,6 +6479,11 @@ static bool shouldWarnAboutPotentialWitness(
64796479
if (groupChecker.isCoveredMember(witness))
64806480
return false;
64816481

6482+
// If the kinds of the requirement and witness are different, there's
6483+
// nothing to warn about.
6484+
if (req->getKind() != witness->getKind())
6485+
return false;
6486+
64826487
// If the warning couldn't be suppressed, don't warn.
64836488
if (!canSuppressPotentialWitnessWarningWithMovement(req, witness) &&
64846489
!canSuppressPotentialWitnessWarningWithNonObjC(req, witness))
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-swift-frontend %s -emit-ir -o -
2+
3+
func f() {
4+
enum NotAnError: Swift.Error {
5+
case nope(length: Int)
6+
}
7+
}
8+

0 commit comments

Comments
 (0)