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

Side by Side Diff: test/checker/inferred_type_test.dart

Issue 1050703002: Downwards closure inference (Closed) Base URL: git@github.com:dart-lang/dart-dev-compiler.git@master
Patch Set: Created 5 years, 8 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 /// Tests for type inference. 5 /// Tests for type inference.
6 library dev_compiler.test.inferred_type_test; 6 library dev_compiler.test.inferred_type_test;
7 7
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 import 'package:dev_compiler/src/testing.dart'; 10 import 'package:dev_compiler/src/testing.dart';
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 { 1233 {
1234 int f(int x) {}; 1234 int f(int x) {};
1235 A<int> = new A(f); 1235 A<int> = new A(f);
1236 } 1236 }
1237 } 1237 }
1238 ''' 1238 '''
1239 }, inferDownwards: true); 1239 }, inferDownwards: true);
1240 }); 1240 });
1241 1241
1242 test('downwards inference on instance creations', () { 1242 test('downwards inference on instance creations', () {
1243 String mk(String error) => ''' 1243 String mk(String info) => '''
Leaf 2015/03/31 23:41:34 Renamed this to info, as suggest in comments to an
1244 class A<S, T> { 1244 class A<S, T> {
1245 S x; 1245 S x;
1246 T y; 1246 T y;
1247 A(this.x, this.y); 1247 A(this.x, this.y);
1248 A.named(this.x, this.y); 1248 A.named(this.x, this.y);
1249 } 1249 }
1250 1250
1251 class B<S, T> extends A<T, S> { 1251 class B<S, T> extends A<T, S> {
1252 B(S y, T x) : super(x, y); 1252 B(S y, T x) : super(x, y);
1253 B.named(S y, T x) : super.named(x, y); 1253 B.named(S y, T x) : super.named(x, y);
(...skipping 13 matching lines...) Expand all
1267 E(T a) : super(null, a); 1267 E(T a) : super(null, a);
1268 } 1268 }
1269 1269
1270 class F<S, T> extends A<S, T> { 1270 class F<S, T> extends A<S, T> {
1271 F(S x, T y, {List<S> a, List<T> b}) : super(x, y); 1271 F(S x, T y, {List<S> a, List<T> b}) : super(x, y);
1272 F.named(S x, T y, [S a, T b]) : super(a, b); 1272 F.named(S x, T y, [S a, T b]) : super(a, b);
1273 } 1273 }
1274 1274
1275 void main() { 1275 void main() {
1276 { 1276 {
1277 A<int, String> a0 = /*$error*/new A(3, "hello"); 1277 A<int, String> a0 = /*$info*/new A(3, "hello");
1278 A<int, String> a1 = /*$error*/new A.named(3, "hello"); 1278 A<int, String> a1 = /*$info*/new A.named(3, "hello");
1279 A<int, String> a2 = new A<int, String>(3, "hello"); 1279 A<int, String> a2 = new A<int, String>(3, "hello");
1280 A<int, String> a3 = new A<int, String>.named(3, "hello"); 1280 A<int, String> a3 = new A<int, String>.named(3, "hello");
1281 A<int, String> a4 = /*severe:StaticTypeError*/new A<int, dynamic>(3, " hello"); 1281 A<int, String> a4 = /*severe:StaticTypeError*/new A<int, dynamic>(3, " hello");
1282 A<int, String> a5 = /*severe:StaticTypeError*/new A<dynamic, dynamic>. named(3, "hello"); 1282 A<int, String> a5 = /*severe:StaticTypeError*/new A<dynamic, dynamic>. named(3, "hello");
1283 } 1283 }
1284 { 1284 {
1285 A<int, String> a0 = /*severe:StaticTypeError*/new A("hello", 3); 1285 A<int, String> a0 = /*severe:StaticTypeError*/new A("hello", 3);
1286 A<int, String> a1 = /*severe:StaticTypeError*/new A.named("hello", 3); 1286 A<int, String> a1 = /*severe:StaticTypeError*/new A.named("hello", 3);
1287 } 1287 }
1288 { 1288 {
1289 A<int, String> a0 = /*$error*/new B("hello", 3); 1289 A<int, String> a0 = /*$info*/new B("hello", 3);
1290 A<int, String> a1 = /*$error*/new B.named("hello", 3); 1290 A<int, String> a1 = /*$info*/new B.named("hello", 3);
1291 A<int, String> a2 = new B<String, int>("hello", 3); 1291 A<int, String> a2 = new B<String, int>("hello", 3);
1292 A<int, String> a3 = new B<String, int>.named("hello", 3); 1292 A<int, String> a3 = new B<String, int>.named("hello", 3);
1293 A<int, String> a4 = /*severe:StaticTypeError*/new B<String, dynamic>(" hello", 3); 1293 A<int, String> a4 = /*severe:StaticTypeError*/new B<String, dynamic>(" hello", 3);
1294 A<int, String> a5 = /*severe:StaticTypeError*/new B<dynamic, dynamic>. named("hello", 3); 1294 A<int, String> a5 = /*severe:StaticTypeError*/new B<dynamic, dynamic>. named("hello", 3);
1295 } 1295 }
1296 { 1296 {
1297 A<int, String> a0 = /*severe:StaticTypeError*/new B(3, "hello"); 1297 A<int, String> a0 = /*severe:StaticTypeError*/new B(3, "hello");
1298 A<int, String> a1 = /*severe:StaticTypeError*/new B.named(3, "hello"); 1298 A<int, String> a1 = /*severe:StaticTypeError*/new B.named(3, "hello");
1299 } 1299 }
1300 { 1300 {
1301 A<int, int> a0 = /*$error*/new C(3); 1301 A<int, int> a0 = /*$info*/new C(3);
1302 A<int, int> a1 = /*$error*/new C.named(3); 1302 A<int, int> a1 = /*$info*/new C.named(3);
1303 A<int, int> a2 = new C<int>(3); 1303 A<int, int> a2 = new C<int>(3);
1304 A<int, int> a3 = new C<int>.named(3); 1304 A<int, int> a3 = new C<int>.named(3);
1305 A<int, int> a4 = /*severe:StaticTypeError*/new C<dynamic>(3); 1305 A<int, int> a4 = /*severe:StaticTypeError*/new C<dynamic>(3);
1306 A<int, int> a5 = /*severe:StaticTypeError*/new C<dynamic>.named(3); 1306 A<int, int> a5 = /*severe:StaticTypeError*/new C<dynamic>.named(3);
1307 } 1307 }
1308 { 1308 {
1309 A<int, int> a0 = /*severe:StaticTypeError*/new C("hello"); 1309 A<int, int> a0 = /*severe:StaticTypeError*/new C("hello");
1310 A<int, int> a1 = /*severe:StaticTypeError*/new C.named("hello"); 1310 A<int, int> a1 = /*severe:StaticTypeError*/new C.named("hello");
1311 } 1311 }
1312 { 1312 {
1313 A<int, String> a0 = /*$error*/new D("hello"); 1313 A<int, String> a0 = /*$info*/new D("hello");
1314 A<int, String> a1 = /*$error*/new D.named("hello"); 1314 A<int, String> a1 = /*$info*/new D.named("hello");
1315 A<int, String> a2 = new D<int, String>("hello"); 1315 A<int, String> a2 = new D<int, String>("hello");
1316 A<int, String> a3 = new D<String, String>.named("hello"); 1316 A<int, String> a3 = new D<String, String>.named("hello");
1317 A<int, String> a4 = /*severe:StaticTypeError*/new D<num, dynamic>("hel lo"); 1317 A<int, String> a4 = /*severe:StaticTypeError*/new D<num, dynamic>("hel lo");
1318 A<int, String> a5 = /*severe:StaticTypeError*/new D<dynamic, dynamic>. named("hello"); 1318 A<int, String> a5 = /*severe:StaticTypeError*/new D<dynamic, dynamic>. named("hello");
1319 } 1319 }
1320 { 1320 {
1321 A<int, String> a0 = /*severe:StaticTypeError*/new D(3); 1321 A<int, String> a0 = /*severe:StaticTypeError*/new D(3);
1322 A<int, String> a1 = /*severe:StaticTypeError*/new D.named(3); 1322 A<int, String> a1 = /*severe:StaticTypeError*/new D.named(3);
1323 } 1323 }
1324 { // Currently we only allow variable constraints. Test that we reject. 1324 { // Currently we only allow variable constraints. Test that we reject.
1325 A<C<int>, String> a0 = /*severe:StaticTypeError*/new E("hello"); 1325 A<C<int>, String> a0 = /*severe:StaticTypeError*/new E("hello");
1326 } 1326 }
1327 { // Check named and optional arguments 1327 { // Check named and optional arguments
1328 A<int, String> a0 = /*$error*/new F(3, "hello", a: [3], b: ["hello"]); 1328 A<int, String> a0 = /*$info*/new F(3, "hello", a: [3], b: ["hello"]);
1329 A<int, String> a1 = /*severe:StaticTypeError*/new F(3, "hello", a: ["h ello"], b:[3]); 1329 A<int, String> a1 = /*severe:StaticTypeError*/new F(3, "hello", a: ["h ello"], b:[3]);
1330 A<int, String> a2 = /*$error*/new F.named(3, "hello", 3, "hello"); 1330 A<int, String> a2 = /*$info*/new F.named(3, "hello", 3, "hello");
1331 A<int, String> a3 = /*$error*/new F.named(3, "hello"); 1331 A<int, String> a3 = /*$info*/new F.named(3, "hello");
1332 A<int, String> a4 = /*severe:StaticTypeError*/new F.named(3, "hello", "hello", 3); 1332 A<int, String> a4 = /*severe:StaticTypeError*/new F.named(3, "hello", "hello", 3);
1333 A<int, String> a5 = /*severe:StaticTypeError*/new F.named(3, "hello", "hello"); 1333 A<int, String> a5 = /*severe:StaticTypeError*/new F.named(3, "hello", "hello");
1334 } 1334 }
1335 } 1335 }
1336 '''; 1336 ''';
1337 testChecker({'/main.dart': mk("info:InferredTypeAllocation")}, 1337 testChecker({'/main.dart': mk("info:InferredTypeAllocation")},
1338 inferDownwards: true); 1338 inferDownwards: true);
1339 testChecker({'/main.dart': mk("severe:StaticTypeError")}, 1339 testChecker({'/main.dart': mk("severe:StaticTypeError")},
1340 inferDownwards: false); 1340 inferDownwards: false);
1341 }); 1341 });
1342 1342
1343 test('downwards inference on list literals', () { 1343 test('downwards inference on list literals', () {
1344 String mk(String error) => ''' 1344 String mk(String info) => '''
Leaf 2015/03/31 23:41:34 Moved the code into main with scoping, since the v
1345 List<int> l0 = /*$error*/[]; 1345 void main() {
1346 List<int> l1 = /*$error*/[3]; 1346 {
1347 List<int> l2 = /*severe:StaticTypeError*/["hello"]; 1347 List<int> l0 = /*$info*/[];
1348 List<int> l3 = /*severe:StaticTypeError*/["hello", 3]; 1348 List<int> l1 = /*$info*/[3];
1349 1349 List<int> l2 = /*severe:StaticTypeError*/["hello"];
1350 List<dynamic> l0 = []; 1350 List<int> l3 = /*severe:StaticTypeError*/["hello", 3];
1351 List<dynamic> l1 = [3]; 1351 }
1352 List<dynamic> l2 = ["hello"]; 1352 {
1353 List<dynamic> l3 = ["hello", 3]; 1353 List<dynamic> l0 = [];
1354 1354 List<dynamic> l1 = [3];
1355 List<int> l0 = /*severe:StaticTypeError*/<num>[]; 1355 List<dynamic> l2 = ["hello"];
1356 List<int> l1 = /*severe:StaticTypeError*/<num>[3]; 1356 List<dynamic> l3 = ["hello", 3];
1357 List<int> l2 = /*severe:StaticTypeError*/<num>[/*severe:StaticTypeError*/" hello"]; 1357 }
1358 List<int> l3 = /*severe:StaticTypeError*/<num>[/*severe:StaticTypeError*/" hello", 3]; 1358 {
1359 1359 List<int> l0 = /*severe:StaticTypeError*/<num>[];
1360 Iterable<int> i0 = /*$error*/[]; 1360 List<int> l1 = /*severe:StaticTypeError*/<num>[3];
1361 Iterable<int> i1 = /*$error*/[3]; 1361 List<int> l2 = /*severe:StaticTypeError*/<num>[/*severe:StaticTypeErro r*/"hello"];
1362 Iterable<int> i2 = /*severe:StaticTypeError*/["hello"]; 1362 List<int> l3 = /*severe:StaticTypeError*/<num>[/*severe:StaticTypeErro r*/"hello", 3];
1363 Iterable<int> i3 = /*severe:StaticTypeError*/["hello", 3]; 1363 }
1364 1364 {
1365 const List<int> c0 = /*$error*/const []; 1365 Iterable<int> i0 = /*$info*/[];
1366 const List<int> c1 = /*$error*/const [3]; 1366 Iterable<int> i1 = /*$info*/[3];
1367 const List<int> c2 = /*severe:StaticTypeError*/const ["hello"]; 1367 Iterable<int> i2 = /*severe:StaticTypeError*/["hello"];
1368 const List<int> c3 = /*severe:StaticTypeError*/const ["hello", 3]; 1368 Iterable<int> i3 = /*severe:StaticTypeError*/["hello", 3];
1369 '''; 1369 }
1370 {
1371 const List<int> c0 = /*$info*/const [];
1372 const List<int> c1 = /*$info*/const [3];
1373 const List<int> c2 = /*severe:StaticTypeError*/const ["hello"];
1374 const List<int> c3 = /*severe:StaticTypeError*/const ["hello", 3];
1375 }
1376 }
1377 ''';
1370 testChecker({'/main.dart': mk("info:InferredTypeLiteral")}, 1378 testChecker({'/main.dart': mk("info:InferredTypeLiteral")},
1371 inferDownwards: true); 1379 inferDownwards: true);
1372 testChecker({'/main.dart': mk("severe:StaticTypeError")}, 1380 testChecker({'/main.dart': mk("severe:StaticTypeError")},
1373 inferDownwards: false); 1381 inferDownwards: false);
1374 }); 1382 });
1375 1383
1376 test('downwards inference on function arguments', () { 1384 test('downwards inference on function arguments', () {
1377 String mk(String error) => ''' 1385 String mk(String info) => '''
1378 void f0(List<int> a) {}; 1386 void f0(List<int> a) {};
1379 void f1({List<int> a}) {}; 1387 void f1({List<int> a}) {};
1380 void f2(Iterable<int> a) {}; 1388 void f2(Iterable<int> a) {};
1381 void f3(Iterable<Iterable<int>> a) {}; 1389 void f3(Iterable<Iterable<int>> a) {};
1382 void f4({Iterable<Iterable<int>> a}) {}; 1390 void f4({Iterable<Iterable<int>> a}) {};
1383 void main() { 1391 void main() {
1384 f0(/*$error*/[]); 1392 f0(/*$info*/[]);
1385 f0(/*$error*/[3]); 1393 f0(/*$info*/[3]);
1386 f0(/*severe:StaticTypeError*/["hello"]); 1394 f0(/*severe:StaticTypeError*/["hello"]);
1387 f0(/*severe:StaticTypeError*/["hello", 3]); 1395 f0(/*severe:StaticTypeError*/["hello", 3]);
1388 1396
1389 f1(a: /*$error*/[]); 1397 f1(a: /*$info*/[]);
1390 f1(a: /*$error*/[3]); 1398 f1(a: /*$info*/[3]);
1391 f1(a: /*severe:StaticTypeError*/["hello"]); 1399 f1(a: /*severe:StaticTypeError*/["hello"]);
1392 f1(a: /*severe:StaticTypeError*/["hello", 3]); 1400 f1(a: /*severe:StaticTypeError*/["hello", 3]);
1393 1401
1394 f2(/*$error*/[]); 1402 f2(/*$info*/[]);
1395 f2(/*$error*/[3]); 1403 f2(/*$info*/[3]);
1396 f2(/*severe:StaticTypeError*/["hello"]); 1404 f2(/*severe:StaticTypeError*/["hello"]);
1397 f2(/*severe:StaticTypeError*/["hello", 3]); 1405 f2(/*severe:StaticTypeError*/["hello", 3]);
1398 1406
1399 f3(/*$error*/[]); 1407 f3(/*$info*/[]);
1400 f3(/*$error*/[[3]]); 1408 f3(/*$info*/[[3]]);
1401 f3(/*severe:StaticTypeError*/[["hello"]]); 1409 f3(/*severe:StaticTypeError*/[["hello"]]);
1402 f3(/*severe:StaticTypeError*/[["hello"], [3]]); 1410 f3(/*severe:StaticTypeError*/[["hello"], [3]]);
1403 1411
1404 f4(a: /*$error*/[]); 1412 f4(a: /*$info*/[]);
1405 f4(a: /*$error*/[[3]]); 1413 f4(a: /*$info*/[[3]]);
1406 f4(a: /*severe:StaticTypeError*/[["hello"]]); 1414 f4(a: /*severe:StaticTypeError*/[["hello"]]);
1407 f4(a: /*severe:StaticTypeError*/[["hello"], [3]]); 1415 f4(a: /*severe:StaticTypeError*/[["hello"], [3]]);
1408 } 1416 }
1409 '''; 1417 ''';
1410 testChecker({'/main.dart': mk("info:InferredTypeLiteral")}, 1418 testChecker({'/main.dart': mk("info:InferredTypeLiteral")},
1411 inferDownwards: true); 1419 inferDownwards: true);
1412 testChecker({'/main.dart': mk("severe:StaticTypeError")}, 1420 testChecker({'/main.dart': mk("severe:StaticTypeError")},
1413 inferDownwards: false); 1421 inferDownwards: false);
1414 }); 1422 });
1415 1423
1416 test('downwards inference on map literals', () { 1424 test('downwards inference on map literals', () {
1417 String mk(String error) => ''' 1425 String mk(String info) => '''
1418 Map<int, String> l0 = /*$error*/{}; 1426 void main() {
1419 Map<int, String> l1 = /*$error*/{3: "hello"}; 1427 {
1420 Map<int, String> l2 = /*severe:StaticTypeError*/{"hello": "hello"}; 1428 Map<int, String> l0 = /*$info*/{};
1421 Map<int, String> l3 = /*severe:StaticTypeError*/{3: 3}; 1429 Map<int, String> l1 = /*$info*/{3: "hello"};
1422 Map<int, String> l4 = /*severe:StaticTypeError*/{3:"hello", "hello": 3}; 1430 Map<int, String> l2 = /*severe:StaticTypeError*/{"hello": "hello"};
1423 1431 Map<int, String> l3 = /*severe:StaticTypeError*/{3: 3};
1424 Map<dynamic, dynamic> l0 = {}; 1432 Map<int, String> l4 = /*severe:StaticTypeError*/{3:"hello", "hello": 3 };
1425 Map<dynamic, dynamic> l1 = {3: "hello"}; 1433 }
1426 Map<dynamic, dynamic> l2 = {"hello": "hello"}; 1434 {
1427 Map<dynamic, dynamic> l3 = {3: 3}; 1435 Map<dynamic, dynamic> l0 = {};
1428 Map<dynamic, dynamic> l4 = {3:"hello", "hello": 3}; 1436 Map<dynamic, dynamic> l1 = {3: "hello"};
1429 1437 Map<dynamic, dynamic> l2 = {"hello": "hello"};
1430 Map<dynamic, String> l0 = /*$error*/{}; 1438 Map<dynamic, dynamic> l3 = {3: 3};
1431 Map<dynamic, String> l1 = /*$error*/{3: "hello"}; 1439 Map<dynamic, dynamic> l4 = {3:"hello", "hello": 3};
1432 Map<dynamic, String> l2 = /*$error*/{"hello": "hello"}; 1440 }
1433 Map<dynamic, String> l3 = /*severe:StaticTypeError*/{3: 3}; 1441 {
1434 Map<dynamic, String> l4 = /*severe:StaticTypeError*/{3:"hello", "hello": 3 }; 1442 Map<dynamic, String> l0 = /*$info*/{};
1435 1443 Map<dynamic, String> l1 = /*$info*/{3: "hello"};
1436 Map<int, dynamic> l0 = /*$error*/{}; 1444 Map<dynamic, String> l2 = /*$info*/{"hello": "hello"};
1437 Map<int, dynamic> l1 = /*$error*/{3: "hello"}; 1445 Map<dynamic, String> l3 = /*severe:StaticTypeError*/{3: 3};
1438 Map<int, dynamic> l2 = /*severe:StaticTypeError*/{"hello": "hello"}; 1446 Map<dynamic, String> l4 = /*severe:StaticTypeError*/{3:"hello", "hello ": 3};
1439 Map<int, dynamic> l3 = /*$error*/{3: 3}; 1447 }
1440 Map<int, dynamic> l3 = /*severe:StaticTypeError*/{3:"hello", "hello": 3}; 1448 {
1441 1449 Map<int, dynamic> l0 = /*$info*/{};
1442 Map<int, String> l0 = /*severe:StaticTypeError*/<num, dynamic>{}; 1450 Map<int, dynamic> l1 = /*$info*/{3: "hello"};
1443 Map<int, String> l1 = /*severe:StaticTypeError*/<num, dynamic>{3: "hello"} ; 1451 Map<int, dynamic> l2 = /*severe:StaticTypeError*/{"hello": "hello"};
1444 Map<int, String> l3 = /*severe:StaticTypeError*/<num, dynamic>{3: 3}; 1452 Map<int, dynamic> l3 = /*$info*/{3: 3};
1445 1453 Map<int, dynamic> l3 = /*severe:StaticTypeError*/{3:"hello", "hello": 3};
1446 const Map<int, String> l0 = /*$error*/const {}; 1454 }
1447 const Map<int, String> l1 = /*$error*/const {3: "hello"}; 1455 {
1448 const Map<int, String> l2 = /*severe:StaticTypeError*/const {"hello": "hel lo"}; 1456 Map<int, String> l0 = /*severe:StaticTypeError*/<num, dynamic>{};
1449 const Map<int, String> l3 = /*severe:StaticTypeError*/const {3: 3}; 1457 Map<int, String> l1 = /*severe:StaticTypeError*/<num, dynamic>{3: "hel lo"};
1450 const Map<int, String> l4 = /*severe:StaticTypeError*/const {3:"hello", "h ello": 3}; 1458 Map<int, String> l3 = /*severe:StaticTypeError*/<num, dynamic>{3: 3};
1459 }
1460 {
1461 const Map<int, String> l0 = /*$info*/const {};
1462 const Map<int, String> l1 = /*$info*/const {3: "hello"};
1463 const Map<int, String> l2 = /*severe:StaticTypeError*/const {"hello": "hello"};
1464 const Map<int, String> l3 = /*severe:StaticTypeError*/const {3: 3};
1465 const Map<int, String> l4 = /*severe:StaticTypeError*/const {3:"hello" , "hello": 3};
1466 }
1467 }
1451 '''; 1468 ''';
1452 testChecker({'/main.dart': mk("info:InferredTypeLiteral")}, 1469 testChecker({'/main.dart': mk("info:InferredTypeLiteral")},
1453 inferDownwards: true); 1470 inferDownwards: true);
1454 testChecker({'/main.dart': mk("severe:StaticTypeError")}, 1471 testChecker({'/main.dart': mk("severe:StaticTypeError")},
1455 inferDownwards: false); 1472 inferDownwards: false);
1456 }); 1473 });
1474
1475 test('downwards inference on function expressions', () {
1476 testChecker({
1477 '/main.dart': '''
1478 typedef T Function2<S, T>(S x);
1479
1480 void main () {
1481 {
1482 Function2<int, String> l0 = (int x) => null;
1483 Function2<int, String> l1 = (int x) => "hello";
1484 Function2<int, String> l2 = /*severe:StaticTypeError*/(String x) => "h ello";
1485 Function2<int, String> l3 = /*severe:StaticTypeError*/(int x) => 3;
1486 Function2<int, String> l4 = /*warning:ClosureWrapLiteral should be pas s*/(int x) {return 3};
1487 }
1488 {
1489 Function2<int, String> l0 = /*info:InferredTypeClosure*/(x) => null;
1490 Function2<int, String> l1 = /*info:InferredTypeClosure*/(x) => "hello" ;
1491 Function2<int, String> l2 = /*severe:StaticTypeError*/(x) => 3;
vsm 2015/04/01 00:14:19 What would we do with: Function2<int, int> l4 = (
Leaf 2015/04/03 00:51:55 The first will be inferred once we push types to t
1492 Function2<int, String> l3 = /*warning:ClosureWrapLiteral should be pas s*/(x) {return 3};
1493 }
1494 {
1495 Function2<int, List<String>> l0 = (int x) => null;
1496 Function2<int, List<String>> l1 = /*info:InferredTypeClosure*/(int x) => /*info:InferredTypeLiteral*/["hello"];
1497 Function2<int, List<String>> l2 = /*severe:StaticTypeError*/(String x) => ["hello"];
1498 Function2<int, List<String>> l3 = /*warning:ClosureWrapLiteral*/(int x ) => [3];
1499 Function2<int, List<String>> l4 = /*warning:ClosureWrapLiteral*/(int x ) {return [3]};
1500 }
1501 }
1502 '''
1503 }, inferDownwards: true);
vsm 2015/04/01 00:14:19 Perhaps turn closure wrapping off for this test?
Leaf 2015/04/03 00:51:55 Done.
1504 });
1457 } 1505 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698