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

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

Issue 1414003003: Do not generate warnings when noSuchMethod is inherited (issue 24337) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | tests/co19/co19-analyzer2.status » ('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) 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/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 class A implements Function { 1849 class A implements Function {
1850 noSuchMethod(inv) { 1850 noSuchMethod(inv) {
1851 return 42; 1851 return 42;
1852 } 1852 }
1853 }'''); 1853 }''');
1854 computeLibrarySourceErrors(source); 1854 computeLibrarySourceErrors(source);
1855 assertNoErrors(source); 1855 assertNoErrors(source);
1856 verify([source]); 1856 verify([source]);
1857 } 1857 }
1858 1858
1859 void test_functionWithoutCall_withNoSuchMethod_inherited() {
1860 // 16078
1861 Source source = addSource(r'''
1862 class A {
1863 noSuchMethod(inv) {}
1864 }
1865 class B extends A implements Function {
1866 }''');
1867 computeLibrarySourceErrors(source);
1868 assertNoErrors(source);
1869 verify([source]);
1870 }
1871
1859 void test_implicitConstructorDependencies() { 1872 void test_implicitConstructorDependencies() {
1860 // No warning should be generated for the code below; this requires that 1873 // No warning should be generated for the code below; this requires that
1861 // implicit constructors are generated for C1 before C2, even though C1 1874 // implicit constructors are generated for C1 before C2, even though C1
1862 // follows C2 in the file. See dartbug.com/21600. 1875 // follows C2 in the file. See dartbug.com/21600.
1863 Source source = addSource(r''' 1876 Source source = addSource(r'''
1864 class B { 1877 class B {
1865 B(int i); 1878 B(int i);
1866 } 1879 }
1867 class M1 {} 1880 class M1 {}
1868 class M2 {} 1881 class M2 {}
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after
3603 int get g; 3616 int get g;
3604 } 3617 }
3605 class B extends A { 3618 class B extends A {
3606 noSuchMethod(v) => ''; 3619 noSuchMethod(v) => '';
3607 }'''); 3620 }''');
3608 computeLibrarySourceErrors(source); 3621 computeLibrarySourceErrors(source);
3609 assertNoErrors(source); 3622 assertNoErrors(source);
3610 verify([source]); 3623 verify([source]);
3611 } 3624 }
3612 3625
3626 void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_inherited() {
3627 Source source = addSource(r'''
3628 class A {
3629 noSuchMethod(v) => '';
3630 }
3631 class B extends A {
3632 m(p);
3633 }''');
3634 computeLibrarySourceErrors(source);
3635 assertNoErrors(source);
3636 verify([source]);
3637 }
3638
3613 void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_method() { 3639 void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_method() {
3614 Source source = addSource(r''' 3640 Source source = addSource(r'''
3615 abstract class A { 3641 abstract class A {
3616 m(p); 3642 m(p);
3617 } 3643 }
3618 class B extends A { 3644 class B extends A {
3619 noSuchMethod(v) => ''; 3645 noSuchMethod(v) => '';
3620 }'''); 3646 }''');
3621 computeLibrarySourceErrors(source); 3647 computeLibrarySourceErrors(source);
3622 assertNoErrors(source); 3648 assertNoErrors(source);
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after
5780 reset(); 5806 reset();
5781 } 5807 }
5782 5808
5783 void _check_wrongNumberOfParametersForOperator1(String name) { 5809 void _check_wrongNumberOfParametersForOperator1(String name) {
5784 _check_wrongNumberOfParametersForOperator(name, "a"); 5810 _check_wrongNumberOfParametersForOperator(name, "a");
5785 } 5811 }
5786 5812
5787 CompilationUnit _getResolvedLibraryUnit(Source source) => 5813 CompilationUnit _getResolvedLibraryUnit(Source source) =>
5788 analysisContext.getResolvedCompilationUnit2(source, source); 5814 analysisContext.getResolvedCompilationUnit2(source, source);
5789 } 5815 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | tests/co19/co19-analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698