Skip to content

Commit 648333b

Browse files
committed
[CSOptimizer] Don't attempt to optimize calls with code completion token(s) in argument position
1 parent 5f1fa43 commit 648333b

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

lib/Sema/CSOptimizer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ static void determineBestChoicesInContext(
112112
auto argFuncType =
113113
applicableFn.get()->getFirstType()->getAs<FunctionType>();
114114

115+
auto argumentList = cs.getArgumentList(applicableFn.get()->getLocator());
116+
if (!argumentList || cs.containsIDEInspectionTarget(argumentList))
117+
return;
118+
115119
SmallVector<SmallVector<std::pair<Type, /*fromLiteral=*/bool>, 2>, 2>
116120
candidateArgumentTypes;
117121
candidateArgumentTypes.resize(argFuncType->getNumParams());

test/IDE/complete_expr_postfix_begin.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ typealias FooTypealias = Int
3737
// COMMON-DAG: Decl[TypeAlias]/CurrModule{{(/TypeRelation\[Convertible\])?}}: FooTypealias[#Int#]{{; name=.+$}}
3838
// COMMON-DAG: Decl[GlobalVar]/CurrModule: fooObject[#FooStruct#]{{; name=.+$}}
3939
// COMMON-DAG: Keyword[try]/None: try{{; name=.+$}}
40-
// COMMON-DAG: Literal[Boolean]/None: true[#Bool#]{{; name=.+$}}
41-
// COMMON-DAG: Literal[Boolean]/None: false[#Bool#]{{; name=.+$}}
40+
// COMMON-DAG: Literal[Boolean]/None{{(/TypeRelation\[Convertible\])?}}: true[#Bool#]{{; name=.+$}}
41+
// COMMON-DAG: Literal[Boolean]/None{{(/TypeRelation\[Convertible\])?}}: false[#Bool#]{{; name=.+$}}
4242
// COMMON-DAG: Literal[Nil]/None: nil{{; name=.+$}}
43-
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int8[#Int8#]{{; name=.+$}}
44-
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int16[#Int16#]{{; name=.+$}}
45-
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int32[#Int32#]{{; name=.+$}}
46-
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Int64[#Int64#]{{; name=.+$}}
47-
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem: Bool[#Bool#]{{; name=.+$}}
43+
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem{{(/TypeRelation\[Convertible\])?}}: Int8[#Int8#]{{; name=.+$}}
44+
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem{{(/TypeRelation\[Convertible\])?}}: Int16[#Int16#]{{; name=.+$}}
45+
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem{{(/TypeRelation\[Convertible\])?}}: Int32[#Int32#]{{; name=.+$}}
46+
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem{{(/TypeRelation\[Convertible\])?}}: Int64[#Int64#]{{; name=.+$}}
47+
// COMMON-DAG: Decl[Struct]/OtherModule[Swift]/IsSystem{{(/TypeRelation\[Convertible\])?}}: Bool[#Bool#]{{; name=.+$}}
4848
// COMMON-DAG: Keyword[#function]/None{{(/TypeRelation\[Convertible\])?}}: #function[#String#]{{; name=.+$}}
4949
// COMMON-DAG: Keyword[#file]/None{{(/TypeRelation\[Convertible\])?}}: #file[#String#]{{; name=.+$}}
50-
// COMMON-DAG: Keyword[#line]/None{{(/TypeRelation\[Convertible\])?}}: #line[#Int#]{{; name=.+$}}
51-
// COMMON-DAG: Keyword[#column]/None{{(/TypeRelation\[Convertible\])?}}: #column[#Int#]{{; name=.+$}}
50+
// COMMON-DAG: Keyword[#line]/None{{(/TypeRelation\[Convertible\])?}}: #line[#{{.*}}#]{{; name=.+$}}
51+
// COMMON-DAG: Keyword[#column]/None{{(/TypeRelation\[Convertible\])?}}: #column[#{{.*}}#]{{; name=.+$}}
5252
// COMMON: End completions
5353

5454
// NO_SELF-NOT: {{[[:<:]][Ss]elf[[:>:]]}}
@@ -69,7 +69,7 @@ func testExprPostfixBegin3(fooParam: FooStruct) {
6969
}
7070

7171
func testExprPostfixBegin4(fooParam: FooStruct) {
72-
"\(#^EXPR_POSTFIX_BEGIN_4?xfail=FIXME-64812321;check=COMMON^#)"
72+
"\(#^EXPR_POSTFIX_BEGIN_4?check=COMMON^#)"
7373
}
7474
7575
func testExprPostfixBegin5(fooParam: FooStruct) {

0 commit comments

Comments
 (0)