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

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

Issue 2716453006: Add error for mixins defining conflicting private names (issue 28809) (Closed)
Patch Set: Created 3 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
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 5245 matching lines...) Expand 10 before | Expand all | Expand 10 after
5256 f() { 5256 f() {
5257 p?.g(); 5257 p?.g();
5258 } 5258 }
5259 '''); 5259 ''');
5260 await computeAnalysisResult(source); 5260 await computeAnalysisResult(source);
5261 assertErrors( 5261 assertErrors(
5262 source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); 5262 source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
5263 verify([source]); 5263 verify([source]);
5264 } 5264 }
5265 5265
5266 test_privateCollisionInMixinApplication_mixinAndMixin() async {
5267 addNamedSource(
5268 '/lib1.dart',
5269 '''
5270 class A {
5271 int _x;
5272 }
5273
5274 class B {
5275 int _x;
5276 }
5277 ''');
5278 Source source = addSource('''
5279 import 'lib1.dart';
5280 class C extends Object with A, B {}
5281 ''');
5282 await computeAnalysisResult(source);
5283 assertErrors(
5284 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]);
5285 verify([source]);
5286 }
5287
5288 test_privateCollisionInMixinApplication_mixinAndMixin_indirect() async {
5289 addNamedSource(
5290 '/lib1.dart',
5291 '''
5292 class A {
5293 int _x;
5294 }
5295
5296 class B {
5297 int _x;
5298 }
5299 ''');
5300 Source source = addSource('''
5301 import 'lib1.dart';
5302 class C extends Object with A {}
5303 class D extends C with B {}
5304 ''');
5305 await computeAnalysisResult(source);
5306 assertErrors(
5307 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]);
5308 verify([source]);
5309 }
5310
5311 test_privateCollisionInMixinApplication_superclassAndMixin() async {
5312 addNamedSource(
5313 '/lib1.dart',
5314 '''
5315 class A {
5316 int _x;
5317 }
5318
5319 class B {
5320 int _x;
5321 }
5322 ''');
5323 Source source = addSource('''
5324 import 'lib1.dart';
5325 class C extends A with B {}
5326 ''');
5327 await computeAnalysisResult(source);
5328 assertErrors(
5329 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]);
5330 verify([source]);
5331 }
5332
5333 test_privateCollisionInMixinApplication_superclassAndMixin_same() async {
5334 addNamedSource(
5335 '/lib1.dart',
5336 '''
5337 class A {
5338 int _x;
5339 }
5340
5341 class B {
5342 int _x;
5343 }
5344 ''');
5345 Source source = addSource('''
5346 import 'lib1.dart';
5347 class C extends A with A {}
5348 ''');
5349 await computeAnalysisResult(source);
5350 assertErrors(
5351 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]);
5352 verify([source]);
5353 }
5354
5266 test_privateOptionalParameter() async { 5355 test_privateOptionalParameter() async {
5267 Source source = addSource("f({var _p}) {}"); 5356 Source source = addSource("f({var _p}) {}");
5268 await computeAnalysisResult(source); 5357 await computeAnalysisResult(source);
5269 assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); 5358 assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
5270 verify([source]); 5359 verify([source]);
5271 } 5360 }
5272 5361
5273 test_privateOptionalParameter_fieldFormal() async { 5362 test_privateOptionalParameter_fieldFormal() async {
5274 Source source = addSource(r''' 5363 Source source = addSource(r'''
5275 class A { 5364 class A {
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
6489 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); 6578 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
6490 verify([source]); 6579 verify([source]);
6491 reset(); 6580 reset();
6492 } 6581 }
6493 6582
6494 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { 6583 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
6495 await _check_wrongNumberOfParametersForOperator(name, ""); 6584 await _check_wrongNumberOfParametersForOperator(name, "");
6496 await _check_wrongNumberOfParametersForOperator(name, "a, b"); 6585 await _check_wrongNumberOfParametersForOperator(name, "a, b");
6497 } 6586 }
6498 } 6587 }
OLDNEW
« pkg/analyzer/lib/src/error/codes.dart ('K') | « 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