From dc5768caa774da1937df7ba8d67c049bd4e74106 Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Thu, 18 Mar 2021 17:51:20 +0100 Subject: [PATCH] [Sema] Fix rdar://75200446 It appears like the simplification in 9d3c8ca3962984dbd7cdb3570332a85cca13d02c was a little over-optimistic to declare the code path unreachable and causes a crash in the test case added by this commit. Restore the old code code path. Fixes rdar://75200446 --- lib/Sema/CSApply.cpp | 6 +++++- test/SourceKit/CodeComplete/rdar75200446.swift | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test/SourceKit/CodeComplete/rdar75200446.swift diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index 387c39025f4cb..57fe6d3ee627a 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -7577,7 +7577,11 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType, // FIXME: handle unwrapping everywhere else assert(!unwrapResult); - assert(!cs.getType(fn)->is()); + // If this is an UnresolvedType in the system, preserve it. + if (cs.getType(fn)->is()) { + cs.setType(apply, cs.getType(fn)); + return apply; + } // We have a type constructor. auto metaTy = cs.getType(fn)->castTo(); diff --git a/test/SourceKit/CodeComplete/rdar75200446.swift b/test/SourceKit/CodeComplete/rdar75200446.swift new file mode 100644 index 0000000000000..33a256ce2115f --- /dev/null +++ b/test/SourceKit/CodeComplete/rdar75200446.swift @@ -0,0 +1,3 @@ +// RUN: %sourcekitd-test -req=complete -pos=3:14 %s -- %s + +.undefined() /*HERE*/