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

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

Issue 2837173002: fix #29426, class type alias was missing checks (Closed)
Patch Set: Created 3 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) 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 analyzer.test.generated.static_warning_code_test; 5 library analyzer.test.generated.static_warning_code_test;
6 6
7 import 'package:analyzer/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/error/codes.dart'; 8 import 'package:analyzer/src/error/codes.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/source_io.dart'; 10 import 'package:analyzer/src/generated/source_io.dart';
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 Source source = addSource(r''' 1519 Source source = addSource(r'''
1520 abstract class A implements Function { 1520 abstract class A implements Function {
1521 } 1521 }
1522 class B implements A { 1522 class B implements A {
1523 }'''); 1523 }''');
1524 await computeAnalysisResult(source); 1524 await computeAnalysisResult(source);
1525 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]); 1525 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]);
1526 verify([source]); 1526 verify([source]);
1527 } 1527 }
1528 1528
1529 test_functionWithoutCall_mixin_implements() async {
1530 Source source = addSource(r'''
1531 abstract class A implements Function {}
1532 class B extends Object with A {}''');
1533 await computeAnalysisResult(source);
1534 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]);
1535 verify([source]);
1536 }
1537
1538 test_functionWithoutCall_direct_typeAlias() async {
1539 Source source = addSource(r'''
1540 class M {}
1541 class A = Object with M implements Function;''');
1542 await computeAnalysisResult(source);
1543 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]);
1544 verify([source]);
1545 }
1546
1547 test_functionWithoutCall_indirect_extends_typeAlias() async {
1548 Source source = addSource(r'''
1549 abstract class A implements Function {}
1550 class M {}
1551 class B = A with M;''');
1552 await computeAnalysisResult(source);
1553 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]);
1554 verify([source]);
1555 }
1556
1557 test_functionWithoutCall_indirect_implements_typeAlias() async {
1558 Source source = addSource(r'''
1559 abstract class A implements Function {}
1560 class M {}
1561 class B = Object with M implements A;''');
1562 await computeAnalysisResult(source);
1563 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]);
1564 verify([source]);
1565 }
1566
1567 test_functionWithoutCall_mixin_implements_typeAlias() async {
1568 Source source = addSource(r'''
1569 abstract class A implements Function {}
1570 class B = Object with A;''');
1571 await computeAnalysisResult(source);
1572 assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]);
1573 verify([source]);
1574 }
1575
1529 test_importDuplicatedLibraryNamed() async { 1576 test_importDuplicatedLibraryNamed() async {
1530 Source source = addSource(r''' 1577 Source source = addSource(r'''
1531 library test; 1578 library test;
1532 import 'lib1.dart'; 1579 import 'lib1.dart';
1533 import 'lib2.dart';'''); 1580 import 'lib2.dart';''');
1534 addNamedSource("/lib1.dart", "library lib;"); 1581 addNamedSource("/lib1.dart", "library lib;");
1535 addNamedSource("/lib2.dart", "library lib;"); 1582 addNamedSource("/lib2.dart", "library lib;");
1536 await computeAnalysisResult(source); 1583 await computeAnalysisResult(source);
1537 assertErrors(source, [ 1584 assertErrors(source, [
1538 StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAMED, 1585 StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAMED,
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3750 3797
3751 test_voidReturnForGetter() async { 3798 test_voidReturnForGetter() async {
3752 Source source = addSource(r''' 3799 Source source = addSource(r'''
3753 class S { 3800 class S {
3754 void get value {} 3801 void get value {}
3755 }'''); 3802 }''');
3756 await computeAnalysisResult(source); 3803 await computeAnalysisResult(source);
3757 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); 3804 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]);
3758 } 3805 }
3759 } 3806 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698