Skip to content

Commit 171808b

Browse files
committed
[CSSolver] Split ambiguity handling for diagnostics and code completion
1 parent 878066b commit 171808b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/Sema/CSSolver.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -1448,18 +1448,23 @@ ConstraintSystem::solve(SyntacticElementTarget &target,
14481448
return None;
14491449
}
14501450

1451-
case SolutionResult::Ambiguous:
1452-
// If salvaging produced an ambiguous result, it has already been
1453-
// diagnosed.
1451+
case SolutionResult::Ambiguous: {
14541452
// If we have found an ambiguous solution in the first stage, salvaging
14551453
// won't produce more solutions, so we can inform the solution callback
14561454
// about the current ambiguous solutions straight away.
1457-
if (stage == 1 || Context.SolutionCallback) {
1455+
if (Context.SolutionCallback) {
14581456
reportSolutionsToSolutionCallback(solution);
14591457
solution.markAsDiagnosed();
14601458
return None;
14611459
}
14621460

1461+
// If salvaging produced an ambiguous result, it has already been
1462+
// diagnosed.
1463+
if (stage == 1) {
1464+
solution.markAsDiagnosed();
1465+
return None;
1466+
}
1467+
14631468
if (Options.contains(
14641469
ConstraintSystemFlags::AllowUnresolvedTypeVariables)) {
14651470
dumpSolutions(solution);
@@ -1471,6 +1476,7 @@ ConstraintSystem::solve(SyntacticElementTarget &target,
14711476
}
14721477

14731478
LLVM_FALLTHROUGH;
1479+
}
14741480

14751481
case SolutionResult::UndiagnosedError:
14761482
/// If we have a SolutionCallback, we are inspecting constraint system

0 commit comments

Comments
 (0)