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

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

Issue 894063004: Fix return type checking for generator functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.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) 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/error.dart'; 9 import 'package:analyzer/src/generated/error.dart';
10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 void test_dynamicIdentifier() { 1273 void test_dynamicIdentifier() {
1274 Source source = addSource(r''' 1274 Source source = addSource(r'''
1275 main() { 1275 main() {
1276 var v = dynamic; 1276 var v = dynamic;
1277 }'''); 1277 }''');
1278 resolve(source); 1278 resolve(source);
1279 assertNoErrors(source); 1279 assertNoErrors(source);
1280 verify([source]); 1280 verify([source]);
1281 } 1281 }
1282 1282
1283 void test_empty_generator_async() {
1284 Source source = addSource('''
1285 import 'dart:async';
1286 Stream<int> f() async* {
1287 }
1288 ''');
1289 resolve(source);
1290 assertNoErrors(source);
1291 verify([source]);
1292 }
1293
1294 void test_empty_generator_sync() {
1295 Source source = addSource('''
1296 Iterable<int> f() sync* {
1297 }
1298 ''');
1299 resolve(source);
1300 assertNoErrors(source);
1301 verify([source]);
1302 }
1303
1283 void test_expectedOneListTypeArgument() { 1304 void test_expectedOneListTypeArgument() {
1284 Source source = addSource(r''' 1305 Source source = addSource(r'''
1285 main() { 1306 main() {
1286 <int> []; 1307 <int> [];
1287 }'''); 1308 }''');
1288 resolve(source); 1309 resolve(source);
1289 assertNoErrors(source); 1310 assertNoErrors(source);
1290 verify([source]); 1311 verify([source]);
1291 } 1312 }
1292 1313
(...skipping 20 matching lines...) Expand all
1313 void test_exportOfNonLibrary_libraryNotDeclared() { 1334 void test_exportOfNonLibrary_libraryNotDeclared() {
1314 Source source = addSource(r''' 1335 Source source = addSource(r'''
1315 library L; 1336 library L;
1316 export 'lib1.dart';'''); 1337 export 'lib1.dart';''');
1317 addNamedSource("/lib1.dart", ""); 1338 addNamedSource("/lib1.dart", "");
1318 resolve(source); 1339 resolve(source);
1319 assertNoErrors(source); 1340 assertNoErrors(source);
1320 verify([source]); 1341 verify([source]);
1321 } 1342 }
1322 1343
1344 void test_extraPositionalArguments_Function() {
1345 Source source = addSource(r'''
1346 f(Function a) {
1347 a(1, 2);
1348 }''');
1349 resolve(source);
1350 assertNoErrors(source);
1351 verify([source]);
1352 }
1353
1323 void test_extraPositionalArguments_function() { 1354 void test_extraPositionalArguments_function() {
1324 Source source = addSource(r''' 1355 Source source = addSource(r'''
1325 f(p1, p2) {} 1356 f(p1, p2) {}
1326 main() { 1357 main() {
1327 f(1, 2); 1358 f(1, 2);
1328 }'''); 1359 }''');
1329 resolve(source); 1360 resolve(source);
1330 assertNoErrors(source); 1361 assertNoErrors(source);
1331 verify([source]);
1332 }
1333
1334 void test_extraPositionalArguments_Function() {
1335 Source source = addSource(r'''
1336 f(Function a) {
1337 a(1, 2);
1338 }''');
1339 resolve(source);
1340 assertNoErrors(source);
1341 verify([source]); 1362 verify([source]);
1342 } 1363 }
1343 1364
1344 void test_extraPositionalArguments_implicitConstructor() { 1365 void test_extraPositionalArguments_implicitConstructor() {
1345 Source source = addSource(r''' 1366 Source source = addSource(r'''
1346 class A<E extends num> { 1367 class A<E extends num> {
1347 A(E x, E y); 1368 A(E x, E y);
1348 } 1369 }
1349 class M {} 1370 class M {}
1350 class B<E extends num> = A<E> with M; 1371 class B<E extends num> = A<E> with M;
(...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after
4023 class A { 4044 class A {
4024 void m() { 4045 void m() {
4025 try {} catch (e) {rethrow;} 4046 try {} catch (e) {rethrow;}
4026 } 4047 }
4027 }'''); 4048 }''');
4028 resolve(source); 4049 resolve(source);
4029 assertNoErrors(source); 4050 assertNoErrors(source);
4030 verify([source]); 4051 verify([source]);
4031 } 4052 }
4032 4053
4054 void test_return_in_generator_async() {
4055 Source source = addSource('''
4056 import 'dart:async';
4057 Stream<int> f() async* {
4058 return;
4059 }
4060 ''');
4061 resolve(source);
4062 assertNoErrors(source);
4063 verify([source]);
4064 }
4065
4066 void test_return_in_generator_sync() {
4067 Source source = addSource('''
4068 Iterable<int> f() sync* {
4069 return;
4070 }
4071 ''');
4072 resolve(source);
4073 assertNoErrors(source);
4074 verify([source]);
4075 }
4076
4033 void test_returnInGenerativeConstructor() { 4077 void test_returnInGenerativeConstructor() {
4034 Source source = addSource(r''' 4078 Source source = addSource(r'''
4035 class A { 4079 class A {
4036 A() { return; } 4080 A() { return; }
4037 }'''); 4081 }''');
4038 resolve(source); 4082 resolve(source);
4039 assertNoErrors(source); 4083 assertNoErrors(source);
4040 verify([source]); 4084 verify([source]);
4041 } 4085 }
4042 4086
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
5016 resolve(source); 5060 resolve(source);
5017 assertNoErrors(source); 5061 assertNoErrors(source);
5018 verify([source]); 5062 verify([source]);
5019 reset(); 5063 reset();
5020 } 5064 }
5021 5065
5022 void _check_wrongNumberOfParametersForOperator1(String name) { 5066 void _check_wrongNumberOfParametersForOperator1(String name) {
5023 _check_wrongNumberOfParametersForOperator(name, "a"); 5067 _check_wrongNumberOfParametersForOperator(name, "a");
5024 } 5068 }
5025 } 5069 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698