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

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

Issue 1052243002: Implement the new '??=' operator in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/non_error_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 43775da08119b196a4a18cf6f1a11eb728a6a1aa..33b976963652a1765af50daca70d7932486d3fc3 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -6,6 +6,7 @@ library engine.non_error_resolver_test;
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/element.dart';
+import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/error.dart';
import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
import 'package:analyzer/src/generated/source_io.dart';
@@ -2307,6 +2308,36 @@ f([String x = '0']) {
verify([source]);
}
+ void test_invalidAssignment_ifNullAssignment_compatibleType() {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ Source source = addSource('''
+void f(int i) {
+ num n;
+ n ??= i;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_invalidAssignment_ifNullAssignment_sameType() {
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ options.enableNullAwareOperators = true;
+ resetWithOptions(options);
+ Source source = addSource('''
+void f(int i) {
+ int j;
+ j ??= i;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_invalidAssignment_implicitlyImplementFunctionViaCall_1() {
// 18341
//
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698