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

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

Issue 1873913002: Refine compound assignment type. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | pkg/analyzer/test/generated/test_all.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/static_type_analyzer_test.dart
diff --git a/pkg/analyzer/test/generated/static_type_analyzer_test.dart b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
index dd0d1729f4475d9e17997b5b9f1a111b7e90c87a..0e0e3a1005e8dd9393cdf02cae66c27400c00ddf 100644
--- a/pkg/analyzer/test/generated/static_type_analyzer_test.dart
+++ b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
@@ -375,16 +375,42 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
_listener.assertNoErrors();
}
- void test_visitAssignmentExpression_compound() {
- // i += 1
- InterfaceType numType = _typeProvider.numType;
- SimpleIdentifier identifier = _resolvedVariable(_typeProvider.intType, "i");
- AssignmentExpression node = AstFactory.assignmentExpression(
- identifier, TokenType.PLUS_EQ, _resolvedInteger(1));
- MethodElement plusMethod = getMethod(numType, "+");
- node.staticElement = plusMethod;
- expect(_analyze(node), same(numType));
- _listener.assertNoErrors();
+ void test_visitAssignmentExpression_compound_II() {
+ validate(TokenType operator) {
+ InterfaceType numType = _typeProvider.numType;
+ InterfaceType intType = _typeProvider.intType;
+ SimpleIdentifier identifier = _resolvedVariable(intType, "i");
+ AssignmentExpression node = AstFactory.assignmentExpression(
+ identifier, operator, _resolvedInteger(1));
+ MethodElement plusMethod = getMethod(numType, "+");
+ node.staticElement = plusMethod;
+ expect(_analyze(node), same(intType));
+ _listener.assertNoErrors();
+ }
+ validate(TokenType.MINUS_EQ);
+ validate(TokenType.PERCENT_EQ);
+ validate(TokenType.PLUS_EQ);
+ validate(TokenType.STAR_EQ);
+ validate(TokenType.TILDE_SLASH_EQ);
+ }
+
+ void test_visitAssignmentExpression_compound_plusID() {
+ validate(TokenType operator) {
+ InterfaceType numType = _typeProvider.numType;
+ InterfaceType intType = _typeProvider.intType;
+ InterfaceType doubleType = _typeProvider.doubleType;
+ SimpleIdentifier identifier = _resolvedVariable(intType, "i");
+ AssignmentExpression node = AstFactory.assignmentExpression(
+ identifier, operator, _resolvedDouble(1.0));
+ MethodElement plusMethod = getMethod(numType, "+");
+ node.staticElement = plusMethod;
+ expect(_analyze(node), same(doubleType));
+ _listener.assertNoErrors();
+ }
+ validate(TokenType.MINUS_EQ);
+ validate(TokenType.PERCENT_EQ);
+ validate(TokenType.PLUS_EQ);
+ validate(TokenType.STAR_EQ);
}
void test_visitAssignmentExpression_compoundIfNull_differentTypes() {
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | pkg/analyzer/test/generated/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698