Skip to content

Commit

Permalink
Retire inference-update-3 experiment introduced in Dart 3.4.
Browse files Browse the repository at this point in the history
The expriment is now retired in Dart 3.5, and the flag
stops being valid.

Change-Id: I1ecb087d45b90e98a7f0d3c15a6c8038a1c6982e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/365260
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
  • Loading branch information
lrhn authored and Commit Queue committed May 3, 2024
1 parent 0d8bb0e commit 281241e
Show file tree
Hide file tree
Showing 31 changed files with 4 additions and 56 deletions.
2 changes: 1 addition & 1 deletion pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ enum ExperimentalFlag {
inferenceUpdate3(
name: 'inference-update-3',
isEnabledByDefault: true,
isExpired: false,
isExpired: true,
experimentEnabledVersion: const Version(3, 4),
experimentReleasedVersion: const Version(3, 4)),

Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class IsExpired {
static const bool inference_update_2 = true;

/// Expiration status of the experiment "inference-update-3"
static const bool inference_update_3 = false;
static const bool inference_update_3 = true;

/// Expiration status of the experiment "inline-class"
static const bool inline_class = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class ExperimentalFlag {
static const ExperimentalFlag inferenceUpdate3 = const ExperimentalFlag(
name: 'inference-update-3',
isEnabledByDefault: true,
isExpired: false,
isExpired: true,
enabledVersion: const Version(3, 4),
experimentEnabledVersion: const Version(3, 4),
experimentReleasedVersion: const Version(3, 4));
Expand Down
1 change: 0 additions & 1 deletion pkg/front_end/testcases/inference_update_3/folder.options
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
--enable-experiment=inference-update-3
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using conditional expressions.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is an ordinary index expression that
// refers to operators defined in an extension, using explicit extension syntax.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a null-aware index expression that
// refers to operators defined in an extension, using explicit extension syntax.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>?` for the operand, or `Iterable<_>?`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a null-aware access to an extension
// property, using explicit extension syntax.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>?` for the operand, or `Iterable<_>?`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is an access to an extension property,
// using explicit extension syntax.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a property of the current
// extension, accessed through explicit `this` using explicit extension syntax.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a property of the current class,
// accessed through explicit `this`.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a property of the current
// extension, accessed through explicit `this`.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a property of the current
// extension, accessed through implicit `this`.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is an ordinary index expression that
// refers to operators defined in an extension.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a null-aware index expression that
// refers to operators defined in an extension.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>?` for the operand, or `Iterable<_>?`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a null-aware access to an extension
// property.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>?` for the operand, or `Iterable<_>?`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using if-null assignments whose target is an access to an extension property.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a property of the current class,
// accessed through implicit `this`.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using if-null assignments whose target is an ordinary index expression.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using if-null assignments whose target is a local variable.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using if-null assignments whose target is a null-aware index expression.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>?` for the operand, or `Iterable<_>?`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using if-null assignments whose target is a null-aware property access.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>?` for the operand, or `Iterable<_>?`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using if-null assignments whose target is an ordinary property access.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using if-null assignments whose target is a static property access.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is an index expression whose target is
// `super`.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is a property of the superclass,
// accessed through `super`.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// using if-null assignments whose target is an index expression whose target is
// `this`.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using if-null assignments whose target is an access to a top level property.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
2 changes: 0 additions & 2 deletions tests/language/inference_update_3/if_null_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using if-null expressions.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `_` for the operand, if no type argument is
Expand Down
2 changes: 0 additions & 2 deletions tests/language/inference_update_3/switch_expression_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
// https://github.com/dart-lang/language/issues/1618#issuecomment-1507241494,
// using switch expressions.

// SharedOptions=--enable-experiment=inference-update-3

import '../static_type_helper.dart';

/// Ensures a context type of `Iterable<T>` for the operand, or `Iterable<_>` if
Expand Down
1 change: 1 addition & 0 deletions tools/experimental_features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ features:
print('feature enabled');
}
help: "Better handling of conditional expressions, and switch expressions."
expired: true

inline-class:
enabledIn: '3.3.0'
Expand Down

2 comments on commit 281241e

@mnordine
Copy link
Contributor

@mnordine mnordine commented on 281241e May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the experiment retired, or is it now enabled by default in 3.5?

I'm guessing it was enabled by looking at https://github.com/dart-lang/sdk/blob/main/CHANGELOG.md#language

Dart 3.4 makes improvements to the type analysis of conditional expressions (e1 ? e2 : e3), if-null expressions (e1 ?? e2), if-null assignments (e1 ??= e2), and switch expressions (switch (e) { p1 => e1, ... }). To take advantage of these improvements, set your package's SDK constraint lower bound to 3.4 or greater (sdk: '^3.4.0').

@eernstg
Copy link
Member

@eernstg eernstg commented on 281241e May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag is expired. The feature is enabled by default now, starting with version 3.4.0.

Please sign in to comment.