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

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

Issue 3007873002: Ensure mustCallSuper check visits children (flutter#11646). (Closed)
Patch Set: Moved comments. Created 3 years, 3 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') | no next file » | 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) 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 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 void a() { 2141 void a() {
2142 super.a(); //OK 2142 super.a(); //OK
2143 } 2143 }
2144 } 2144 }
2145 '''); 2145 ''');
2146 await computeAnalysisResult(source); 2146 await computeAnalysisResult(source);
2147 assertErrors(source, []); 2147 assertErrors(source, []);
2148 verify([source]); 2148 verify([source]);
2149 } 2149 }
2150 2150
2151 test_mustCallSuper_overridden_w_future() async {
2152 //https://github.com/flutter/flutter/issues/11646
2153 Source source = addSource(r'''
2154 import 'dart:async';
2155 import 'package:meta/meta.dart';
2156 class A {
2157 @mustCallSuper
2158 Future<Null> bar() => new Future<Null>.value();
2159 }
2160 class C extends A {
2161 @override
2162 Future<Null> bar() {
2163 final value = super.bar();
2164 return value.then((Null _) {
2165 return null;
2166 });
2167 }
2168 }
2169 ''');
2170 await computeAnalysisResult(source);
2171 assertErrors(source, []);
2172 verify([source]);
2173 }
2174
2175 test_mustCallSuper_overridden_w_future2() async {
2176 //https://github.com/flutter/flutter/issues/11646
2177 Source source = addSource(r'''
2178 import 'dart:async';
2179 import 'package:meta/meta.dart';
2180 class A {
2181 @mustCallSuper
2182 Future<Null> bar() => new Future<Null>.value();
2183 }
2184 class C extends A {
2185 @override
2186 Future<Null> bar() {
2187 return super.bar().then((Null _) {
2188 return null;
2189 });
2190 }
2191 }
2192 ''');
2193 await computeAnalysisResult(source);
2194 assertErrors(source, []);
2195 verify([source]);
2196 }
2197
2151 test_nullAwareInCondition_assert() async { 2198 test_nullAwareInCondition_assert() async {
2152 Source source = addSource(r''' 2199 Source source = addSource(r'''
2153 m(x) { 2200 m(x) {
2154 assert (x?.a); 2201 assert (x?.a);
2155 } 2202 }
2156 '''); 2203 ''');
2157 await computeAnalysisResult(source); 2204 await computeAnalysisResult(source);
2158 assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]); 2205 assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
2159 verify([source]); 2206 verify([source]);
2160 } 2207 }
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after
4254 n() { 4301 n() {
4255 var a = m(), b = m(); 4302 var a = m(), b = m();
4256 } 4303 }
4257 }'''); 4304 }''');
4258 await computeAnalysisResult(source); 4305 await computeAnalysisResult(source);
4259 assertErrors( 4306 assertErrors(
4260 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 4307 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
4261 verify([source]); 4308 verify([source]);
4262 } 4309 }
4263 } 4310 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698