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

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

Issue 1296723002: Cleanup InferableOverride (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix format Created 5 years, 4 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 | « lib/src/info.dart ('k') | test/checker/inferred_type_test.dart » ('j') | 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 /// General type checking tests 5 /// General type checking tests
6 library dev_compiler.test.checker_test; 6 library dev_compiler.test.checker_test;
7 7
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 9
10 import '../testing.dart'; 10 import '../testing.dart';
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 class Base { 1382 class Base {
1383 B f1; 1383 B f1;
1384 B f2; 1384 B f2;
1385 B f3; 1385 B f3;
1386 B f4; 1386 B f4;
1387 } 1387 }
1388 1388
1389 class Child extends Base { 1389 class Child extends Base {
1390 /*severe:InvalidMethodOverride*/A f1; // invalid for getter 1390 /*severe:InvalidMethodOverride*/A f1; // invalid for getter
1391 /*severe:InvalidMethodOverride*/C f2; // invalid for setter 1391 /*severe:InvalidMethodOverride*/C f2; // invalid for setter
1392 /*severe:InferableOverride,severe:InvalidMethodOverride*/var f3; 1392 /*severe:InvalidMethodOverride,severe:InvalidMethodOverride*/var f3;
1393 /*severe:InvalidMethodOverride,severe:InvalidMethodOverride*/dynamic f4; 1393 /*severe:InvalidMethodOverride,severe:InvalidMethodOverride*/dynamic f4;
1394 } 1394 }
1395 ''' 1395 '''
1396 }, 1396 },
1397 inferFromOverrides: false); 1397 inferFromOverrides: false);
1398 1398
1399 testChecker( 1399 testChecker(
1400 'getter/getter override', 1400 'getter/getter override',
1401 { 1401 {
1402 '/main.dart': ''' 1402 '/main.dart': '''
(...skipping 29 matching lines...) Expand all
1432 abstract class Base { 1432 abstract class Base {
1433 B get f1; 1433 B get f1;
1434 B get f2; 1434 B get f2;
1435 B get f3; 1435 B get f3;
1436 B get f4; 1436 B get f4;
1437 } 1437 }
1438 1438
1439 class Child extends Base { 1439 class Child extends Base {
1440 /*severe:InvalidMethodOverride*/A get f1 => null; 1440 /*severe:InvalidMethodOverride*/A get f1 => null;
1441 C get f2 => null; 1441 C get f2 => null;
1442 /*severe:InferableOverride*/get f3 => null; 1442 /*severe:InvalidMethodOverride*/get f3 => null;
1443 /*severe:InvalidMethodOverride*/dynamic get f4 => null; 1443 /*severe:InvalidMethodOverride*/dynamic get f4 => null;
1444 } 1444 }
1445 ''' 1445 '''
1446 }, 1446 },
1447 inferFromOverrides: false); 1447 inferFromOverrides: false);
1448 1448
1449 testChecker( 1449 testChecker(
1450 'field/getter override', 1450 'field/getter override',
1451 { 1451 {
1452 '/main.dart': ''' 1452 '/main.dart': '''
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 // This is a regression test: we used to report it twice because it was 2482 // This is a regression test: we used to report it twice because it was
2483 // the top super class and top super interface. 2483 // the top super class and top super interface.
2484 // TODO(sigmund): maybe we generalize this and don't report again errors 2484 // TODO(sigmund): maybe we generalize this and don't report again errors
2485 // when an interface is also a superclass. 2485 // when an interface is also a superclass.
2486 testChecker( 2486 testChecker(
2487 'no reporting of overrides with Object twice.', 2487 'no reporting of overrides with Object twice.',
2488 { 2488 {
2489 '/main.dart': ''' 2489 '/main.dart': '''
2490 class A {} 2490 class A {}
2491 class T1 implements A { 2491 class T1 implements A {
2492 /*severe:InferableOverride*/toString() {} 2492 /*severe:InvalidMethodOverride*/toString() {}
2493 } 2493 }
2494 ''' 2494 '''
2495 }, 2495 },
2496 inferFromOverrides: false); 2496 inferFromOverrides: false);
2497 2497
2498 testChecker('invalid runtime checks', { 2498 testChecker('invalid runtime checks', {
2499 '/main.dart': ''' 2499 '/main.dart': '''
2500 typedef int I2I(int x); 2500 typedef int I2I(int x);
2501 typedef int D2I(x); 2501 typedef int D2I(x);
2502 typedef int II2I(int x, int y); 2502 typedef int II2I(int x, int y);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 // Types other than int and double are not accepted. 2665 // Types other than int and double are not accepted.
2666 printInt( 2666 printInt(
2667 /*warning:DownCastImplicit*/min( 2667 /*warning:DownCastImplicit*/min(
2668 /*severe:StaticTypeError*/"hi", 2668 /*severe:StaticTypeError*/"hi",
2669 /*severe:StaticTypeError*/"there")); 2669 /*severe:StaticTypeError*/"there"));
2670 } 2670 }
2671 ''' 2671 '''
2672 }); 2672 });
2673 }); 2673 });
2674 } 2674 }
OLDNEW
« no previous file with comments | « lib/src/info.dart ('k') | test/checker/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698