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

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2781443003: Fix #28120, strong mode allows field overrides (Closed)
Patch Set: fix Created 3 years, 8 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) 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.src.context.context_test; 5 library analyzer.test.src.context.context_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 4308 matching lines...) Expand 10 before | Expand all | Expand 10 after
4319 r''' 4319 r'''
4320 class A { 4320 class A {
4321 int foo; 4321 int foo;
4322 int get foo => 1; 4322 int get foo => 1;
4323 } 4323 }
4324 class B extends A { 4324 class B extends A {
4325 int get foo => 2; 4325 int get foo => 2;
4326 } 4326 }
4327 '''); 4327 ''');
4328 _performPendingAnalysisTasks(); 4328 _performPendingAnalysisTasks();
4329 expect(context.getErrors(a).errors, hasLength(2)); 4329 expect(context.getErrors(a).errors, hasLength(1));
4330 // Update a.dart: rename "int foo" to "int bar". 4330 // Update a.dart: rename "int foo" to "int bar".
4331 // The strong mode "getter cannot override field" error is gone.
4332 context.setContents( 4331 context.setContents(
4333 a, 4332 a,
4334 r''' 4333 r'''
4335 class A { 4334 class A {
4336 int bar; 4335 int bar;
4337 int get foo => 1; 4336 int get foo => 1;
4338 } 4337 }
4339 class B extends A { 4338 class B extends A {
4340 int get foo => 2; 4339 int get foo => 2;
4341 } 4340 }
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
5445 * Initialize the visitor. 5444 * Initialize the visitor.
5446 */ 5445 */
5447 _ElementGatherer(); 5446 _ElementGatherer();
5448 5447
5449 @override 5448 @override
5450 void visitElement(Element element) { 5449 void visitElement(Element element) {
5451 elements[element] = element; 5450 elements[element] = element;
5452 super.visitElement(element); 5451 super.visitElement(element);
5453 } 5452 }
5454 } 5453 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/compile_time_error_code_test.dart ('k') | pkg/analyzer/test/src/task/strong/checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698