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

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

Issue 1749753002: Fix bug when @protected is not on a class member (issue 25882) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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) 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.resolver_test; 5 library analyzer.test.generated.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 3534 matching lines...) Expand 10 before | Expand all | Expand 10 after
3545 abstract class B implements A { 3545 abstract class B implements A {
3546 b(int i) { 3546 b(int i) {
3547 a = i; 3547 a = i;
3548 } 3548 }
3549 }'''); 3549 }''');
3550 computeLibrarySourceErrors(source); 3550 computeLibrarySourceErrors(source);
3551 assertErrors(source, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]); 3551 assertErrors(source, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
3552 verify([source]); 3552 verify([source]);
3553 } 3553 }
3554 3554
3555 void test_invalidUseOfProtectedMember_topLevelVariable() {
3556 Source source = addSource(r'''
3557 import 'package:meta/meta.dart';
3558 @protected
3559 int x = 0;
3560 main() {
3561 print(x);
3562 }''');
3563 computeLibrarySourceErrors(source);
3564 // TODO(brianwilkerson) This should produce a hint because the annotation is
3565 // being applied to the wrong kind of declaration.
3566 assertNoErrors(source);
3567 verify([source]);
3568 }
3569
3555 void test_isDouble() { 3570 void test_isDouble() {
3556 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); 3571 AnalysisOptionsImpl options = new AnalysisOptionsImpl();
3557 options.dart2jsHint = true; 3572 options.dart2jsHint = true;
3558 resetWithOptions(options); 3573 resetWithOptions(options);
3559 Source source = addSource("var v = 1 is double;"); 3574 Source source = addSource("var v = 1 is double;");
3560 computeLibrarySourceErrors(source); 3575 computeLibrarySourceErrors(source);
3561 assertErrors(source, [HintCode.IS_DOUBLE]); 3576 assertErrors(source, [HintCode.IS_DOUBLE]);
3562 verify([source]); 3577 verify([source]);
3563 } 3578 }
3564 3579
(...skipping 13745 matching lines...) Expand 10 before | Expand all | Expand 10 after
17310 17325
17311 void _resolveTestUnit(String code) { 17326 void _resolveTestUnit(String code) {
17312 testCode = code; 17327 testCode = code;
17313 testSource = addSource(testCode); 17328 testSource = addSource(testCode);
17314 LibraryElement library = resolve2(testSource); 17329 LibraryElement library = resolve2(testSource);
17315 assertNoErrors(testSource); 17330 assertNoErrors(testSource);
17316 verify([testSource]); 17331 verify([testSource]);
17317 testUnit = resolveCompilationUnit(testSource, library); 17332 testUnit = resolveCompilationUnit(testSource, library);
17318 } 17333 }
17319 } 17334 }
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