| 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 engine.compile_time_error_code_test; | 5 library engine.compile_time_error_code_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/error.dart'; | 7 import 'package:analyzer/src/generated/error.dart'; |
| 8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; | 8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
| 9 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
| 10 | 10 |
| (...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 Source source = addSource(r''' | 1002 Source source = addSource(r''' |
| 1003 class A { | 1003 class A { |
| 1004 external factory const A(); | 1004 external factory const A(); |
| 1005 } | 1005 } |
| 1006 const x = const A();'''); | 1006 const x = const A();'''); |
| 1007 computeLibrarySourceErrors(source); | 1007 computeLibrarySourceErrors(source); |
| 1008 assertNoErrors(source); | 1008 assertNoErrors(source); |
| 1009 verify([source]); | 1009 verify([source]); |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 void test_constEval_nonStaticField_inGenericClass() { |
| 1013 Source source = addSource(''' |
| 1014 class C<T> { |
| 1015 const C(); |
| 1016 T get t => null; |
| 1017 } |
| 1018 |
| 1019 const x = const C().t;'''); |
| 1020 computeLibrarySourceErrors(source); |
| 1021 assertErrors(source, |
| 1022 [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]); |
| 1023 verify([source]); |
| 1024 } |
| 1025 |
| 1012 void test_constEval_propertyExtraction_targetNotConst() { | 1026 void test_constEval_propertyExtraction_targetNotConst() { |
| 1013 Source source = addSource(r''' | 1027 Source source = addSource(r''' |
| 1014 class A { | 1028 class A { |
| 1015 const A(); | 1029 const A(); |
| 1016 m() {} | 1030 m() {} |
| 1017 } | 1031 } |
| 1018 final a = const A(); | 1032 final a = const A(); |
| 1019 const C = a.m;'''); | 1033 const C = a.m;'''); |
| 1020 computeLibrarySourceErrors(source); | 1034 computeLibrarySourceErrors(source); |
| 1021 assertErrors(source, | 1035 assertErrors(source, |
| (...skipping 5157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6179 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); | 6193 source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]); |
| 6180 verify([source]); | 6194 verify([source]); |
| 6181 reset(); | 6195 reset(); |
| 6182 } | 6196 } |
| 6183 | 6197 |
| 6184 void _check_wrongNumberOfParametersForOperator1(String name) { | 6198 void _check_wrongNumberOfParametersForOperator1(String name) { |
| 6185 _check_wrongNumberOfParametersForOperator(name, ""); | 6199 _check_wrongNumberOfParametersForOperator(name, ""); |
| 6186 _check_wrongNumberOfParametersForOperator(name, "a, b"); | 6200 _check_wrongNumberOfParametersForOperator(name, "a, b"); |
| 6187 } | 6201 } |
| 6188 } | 6202 } |
| OLD | NEW |