Skip to content

Commit 17cb2d2

Browse files
committed
[ConstraintSystem] Add a new flag which specifies that solver is used for code completion
1 parent bdfa8d9 commit 17cb2d2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/Sema/ConstraintSystem.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,11 @@ enum class ConstraintSystemFlags {
12931293
/// Don't try to type check closure bodies, and leave them unchecked. This is
12941294
/// used for source tooling functionalities.
12951295
LeaveClosureBodyUnchecked = 0x20,
1296+
1297+
/// If set, we are solving specifically to determine the type of a
1298+
/// CodeCompletionExpr, and should continue in the presence of errors wherever
1299+
/// possible.
1300+
ForCodeCompletion = 0x40,
12961301
};
12971302

12981303
/// Options that affect the constraint system as a whole.
@@ -3057,6 +3062,12 @@ class ConstraintSystem {
30573062
return Options.contains(ConstraintSystemFlags::ReusePrecheckedType);
30583063
}
30593064

3065+
/// Whether we are solving to determine the possible types of a
3066+
/// \c CodeCompletionExpr.
3067+
bool isForCodeCompletion() const {
3068+
return Options.contains(ConstraintSystemFlags::ForCodeCompletion);
3069+
}
3070+
30603071
/// Log and record the application of the fix. Return true iff any
30613072
/// subsequent solution would be worse than the best known solution.
30623073
bool recordFix(ConstraintFix *fix, unsigned impact = 1);

0 commit comments

Comments
 (0)