OLD | NEW |
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 5255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5266 f() { | 5266 f() { |
5267 p?.g(); | 5267 p?.g(); |
5268 } | 5268 } |
5269 '''); | 5269 '''); |
5270 await computeAnalysisResult(source); | 5270 await computeAnalysisResult(source); |
5271 assertErrors( | 5271 assertErrors( |
5272 source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); | 5272 source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]); |
5273 verify([source]); | 5273 verify([source]); |
5274 } | 5274 } |
5275 | 5275 |
| 5276 test_privateCollisionInMixinApplication_mixinAndMixin() async { |
| 5277 resetWith(options: new AnalysisOptionsImpl()..strongMode = true); |
| 5278 addNamedSource( |
| 5279 '/lib1.dart', |
| 5280 ''' |
| 5281 class A { |
| 5282 int _x; |
| 5283 } |
| 5284 |
| 5285 class B { |
| 5286 int _x; |
| 5287 } |
| 5288 '''); |
| 5289 Source source = addSource(''' |
| 5290 import 'lib1.dart'; |
| 5291 class C extends Object with A, B {} |
| 5292 '''); |
| 5293 await computeAnalysisResult(source); |
| 5294 assertErrors(source, [ |
| 5295 CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, |
| 5296 StrongModeCode.INVALID_FIELD_OVERRIDE |
| 5297 ]); |
| 5298 verify([source]); |
| 5299 } |
| 5300 |
| 5301 test_privateCollisionInMixinApplication_mixinAndMixin_indirect() async { |
| 5302 resetWith(options: new AnalysisOptionsImpl()..strongMode = true); |
| 5303 addNamedSource( |
| 5304 '/lib1.dart', |
| 5305 ''' |
| 5306 class A { |
| 5307 int _x; |
| 5308 } |
| 5309 |
| 5310 class B { |
| 5311 int _x; |
| 5312 } |
| 5313 '''); |
| 5314 Source source = addSource(''' |
| 5315 import 'lib1.dart'; |
| 5316 class C extends Object with A {} |
| 5317 class D extends C with B {} |
| 5318 '''); |
| 5319 await computeAnalysisResult(source); |
| 5320 assertErrors( |
| 5321 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]); |
| 5322 verify([source]); |
| 5323 } |
| 5324 |
| 5325 test_privateCollisionInMixinApplication_superclassAndMixin() async { |
| 5326 resetWith(options: new AnalysisOptionsImpl()..strongMode = true); |
| 5327 addNamedSource( |
| 5328 '/lib1.dart', |
| 5329 ''' |
| 5330 class A { |
| 5331 int _x; |
| 5332 } |
| 5333 |
| 5334 class B { |
| 5335 int _x; |
| 5336 } |
| 5337 '''); |
| 5338 Source source = addSource(''' |
| 5339 import 'lib1.dart'; |
| 5340 class C extends A with B {} |
| 5341 '''); |
| 5342 await computeAnalysisResult(source); |
| 5343 assertErrors(source, [ |
| 5344 CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, |
| 5345 StrongModeCode.INVALID_FIELD_OVERRIDE |
| 5346 ]); |
| 5347 verify([source]); |
| 5348 } |
| 5349 |
| 5350 test_privateCollisionInMixinApplication_superclassAndMixin_same() async { |
| 5351 resetWith(options: new AnalysisOptionsImpl()..strongMode = true); |
| 5352 addNamedSource( |
| 5353 '/lib1.dart', |
| 5354 ''' |
| 5355 class A { |
| 5356 int _x; |
| 5357 } |
| 5358 |
| 5359 class B { |
| 5360 int _x; |
| 5361 } |
| 5362 '''); |
| 5363 Source source = addSource(''' |
| 5364 import 'lib1.dart'; |
| 5365 class C extends A with A {} |
| 5366 '''); |
| 5367 await computeAnalysisResult(source); |
| 5368 assertErrors(source, [ |
| 5369 CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, |
| 5370 StrongModeCode.INVALID_FIELD_OVERRIDE |
| 5371 ]); |
| 5372 verify([source]); |
| 5373 } |
| 5374 |
5276 test_privateOptionalParameter() async { | 5375 test_privateOptionalParameter() async { |
5277 Source source = addSource("f({var _p}) {}"); | 5376 Source source = addSource("f({var _p}) {}"); |
5278 await computeAnalysisResult(source); | 5377 await computeAnalysisResult(source); |
5279 assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); | 5378 assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]); |
5280 verify([source]); | 5379 verify([source]); |
5281 } | 5380 } |
5282 | 5381 |
5283 test_privateOptionalParameter_fieldFormal() async { | 5382 test_privateOptionalParameter_fieldFormal() async { |
5284 Source source = addSource(r''' | 5383 Source source = addSource(r''' |
5285 class A { | 5384 class A { |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6499 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); | 6598 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); |
6500 verify([source]); | 6599 verify([source]); |
6501 reset(); | 6600 reset(); |
6502 } | 6601 } |
6503 | 6602 |
6504 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { | 6603 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { |
6505 await _check_wrongNumberOfParametersForOperator(name, ""); | 6604 await _check_wrongNumberOfParametersForOperator(name, ""); |
6506 await _check_wrongNumberOfParametersForOperator(name, "a, b"); | 6605 await _check_wrongNumberOfParametersForOperator(name, "a, b"); |
6507 } | 6606 } |
6508 } | 6607 } |
OLD | NEW |