| 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 4566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4577 import 'lib1.dart' deferred as a; | 4577 import 'lib1.dart' deferred as a; |
| 4578 f() { | 4578 f() { |
| 4579 return const {'a' : a.c + 1}; | 4579 return const {'a' : a.c + 1}; |
| 4580 }''' | 4580 }''' |
| 4581 ], <ErrorCode>[ | 4581 ], <ErrorCode>[ |
| 4582 CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY | 4582 CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE_FROM_DEFERRED_LIBRARY |
| 4583 ]); | 4583 ]); |
| 4584 } | 4584 } |
| 4585 | 4585 |
| 4586 test_nonConstValueInInitializer_assert_condition() async { | 4586 test_nonConstValueInInitializer_assert_condition() async { |
| 4587 resetWithOptions(new AnalysisOptionsImpl()..enableAssertInitializer = true); | 4587 resetWith( |
| 4588 options: new AnalysisOptionsImpl()..enableAssertInitializer = true); |
| 4588 Source source = addSource(r''' | 4589 Source source = addSource(r''' |
| 4589 class A { | 4590 class A { |
| 4590 const A(int i) : assert(i.isNegative); | 4591 const A(int i) : assert(i.isNegative); |
| 4591 }'''); | 4592 }'''); |
| 4592 await computeAnalysisResult(source); | 4593 await computeAnalysisResult(source); |
| 4593 assertErrors( | 4594 assertErrors( |
| 4594 source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); | 4595 source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| 4595 verify([source]); | 4596 verify([source]); |
| 4596 } | 4597 } |
| 4597 | 4598 |
| 4598 test_nonConstValueInInitializer_assert_message() async { | 4599 test_nonConstValueInInitializer_assert_message() async { |
| 4599 resetWithOptions(new AnalysisOptionsImpl()..enableAssertInitializer = true); | 4600 resetWith( |
| 4601 options: new AnalysisOptionsImpl()..enableAssertInitializer = true); |
| 4600 Source source = addSource(r''' | 4602 Source source = addSource(r''' |
| 4601 class A { | 4603 class A { |
| 4602 const A(int i) : assert(i < 0, 'isNegative = ${i.isNegative}'); | 4604 const A(int i) : assert(i < 0, 'isNegative = ${i.isNegative}'); |
| 4603 }'''); | 4605 }'''); |
| 4604 await computeAnalysisResult(source); | 4606 await computeAnalysisResult(source); |
| 4605 assertErrors( | 4607 assertErrors( |
| 4606 source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); | 4608 source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]); |
| 4607 verify([source]); | 4609 verify([source]); |
| 4608 } | 4610 } |
| 4609 | 4611 |
| (...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6430 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); | 6432 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); |
| 6431 verify([source]); | 6433 verify([source]); |
| 6432 reset(); | 6434 reset(); |
| 6433 } | 6435 } |
| 6434 | 6436 |
| 6435 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { | 6437 Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async { |
| 6436 await _check_wrongNumberOfParametersForOperator(name, ""); | 6438 await _check_wrongNumberOfParametersForOperator(name, ""); |
| 6437 await _check_wrongNumberOfParametersForOperator(name, "a, b"); | 6439 await _check_wrongNumberOfParametersForOperator(name, "a, b"); |
| 6438 } | 6440 } |
| 6439 } | 6441 } |
| OLD | NEW |