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

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

Issue 637303005: Type check constant variable declarations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index f46e48b3e722d3a9391b1fa9f2ab08bcec6c1957..618c33aa405fb9766e1b9e58aa3b1adbf8ea1136 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -810,6 +810,24 @@ class CheckedModeCompileTimeErrorCodeTest extends ResolverTestCase {
StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
verify([source]);
}
+
+ void test_topLevelVarAssignable_null() {
+ Source source = addSource(EngineTestCase.createSource([
+ "const int x = null;"]));
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_topLevelVarNotAssignable() {
+ Source source = addSource(EngineTestCase.createSource([
+ "const int x = 'foo';"]));
+ resolve(source);
+ assertErrors(source, [
+ CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH,
+ StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ verify([source]);
+ }
}
class CompileTimeErrorCodeTest extends ResolverTestCase {

Powered by Google App Engine
This is Rietveld 408576698