Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be89557

Browse files
authored
Merge pull request swiftlang#84217 from hamishknight/fix-crash
[Completion] Simplify opened function type in `tryResolveDoubleAppliedFunction`
2 parents 3ce46e8 + 9beb2e3 commit be89557

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/IDE/ArgumentCompletion.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ tryResolveDoubleAppliedFunction(CallExpr *OuterCall, const Solution &S) {
133133
if (!FuncRefInfo.isDoubleApply())
134134
return std::nullopt;
135135

136-
auto CalleeTy = Overload->adjustedOpenedType->getAs<AnyFunctionType>();
137-
auto ResultTy = S.simplifyTypeForCodeCompletion(CalleeTy->getResult());
136+
auto CalleeTy = S.simplifyTypeForCodeCompletion(Overload->adjustedOpenedType)
137+
->getAs<AnyFunctionType>();
138+
if (!CalleeTy)
139+
return std::nullopt;
138140

139-
auto *FuncTy = ResultTy->getAs<AnyFunctionType>();
141+
auto *FuncTy = CalleeTy->getResult()->getAs<AnyFunctionType>();
140142
if (!FuncTy)
141143
return std::nullopt;
142144

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"kind":"complete","original":"a705fa0d","signature":"swift::constraints::Solution::simplifyType(swift::Type, bool) const","signatureAssert":"Assertion failed: (!resolvedType->getRecursiveProperties().isSolverAllocated()), function simplifyType"}
2+
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
3+
{
4+
$1 {
5+
}(
6+
#^^#)
7+
}

0 commit comments

Comments
 (0)