Skip to content

Commit f20f619

Browse files
kallentucommit-bot@chromium.org
authored andcommitted
Add 'variance' experimental flag.
Generated flag code Change-Id: I61e6b8fd0a21c511c93afb9b334dc8c17eb69272 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117041 Reviewed-by: Leaf Petersen <[email protected]> Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Kallen Tu <[email protected]>
1 parent 139889e commit f20f619

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

pkg/analyzer/lib/src/dart/analysis/experiments.g.dart

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const _knownFeatures = <String, ExperimentalFeature>{
1616
EnableString.set_literals: ExperimentalFeatures.set_literals,
1717
EnableString.spread_collections: ExperimentalFeatures.spread_collections,
1818
EnableString.triple_shift: ExperimentalFeatures.triple_shift,
19+
EnableString.variance: ExperimentalFeatures.variance,
1920

2021
// ignore: deprecated_member_use_from_same_package
2122
EnableString.bogus_disabled: ExperimentalFeatures.bogus_disabled,
@@ -31,6 +32,7 @@ List<bool> _buildExperimentalFlagsArray() => <bool>[
3132
true, // set-literals
3233
true, // spread-collections
3334
IsEnabledByDefault.triple_shift,
35+
IsEnabledByDefault.variance,
3436
false, // bogus-disabled
3537
true, // bogus-enabled
3638
];
@@ -59,6 +61,9 @@ class EnableString {
5961
/// String to enable the experiment "triple-shift"
6062
static const String triple_shift = 'triple-shift';
6163

64+
/// String to enable the experiment "variance"
65+
static const String variance = 'variance';
66+
6267
/// String to enable the experiment "bogus-disabled"
6368
@deprecated
6469
static const String bogus_disabled = 'bogus-disabled';
@@ -122,9 +127,12 @@ class ExperimentalFeatures {
122127
IsExpired.triple_shift,
123128
'Triple-shift operator');
124129

130+
static const variance = const ExperimentalFeature(7, EnableString.variance,
131+
IsEnabledByDefault.variance, IsExpired.variance, 'Sound variance.');
132+
125133
@deprecated
126134
static const bogus_disabled = const ExperimentalFeature(
127-
7,
135+
8,
128136
// ignore: deprecated_member_use_from_same_package
129137
EnableString.bogus_disabled,
130138
IsEnabledByDefault.bogus_disabled,
@@ -133,7 +141,7 @@ class ExperimentalFeatures {
133141

134142
@deprecated
135143
static const bogus_enabled = const ExperimentalFeature(
136-
8,
144+
9,
137145
// ignore: deprecated_member_use_from_same_package
138146
EnableString.bogus_enabled,
139147
IsEnabledByDefault.bogus_enabled,
@@ -166,6 +174,9 @@ class IsEnabledByDefault {
166174
/// Default state of the experiment "triple-shift"
167175
static const bool triple_shift = false;
168176

177+
/// Default state of the experiment "variance"
178+
static const bool variance = false;
179+
169180
/// Default state of the experiment "bogus-disabled"
170181
@deprecated
171182
static const bool bogus_disabled = false;
@@ -200,6 +211,9 @@ class IsExpired {
200211
/// Expiration status of the experiment "triple-shift"
201212
static const bool triple_shift = false;
202213

214+
/// Expiration status of the experiment "variance"
215+
static const bool variance = false;
216+
203217
/// Expiration status of the experiment "bogus-disabled"
204218
static const bool bogus_disabled = true;
205219

@@ -241,5 +255,8 @@ mixin _CurrentState {
241255
/// Current state for the flag "triple-shift"
242256
bool get triple_shift => isEnabled(ExperimentalFeatures.triple_shift);
243257

258+
/// Current state for the flag "variance"
259+
bool get variance => isEnabled(ExperimentalFeatures.variance);
260+
244261
bool isEnabled(covariant ExperimentalFeature feature);
245262
}

pkg/front_end/lib/src/api_prototype/experimental_flags.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ enum ExperimentalFlag {
1515
setLiterals,
1616
spreadCollections,
1717
tripleShift,
18+
variance,
1819
}
1920

2021
ExperimentalFlag parseExperimentalFlag(String flag) {
@@ -33,6 +34,8 @@ ExperimentalFlag parseExperimentalFlag(String flag) {
3334
return ExperimentalFlag.spreadCollections;
3435
case "triple-shift":
3536
return ExperimentalFlag.tripleShift;
37+
case "variance":
38+
return ExperimentalFlag.variance;
3639
}
3740
return null;
3841
}
@@ -45,6 +48,7 @@ const Map<ExperimentalFlag, bool> defaultExperimentalFlags = {
4548
ExperimentalFlag.setLiterals: true,
4649
ExperimentalFlag.spreadCollections: true,
4750
ExperimentalFlag.tripleShift: false,
51+
ExperimentalFlag.variance: false,
4852
};
4953

5054
const Map<ExperimentalFlag, bool> expiredExperimentalFlags = {
@@ -55,4 +59,5 @@ const Map<ExperimentalFlag, bool> expiredExperimentalFlags = {
5559
ExperimentalFlag.setLiterals: true,
5660
ExperimentalFlag.spreadCollections: true,
5761
ExperimentalFlag.tripleShift: false,
62+
ExperimentalFlag.variance: false,
5863
};

tools/experimental_features.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ non-nullable:
7979
triple-shift:
8080
help: "Triple-shift operator"
8181

82+
variance:
83+
help: "Sound variance."
84+
8285
#
8386
# Flags below this line are shipped, retired, or rejected, cannot be specified
8487
# on the command line, and will eventually be removed.

0 commit comments

Comments
 (0)