Skip to content

GSB: Set HadAnyError in two more places #38360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/AST/GenericSignatureBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8146,6 +8146,8 @@ void GenericSignatureBuilder::enumerateRequirements(
RequirementRHS rhs) {
if (auto req = createRequirement(kind, depTy, rhs, genericParams))
requirements.push_back(*req);
else
Impl->HadAnyError = true;
};

// Collect all non-same type requirements.
Expand Down Expand Up @@ -8489,6 +8491,8 @@ GenericSignature GenericSignatureBuilder::rebuildSignatureWithoutRedundantRequir
auto newReq = stripBoundDependentMemberTypes(*optReq);
newBuilder.addRequirement(newReq, getRebuiltSource(req.getSource()),
nullptr);
} else {
Impl->HadAnyError = true;
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/decl/protocol/req/recursion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ public struct S<A: P> where A.T == S<A> { // expected-error {{circular reference
// expected-note@-3 {{while resolving type 'S<A>'}}
func f(a: A.T) {
g(a: id(t: a)) // `a` has error type which is diagnosed as circular reference
// expected-error@-1 {{conflicting arguments to generic parameter 'T' ('A.T' (associated type of protocol 'P') vs. 'S<A>')}}
_ = A.T.self
}

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

Expand Down