mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeCompletion] Add type relation indicators to completion results at the conditions of repeat-while statements.
Boolean expressions should have higher priority at loop conditions.
This commit is contained in:
@@ -4186,6 +4186,7 @@ public:
|
||||
switch (S->getKind()) {
|
||||
case StmtKind::Return:
|
||||
case StmtKind::ForEach:
|
||||
case StmtKind::RepeatWhile:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -4249,6 +4250,15 @@ public:
|
||||
}
|
||||
break;
|
||||
}
|
||||
case StmtKind::RepeatWhile: {
|
||||
auto Cond = cast<RepeatWhileStmt>(Parent)->getCond();
|
||||
if (Cond &&
|
||||
SM.rangeContains(Cond->getSourceRange(),
|
||||
ParsedExpr->getSourceRange())) {
|
||||
Callback(Context.getBoolDecl()->getDeclaredType());
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
llvm_unreachable("Unhandled statement kinds.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user