Skip to content

Commit 1bd0cd7

Browse files
authored
Merge pull request #79928 from xedin/support-debug-constraints-on-line-for-result-builders
[ResultBuilders] NFC: Support `-debug-constraints{-on-line=}` for dec…
2 parents 47b4493 + 6197aab commit 1bd0cd7

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6510,6 +6510,9 @@ bool isResultBuilderMethodReference(ASTContext &, UnresolvedDotExpr *);
65106510
unsigned getNumApplications(bool hasAppliedSelf,
65116511
FunctionRefInfo functionRefInfo);
65126512

6513+
/// Determine whether the debug output is enabled for the given target.
6514+
bool debugConstraintSolverForTarget(ASTContext &C,
6515+
SyntacticElementTarget target);
65136516
} // end namespace constraints
65146517

65156518
template<typename ...Args>

lib/Sema/BuilderTransform.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,9 @@ TypeChecker::applyResultBuilderBodyTransform(FuncDecl *func, Type builderType) {
959959
return nullptr;
960960

961961
ConstraintSystemOptions options = ConstraintSystemFlags::AllowFixes;
962+
if (debugConstraintSolverForTarget(ctx, target))
963+
options |= ConstraintSystemFlags::DebugConstraints;
964+
962965
auto resultInterfaceTy = func->getResultInterfaceType();
963966
auto resultContextType = func->mapTypeIntoContext(resultInterfaceTy);
964967

lib/Sema/CSSolver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,8 +1342,8 @@ void ConstraintSystem::shrink(Expr *expr) {
13421342
}
13431343
}
13441344

1345-
static bool debugConstraintSolverForTarget(ASTContext &C,
1346-
SyntacticElementTarget target) {
1345+
bool constraints::debugConstraintSolverForTarget(
1346+
ASTContext &C, SyntacticElementTarget target) {
13471347
if (C.TypeCheckerOpts.DebugConstraintSolver)
13481348
return true;
13491349

0 commit comments

Comments
 (0)