Skip to content

Commit f5078e2

Browse files
authored
Merge pull request #42538 from slavapestov/testcase-rdar92092635
Add test case for rdar://92092635
2 parents 9f7dbad + 504b2eb commit f5078e2

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/AST/RequirementMachine/RequirementLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static void desugarConformanceRequirement(Type subjectType, Type constraintType,
340340
}
341341

342342
for (auto memberType : compositionType->getMembers()) {
343-
if (memberType->isExistentialType())
343+
if (memberType->isConstraintType())
344344
desugarConformanceRequirement(subjectType, memberType,
345345
loc, result, errors);
346346
else
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %target-typecheck-verify-swift -requirement-machine-inferred-signatures=on
2+
3+
// The GenericSignatureBuilder did not diagnose the first two.
4+
5+
struct G1<T : BinaryInteger & FixedWidthInteger & UnsignedInteger & Codable> {}
6+
// expected-warning@-1 {{redundant conformance constraint 'T' : 'BinaryInteger'}}
7+
8+
struct G2<T> where T : BinaryInteger & FixedWidthInteger & UnsignedInteger & Codable {}
9+
// expected-warning@-1 {{redundant conformance constraint 'T' : 'BinaryInteger'}}
10+
11+
struct G3<T> where T : BinaryInteger, T : FixedWidthInteger, T : UnsignedInteger & Codable {}
12+
// expected-warning@-1 {{redundant conformance constraint 'T' : 'BinaryInteger'}}
13+
14+
// FIXME: These should also diagnose, but do not due to overly-eager
15+
// canonicalization in ProtocolCompositionType::get().
16+
17+
struct G1a<T : BinaryInteger & FixedWidthInteger & UnsignedInteger> {}
18+
struct G2a<T> where T : BinaryInteger & FixedWidthInteger & UnsignedInteger {}
19+

0 commit comments

Comments
 (0)