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

Side by Side Diff: pkg/analyzer/test/generated/compile_time_error_code_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.generated.compile_time_error_code_test; 5 library analyzer.test.generated.compile_time_error_code_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/error/error.dart'; 9 import 'package:analyzer/error/error.dart';
10 import 'package:analyzer/src/error/codes.dart'; 10 import 'package:analyzer/src/error/codes.dart';
(...skipping 5273 matching lines...) Expand 10 before | Expand all | Expand 10 after
5284 5284
5285 class B { 5285 class B {
5286 int _x; 5286 int _x;
5287 } 5287 }
5288 '''); 5288 ''');
5289 Source source = addSource(''' 5289 Source source = addSource('''
5290 import 'lib1.dart'; 5290 import 'lib1.dart';
5291 class C extends Object with A, B {} 5291 class C extends Object with A, B {}
5292 '''); 5292 ''');
5293 await computeAnalysisResult(source); 5293 await computeAnalysisResult(source);
5294 assertErrors(source, [ 5294 assertErrors(
5295 CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, 5295 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]);
5296 StrongModeCode.INVALID_FIELD_OVERRIDE
5297 ]);
5298 verify([source]); 5296 verify([source]);
5299 } 5297 }
5300 5298
5301 test_privateCollisionInMixinApplication_mixinAndMixin_indirect() async { 5299 test_privateCollisionInMixinApplication_mixinAndMixin_indirect() async {
5302 resetWith(options: new AnalysisOptionsImpl()..strongMode = true); 5300 resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
5303 addNamedSource( 5301 addNamedSource(
5304 '/lib1.dart', 5302 '/lib1.dart',
5305 ''' 5303 '''
5306 class A { 5304 class A {
5307 int _x; 5305 int _x;
(...skipping 25 matching lines...) Expand all
5333 5331
5334 class B { 5332 class B {
5335 int _x; 5333 int _x;
5336 } 5334 }
5337 '''); 5335 ''');
5338 Source source = addSource(''' 5336 Source source = addSource('''
5339 import 'lib1.dart'; 5337 import 'lib1.dart';
5340 class C extends A with B {} 5338 class C extends A with B {}
5341 '''); 5339 ''');
5342 await computeAnalysisResult(source); 5340 await computeAnalysisResult(source);
5343 assertErrors(source, [ 5341 assertErrors(
5344 CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, 5342 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]);
5345 StrongModeCode.INVALID_FIELD_OVERRIDE
5346 ]);
5347 verify([source]); 5343 verify([source]);
5348 } 5344 }
5349 5345
5350 test_privateCollisionInMixinApplication_superclassAndMixin_same() async { 5346 test_privateCollisionInMixinApplication_superclassAndMixin_same() async {
5351 resetWith(options: new AnalysisOptionsImpl()..strongMode = true); 5347 resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
5352 addNamedSource( 5348 addNamedSource(
5353 '/lib1.dart', 5349 '/lib1.dart',
5354 ''' 5350 '''
5355 class A { 5351 class A {
5356 int _x; 5352 int _x;
5357 } 5353 }
5358 5354
5359 class B { 5355 class B {
5360 int _x; 5356 int _x;
5361 } 5357 }
5362 '''); 5358 ''');
5363 Source source = addSource(''' 5359 Source source = addSource('''
5364 import 'lib1.dart'; 5360 import 'lib1.dart';
5365 class C extends A with A {} 5361 class C extends A with A {}
5366 '''); 5362 ''');
5367 await computeAnalysisResult(source); 5363 await computeAnalysisResult(source);
5368 assertErrors(source, [ 5364 assertErrors(
5369 CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, 5365 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]);
5370 StrongModeCode.INVALID_FIELD_OVERRIDE
5371 ]);
5372 verify([source]); 5366 verify([source]);
5373 } 5367 }
5374 5368
5375 test_privateOptionalParameter() async { 5369 test_privateOptionalParameter() async {
5376 Source source = addSource("f({var _p}) {}"); 5370 Source source = addSource("f({var _p}) {}");
5377 await computeAnalysisResult(source); 5371 await computeAnalysisResult(source);
5378 assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); 5372 assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
5379 verify([source]); 5373 verify([source]);
5380 } 5374 }
5381 5375
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
6598 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 6592 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6599 verify([source]); 6593 verify([source]);
6600 reset(); 6594 reset();
6601 } 6595 }
6602 6596
6603 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { 6597 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
6604 await _check_wrongNumberOfParametersForOperator(name, ""); 6598 await _check_wrongNumberOfParametersForOperator(name, "");
6605 await _check_wrongNumberOfParametersForOperator(name, "a, b"); 6599 await _check_wrongNumberOfParametersForOperator(name, "a, b");
6606 } 6600 }
6607 } 6601 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698