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

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

Issue 1416873003: Rework handling of potentially-constant variables. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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
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 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698