Version 2.15.0-125.0.dev
Merge commit '4ff0cb2ac3e57fe351da445653b8af2a5430a495' into 'dev'
diff --git a/pkg/analyzer/test/generated/constant_test.dart b/pkg/analyzer/test/generated/constant_test.dart
index 4a17b0e..2fb02e1 100644
--- a/pkg/analyzer/test/generated/constant_test.dart
+++ b/pkg/analyzer/test/generated/constant_test.dart
@@ -421,10 +421,6 @@
expect(value, null);
}
- test_leftShift_int_int() async {
- await _assertValueInt(64, "16 << 2");
- }
-
test_lessThan_int_int() async {
await _assertValueBool(true, "2 < 3");
}
@@ -608,18 +604,6 @@
expect(value, null);
}
- test_remainder_double_double() async {
- await _assertValueDouble(3.2 % 2.3, "3.2 % 2.3");
- }
-
- test_remainder_int_int() async {
- await _assertValueInt(2, "8 % 3");
- }
-
- test_rightShift() async {
- await _assertValueInt(16, "64 >> 2");
- }
-
@failingTest
test_simpleIdentifier_invalid() async {
var result = await _getExpressionValue("?");
@@ -644,26 +628,6 @@
await _assertValueInt(6, "'Dvorak'.length");
}
- test_times_double_double() async {
- await _assertValueDouble(2.3 * 3.2, "2.3 * 3.2");
- }
-
- test_times_int_int() async {
- await _assertValueInt(6, "2 * 3");
- }
-
- test_tripleShift() async {
- await _assertValueInt(16, "64 >>> 2");
- }
-
- test_truncatingDivide_double_double() async {
- await _assertValueInt(1, "3.2 ~/ 2.3");
- }
-
- test_truncatingDivide_int_int() async {
- await _assertValueInt(3, "10 ~/ 3");
- }
-
Future<void> _assertValueBool(bool expectedValue, String contents) async {
var result = await _getExpressionValue(contents);
DartObject value = result.value!;
diff --git a/pkg/analyzer/test/src/dart/constant/value_test.dart b/pkg/analyzer/test/src/dart/constant/value_test.dart
index aad7d69..232d0f1 100644
--- a/pkg/analyzer/test/src/dart/constant/value_test.dart
+++ b/pkg/analyzer/test/src/dart/constant/value_test.dart
@@ -1361,6 +1361,22 @@
_assertLazyOr(_boolValue(true), _boolValue(true), _boolValue(true));
}
+ void test_logicalShiftRight_knownInt_knownInt() {
+ _assertLogicalShiftRight(_intValue(16), _intValue(64), _intValue(2));
+ }
+
+ void test_logicalShiftRight_knownInt_unknownInt() {
+ _assertLogicalShiftRight(_intValue(null), _intValue(64), _intValue(null));
+ }
+
+ void test_logicalShiftRight_unknownInt_knownInt() {
+ _assertLogicalShiftRight(_intValue(null), _intValue(null), _intValue(2));
+ }
+
+ void test_logicalShiftRight_unknownInt_unknownInt() {
+ _assertLogicalShiftRight(_intValue(null), _intValue(null), _intValue(null));
+ }
+
void test_minus_knownDouble_knownDouble() {
_assertMinus(_doubleValue(1.0), _doubleValue(4.0), _doubleValue(3.0));
}
@@ -1728,6 +1744,20 @@
_assertTimes(_intValue(null), _intValue(null), _intValue(3));
}
+ /// Assert that the result of executing [fn] is the [expected] value, or, if
+ /// [expected] is `null`, that the operation throws an exception .
+ void _assert(DartObjectImpl? expected, DartObjectImpl? Function() fn) {
+ if (expected == null) {
+ expect(() {
+ fn();
+ }, throwsEvaluationException);
+ } else {
+ var result = fn();
+ expect(result, isNotNull);
+ expect(result, expected);
+ }
+ }
+
/// Assert that the result of adding the [left] and [right] operands is the
/// [expected] value, or that the operation throws an exception if the
/// expected value is `null`.
@@ -1993,6 +2023,14 @@
}
}
+ /// Assert that the result of bit-shifting the [left] operand by the [right]
+ /// operand number of bits is the [expected] value, or that the operation
+ /// throws an exception if the expected value is `null`.
+ void _assertLogicalShiftRight(
+ DartObjectImpl? expected, DartObjectImpl left, DartObjectImpl right) {
+ _assert(expected, () => left.logicalShiftRight(_typeSystem, right));
+ }
+
/// Assert that the result of subtracting the [left] and [right] operands is
/// the [expected] value, or that the operation throws an exception if the
/// expected value is `null`.
@@ -2059,15 +2097,7 @@
/// exception if the expected value is `null`.
void _assertRemainder(
DartObjectImpl? expected, DartObjectImpl left, DartObjectImpl right) {
- if (expected == null) {
- expect(() {
- left.remainder(_typeSystem, right);
- }, throwsEvaluationException);
- } else {
- DartObjectImpl result = left.remainder(_typeSystem, right);
- expect(result, isNotNull);
- expect(result, expected);
- }
+ _assert(expected, () => left.remainder(_typeSystem, right));
}
/// Assert that the result of multiplying the [left] and [right] operands is
@@ -2075,15 +2105,7 @@
/// expected value is `null`.
void _assertShiftLeft(
DartObjectImpl? expected, DartObjectImpl left, DartObjectImpl right) {
- if (expected == null) {
- expect(() {
- left.shiftLeft(_typeSystem, right);
- }, throwsEvaluationException);
- } else {
- DartObjectImpl result = left.shiftLeft(_typeSystem, right);
- expect(result, isNotNull);
- expect(result, expected);
- }
+ _assert(expected, () => left.shiftLeft(_typeSystem, right));
}
/// Assert that the result of multiplying the [left] and [right] operands is
@@ -2091,15 +2113,7 @@
/// expected value is `null`.
void _assertShiftRight(
DartObjectImpl? expected, DartObjectImpl left, DartObjectImpl right) {
- if (expected == null) {
- expect(() {
- left.shiftRight(_typeSystem, right);
- }, throwsEvaluationException);
- } else {
- DartObjectImpl result = left.shiftRight(_typeSystem, right);
- expect(result, isNotNull);
- expect(result, expected);
- }
+ _assert(expected, () => left.shiftRight(_typeSystem, right));
}
/// Assert that the length of the [operand] is the [expected] value, or that
@@ -2121,15 +2135,7 @@
/// expected value is `null`.
void _assertTimes(
DartObjectImpl? expected, DartObjectImpl left, DartObjectImpl right) {
- if (expected == null) {
- expect(() {
- left.times(_typeSystem, right);
- }, throwsEvaluationException);
- } else {
- DartObjectImpl result = left.times(_typeSystem, right);
- expect(result, isNotNull);
- expect(result, expected);
- }
+ _assert(expected, () => left.times(_typeSystem, right));
}
DartObjectImpl _boolValue(bool? value) {
diff --git a/tools/VERSION b/tools/VERSION
index 96c9f0d..3b4a0db 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 124
+PRERELEASE 125
PRERELEASE_PATCH 0
\ No newline at end of file