Cleanup experiment flags formatting:

- Move down shipped 3.0 flags
- Sort all flags consistently

TEST=Manually verified

Change-Id: I21c209df4ff11322512e50a2be666293b5a9743f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302323
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
This commit is contained in:
Michael Thomsen 2023-05-09 21:08:41 +00:00 committed by Commit Queue
parent 2829b2cfce
commit 152296e642
4 changed files with 134 additions and 132 deletions

View file

@ -87,7 +87,7 @@ import 'package:analyzer/src/utilities/uri_cache.dart';
/// TODO(scheglov) Clean up the list of implicitly analyzed files.
class AnalysisDriver implements AnalysisDriverGeneric {
/// The version of data format, should be incremented on every format change.
static const int DATA_VERSION = 270;
static const int DATA_VERSION = 271;
/// The number of exception contexts allowed to write. Once this field is
/// zero, we stop writing any new exception contexts in this process.

View file

@ -29,23 +29,23 @@ const char* GetExperimentalFeatureName(ExperimentalFeature feature) {
constexpr const char* kFeatureNames[] = {
"sealed-class",
"class-modifiers",
"records",
"patterns",
"unnamed-libraries",
"inference-update-1",
"enhanced-enums",
"named-arguments-anywhere",
"super-parameters",
"constructor-tearoffs",
"generic-metadata",
"triple-shift",
"nonfunction-type-aliases",
"non-nullable",
"extension-methods",
"constant-update-2018",
"control-flow-collections",
"generic-metadata",
"set-literals",
"spread-collections",
"triple-shift",
"constructor-tearoffs",
"enhanced-enums",
"named-arguments-anywhere",
"super-parameters",
"inference-update-1",
"unnamed-libraries",
"records",
"patterns",
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureNames));
return kFeatureNames[static_cast<int>(feature)];

View file

@ -16,23 +16,23 @@ namespace dart {
enum class ExperimentalFeature {
sealed_class,
class_modifiers,
records,
patterns,
unnamed_libraries,
inference_update_1,
enhanced_enums,
named_arguments_anywhere,
super_parameters,
constructor_tearoffs,
generic_metadata,
triple_shift,
nonfunction_type_aliases,
non_nullable,
extension_methods,
constant_update_2018,
control_flow_collections,
generic_metadata,
set_literals,
spread_collections,
triple_shift,
constructor_tearoffs,
enhanced_enums,
named_arguments_anywhere,
super_parameters,
inference_update_1,
unnamed_libraries,
records,
patterns,
};
bool GetExperimentalFeatureDefault(ExperimentalFeature feature);

View file

@ -133,6 +133,19 @@ features:
inline-class:
help: "Inline class"
# Experiment flag only used for testing.
test-experiment:
help: >-
Has no effect. Can be used for testing the --enable-experiment
command line functionality.
#
# Flags below this line are shipped, or scheduled to ship in the next
# stable release. They should be sorted descending by release.
#
# Shipped flags should be marked retired the following stable release.
#
sealed-class:
help: "Sealed class"
enabledIn: '3.0.0'
@ -151,16 +164,31 @@ features:
print('feature enabled');
}
# Experiment flag only used for testing.
test-experiment:
help: >-
Has no effect. Can be used for testing the --enable-experiment
command line functionality.
records:
help: "Records"
enabledIn: '3.0.0'
validation: |
final x = ('feature', a: 'enabled');
void main() {
print('${x.$1} ${x.a}');
}
#
# Flags below this line are shipped, retired, or rejected, cannot be specified
# on the command line, and will eventually be removed.
#
patterns:
help: "Patterns"
enabledIn: '3.0.0'
validation: |
void main() {
final [a, b] = ['feature', 'enabled'];
print('$a $b');
}
unnamed-libraries:
help: "Unnamed libraries"
enabledIn: '2.19.0'
expired: true
validation: |
library;
void main() => print('feature enabled');
alternative-invalidation-strategy:
help: "Alternative invalidation strategy for incremental compilation."
@ -168,86 +196,23 @@ features:
enabledIn: '2.18.0'
expired: true
nonfunction-type-aliases:
help: "Type aliases define a <type>, not just a <functionType>"
enabledIn: '2.13.0'
inference-update-1:
help: "Horizontal type inference for function expressions passed to generic invocations."
enabledIn: '2.18.0'
expired: true
validation: |
typedef S = String;
void main() {
S s = 'feature enabled';
print(s);
void test(List<int> list) {
var a = list.fold(0, (x, y) => x + y);
f(a);
}
expired: true
non-nullable:
help: "Non Nullable by default"
experimentalReleaseVersion: '2.10.0'
enabledIn: '2.12.0'
validation: |
void main() {
int? a = null;
print('feature enabled');
}
expired: true
extension-methods:
help: "Extension Methods"
enabledIn: '2.6.0'
expired: true
constant-update-2018:
help: "Enhanced constant expressions"
enabledIn: '2.0.0'
expired: true
control-flow-collections:
help: "Control Flow Collections"
enabledIn: '2.0.0'
expired: true
generic-metadata:
help: >-
Allow annotations to accept type arguments;
also allow generic function types as type arguments.
enabledIn: '2.14.0'
expired: true
set-literals:
help: "Set Literals"
enabledIn: '2.0.0'
expired: true
spread-collections:
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');
}
expired: true
constructor-tearoffs:
help: "Allow constructor tear-offs and explicit generic instantiations."
enabledIn: '2.15.0'
validation: |
class A {
A() {
void f<T>(T t) {
if (T == int) {
print('feature enabled');
}
}
void main() {
var c = A.new;
c();
test([1, 2, 3]);
}
expired: true
enhanced-enums:
help: "Enhanced Enums"
@ -294,46 +259,83 @@ features:
}
expired: true
inference-update-1:
help: "Horizontal type inference for function expressions passed to generic invocations."
enabledIn: '2.18.0'
expired: true
constructor-tearoffs:
help: "Allow constructor tear-offs and explicit generic instantiations."
enabledIn: '2.15.0'
validation: |
void test(List<int> list) {
var a = list.fold(0, (x, y) => x + y);
f(a);
}
void f<T>(T t) {
if (T == int) {
class A {
A() {
print('feature enabled');
}
}
void main() {
test([1, 2, 3]);
var c = A.new;
c();
}
unnamed-libraries:
help: "Unnamed libraries"
enabledIn: '2.19.0'
expired: true
validation: |
library;
void main() => print('feature enabled');
records:
help: "Records"
enabledIn: '3.0.0'
generic-metadata:
help: >-
Allow annotations to accept type arguments;
also allow generic function types as type arguments.
enabledIn: '2.14.0'
expired: true
triple-shift:
help: "Triple-shift operator"
enabledIn: '2.14.0'
validation: |
final x = ('feature', a: 'enabled');
void main() {
print('${x.$1} ${x.a}');
class A {
operator>>>(int k) => 42;
}
void main() {
if ((A() >>> 1) == 42) print('feature enabled');
}
expired: true
patterns:
help: "Patterns"
enabledIn: '3.0.0'
nonfunction-type-aliases:
help: "Type aliases define a <type>, not just a <functionType>"
enabledIn: '2.13.0'
validation: |
typedef S = String;
void main() {
S s = 'feature enabled';
print(s);
}
expired: true
non-nullable:
help: "Non Nullable by default"
experimentalReleaseVersion: '2.10.0'
enabledIn: '2.12.0'
validation: |
void main() {
final [a, b] = ['feature', 'enabled'];
print('$a $b');
int? a = null;
print('feature enabled');
}
expired: true
extension-methods:
help: "Extension Methods"
enabledIn: '2.6.0'
expired: true
constant-update-2018:
help: "Enhanced constant expressions"
enabledIn: '2.0.0'
expired: true
control-flow-collections:
help: "Control Flow Collections"
enabledIn: '2.0.0'
expired: true
set-literals:
help: "Set Literals"
enabledIn: '2.0.0'
expired: true
spread-collections:
help: "Spread Collections"
enabledIn: '2.0.0'
expired: true