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

Unified Diff: pkg/analyzer/test/src/task/strong/non_null_checker_test.dart

Issue 2205743002: Add non-null types list to StrongModeOptions (Closed) Base URL: https://github.com/dart-lang/sdk@master
Patch Set: Address comments Created 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/task/strong/non_null_checker_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/non_null_checker_test.dart b/pkg/analyzer/test/src/task/strong/non_null_checker_test.dart
index 1b2a7a6de77f6e864c07d9e3ce6365c4a12c8290..7b9b933973941f16ec1a328330c89e10378b925a 100644
--- a/pkg/analyzer/test/src/task/strong/non_null_checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/non_null_checker_test.dart
@@ -42,4 +42,16 @@ main() {
}
''');
}
+
+ void test_nullableTypes() {
+ // By default x can be set to null.
+ checkFile('''int x = null;''');
+ }
+
+ @failingTest
+ void test_nonnullableTypes() {
+ // If `int`s are non-nullable, then this code should throw an error.
+ addFile('''int x = /*error:INVALID_ASSIGNMENT*/null;''');
+ check(nonnullableTypes: <String>['dart:core,int']);
+ }
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/type_system.dart ('k') | pkg/analyzer/test/src/task/strong/strong_test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698