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

Unified Diff: pkg/analyzer/test/src/summary/resynthesize_common.dart

Issue 2912843004: Fix an exception caused by incomplete input (issue 29687) (Closed)
Patch Set: Added test Created 3 years, 7 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
Index: pkg/analyzer/test/src/summary/resynthesize_common.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 879fbe8297d9943b931bb94206001cb5d83c9027..4173ca9db2d2ece7063c020bc0674c80a32d966c 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -473,7 +473,7 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
} else if (o is BooleanLiteral && r is BooleanLiteral) {
expect(r.value, o.value, reason: desc);
} else if (o is IntegerLiteral && r is IntegerLiteral) {
- expect(r.value, o.value, reason: desc);
+ expect(r.value ?? 0, o.value ?? 0, reason: desc);
} else if (o is DoubleLiteral && r is DoubleLiteral) {
if (r.value != null &&
r.value.isNaN &&
@@ -3293,6 +3293,27 @@ int foo() {}
}
}
+ test_const_invalid_intLiteral() {
+ var library = checkLibrary(
+ r'''
+const int x = 0x;
+''',
+ allowErrors: true);
+ if (isStrongMode) {
+ checkElementText(
+ library,
+ r'''
+const int x = 0;
+''');
+ } else {
+ checkElementText(
+ library,
+ r'''
+const int x = 0;
scheglov 2017/05/30 17:25:18 I don't think we do this for all the tests, but in
Brian Wilkerson 2017/05/30 17:38:45 Done
+''');
+ }
+ }
+
test_const_invalid_topLevel() {
variablesWithNotConstInitializers.add('v');
var library = checkLibrary(

Powered by Google App Engine
This is Rietveld 408576698