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

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

Issue 2032363003: Fix @protected access check from within defining class (#26614). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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/resolver.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/src/generated/engine.dart'; 7 import 'package:analyzer/src/generated/engine.dart';
8 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
9 import 'package:analyzer/src/generated/source_io.dart'; 9 import 'package:analyzer/src/generated/source_io.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 void b(int i) { 1272 void b(int i) {
1273 a = i; 1273 a = i;
1274 } 1274 }
1275 } 1275 }
1276 '''); 1276 ''');
1277 computeLibrarySourceErrors(source); 1277 computeLibrarySourceErrors(source);
1278 assertNoErrors(source); 1278 assertNoErrors(source);
1279 verify([source]); 1279 verify([source]);
1280 } 1280 }
1281 1281
1282 void test_invalidUseOfProtectedMember_OK_setter_2() {
1283 Source source = addSource(r'''
1284 import 'package:meta/meta.dart';
1285 class A {
1286 int _a;
1287 @protected
1288 void set a(int a) { _a = a; }
1289 A(int a) {
1290 this.a = a;
1291 }
1292 }
1293 ''');
1294 computeLibrarySourceErrors(source);
1295 assertNoErrors(source);
1296 verify([source]);
1297 }
1298
1282 void test_invalidUseOfProtectedMember_setter() { 1299 void test_invalidUseOfProtectedMember_setter() {
1283 Source source = addSource(r''' 1300 Source source = addSource(r'''
1284 import 'package:meta/meta.dart'; 1301 import 'package:meta/meta.dart';
1285 class A { 1302 class A {
1286 @protected 1303 @protected
1287 void set a(int i) { } 1304 void set a(int i) { }
1288 } 1305 }
1289 class B{ 1306 class B{
1290 A a; 1307 A a;
1291 b(int i) { 1308 b(int i) {
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 n() { 3461 n() {
3445 var a = m(), b = m(); 3462 var a = m(), b = m();
3446 } 3463 }
3447 }'''); 3464 }''');
3448 computeLibrarySourceErrors(source); 3465 computeLibrarySourceErrors(source);
3449 assertErrors( 3466 assertErrors(
3450 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); 3467 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
3451 verify([source]); 3468 verify([source]);
3452 } 3469 }
3453 } 3470 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698