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>
This commit is contained in:
Nate Bosch 2021-04-19 21:04:38 +00:00 committed by commit-bot@chromium.org
parent 198450f53c
commit 9443e248ee
9 changed files with 40 additions and 43 deletions

View file

@ -30,6 +30,12 @@ Updated the Linter to `1.3.0`, which includes:
- 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

View file

@ -182,7 +182,7 @@ class ExperimentalFeatures {
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 @@ class IsEnabledByDefault {
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;

View file

@ -90,7 +90,7 @@ const Map<ExperimentalFlag, bool> defaultExperimentalFlags = {
ExperimentalFlag.nonfunctionTypeAliases: true,
ExperimentalFlag.setLiterals: true,
ExperimentalFlag.spreadCollections: true,
ExperimentalFlag.tripleShift: false,
ExperimentalFlag.tripleShift: true,
ExperimentalFlag.valueClass: false,
ExperimentalFlag.variance: false,
};

View file

@ -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 = #>>>
}

View file

@ -6,3 +6,8 @@ import "dart:_internal" as _in;
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

View file

@ -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 = #>>>
}

View file

@ -18,7 +18,7 @@ namespace dart {
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 @@ const char* GetExperimentalFeatureName(ExperimentalFeature feature) {
"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)];

View file

@ -21,6 +21,7 @@ enum class ExperimentalFeature {
control_flow_collections,
set_literals,
spread_collections,
triple_shift,
};
bool GetExperimentalFeatureDefault(ExperimentalFeature feature);

View file

@ -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 @@ features:
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');
}