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

Side by Side Diff: pkg/analyzer/test/src/task/strong/checker_test.dart

Issue 1579503005: fix #25409, error if a generic method argument did not have a corresponding parameter (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // TODO(jmesserly): this file needs to be refactored, it's a port from 5 // TODO(jmesserly): this file needs to be refactored, it's a port from
6 // package:dev_compiler's tests 6 // package:dev_compiler's tests
7 /// General type checking tests 7 /// General type checking tests
8 library analyzer.test.src.task.strong.checker_test; 8 library analyzer.test.src.task.strong.checker_test;
9 9
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 /*=B*/ then/*<B>*/(/*=B*/ onValue(A a)) => null; 1397 /*=B*/ then/*<B>*/(/*=B*/ onValue(A a)) => null;
1398 } 1398 }
1399 1399
1400 class DerivedFuture3<T> extends Future<T> { 1400 class DerivedFuture3<T> extends Future<T> {
1401 /*=S*/ then/*<S>*/(Object onValue(T t)) => null; 1401 /*=S*/ then/*<S>*/(Object onValue(T t)) => null;
1402 } 1402 }
1403 1403
1404 class DerivedFuture4<A> extends Future<A> { 1404 class DerivedFuture4<A> extends Future<A> {
1405 /*=B*/ then/*<B>*/(Object onValue(A a)) => null; 1405 /*=B*/ then/*<B>*/(Object onValue(A a)) => null;
1406 } 1406 }
1407 ''' 1407 '''
1408 });
1409
1410 testChecker('generic function wrong number of arguments', {
1411 '/main.dart': r'''
1412 /*=T*/ foo/*<T>*/(/*=T*/ x, /*=T*/ y) => x;
1413 /*=T*/ bar/*<T>*/({/*=T*/ x, /*=T*/ y}) => x;
1414
1415 main() {
1416 // resolving thses shouldn't crash.
1417 foo(1, 2, 3);
1418 String x = foo('1', '2', '3');
1419 foo(1);
1420 String x = foo('1');
1421 x = /*severe:STATIC_TYPE_ERROR*/foo(1, 2, 3);
1422 x = /*severe:STATIC_TYPE_ERROR*/foo(1);
1423
1424 // named arguments
1425 bar(y: 1, x: 2, z: 3);
1426 String x = bar(z: '1', x: '2', y: '3');
1427 bar(y: 1);
1428 x = bar(x: '1', z: 42);
1429 x = /*severe:STATIC_TYPE_ERROR*/bar(y: 1, x: 2, z: 3);
1430 x = /*severe:STATIC_TYPE_ERROR*/bar(x: 1);
1431 }
1432 '''
1408 }); 1433 });
1409 1434
1410 testChecker('unary operators', { 1435 testChecker('unary operators', {
1411 '/main.dart': ''' 1436 '/main.dart': '''
1412 class A { 1437 class A {
1413 A operator ~() {} 1438 A operator ~() {}
1414 A operator +(int x) {} 1439 A operator +(int x) {}
1415 A operator -(int x) {} 1440 A operator -(int x) {}
1416 A operator -() {} 1441 A operator -() {}
1417 } 1442 }
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 2533
2509 baz1() sync* { yield* (/*info:DYNAMIC_CAST*/x); } 2534 baz1() sync* { yield* (/*info:DYNAMIC_CAST*/x); }
2510 Iterable baz2() sync* { yield* (/*info:DYNAMIC_CAST*/x); } 2535 Iterable baz2() sync* { yield* (/*info:DYNAMIC_CAST*/x); }
2511 Iterable<int> baz3() sync* { yield* (/*warning:DOWN_CAST_COMPOSITE*/x); } 2536 Iterable<int> baz3() sync* { yield* (/*warning:DOWN_CAST_COMPOSITE*/x); }
2512 Iterable<int> baz4() sync* { yield* new Iterable<int>(); } 2537 Iterable<int> baz4() sync* { yield* new Iterable<int>(); }
2513 Iterable<int> baz5() sync* { yield* (/*info:INFERRED_TYPE_ALLOCATION*/ne w Iterable()); } 2538 Iterable<int> baz5() sync* { yield* (/*info:INFERRED_TYPE_ALLOCATION*/ne w Iterable()); }
2514 ''' 2539 '''
2515 }); 2540 });
2516 }); 2541 });
2517 } 2542 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698