Skip to content

Commit 91410d8

Browse files
authored
Merge pull request #41657 from rintaro/ide-completion-simpleparam-rdar83904268
[CodeCompletion] Fix placeholder rendering for addSimpleNamedParameter()
2 parents 5d72984 + a75b80c commit 91410d8

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

lib/IDE/CodeCompletionResultPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ constructTextForCallParam(ArrayRef<CodeCompletionString::Chunk> ParamGroup,
410410
OS << "<#T##" << Display;
411411
if (Display == Type && Display == ExpansionType) {
412412
// Short version, display and type are the same.
413-
} else {
413+
} else if (!Type.empty()) {
414414
OS << "##" << Type;
415415
if (ExpansionType != Type)
416416
OS << "##" << ExpansionType;

test/IDE/complete_pound_directive.swift

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_NOMINAL_TOP | %FileCheck %s -check-prefix=POUND_DIRECTIVE
2-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_NOMINAL_IN_IF | %FileCheck %s -check-prefix=POUND_DIRECTIVE
3-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_NOMINAL_IN_ELSEIF | %FileCheck %s -check-prefix=POUND_DIRECTIVE
4-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_NOMINAL_IN_ELSE | %FileCheck %s -check-prefix=POUND_DIRECTIVE
5-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_GLOBAL_TOP | %FileCheck %s -check-prefix=POUND_DIRECTIVE
6-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_GLOBAL_IN_IF | %FileCheck %s -check-prefix=POUND_DIRECTIVE
7-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_GLOBAL_IN_ELSEIF | %FileCheck %s -check-prefix=POUND_DIRECTIVE
8-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=POUND_GLOBAL_IN_ELSE | %FileCheck %s -check-prefix=POUND_DIRECTIVE
1+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=POUND_NOMINAL_TOP | %FileCheck %s -check-prefix=POUND_DIRECTIVE
2+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=POUND_NOMINAL_IN_IF | %FileCheck %s -check-prefix=POUND_DIRECTIVE
3+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=POUND_NOMINAL_IN_ELSEIF | %FileCheck %s -check-prefix=POUND_DIRECTIVE
4+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=POUND_NOMINAL_IN_ELSE | %FileCheck %s -check-prefix=POUND_DIRECTIVE
5+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=POUND_GLOBAL_TOP | %FileCheck %s -check-prefix=POUND_DIRECTIVE
6+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=POUND_GLOBAL_IN_IF | %FileCheck %s -check-prefix=POUND_DIRECTIVE
7+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=POUND_GLOBAL_IN_ELSEIF | %FileCheck %s -check-prefix=POUND_DIRECTIVE
8+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=POUND_GLOBAL_IN_ELSE | %FileCheck %s -check-prefix=POUND_DIRECTIVE
99

10-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONDITION_NOMINAL_1 | %FileCheck %s -check-prefix=CONDITION -check-prefix=NOFLAG
11-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONDITION_NOMINAL_1 -D FOO -D BAR | %FileCheck %s -check-prefix=CONDITION -check-prefix=WITHFLAG
12-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONDITION_NOMINAL_2 | %FileCheck %s -check-prefix=CONDITION -check-prefix=NOFLAG
13-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONDITION_GLOBAL_1 | %FileCheck %s -check-prefix=CONDITION -check-prefix=NOFLAG
14-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONDITION_GLOBAL_2 | %FileCheck %s -check-prefix=CONDITION -check-prefix=NOFLAG
15-
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CONDITION_GLOBAL_2 -D FOO -D BAR | %FileCheck %s -check-prefix=CONDITION -check-prefix=WITHFLAG
10+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=CONDITION_NOMINAL_1 | %FileCheck %s -check-prefix=CONDITION -check-prefix=NOFLAG
11+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=CONDITION_NOMINAL_1 -D FOO -D BAR | %FileCheck %s -check-prefix=CONDITION -check-prefix=WITHFLAG
12+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=CONDITION_NOMINAL_2 | %FileCheck %s -check-prefix=CONDITION -check-prefix=NOFLAG
13+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=CONDITION_GLOBAL_1 | %FileCheck %s -check-prefix=CONDITION -check-prefix=NOFLAG
14+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=CONDITION_GLOBAL_2 | %FileCheck %s -check-prefix=CONDITION -check-prefix=NOFLAG
15+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-sourcetext -code-completion-token=CONDITION_GLOBAL_2 -D FOO -D BAR | %FileCheck %s -check-prefix=CONDITION -check-prefix=WITHFLAG
1616

1717
// POUND_DIRECTIVE: Begin completions, 7 items
18-
// POUND_DIRECTIVE-DAG: Keyword[#sourceLocation]/None: sourceLocation(file: {#String#}, line: {#Int#}); name=sourceLocation(file:line:)
19-
// POUND_DIRECTIVE-DAG: Keyword[#warning]/None: warning("{#(message)#}"); name=warning("")
20-
// POUND_DIRECTIVE-DAG: Keyword[#error]/None: error("{#(message)#}"); name=error("")
21-
// POUND_DIRECTIVE-DAG: Keyword[#if]/None: if {#(condition)#}; name=if
22-
// POUND_DIRECTIVE-DAG: Keyword[#elseif]/None: elseif {#(condition)#}; name=elseif
23-
// POUND_DIRECTIVE-DAG: Keyword[#else]/None: else; name=else
24-
// POUND_DIRECTIVE-DAG: Keyword[#endif]/None: endif; name=endif
18+
// POUND_DIRECTIVE-DAG: Keyword[#sourceLocation]/None: sourceLocation(file: {#String#}, line: {#Int#}); name=sourceLocation(file:line:); sourcetext=sourceLocation(file: <#T##String#>, line: <#T##Int#>)
19+
// POUND_DIRECTIVE-DAG: Keyword[#warning]/None: warning("{#(message)#}"); name=warning(""); sourcetext=warning(\"<#T##message#>\")
20+
// POUND_DIRECTIVE-DAG: Keyword[#error]/None: error("{#(message)#}"); name=error(""); sourcetext=error(\"<#T##message#>\")
21+
// POUND_DIRECTIVE-DAG: Keyword[#if]/None: if {#(condition)#}; name=if ; sourcetext=if <#T##condition#>
22+
// POUND_DIRECTIVE-DAG: Keyword[#elseif]/None: elseif {#(condition)#}; name=elseif ; sourcetext=elseif <#T##condition#>
23+
// POUND_DIRECTIVE-DAG: Keyword[#else]/None: else; name=else; sourcetext=else
24+
// POUND_DIRECTIVE-DAG: Keyword[#endif]/None: endif; name=endif; sourcetext=endif
2525

2626
class C {
2727
##^POUND_NOMINAL_TOP^#
@@ -47,20 +47,20 @@ class C {
4747

4848
// CONDITION: Begin completions
4949
// CONDITION-NOT: globalVar
50-
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: os({#(name)#}); name=os()
51-
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: arch({#(name)#}); name=arch()
52-
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: canImport({#(module)#}); name=canImport()
53-
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: targetEnvironment(simulator); name=targetEnvironment(simulator)
54-
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: swift(>={#(version)#}); name=swift(>=)
55-
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: swift(<{#(version)#}); name=swift(<)
56-
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: compiler(>={#(version)#}); name=compiler(>=)
57-
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: compiler(<{#(version)#}); name=compiler(<)
58-
// CONDITION-DAG: Keyword[true]/None: true[#Bool#]; name=true
59-
// CONDITION-DAG: Keyword[false]/None: false[#Bool#]; name=false
50+
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: os({#(name)#}); name=os(); sourcetext=os(<#T##name#>)
51+
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: arch({#(name)#}); name=arch(); sourcetext=arch(<#T##name#>)
52+
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: canImport({#(module)#}); name=canImport(); sourcetext=canImport(<#T##module#>)
53+
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: targetEnvironment(simulator); name=targetEnvironment(simulator); sourcetext=targetEnvironment(simulator)
54+
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: swift(>={#(version)#}); name=swift(>=); sourcetext=swift(>=<#T##version#>)
55+
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: swift(<{#(version)#}); name=swift(<); sourcetext=swift(<<#T##version#>)
56+
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: compiler(>={#(version)#}); name=compiler(>=); sourcetext=compiler(>=<#T##version#>)
57+
// CONDITION-DAG: Pattern/CurrModule/Flair[ExprSpecific]: compiler(<{#(version)#}); name=compiler(<); sourcetext=compiler(<<#T##version#>)
58+
// CONDITION-DAG: Keyword[true]/None: true[#Bool#]; name=true; sourcetext=true
59+
// CONDITION-DAG: Keyword[false]/None: false[#Bool#]; name=false; sourcetext=false
6060
// CONDITION-NOT: globalVar
6161

62-
// WITHFLAG: Keyword/CurrModule/Flair[ExprSpecific]: FOO; name=FOO
63-
// WITHFLAG: Keyword/CurrModule/Flair[ExprSpecific]: BAR; name=BAR
62+
// WITHFLAG: Keyword/CurrModule/Flair[ExprSpecific]: FOO; name=FOO; sourcetext=FOO
63+
// WITHFLAG: Keyword/CurrModule/Flair[ExprSpecific]: BAR; name=BAR; sourcetext=BAR
6464

6565
// NOFLAG-NOT: FOO
6666
// NOFLAG-NOT: BAR

0 commit comments

Comments
 (0)