@@ -42,21 +42,39 @@ class FeatureComputerTest extends AbstractSingleUnitTest {
4242 }
4343 }
4444
45- Future <void > test_argumentList_first () async {
45+ Future <void > test_argumentList_named () async {
4646 await assertContextType ('''
47- void f(int i, String str , bool b) {}
47+ void f({ int i, String s , bool b} ) {}
4848void g(int j) {
49- f(^j );
49+ f(i:^ );
5050}
5151''' , 'int' );
5252 }
5353
54- @failingTest
55- Future <void > test_argumentList_implicitFirst () async {
54+ Future <void > test_argumentList_named2 () async {
5655 await assertContextType ('''
57- void f(int i, String str , bool b) {}
56+ void f({ int i, String s , bool b} ) {}
5857void g(int j) {
59- f(^);
58+ f(s:^);
59+ }
60+ ''' , 'String' );
61+ }
62+
63+ Future <void > test_argumentList_named_with_requiredPositional () async {
64+ await assertContextType ('''
65+ void f(String s, {int i}) {}
66+ void g(int j) {
67+ f('str', i: ^);
68+ }
69+ ''' , 'int' );
70+ }
71+
72+ Future <void >
73+ test_argumentList_named_with_requiredPositional_defaultValue () async {
74+ await assertContextType ('''
75+ void f(String s, {int i = 0}) {}
76+ void g(int j) {
77+ f('str', i: ^);
6078}
6179''' , 'int' );
6280 }
@@ -70,46 +88,116 @@ void g() {
7088''' , null );
7189 }
7290
73- Future <void > test_argumentList_noParameters_whitespage () async {
91+ Future <void > test_argumentList_noParameters_whitespace () async {
7492 await assertContextType ('''
7593void f() {}
7694void g() {
77- f( ^ );
95+ f( ^ );
7896}
7997''' , null );
8098 }
8199
82- @failingTest
83- Future <void > test_argumentList_secondArg () async {
100+ Future <void > test_argumentList_noParameters_whitespace_left () async {
84101 await assertContextType ('''
85- void f(int i, String str, bool b) {}
102+ void f() {}
103+ void g() {
104+ f( ^);
105+ }
106+ ''' , null );
107+ }
108+
109+ Future <void > test_argumentList_noParameters_whitespace_right () async {
110+ await assertContextType ('''
111+ void f() {}
112+ void g() {
113+ f(^ );
114+ }
115+ ''' , null );
116+ }
117+
118+ Future <void > test_argumentList_positional () async {
119+ await assertContextType ('''
120+ void f([int i]) {}
86121void g(int j) {
87- f(1, ^);
122+ f(i: ^);
88123}
89- ''' , 'String' );
124+ ''' , 'int' );
125+ }
126+
127+ Future <void > test_argumentList_positional_completionInLabel () async {
128+ await assertContextType ('''
129+ void f([int i = 2]) {}
130+ void g(int j) {
131+ f(^i:);
132+ }
133+ ''' , null );
134+ }
135+
136+ Future <void > test_argumentList_positional_completionInLabel2 () async {
137+ await assertContextType ('''
138+ void f(String s, bool b, [int i = 2]) {}
139+ void g(int j) {
140+ f(i^:);
141+ }
142+ ''' , null );
143+ }
144+
145+ Future <void > test_argumentList_positional_whitespace () async {
146+ await assertContextType ('''
147+ void f([int i]) {}
148+ void g(int j) {
149+ f(i: ^ );
150+ }
151+ ''' , 'int' );
90152 }
91153
92- Future <void > test_argumentList_secondArg2 () async {
154+ Future <void > test_argumentList_positional_with_requiredPositional () async {
155+ await assertContextType ('''
156+ void f(String s, bool b, [int i]) {}
157+ void g(int j) {
158+ f('', 3, i:^);
159+ }
160+ ''' , 'int' );
161+ }
162+
163+ Future <void >
164+ test_argumentList_positional_with_requiredPositional_defaultValue () async {
165+ await assertContextType ('''
166+ void f(String s, bool b, [int i = 2]) {}
167+ void g(int j) {
168+ f('', 3, i:^);
169+ }
170+ ''' , 'int' );
171+ }
172+
173+ Future <void > test_argumentList_requiredPositional_first () async {
93174 await assertContextType ('''
94175void f(int i, String str, bool b) {}
95176void g(int j) {
96- f(1, w^ );
177+ f(^j );
97178}
98- ''' , 'String ' );
179+ ''' , 'int ' );
99180 }
100181
101- @failingTest
102- Future <void > test_argumentList_thirdArg () async {
182+ Future <void > test_argumentList_requiredPositional_first_implicit () async {
183+ await assertContextType ('''
184+ void f(int i, String str, bool b) {}
185+ void g() {
186+ f(^);
187+ }
188+ ''' , 'int' );
189+ }
190+
191+ Future <void > test_argumentList_requiredPositional_last () async {
103192 await assertContextType ('''
104193void f(int i, String str, bool b) {}
105194void g(int j) {
106- f(1, '2', ^);
195+ f(1, '2', t ^);
107196}
108197''' , 'bool' );
109198 }
110199
111- @failingTest
112- Future <void > test_argumentList_thirdArg2 () async {
200+ Future <void > test_argumentList_requiredPositional_last_implicit () async {
113201 await assertContextType ('''
114202void f(int i, String str, bool b, num n) {}
115203void g(int j) {
@@ -118,6 +206,33 @@ void g(int j) {
118206''' , 'bool' );
119207 }
120208
209+ Future <void > test_argumentList_requiredPositional_middle () async {
210+ await assertContextType ('''
211+ void f(int i, String str, bool b) {}
212+ void g(int j) {
213+ f(1, w^);
214+ }
215+ ''' , 'String' );
216+ }
217+
218+ Future <void > test_argumentList_requiredPositional_middle2 () async {
219+ await assertContextType ('''
220+ void f(int i, String str, bool b) {}
221+ void g(int j) {
222+ f(1, ^, );
223+ }
224+ ''' , 'String' );
225+ }
226+
227+ Future <void > test_argumentList_requiredPositional_middle_implicit () async {
228+ await assertContextType ('''
229+ void f(int i, String str, bool b) {}
230+ void g(int j) {
231+ f(1, ^ );
232+ }
233+ ''' , 'String' );
234+ }
235+
121236 Future <void > test_assertInitializer_with_identifier () async {
122237 await assertContextType ('''
123238class C {
0 commit comments