Index: pkg/analyzer/lib/src/dart/ast/utilities.dart |
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart |
index 3efd68b24894e652a1fd46e77a69644023dec045..8ac2c16df693767f4f30d52b213241b5ed254bae 100644 |
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart |
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart |
@@ -2190,16 +2190,21 @@ class AstComparator implements AstVisitor<bool> { |
* > expressions that evaluate to an integer value or to <b>null</b>. |
* > </span> |
* > * <span> |
- * > An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub> + |
- * > e<sub>2</sub></i>, <i>e<sub>1</sub> -e<sub>2</sub></i>, |
- * > <i>e<sub>1</sub> * e<sub>2</sub></i>, <i>e<sub>1</sub> / |
- * > e<sub>2</sub></i>, <i>e<sub>1</sub> ~/ e<sub>2</sub></i>, |
- * > <i>e<sub>1</sub> > e<sub>2</sub></i>, <i>e<sub>1</sub> < |
- * > e<sub>2</sub></i>, <i>e<sub>1</sub> >= e<sub>2</sub></i>, |
- * > <i>e<sub>1</sub> <= e<sub>2</sub></i> or <i>e<sub>1</sub> % |
- * > e<sub>2</sub></i>, where <i>e</i>, <i>e<sub>1</sub></i> and |
- * > <i>e<sub>2</sub></i> are constant expressions that evaluate to a numeric |
- * > value or to <b>null</b>. |
+ * > An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub> |
+ * > -e<sub>2</sub></i>, <i>e<sub>1</sub> * e<sub>2</sub></i>, |
+ * > <i>e<sub>1</sub> / e<sub>2</sub></i>, <i>e<sub>1</sub> ~/ |
+ * > e<sub>2</sub></i>, <i>e<sub>1</sub> > e<sub>2</sub></i>, |
+ * > <i>e<sub>1</sub> < e<sub>2</sub></i>, <i>e<sub>1</sub> >= |
+ * > e<sub>2</sub></i>, <i>e<sub>1</sub> <= e<sub>2</sub></i> or |
+ * > <i>e<sub>1</sub> % e<sub>2</sub></i>, where <i>e</i>, |
+ * > <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant expressions |
+ * > that evaluate to a numeric value or to <b>null</b>. |
+ * > </span> |
+ * > * <span> |
+ * > An expression of one the form <i>e<sub>1</sub> + e<sub>2</sub></i>, |
+ * > <i>e<sub>1</sub> -e<sub>2</sub></i> where <i>e<sub>1</sub> and |
+ * > e<sub>2</sub></i> are constant expressions that evaluate to a numeric or |
+ * > string value or to <b>null</b>. |
* > </span> |
* > * <span> |
* > An expression of the form <i>e<sub>1</sub> ? e<sub>2</sub> : |
@@ -2208,6 +2213,8 @@ class AstComparator implements AstVisitor<bool> { |
* > evaluates to a boolean value. |
* > </span> |
* |
+ * However, this comment is now at least a little bit out of sync with the spec. |
+ * |
* The values returned by instances of this class are therefore `null` and |
* instances of the classes `Boolean`, `BigInteger`, `Double`, `String`, and |
* `DartObject`. |
@@ -2332,7 +2339,8 @@ class ConstantEvaluator extends GeneralizingAstVisitor<Object> { |
} |
} else if (node.operator.type == TokenType.PLUS) { |
// numeric or {@code null} |
- if (leftOperand is num && rightOperand is num) { |
+ if ((leftOperand is num && rightOperand is num) || |
+ (leftOperand is String && rightOperand is String)) { |
return leftOperand + rightOperand; |
} |
} else if (node.operator.type == TokenType.STAR) { |