Enable the triple shift experiment
Update the golden for a front_end test which adds additional constant evaluation
information now that the experiment is enabled.
A co19 test will start failing. https://github.com/dart-lang/co19/issues/1062
Change-Id: I18ec586f57deda83f6cd75e476137ab75d50a92f
TEST=No new tests.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193747
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b563cd..c1377e8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,12 @@
- new lint: `require_trailing_commas`.
- new lint: `prefer_null_aware_method_calls`.
+### Language
+
+* Add an unsigned shift right operator `>>>`. Pad with zeroes, ignoring the
+ sign bit. On the web platform `int.>>>` shifts the low 32 bits interpreted
+ as an unsigned integer, so `a >>> b` gives the same result as
+ `a.toUnsigned(32) >>> b` on the VM.
## 2.13.0
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
index cc7a05d..80b996d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
@@ -182,7 +182,7 @@
isExpired: IsExpired.triple_shift,
documentation: 'Triple-shift operator',
experimentalReleaseVersion: null,
- releaseVersion: null,
+ releaseVersion: Version.parse('2.14.0'),
);
static final value_class = ExperimentalFeature(
@@ -240,7 +240,7 @@
static const bool spread_collections = true;
/// Default state of the experiment "triple-shift"
- static const bool triple_shift = false;
+ static const bool triple_shift = true;
/// Default state of the experiment "value-class"
static const bool value_class = false;
diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
index 759b8fb..af04e106 100644
--- a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
+++ b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
@@ -90,7 +90,7 @@
ExperimentalFlag.nonfunctionTypeAliases: true,
ExperimentalFlag.setLiterals: true,
ExperimentalFlag.spreadCollections: true,
- ExperimentalFlag.tripleShift: false,
+ ExperimentalFlag.tripleShift: true,
ExperimentalFlag.valueClass: false,
ExperimentalFlag.variance: false,
};
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.expect b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.expect
index d856926..376dfb4 100644
--- a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.expect
+++ b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.expect
@@ -1,19 +1,11 @@
library;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:40: Error: Constant evaluation error:
-// const Symbol tripleShiftSymbol = const Symbol(">>>");
-// ^
-// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:47: Context: The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '">>>"'.
-// const Symbol tripleShiftSymbol = const Symbol(">>>");
-// ^
-// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:14: Context: While analyzing:
-// const Symbol tripleShiftSymbol = const Symbol(">>>");
-// ^
-//
import self as self;
import "dart:core" as core;
+import "dart:_internal" as _in;
-static const field core::Symbol* tripleShiftSymbol = invalid-expression "The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '\">>>\"'.";
+static const field core::Symbol* tripleShiftSymbol = #C1;
static method main() → dynamic {}
+
+constants {
+ #C1 = #>>>
+}
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.outline.expect b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.outline.expect
index e41cc76..9194ec0 100644
--- a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.outline.expect
@@ -6,3 +6,8 @@
static const field core::Symbol* tripleShiftSymbol = const _in::Symbol::•(">>>");
static method main() → dynamic
;
+
+
+Extra constant evaluation status:
+Evaluated: ConstructorInvocation @ org-dartlang-testcase:///various.dart:5:40 -> SymbolConstant(#>>>)
+Extra constant evaluation: evaluated: 1, effectively constant: 1
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.transformed.expect b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.transformed.expect
index d856926..376dfb4 100644
--- a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.weak.transformed.expect
@@ -1,19 +1,11 @@
library;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:40: Error: Constant evaluation error:
-// const Symbol tripleShiftSymbol = const Symbol(">>>");
-// ^
-// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:47: Context: The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '">>>"'.
-// const Symbol tripleShiftSymbol = const Symbol(">>>");
-// ^
-// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:14: Context: While analyzing:
-// const Symbol tripleShiftSymbol = const Symbol(">>>");
-// ^
-//
import self as self;
import "dart:core" as core;
+import "dart:_internal" as _in;
-static const field core::Symbol* tripleShiftSymbol = invalid-expression "The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '\">>>\"'.";
+static const field core::Symbol* tripleShiftSymbol = #C1;
static method main() → dynamic {}
+
+constants {
+ #C1 = #>>>
+}
diff --git a/runtime/vm/experimental_features.cc b/runtime/vm/experimental_features.cc
index 1c79061..162f8c8 100644
--- a/runtime/vm/experimental_features.cc
+++ b/runtime/vm/experimental_features.cc
@@ -18,7 +18,7 @@
bool GetExperimentalFeatureDefault(ExperimentalFeature feature) {
constexpr bool kFeatureValues[] = {
- true, true, true, true, true, true, true,
+ true, true, true, true, true, true, true, true,
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureValues));
return kFeatureValues[static_cast<int>(feature)];
@@ -29,7 +29,7 @@
"nonfunction-type-aliases", "non-nullable",
"extension-methods", "constant-update-2018",
"control-flow-collections", "set-literals",
- "spread-collections",
+ "spread-collections", "triple-shift",
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureNames));
return kFeatureNames[static_cast<int>(feature)];
diff --git a/runtime/vm/experimental_features.h b/runtime/vm/experimental_features.h
index 035af24..0bb9e50 100644
--- a/runtime/vm/experimental_features.h
+++ b/runtime/vm/experimental_features.h
@@ -21,6 +21,7 @@
control_flow_collections,
set_literals,
spread_collections,
+ triple_shift,
};
bool GetExperimentalFeatureDefault(ExperimentalFeature feature);
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml
index 55dfb4d..1881ab6 100644
--- a/tools/experimental_features.yaml
+++ b/tools/experimental_features.yaml
@@ -106,16 +106,6 @@
current-version: '2.14.0'
features:
- triple-shift:
- help: "Triple-shift operator"
- validation: |
- class A {
- operator>>>(int k) => 42;
- }
- void main() {
- if ((A() >>> 1) == 42) print('feature enabled');
- }
-
variance:
help: "Sound variance"
@@ -183,3 +173,14 @@
help: "Spread Collections"
enabledIn: '2.0.0'
expired: true
+
+ triple-shift:
+ help: "Triple-shift operator"
+ enabledIn: '2.14.0'
+ validation: |
+ class A {
+ operator>>>(int k) => 42;
+ }
+ void main() {
+ if ((A() >>> 1) == 42) print('feature enabled');
+ }