Skip to content

[Sema] Fix rdar://75200446 #36494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/Sema/CSApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7577,7 +7577,11 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
// FIXME: handle unwrapping everywhere else
assert(!unwrapResult);

assert(!cs.getType(fn)->is<UnresolvedType>());
// If this is an UnresolvedType in the system, preserve it.
if (cs.getType(fn)->is<UnresolvedType>()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slavapestov It looks like some of the recently removed code paths are still used by the code completion. Maybe we should revert #36028?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is code completion still submitting UnresolvedType ASTs for type checking?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume so 🤷

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xedin could we do this with holes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all of the code completion requests has been ported to use typeCheckForCodeCompletion yet, but the plan is to avoid having to apply solution and use holes everywhere. Meanwhile I think the most sensible thing would be to revert #36028.

cs.setType(apply, cs.getType(fn));
return apply;
}

// We have a type constructor.
auto metaTy = cs.getType(fn)->castTo<AnyMetatypeType>();
Expand Down
3 changes: 3 additions & 0 deletions test/SourceKit/CodeComplete/rdar75200446.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// RUN: %sourcekitd-test -req=complete -pos=3:14 %s -- %s

.undefined() /*HERE*/