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

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

Issue 2364733002: Issue 27300. Report HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE. (Closed)
Patch Set: Fixes for false positives. Created 4 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.hint_code_test; 5 library analyzer.test.generated.hint_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/parser.dart'; 10 import 'package:analyzer/src/generated/parser.dart';
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 ''', 58 ''',
59 'package:js/js.dart': r''' 59 'package:js/js.dart': r'''
60 library js; 60 library js;
61 class JS { 61 class JS {
62 const JS([String js]) { } 62 const JS([String js]) { }
63 } 63 }
64 ''' 64 '''
65 }); 65 });
66 } 66 }
67 67
68 void test_abstractSuperMemberReference_getter() {
69 Source source = addSource(r'''
70 abstract class A {
71 int get test;
72 }
73 class B extends A {
74 int get test {
75 super.test;
76 return 0;
77 }
78 }
79 ''');
80 computeLibrarySourceErrors(source);
81 assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
82 verify([source]);
83 }
84
85 void test_abstractSuperMemberReference_method_invocation() {
86 Source source = addSource(r'''
87 abstract class A {
88 void test();
89 }
90 class B extends A {
91 void test() {
92 super.test();
93 }
94 }
95 ''');
96 computeLibrarySourceErrors(source);
97 assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
98 verify([source]);
99 }
100
101 void test_abstractSuperMemberReference_method_reference() {
102 Source source = addSource(r'''
103 abstract class A {
104 void test();
105 }
106 class B extends A {
107 void test() {
108 super.test;
109 }
110 }
111 ''');
112 computeLibrarySourceErrors(source);
113 assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
114 verify([source]);
115 }
116
117 void test_abstractSuperMemberReference_setter() {
118 Source source = addSource(r'''
119 abstract class A {
120 void set test(int v);
121 }
122 class B extends A {
123 void set test(int v){
124 super.test = 0;
125 }
126 }
127 ''');
128 computeLibrarySourceErrors(source);
129 assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
130 verify([source]);
131 }
132
68 void test_argumentTypeNotAssignable_functionType() { 133 void test_argumentTypeNotAssignable_functionType() {
69 Source source = addSource(r''' 134 Source source = addSource(r'''
70 m() { 135 m() {
71 var a = new A(); 136 var a = new A();
72 a.n(() => 0); 137 a.n(() => 0);
73 } 138 }
74 class A { 139 class A {
75 n(void f(int i)) {} 140 n(void f(int i)) {}
76 }'''); 141 }''');
77 computeLibrarySourceErrors(source); 142 computeLibrarySourceErrors(source);
(...skipping 3869 matching lines...) Expand 10 before | Expand all | Expand 10 after
3947 n() { 4012 n() {
3948 var a = m(), b = m(); 4013 var a = m(), b = m();
3949 } 4014 }
3950 }'''); 4015 }''');
3951 computeLibrarySourceErrors(source); 4016 computeLibrarySourceErrors(source);
3952 assertErrors( 4017 assertErrors(
3953 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 4018 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
3954 verify([source]); 4019 verify([source]);
3955 } 4020 }
3956 } 4021 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698