16
16
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_9 > %t
17
17
// RUN: %FileCheck %s -check-prefix=DEFAULT_ARGS_9 < %t
18
18
// RUN: %FileCheck %s -check-prefix=NEGATIVE_DEFAULT_ARGS_9 < %t
19
- //
19
+
20
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARGS_10 | %FileCheck %s -check-prefix=DEFAULT_ARGS_10
21
+
20
22
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_1 | %FileCheck %s -check-prefix=DEFAULT_ARG_INIT
21
23
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_2 | %FileCheck %s -check-prefix=DEFAULT_ARG_INIT_INTCONTEXT
22
24
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=DEFAULT_ARG_INIT_3 | %FileCheck %s -check-prefix=DEFAULT_ARG_INIT_INTCONTEXT
@@ -28,6 +30,9 @@ func freeFuncWithDefaultArgs1(
28
30
func freeFuncWithDefaultArgs2( file: String = #file) { }
29
31
func freeFuncWithDefaultArgs3( a: Int = 0 ) { }
30
32
func freeFuncWithDefaultArgs4( _ a: Int , b: Int = 0 , c: Int = 0 ) { }
33
+ func freeFuncWithDefaultArgs5( a: Int ? = nil ) { }
34
+ func freeFuncWithDefaultArgs6( a: [ Int ] = [ ] ) { }
35
+ func freeFuncWithDefaultArgs7( a: [ Int : Int ] = [ : ] ) { }
31
36
32
37
struct A {
33
38
func methodWithDefaultArgs1( a: Int = 0 ) { }
@@ -60,6 +65,12 @@ func testDefaultArgs1() {
60
65
// DEFAULT_ARGS_1-DAG: Decl[FreeFunction]/CurrModule: freeFuncWithDefaultArgs3({#a: Int#})[#Void#]{{; name=.+$}}
61
66
// DEFAULT_ARGS_1-DAG: Decl[FreeFunction]/CurrModule: freeFuncWithDefaultArgs4({#(a): Int#})[#Void#]{{; name=.+$}}
62
67
// DEFAULT_ARGS_1-DAG: Decl[FreeFunction]/CurrModule: freeFuncWithDefaultArgs4({#(a): Int#}, {#b: Int#}, {#c: Int#})[#Void#]{{; name=.+$}}
68
+ // DEFAULT_ARGS_1-DAG: Decl[FreeFunction]/CurrModule: freeFuncWithDefaultArgs5()[#Void#]{{; name=.+$}}
69
+ // DEFAULT_ARGS_1-DAG: Decl[FreeFunction]/CurrModule: freeFuncWithDefaultArgs5({#a: Int?#})[#Void#]{{; name=.+$}}
70
+ // DEFAULT_ARGS_1-DAG: Decl[FreeFunction]/CurrModule: freeFuncWithDefaultArgs6()[#Void#]{{; name=.+$}}
71
+ // DEFAULT_ARGS_1-DAG: Decl[FreeFunction]/CurrModule: freeFuncWithDefaultArgs6({#a: [Int]#})[#Void#]{{; name=.+$}}
72
+ // DEFAULT_ARGS_1-DAG: Decl[FreeFunction]/CurrModule: freeFuncWithDefaultArgs7()[#Void#]{{; name=.+$}}
73
+ // DEFAULT_ARGS_1-DAG: Decl[FreeFunction]/CurrModule: freeFuncWithDefaultArgs7({#a: [Int : Int]#})[#Void#]{{; name=.+$}}
63
74
// DEFAULT_ARGS_1: End completions
64
75
65
76
func testDefaultArgs2( ) {
@@ -131,6 +142,15 @@ func testDefaultArgs9(_ x: C2) {
131
142
// DEFAULT_ARGS_9: End completions
132
143
// NEGATIVE_DEFAULT_ARGS_9-NOT: methodWithDefaultArgs1()
133
144
145
+ func testDefaultArgs10( ) {
146
+ freeFuncWithDefaultArgs5 ( #^DEFAULT_ARGS_10 ^#)
147
+ // DEFAULT_ARGS_10: Begin completions
148
+ // DEFAULT_ARGS_10-DAG: Decl[FreeFunction]/CurrModule/Flair[ArgLabels]: ['('][')'][#Void#]; name=
149
+ // DEFAULT_ARGS_10-DAG: Decl[FreeFunction]/CurrModule/Flair[ArgLabels]: ['(']{#a: Int?#}[')'][#Void#]; name=a:
150
+ // DEFAULT_ARGS_10: End completions
151
+
152
+ }
153
+
134
154
let globalVar = 1
135
155
func testDefaultArgInit1( x = #^DEFAULT_ARG_INIT_1 ^#) { }
136
156
func testDefaultArgInit2( _: Int = #^DEFAULT_ARG_INIT_2 ^#) { }
0 commit comments