2019-06-04 12:14:09 +00:00
|
|
|
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
# Experimental features are described in docs/process/experimental-flags.md
|
2022-12-10 12:15:47 +00:00
|
|
|
#
|
|
|
|
# Despite the name, they are not limited to experiments, and are often
|
|
|
|
# used to enable new features or enhancements that are being
|
2019-06-04 12:14:09 +00:00
|
|
|
# developed and are not yet shipped. Experimental feature flags are expected
|
2022-12-10 12:15:47 +00:00
|
|
|
# to be relatively short-lived. Some features behind experiment flags
|
|
|
|
# may get cancelled and never ship.
|
2019-06-04 12:14:09 +00:00
|
|
|
#
|
2019-06-13 21:30:05 +00:00
|
|
|
# ### Code Generation
|
|
|
|
#
|
2020-11-13 00:29:38 +00:00
|
|
|
# When you change this file, run the following to update analyzer, kernel, and
|
|
|
|
# vm:
|
2019-06-13 21:30:05 +00:00
|
|
|
#
|
|
|
|
# analyzer:
|
|
|
|
# dart pkg/analyzer/tool/experiments/generate.dart
|
|
|
|
#
|
2022-08-16 06:36:36 +00:00
|
|
|
# Also, pkg/analyzer/lib/src/dart/analysis/driver.dart will need a bump in
|
2022-09-23 05:37:39 +00:00
|
|
|
# DATA_VERSION if making changes that change the "index" of any previous flags,
|
|
|
|
# e.g. if adding a new flag that doesn't happen to be lexicographically last.
|
2022-08-16 06:36:36 +00:00
|
|
|
#
|
2019-06-13 21:30:05 +00:00
|
|
|
# kernel:
|
2022-11-02 11:09:59 +00:00
|
|
|
# dart pkg/front_end/tool/fasta.dart generate-experimental-flags
|
2019-06-13 21:30:05 +00:00
|
|
|
#
|
2020-11-13 00:29:38 +00:00
|
|
|
# vm:
|
|
|
|
# dart tools/generate_experimental_flags.dart
|
|
|
|
#
|
2019-06-13 21:30:05 +00:00
|
|
|
# ### Overview
|
|
|
|
#
|
2020-03-03 19:25:44 +00:00
|
|
|
# This document consists mostly of a map called "features".
|
2019-06-04 12:14:09 +00:00
|
|
|
# Each entry in this map corresponds to an experiment,
|
|
|
|
# and contains the following parts:
|
|
|
|
#
|
|
|
|
# 1. help: (required text)
|
|
|
|
# A human readable description of the experiment.
|
|
|
|
#
|
|
|
|
# 2. enabledIn: (optional #.#)
|
|
|
|
# The Dart SDK version (<major>.<minor>) in which the experiment is shipping.
|
|
|
|
#
|
|
|
|
# If this field is specified, then the experiment is enabled regardless of
|
|
|
|
# the actual version of the SDK. If this field is omitted, then the
|
|
|
|
# experiment is disabled by default, but may be enabled by specifying the
|
|
|
|
# flag on the command line. (e.g. --enable-experiment=non-nullable)
|
|
|
|
#
|
2020-08-25 21:44:03 +00:00
|
|
|
# A version less than this version may be specified in a .packages file
|
2019-06-04 12:14:09 +00:00
|
|
|
# or in a library language version override (e.g. // @dart = 2.1)
|
|
|
|
# to disable this feature. For more on library language version override, see
|
|
|
|
# https://github.com/dart-lang/language/blob/master/accepted/future-releases/language-versioning/language-versioning.md
|
|
|
|
#
|
|
|
|
# 3. expired: (optional boolean)
|
|
|
|
# If true, then the experiment can no longer be enabled by specifying the
|
|
|
|
# flag on the command line, and the corresponding entry is slated for
|
|
|
|
# eventual removal from this file. If this field is omitted, then 'expired'
|
|
|
|
# is considered to be false.
|
|
|
|
#
|
2021-02-23 13:57:29 +00:00
|
|
|
# 4. validation: (optional string)
|
|
|
|
# If provided this should be a program that prints "feature enabled" on
|
|
|
|
# stdout if the feature is enabled, and throws or fails to compile otherwise.
|
|
|
|
# The intended use for this is to be able to run generic tests for each
|
|
|
|
# experiment.
|
|
|
|
#
|
2019-06-04 12:14:09 +00:00
|
|
|
# Using the above fields, experiments pass through several states:
|
|
|
|
#
|
|
|
|
# Disabled:
|
|
|
|
# When an experiment is first added to this file, the 'enabledIn' and
|
|
|
|
# 'expired' fields are omitted and the experiment is disabled by default,
|
|
|
|
# but may be enabled by specifying the flag on the command line.
|
|
|
|
# The implementation teams begin building support for the feature,
|
|
|
|
# guarded by the flag. Users can enable the flag and begin to try out
|
|
|
|
# the feature as it is being developed.
|
|
|
|
#
|
2020-08-25 12:32:50 +00:00
|
|
|
# Experimental release:
|
|
|
|
# When an experiment is released, then the 'experimentalReleaseVersion' field
|
|
|
|
# is added indicating which version of the SDK contains this new language
|
|
|
|
# feature for libraries and packages in mentioned in
|
|
|
|
# `sdk/lib/_internal/allowed_experiments.json`. For other libraries and
|
|
|
|
# packages, passing the experiment flag is still required to turn on the
|
|
|
|
# experiment.
|
|
|
|
#
|
2019-06-04 12:14:09 +00:00
|
|
|
# Shipped:
|
|
|
|
# When an experiment is shipped, then the 'enabledIn' field is added
|
|
|
|
# indicating which version of the SDK contains this new language feature.
|
|
|
|
# At this point, specifying the flag on the command line has no effect because
|
|
|
|
# the experiment is enabled by default and cannot be disabled.
|
|
|
|
#
|
|
|
|
# Retired or Rejected:
|
|
|
|
# At some point, the 'expired' field is added to the experiment indicating
|
|
|
|
# that the flag is to be retired if the experiment has shipped or that the
|
|
|
|
# entire experiment was rejected if the experiment has not shipped. It also
|
|
|
|
# indicates that the corresponding entry is slated for eventual removal
|
|
|
|
# from this file. Users specifying this flag on the command line should receive
|
|
|
|
# a warning that the experiment has been retired or rejected, but the tool
|
|
|
|
# should continue to run.
|
2020-03-03 19:25:44 +00:00
|
|
|
#
|
|
|
|
# In addition, there is also a value called "current-version"
|
|
|
|
# specifying the version of Dart that is currently being developed.
|
|
|
|
# Dart source files that don't specify their own version will be
|
|
|
|
# presumed to be in this version. Experiment flags will not affect
|
|
|
|
# files that specify an earlier version.
|
2020-06-24 07:18:41 +00:00
|
|
|
#
|
|
|
|
# Furthermore, most of the above was designed with language features
|
2023-01-11 02:49:10 +00:00
|
|
|
# (spanning both CFE and Analyzer) in mind, but didn't take into account
|
2020-06-24 07:18:41 +00:00
|
|
|
# features in individual products (e.g. in CFE that has no influence on
|
|
|
|
# Analyzer). As a stepping-stone to allow for this usage as well, a "category"
|
|
|
|
# is also available. If no "category" is specified it's assumed to be the
|
|
|
|
# default 'language' "category" with code generated for both CFE and Analyzer,
|
|
|
|
# while other categories can be tailored more specifically.
|
2020-03-03 19:25:44 +00:00
|
|
|
|
2023-10-06 19:00:58 +00:00
|
|
|
current-version: '3.3.0'
|
2019-06-04 12:14:09 +00:00
|
|
|
|
2020-03-03 19:25:44 +00:00
|
|
|
features:
|
|
|
|
variance:
|
2020-06-30 23:22:42 +00:00
|
|
|
help: "Sound variance"
|
2019-09-13 16:11:16 +00:00
|
|
|
|
2021-02-22 16:32:19 +00:00
|
|
|
const-functions:
|
|
|
|
help: "Allow more of the Dart language to be executed in const expressions."
|
|
|
|
|
2021-12-21 10:45:59 +00:00
|
|
|
macros:
|
2023-11-02 09:38:12 +00:00
|
|
|
experimentalReleaseVersion: '3.3.0'
|
2021-12-21 10:45:59 +00:00
|
|
|
help: "Static meta-programming"
|
|
|
|
|
2022-12-12 22:22:39 +00:00
|
|
|
inline-class:
|
2023-10-30 10:58:45 +00:00
|
|
|
experimentalReleaseVersion: '3.3.0'
|
2023-07-27 09:30:36 +00:00
|
|
|
help: "Extension Types"
|
2022-11-02 11:09:59 +00:00
|
|
|
|
2023-05-30 09:10:28 +00:00
|
|
|
native-assets:
|
|
|
|
help: "Compile and bundle native assets."
|
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2023-07-28 23:56:52 +00:00
|
|
|
inference-update-2:
|
|
|
|
enabledIn: '3.2.0'
|
|
|
|
validation: |
|
|
|
|
class C {
|
|
|
|
final String? _x;
|
|
|
|
C(this._x);
|
|
|
|
}
|
|
|
|
String f(C c) => c._x == null ? 'no' : c._x;
|
|
|
|
main() {
|
|
|
|
print(f(C('feature enabled')));
|
|
|
|
}
|
|
|
|
help: "Type promotion for fields"
|
|
|
|
|
2022-11-05 00:20:50 +00:00
|
|
|
sealed-class:
|
|
|
|
help: "Sealed class"
|
2023-03-10 05:27:57 +00:00
|
|
|
enabledIn: '3.0.0'
|
|
|
|
validation: |
|
|
|
|
sealed class A {}
|
|
|
|
void main() {
|
|
|
|
print('feature enabled');
|
|
|
|
}
|
2022-11-05 00:20:50 +00:00
|
|
|
|
2022-12-21 21:44:32 +00:00
|
|
|
class-modifiers:
|
|
|
|
help: "Class modifiers"
|
2023-03-10 05:27:57 +00:00
|
|
|
enabledIn: '3.0.0'
|
|
|
|
validation: |
|
|
|
|
interface class A {}
|
|
|
|
void main() {
|
|
|
|
print('feature enabled');
|
|
|
|
}
|
2022-12-21 21:44:32 +00:00
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
records:
|
|
|
|
help: "Records"
|
|
|
|
enabledIn: '3.0.0'
|
2021-04-03 01:31:42 +00:00
|
|
|
validation: |
|
2023-05-09 21:08:41 +00:00
|
|
|
final x = ('feature', a: 'enabled');
|
2021-04-03 01:31:42 +00:00
|
|
|
void main() {
|
2023-05-09 21:08:41 +00:00
|
|
|
print('${x.$1} ${x.a}');
|
2021-04-03 01:31:42 +00:00
|
|
|
}
|
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
patterns:
|
|
|
|
help: "Patterns"
|
|
|
|
enabledIn: '3.0.0'
|
2021-02-23 13:57:29 +00:00
|
|
|
validation: |
|
|
|
|
void main() {
|
2023-05-09 21:08:41 +00:00
|
|
|
final [a, b] = ['feature', 'enabled'];
|
|
|
|
print('$a $b');
|
2021-02-23 13:57:29 +00:00
|
|
|
}
|
2019-06-04 12:14:09 +00:00
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
unnamed-libraries:
|
|
|
|
help: "Unnamed libraries"
|
|
|
|
enabledIn: '2.19.0'
|
2023-10-27 16:50:09 +00:00
|
|
|
expired: true
|
2023-05-09 21:08:41 +00:00
|
|
|
validation: |
|
|
|
|
library;
|
|
|
|
void main() => print('feature enabled');
|
2021-04-27 20:16:08 +00:00
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
alternative-invalidation-strategy:
|
|
|
|
help: "Alternative invalidation strategy for incremental compilation."
|
|
|
|
category: "CFE"
|
|
|
|
enabledIn: '2.18.0'
|
2020-03-03 19:25:44 +00:00
|
|
|
expired: true
|
2019-06-04 12:14:09 +00:00
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
inference-update-1:
|
|
|
|
help: "Horizontal type inference for function expressions passed to generic invocations."
|
|
|
|
enabledIn: '2.18.0'
|
2023-10-27 16:50:09 +00:00
|
|
|
expired: true
|
2021-04-19 21:04:38 +00:00
|
|
|
validation: |
|
2023-05-09 21:08:41 +00:00
|
|
|
void test(List<int> list) {
|
|
|
|
var a = list.fold(0, (x, y) => x + y);
|
|
|
|
f(a);
|
2021-04-19 21:04:38 +00:00
|
|
|
}
|
2023-05-09 21:08:41 +00:00
|
|
|
void f<T>(T t) {
|
|
|
|
if (T == int) {
|
2021-09-03 04:19:57 +00:00
|
|
|
print('feature enabled');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void main() {
|
2023-05-09 21:08:41 +00:00
|
|
|
test([1, 2, 3]);
|
2021-09-03 04:19:57 +00:00
|
|
|
}
|
2022-03-04 01:08:01 +00:00
|
|
|
|
|
|
|
enhanced-enums:
|
|
|
|
help: "Enhanced Enums"
|
|
|
|
enabledIn: '2.17.0'
|
|
|
|
validation: |
|
|
|
|
enum T {
|
|
|
|
t();
|
|
|
|
void test() {
|
2022-03-04 03:24:41 +00:00
|
|
|
print('feature enabled');
|
2022-03-04 01:08:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
void main() {
|
|
|
|
T.t.test();
|
|
|
|
}
|
2022-07-11 13:02:22 +00:00
|
|
|
expired: true
|
2022-03-04 01:08:01 +00:00
|
|
|
|
|
|
|
named-arguments-anywhere:
|
|
|
|
help: "Named Arguments Anywhere"
|
|
|
|
enabledIn: '2.17.0'
|
|
|
|
validation: |
|
2022-09-07 14:49:17 +00:00
|
|
|
void test(String msg, {bool enabled = false}) {
|
2022-03-04 01:08:01 +00:00
|
|
|
if (enabled) {
|
|
|
|
print(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void main() {
|
2022-03-04 03:24:41 +00:00
|
|
|
test(enabled : true, 'feature enabled');
|
2022-03-04 01:08:01 +00:00
|
|
|
}
|
2022-07-11 13:02:22 +00:00
|
|
|
expired: true
|
2022-03-04 01:08:01 +00:00
|
|
|
|
|
|
|
super-parameters:
|
|
|
|
help: "Super-Initializer Parameters"
|
|
|
|
enabledIn: '2.17.0'
|
|
|
|
validation: |
|
|
|
|
class B {
|
|
|
|
final String foo;
|
|
|
|
B(this.foo);
|
|
|
|
}
|
|
|
|
class C extends B {
|
|
|
|
C(super.foo);
|
|
|
|
}
|
|
|
|
void main(){
|
2022-03-04 03:24:41 +00:00
|
|
|
print(C('feature enabled').foo);
|
2022-03-04 01:08:01 +00:00
|
|
|
}
|
2022-07-11 13:02:22 +00:00
|
|
|
expired: true
|
2022-05-24 13:54:23 +00:00
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
constructor-tearoffs:
|
|
|
|
help: "Allow constructor tear-offs and explicit generic instantiations."
|
|
|
|
enabledIn: '2.15.0'
|
2022-05-24 13:54:23 +00:00
|
|
|
validation: |
|
2023-05-09 21:08:41 +00:00
|
|
|
class A {
|
|
|
|
A() {
|
2022-05-24 13:54:23 +00:00
|
|
|
print('feature enabled');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void main() {
|
2023-05-09 21:08:41 +00:00
|
|
|
var c = A.new;
|
|
|
|
c();
|
2022-05-24 13:54:23 +00:00
|
|
|
}
|
2023-05-09 21:08:41 +00:00
|
|
|
expired: true
|
2022-10-25 21:10:57 +00:00
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
generic-metadata:
|
|
|
|
help: >-
|
|
|
|
Allow annotations to accept type arguments;
|
|
|
|
also allow generic function types as type arguments.
|
|
|
|
enabledIn: '2.14.0'
|
2023-04-12 12:46:41 +00:00
|
|
|
expired: true
|
2023-05-09 21:08:41 +00:00
|
|
|
|
|
|
|
triple-shift:
|
|
|
|
help: "Triple-shift operator"
|
|
|
|
enabledIn: '2.14.0'
|
2022-10-25 21:10:57 +00:00
|
|
|
validation: |
|
2023-05-09 21:08:41 +00:00
|
|
|
class A {
|
|
|
|
operator>>>(int k) => 42;
|
|
|
|
}
|
|
|
|
void main() {
|
|
|
|
if ((A() >>> 1) == 42) print('feature enabled');
|
|
|
|
}
|
|
|
|
expired: true
|
2023-03-10 20:02:23 +00:00
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
nonfunction-type-aliases:
|
|
|
|
help: "Type aliases define a <type>, not just a <functionType>"
|
|
|
|
enabledIn: '2.13.0'
|
2023-03-10 20:02:23 +00:00
|
|
|
validation: |
|
2023-05-09 21:08:41 +00:00
|
|
|
typedef S = String;
|
2023-03-10 20:02:23 +00:00
|
|
|
void main() {
|
2023-05-09 21:08:41 +00:00
|
|
|
S s = 'feature enabled';
|
|
|
|
print(s);
|
2023-03-10 20:02:23 +00:00
|
|
|
}
|
2023-05-09 21:08:41 +00:00
|
|
|
expired: true
|
2023-03-10 20:02:23 +00:00
|
|
|
|
2023-05-09 21:08:41 +00:00
|
|
|
non-nullable:
|
|
|
|
help: "Non Nullable by default"
|
|
|
|
experimentalReleaseVersion: '2.10.0'
|
|
|
|
enabledIn: '2.12.0'
|
2023-03-10 20:02:23 +00:00
|
|
|
validation: |
|
|
|
|
void main() {
|
2023-05-09 21:08:41 +00:00
|
|
|
int? a = null;
|
|
|
|
print('feature enabled');
|
2023-03-10 20:02:23 +00:00
|
|
|
}
|
2023-05-09 21:08:41 +00:00
|
|
|
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
|