Skip to content

Commit 531f4a2

Browse files
committed
xxx
1 parent 0247760 commit 531f4a2

11 files changed

+15
-10
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ void CodeCompletionCallbacksImpl::typeCheckWithLookup(
15001500
// switch case where there control expression is invalid). Having normal
15011501
// typechecking still resolve even these cases would be beneficial for
15021502
// tooling in general though.
1503-
if (!Lookup.gotCallback()) {
1503+
if (false && !Lookup.gotCallback()) {
15041504
if (Context.TypeCheckerOpts.DebugConstraintSolver) {
15051505
llvm::errs() << "--- Fallback typecheck for code completion ---\n";
15061506
}

lib/Parse/ParseExpr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,9 @@ Parser::parseExprPostfixSuffix(ParserResult<Expr> Result, bool isExprBasic,
15551555
if (!Tok.isAtStartOfLine() && Tok.is(tok::unknown)) {
15561556
SourceLoc UnknownLoc = consumeToken();
15571557
SourceRange ErrorRange = Result.get()->getSourceRange();
1558+
if (SourceMgr.rangeContainsIDEInspectionTarget(Lexer::getCharSourceRangeFromSourceRange(SourceMgr, ErrorRange))) {
1559+
continue;
1560+
}
15581561
ErrorRange.widen(UnknownLoc);
15591562
Result = makeParserResult(Result, new (Context) ErrorExpr(ErrorRange,
15601563
Type(),

lib/Sema/CompletionContextFinder.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ size_t CompletionContextFinder::getKeyPathCompletionComponentIndex() const {
114114

115115
std::optional<Fallback>
116116
CompletionContextFinder::getFallbackCompletionExpr() const {
117+
return std::nullopt;
117118
if (!hasCompletionExpr()) {
118119
// Creating a fallback expression only makes sense if we are completing in
119120
// an expression, not when we're completing in a key path.

lib/Sema/TypeCheckStmt.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
10751075
assert(TheFunc && "Should have bailed from pre-check if this is None");
10761076

10771077
Type ResultTy = TheFunc->getBodyResultType();
1078-
if (!ResultTy || ResultTy->hasError())
1078+
if (!ResultTy)
10791079
return nullptr;
10801080

10811081
if (!RS->hasResult()) {
@@ -2672,7 +2672,8 @@ bool TypeCheckASTNodeAtLocRequest::evaluate(
26722672
// apply the solution.
26732673
// FIXME: We ought to see if we can do better in that case.
26742674
if (auto *CE = DC->getInnermostClosureForCaptures()) {
2675-
if (CE->getBodyState() == ClosureExpr::BodyState::Parsed) {
2675+
if (CE->getBodyState() == ClosureExpr::BodyState::Parsed &&
2676+
!typeCheckCtx.isForUnattachedNode()) {
26762677
swift::typeCheckASTNodeAtLoc(
26772678
TypeCheckASTNodeAtLocContext::declContext(CE->getParent()),
26782679
CE->getLoc());
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// {"kind":"complete","signature":"swift::constraints::ConstraintSystem::assignFixedType(swift::TypeVariableType*, swift::Type, bool, bool)","signatureAssert":"Assertion failed: (!type->hasError() && \"Should not be assigning a type involving ErrorType!\"), function assignFixedType"}
2-
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
2+
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
33
[ _""#^COMPLETE^#

validation-test/IDE/crashers/63cae8d8f799869.swift renamed to validation-test/IDE/crashers_fixed/63cae8d8f799869.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// {"kind":"complete","original":"8d3b43e5","signature":"(anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*)"}
2-
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
2+
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
33
[
44
switch {
55
case ((\.a) #^^#
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// {"kind":"complete","signature":"swift::SourceManager::findBufferContainingLocInternal(swift::SourceLoc) const","signatureAssert":"Assertion failed: (Loc.isValid()), function findBufferContainingLocInternal"}
2-
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
2+
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
33
class a { lazy b: () = { answer {}#^^#
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// {"kind":"complete","original":"7bbb1dc5","signature":"swift::TypeRepr::print(swift::ASTPrinter&, swift::PrintOptions const&, swift::optionset::OptionSet<swift::NonRecursivePrintOption, unsigned int>) const","signatureAssert":"Assertion failed: (false && \"Expression wasn't type checked?\"), function getTypeForCompletion"}
2-
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
2+
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
33
a ? {
44
init { b { extension
55
}#^^#
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// {"kind":"complete","signature":"swift::constraints::ConstraintSystem::buildDisjunctionForOptionalVsUnderlying(swift::Type, swift::Type, swift::constraints::ConstraintLocator*)","signatureAssert":"Assertion failed: (isa<To>(Val) && \"cast<Ty>() argument of incompatible type!\"), function cast"}
2-
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
2+
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
33
class a {b: c! = b #^COMPLETE^#
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// {"kind":"complete","signature":"swift::constraints::ConstraintSystem::getType(swift::ASTNode) const","signatureAssert":"Assertion failed: (!node.isNull() && \"Expected non-null node\"), function hasType"}
2-
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
2+
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
33
if case (
44
#a,#^COMPLETE^# is b

0 commit comments

Comments
 (0)