Skip to content

Commit 816f0b9

Browse files
committed
[Sema] NFC: Remove SuppressDiagnostics from PreCheckResultBuilderRequest
This is always `false`.
1 parent 8b7a75c commit 816f0b9

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

include/swift/AST/TypeCheckRequests.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,6 @@ class AssociatedConformanceRequest
30303030

30313031
struct PreCheckResultBuilderDescriptor {
30323032
AnyFunctionRef Fn;
3033-
bool SuppressDiagnostics;
30343033

30353034
private:
30363035
// NOTE: Since source tooling (e.g. code completion) might replace the body,
@@ -3040,8 +3039,8 @@ struct PreCheckResultBuilderDescriptor {
30403039
BraceStmt *Body;
30413040

30423041
public:
3043-
PreCheckResultBuilderDescriptor(AnyFunctionRef Fn, bool suppressDiagnostics)
3044-
: Fn(Fn), SuppressDiagnostics(suppressDiagnostics), Body(Fn.getBody()) {}
3042+
PreCheckResultBuilderDescriptor(AnyFunctionRef Fn)
3043+
: Fn(Fn), Body(Fn.getBody()) {}
30453044

30463045
friend llvm::hash_code
30473046
hash_value(const PreCheckResultBuilderDescriptor &owner) {

lib/Sema/BuilderTransform.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -926,9 +926,7 @@ TypeChecker::applyResultBuilderBodyTransform(FuncDecl *func, Type builderType) {
926926
// If we encountered an error or there was an explicit result type,
927927
// bail out and report that to the caller.
928928
auto &ctx = func->getASTContext();
929-
auto request =
930-
PreCheckResultBuilderRequest{{AnyFunctionRef(func),
931-
/*SuppressDiagnostics=*/false}};
929+
auto request = PreCheckResultBuilderRequest{AnyFunctionRef(func)};
932930
switch (evaluateOrDefault(ctx.evaluator, request,
933931
ResultBuilderBodyPreCheck::Error)) {
934932
case ResultBuilderBodyPreCheck::Okay:
@@ -1144,9 +1142,8 @@ ConstraintSystem::matchResultBuilder(AnyFunctionRef fn, Type builderType,
11441142
// not apply the result builder transform if it contained an explicit return.
11451143
// To maintain source compatibility, we still need to check for HasReturnStmt.
11461144
// https://github.com/apple/swift/issues/64332.
1147-
auto request =
1148-
PreCheckResultBuilderRequest{{fn, /*SuppressDiagnostics=*/false}};
1149-
switch (evaluateOrDefault(getASTContext().evaluator, request,
1145+
switch (evaluateOrDefault(getASTContext().evaluator,
1146+
PreCheckResultBuilderRequest{fn},
11501147
ResultBuilderBodyPreCheck::Error)) {
11511148
case ResultBuilderBodyPreCheck::Okay:
11521149
// If the pre-check was okay, apply the result-builder transform.
@@ -1383,8 +1380,7 @@ ResultBuilderBodyPreCheck PreCheckResultBuilderRequest::evaluate(
13831380
// to pre-check them again.
13841381
bool skipPrecheck = owner.Fn.getAbstractClosureExpr();
13851382
return PreCheckResultBuilderApplication(
1386-
owner.Fn, skipPrecheck,
1387-
/*suppressDiagnostics=*/owner.SuppressDiagnostics)
1383+
owner.Fn, skipPrecheck, /*suppressDiagnostics=*/false)
13881384
.run();
13891385
}
13901386

0 commit comments

Comments
 (0)