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

Unified Diff: pkg/analyzer/test/generated/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/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 7ba6e181e6ac64c29e865b4904f67c8358d014cd..d3e9748b57d0cb35e82030381fc9be30d980ec97 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -9892,6 +9892,24 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
_listener.assertNoErrors();
}
+ void test_visitAssignmentExpression_compoundIfNull_differentTypes() {
+ // double d; d ??= 0
+ Expression node = AstFactory.assignmentExpression(
+ _resolvedVariable(_typeProvider.doubleType, 'd'),
+ TokenType.QUESTION_QUESTION_EQ, _resolvedInteger(0));
+ expect(_analyze(node), same(_typeProvider.numType));
+ _listener.assertNoErrors();
+ }
+
+ void test_visitAssignmentExpression_compoundIfNull_sameTypes() {
+ // int i; i ??= 0
+ Expression node = AstFactory.assignmentExpression(
+ _resolvedVariable(_typeProvider.intType, 'i'),
+ TokenType.QUESTION_QUESTION_EQ, _resolvedInteger(0));
+ expect(_analyze(node), same(_typeProvider.intType));
+ _listener.assertNoErrors();
+ }
+
void test_visitAssignmentExpression_simple() {
// i = 0
InterfaceType intType = _typeProvider.intType;

Powered by Google App Engine
This is Rietveld 408576698