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

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

Issue 2295853002: fix #26992, inference failures are now an error (Closed)
Patch Set: fix comment Created 4 years, 3 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) 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 library analyzer.test.src.task.strong.checker_test; 5 library analyzer.test.src.task.strong.checker_test;
6 6
7 import 'package:test_reflective_loader/test_reflective_loader.dart'; 7 import 'package:test_reflective_loader/test_reflective_loader.dart';
8 8
9 import 'strong_test_helper.dart'; 9 import 'strong_test_helper.dart';
10 10
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 /*=T*/ foo/*<T>*/(/*=T*/ x, /*=T*/ y) => x; 1850 /*=T*/ foo/*<T>*/(/*=T*/ x, /*=T*/ y) => x;
1851 /*=T*/ bar/*<T>*/({/*=T*/ x, /*=T*/ y}) => x; 1851 /*=T*/ bar/*<T>*/({/*=T*/ x, /*=T*/ y}) => x;
1852 1852
1853 main() { 1853 main() {
1854 String x; 1854 String x;
1855 // resolving these shouldn't crash. 1855 // resolving these shouldn't crash.
1856 foo/*error:EXTRA_POSITIONAL_ARGUMENTS*/(1, 2, 3); 1856 foo/*error:EXTRA_POSITIONAL_ARGUMENTS*/(1, 2, 3);
1857 x = foo/*error:EXTRA_POSITIONAL_ARGUMENTS*/('1', '2', '3'); 1857 x = foo/*error:EXTRA_POSITIONAL_ARGUMENTS*/('1', '2', '3');
1858 foo/*error:NOT_ENOUGH_REQUIRED_ARGUMENTS*/(1); 1858 foo/*error:NOT_ENOUGH_REQUIRED_ARGUMENTS*/(1);
1859 x = foo/*error:NOT_ENOUGH_REQUIRED_ARGUMENTS*/('1'); 1859 x = foo/*error:NOT_ENOUGH_REQUIRED_ARGUMENTS*/('1');
1860 x = /*info:DYNAMIC_CAST*/foo/*error:EXTRA_POSITIONAL_ARGUMENTS*/(1, 2, 3); 1860 x = /*error:COULD_NOT_INFER*/foo/*error:EXTRA_POSITIONAL_ARGUMENTS*/(/*error:A RGUMENT_TYPE_NOT_ASSIGNABLE*/1, /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/2, 3);
1861 x = /*info:DYNAMIC_CAST*/foo/*error:NOT_ENOUGH_REQUIRED_ARGUMENTS*/(1); 1861 x = /*error:COULD_NOT_INFER*/foo/*error:NOT_ENOUGH_REQUIRED_ARGUMENTS*/(/*erro r:ARGUMENT_TYPE_NOT_ASSIGNABLE*/1);
1862 1862
1863 // named arguments 1863 // named arguments
1864 bar(y: 1, x: 2, /*error:UNDEFINED_NAMED_PARAMETER*/z: 3); 1864 bar(y: 1, x: 2, /*error:UNDEFINED_NAMED_PARAMETER*/z: 3);
1865 x = bar(/*error:UNDEFINED_NAMED_PARAMETER*/z: '1', x: '2', y: '3'); 1865 x = bar(/*error:UNDEFINED_NAMED_PARAMETER*/z: '1', x: '2', y: '3');
1866 bar(y: 1); 1866 bar(y: 1);
1867 x = bar(x: '1', /*error:UNDEFINED_NAMED_PARAMETER*/z: 42); 1867 x = bar(x: '1', /*error:UNDEFINED_NAMED_PARAMETER*/z: 42);
1868 x = /*info:DYNAMIC_CAST*/bar(y: 1, x: 2, /*error:UNDEFINED_NAMED_PARAMETER*/z: 3); 1868 x = /*error:COULD_NOT_INFER*/bar(/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/y: 1, / *error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/x: 2, /*error:UNDEFINED_NAMED_PARAMETER*/z: 3);
1869 x = /*info:DYNAMIC_CAST*/bar(x: 1); 1869 x = /*error:COULD_NOT_INFER*/bar(/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/x: 1);
1870 } 1870 }
1871 '''); 1871 ''');
1872 } 1872 }
1873 1873
1874 void test_genericMethodOverride() { 1874 void test_genericMethodOverride() {
1875 checkFile(''' 1875 checkFile('''
1876 class Future<T> { 1876 class Future<T> {
1877 /*=S*/ then/*<S>*/(/*=S*/ onValue(T t)) => null; 1877 /*=S*/ then/*<S>*/(/*=S*/ onValue(T t)) => null;
1878 } 1878 }
1879 1879
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
3727 // Regression test for https://github.com/dart-lang/sdk/issues/25069 3727 // Regression test for https://github.com/dart-lang/sdk/issues/25069
3728 checkFile(''' 3728 checkFile('''
3729 typedef int Foo(); 3729 typedef int Foo();
3730 void foo() {} 3730 void foo() {}
3731 void main () { 3731 void main () {
3732 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); 3732 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo();
3733 } 3733 }
3734 '''); 3734 ''');
3735 } 3735 }
3736 } 3736 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698