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

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

Issue 3000743002: Check for null constructor field initializer expression. (Closed)
Patch Set: Check for null in ConstantEvaluationEngine instead. Created 3 years, 4 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/dart/constant/evaluation.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 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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 break; 874 break;
875 case 'abc': 875 case 'abc':
876 break; 876 break;
877 } 877 }
878 }'''); 878 }''');
879 await computeAnalysisResult(source); 879 await computeAnalysisResult(source);
880 assertNoErrors(source); 880 assertNoErrors(source);
881 verify([source]); 881 verify([source]);
882 } 882 }
883 883
884 test_const_invalid_constructorFieldInitializer_fromLibrary() async {
885 addNamedSource('/lib.dart', r'''
886 class A<T> {
887 final int f;
888 const A() : f = T.foo;
889 }
890 ''');
891 Source source = addSource(r'''
892 import 'lib.dart';
893 const a = const A();
894 ''');
895 await computeAnalysisResult(source);
896 assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
897 }
898
884 test_constConstructor_redirect_generic() async { 899 test_constConstructor_redirect_generic() async {
885 Source source = addSource(r''' 900 Source source = addSource(r'''
886 class A<T> { 901 class A<T> {
887 const A(T value) : this._(value); 902 const A(T value) : this._(value);
888 const A._(T value) : value = value; 903 const A._(T value) : value = value;
889 final T value; 904 final T value;
890 } 905 }
891 906
892 void main(){ 907 void main(){
893 const A<int>(1); 908 const A<int>(1);
(...skipping 5705 matching lines...) Expand 10 before | Expand all | Expand 10 after
6599 int _x; 6614 int _x;
6600 } 6615 }
6601 '''); 6616 ''');
6602 Source source = addSource(testCode); 6617 Source source = addSource(testCode);
6603 await computeAnalysisResult(source); 6618 await computeAnalysisResult(source);
6604 assertErrors( 6619 assertErrors(
6605 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]); 6620 source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]);
6606 verify([source]); 6621 verify([source]);
6607 } 6622 }
6608 } 6623 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/constant/evaluation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698