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

Unified Diff: pkg/analyzer/test/generated/compile_time_error_code_test.dart

Issue 1124433007: Fix constant evaluation logic for String.length. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/compile_time_error_code_test.dart
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index da6980435f283b9030a549a8697df9a540c04981..c365c9f90bfd8b613736c5b44e81a4448cc81d92 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -3251,6 +3251,19 @@ f() {
// We cannot verify resolution with undefined labels
}
+ void test_length_of_erroneous_constant() {
+ // Attempting to compute the length of constant that couldn't be evaluated
+ // (due to an error) should not crash the analyzer (see dartbug.com/23383)
+ Source source = addSource("const int i = (1 ? 'alpha' : 'beta').length;");
+ resolve(source);
+ assertErrors(source, [
+ CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE,
+ CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
+ StaticTypeWarningCode.NON_BOOL_CONDITION
+ ]);
+ verify([source]);
+ }
+
void test_memberWithClassName_field() {
Source source = addSource(r'''
class A {
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698