Skip to content

Commit 5adac2a

Browse files
authored
Merge pull request #38360 from slavapestov/gsb-had-any-error-fix
GSB: Set HadAnyError in two more places
2 parents 27a992e + 6895707 commit 5adac2a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8146,6 +8146,8 @@ void GenericSignatureBuilder::enumerateRequirements(
81468146
RequirementRHS rhs) {
81478147
if (auto req = createRequirement(kind, depTy, rhs, genericParams))
81488148
requirements.push_back(*req);
8149+
else
8150+
Impl->HadAnyError = true;
81498151
};
81508152

81518153
// Collect all non-same type requirements.
@@ -8489,6 +8491,8 @@ GenericSignature GenericSignatureBuilder::rebuildSignatureWithoutRedundantRequir
84898491
auto newReq = stripBoundDependentMemberTypes(*optReq);
84908492
newBuilder.addRequirement(newReq, getRebuiltSource(req.getSource()),
84918493
nullptr);
8494+
} else {
8495+
Impl->HadAnyError = true;
84928496
}
84938497
}
84948498

test/decl/protocol/req/recursion.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ public struct S<A: P> where A.T == S<A> { // expected-error {{circular reference
4949
// expected-note@-3 {{while resolving type 'S<A>'}}
5050
func f(a: A.T) {
5151
g(a: id(t: a)) // `a` has error type which is diagnosed as circular reference
52+
// expected-error@-1 {{conflicting arguments to generic parameter 'T' ('A.T' (associated type of protocol 'P') vs. 'S<A>')}}
5253
_ = A.T.self
5354
}
5455

5556
func g(a: S<A>) {
5657
f(a: id(t: a))
57-
// expected-error@-1 {{cannot convert value of type 'S<A>' to expected argument type 'A.T'}}
58+
// expected-error@-1 {{conflicting arguments to generic parameter 'T' ('S<A>' vs. 'A.T' (associated type of protocol 'P'))}}
5859
_ = S<A>.self
5960
}
6061

0 commit comments

Comments
 (0)