Skip to content

Commit

Permalink
Version 3.6.0-145.0.dev
Browse files Browse the repository at this point in the history
Merge c008c15 into dev
  • Loading branch information
Dart CI committed Aug 13, 2024
2 parents 9a6ec6c + c008c15 commit 3645d29
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 15 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

### Language

Dart 3.6 adds [digit separators] to the language. To use them, set your
package's [SDK constraint][language version] lower bound to 3.6 or greater
(`sdk: '^3.6.0'`).

#### Digit separators

[digit separators]: https://github.com/dart-lang/language/issues/2

Digits in number literals (decimal integer literals, double literals,
scientific notation literals, and hexadecimal literals) can now include
underscores between digits, as "digit separators." The separators do not change
the value of a literal, but can serve to make the number more readable.

```dart
100__000_000__000_000__000_000 // one hundred million million millions!
0x4000_0000_0000_0000
0.000_000_000_01
0x00_14_22_01_23_45 // MAC address
```

Separators are not allowed at the start of a number (this would be parsed as an
identifier), at the end of a number, or adjacent to another character in a
number, like `.`, `x`, or the `e` in scientific notation.

- **Breaking Change** [#56065][]: The context used by the compiler and analyzer
to perform type inference on the operand of a `throw` expression has been
changed from the "unknown type" to `Object`. This makes the type system more
Expand Down
6 changes: 3 additions & 3 deletions pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ enum ExperimentalFlag {

digitSeparators(
name: 'digit-separators',
isEnabledByDefault: false,
isEnabledByDefault: true,
isExpired: false,
experimentEnabledVersion: defaultLanguageVersion,
experimentReleasedVersion: defaultLanguageVersion),
experimentEnabledVersion: const Version(3, 6),
experimentReleasedVersion: const Version(3, 6)),

enhancedEnums(
name: 'enhanced-enums',
Expand Down
4 changes: 2 additions & 2 deletions pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class ExperimentalFeatures {
isExpired: IsExpired.digit_separators,
documentation: 'Number literals with digit separators.',
experimentalReleaseVersion: null,
releaseVersion: null,
releaseVersion: Version.parse('3.6.0'),
);

static final enhanced_enums = ExperimentalFeature(
Expand Down Expand Up @@ -518,7 +518,7 @@ class IsEnabledByDefault {
static const bool control_flow_collections = true;

/// Default state of the experiment "digit-separators"
static const bool digit_separators = false;
static const bool digit_separators = true;

/// Default state of the experiment "enhanced-enums"
static const bool enhanced_enums = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ analysisOptions
constant-update-2018
constructor-tearoffs
control-flow-collections
digit-separators
enhanced-enums
extension-methods
generic-metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import 'package:analyzer/dart/analysis/features.dart';
/// whether a given flag is already included.
List<String> experimentsForTests = [
Feature.augmentations.enableString,
Feature.digit_separators.enableString,
Feature.enhanced_parts.enableString,
Feature.macros.enableString,
Feature.null_aware_elements.enableString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ class ExperimentalFlag {

static const ExperimentalFlag digitSeparators = const ExperimentalFlag(
name: 'digit-separators',
isEnabledByDefault: false,
isEnabledByDefault: true,
isExpired: false,
enabledVersion: defaultLanguageVersion,
experimentEnabledVersion: defaultLanguageVersion,
experimentReleasedVersion: defaultLanguageVersion);
enabledVersion: const Version(3, 6),
experimentEnabledVersion: const Version(3, 6),
experimentReleasedVersion: const Version(3, 6));

static const ExperimentalFlag enhancedEnums = const ExperimentalFlag(
name: 'enhanced-enums',
Expand Down
3 changes: 2 additions & 1 deletion runtime/vm/experimental_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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, true, true, true, true, true, true, true, true,
true, true, true, true, true, true, true, true, true, true, true,
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureValues));
Expand All @@ -25,6 +25,7 @@ bool GetExperimentalFeatureDefault(ExperimentalFeature feature) {

const char* GetExperimentalFeatureName(ExperimentalFeature feature) {
constexpr const char* kFeatureNames[] = {
"digit-separators",
"inference-update-3",
"inline-class",
"inference-update-2",
Expand Down
1 change: 1 addition & 0 deletions runtime/vm/experimental_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace dart {

enum class ExperimentalFeature {
digit_separators,
inference_update_3,
inline_class,
inference_update_2,
Expand Down
2 changes: 1 addition & 1 deletion tools/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ CHANNEL dev
MAJOR 3
MINOR 6
PATCH 0
PRERELEASE 144
PRERELEASE 145
PRERELEASE_PATCH 0
14 changes: 11 additions & 3 deletions tools/experimental_features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ features:
wildcard-variables:
help: "Local declarations and parameters named `_` are non-binding."

digit-separators:
help: "Number literals with digit separators."

null-aware-elements:
help: "Null-aware elements and map entries in collections."

Expand All @@ -156,6 +153,17 @@ features:
# Shipped flags should be marked retired the following stable release.
#

digit-separators:
enabledIn: '3.6.0'
validation: |
main() {
int x = 1_000_000;
int y = 0xff_ff_ff;
double z = 1__2.3__4e5__6;
print('feature enabled');
}
help: "Number literals with digit separators."

inference-update-3: # See https://github.com/dart-lang/language/issues/1618
enabledIn: '3.4.0'
validation: |
Expand Down

0 comments on commit 3645d29

Please sign in to comment.