Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: pkg/analyzer/test/generated/non_error_resolver_test.dart

Issue 1143003007: Fix handling of nested typedefs (for real this time). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library engine.non_error_resolver_test; 5 library engine.non_error_resolver_test;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 Source source = addSource(r''' 230 Source source = addSource(r'''
231 typedef A(int p1, String p2); 231 typedef A(int p1, String p2);
232 f(A a) { 232 f(A a) {
233 a(1, '2'); 233 a(1, '2');
234 }'''); 234 }''');
235 resolve(source); 235 resolve(source);
236 assertNoErrors(source); 236 assertNoErrors(source);
237 verify([source]); 237 verify([source]);
238 } 238 }
239 239
240 void test_assignability_function_expr_rettype_from_typedef_cls() {
241 // In the code below, the type of (() => f()) has a return type which is
242 // a class, and that class is inferred from the return type of the typedef
243 // F.
244 Source source = addSource('''
245 class C {}
246 typedef C F();
247 F f;
248 main() {
249 F f2 = (() => f());
250 }
251 ''');
252 resolve(source);
253 assertNoErrors(source);
254 verify([source]);
255 }
256
257 void test_assignability_function_expr_rettype_from_typedef_typedef() {
258 // In the code below, the type of (() => f()) has a return type which is
259 // a typedef, and that typedef is inferred from the return type of the
260 // typedef F.
261 Source source = addSource('''
262 typedef G F();
263 typedef G();
264 F f;
265 main() {
266 F f2 = (() => f());
267 }
268 ''');
269 resolve(source);
270 assertNoErrors(source);
271 verify([source]);
272 }
273
240 void test_assignmentToFinal_prefixNegate() { 274 void test_assignmentToFinal_prefixNegate() {
241 Source source = addSource(r''' 275 Source source = addSource(r'''
242 f() { 276 f() {
243 final x = 0; 277 final x = 0;
244 -x; 278 -x;
245 }'''); 279 }''');
246 resolve(source); 280 resolve(source);
247 assertNoErrors(source); 281 assertNoErrors(source);
248 verify([source]); 282 verify([source]);
249 } 283 }
(...skipping 5219 matching lines...) Expand 10 before | Expand all | Expand 10 after
5469 resolve(source); 5503 resolve(source);
5470 assertNoErrors(source); 5504 assertNoErrors(source);
5471 verify([source]); 5505 verify([source]);
5472 reset(); 5506 reset();
5473 } 5507 }
5474 5508
5475 void _check_wrongNumberOfParametersForOperator1(String name) { 5509 void _check_wrongNumberOfParametersForOperator1(String name) {
5476 _check_wrongNumberOfParametersForOperator(name, "a"); 5510 _check_wrongNumberOfParametersForOperator(name, "a");
5477 } 5511 }
5478 } 5512 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/element_test.dart ('k') | pkg/analyzer/test/generated/static_type_warning_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698