Enable new features in tests.

Change-Id: Iae97b7dcb3f9059de8755b5c6335655cabc846d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375086
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov
2024-07-10 20:35:48 +00:00
committed by Commit Queue
parent d2bc055651
commit 36d2ae5dc6
10 changed files with 31 additions and 1 deletions
@@ -66,6 +66,8 @@ class AbstractContextTest
/// class, an empty list if there are no experiments that should be enabled.
List<String> get experiments => [
Feature.digit_separators.enableString,
Feature.augmentations.enableString,
Feature.enhanced_parts.enableString,
Feature.macros.enableString,
Feature.wildcard_variables.enableString,
];
@@ -218,6 +218,8 @@ class PubPackageAnalysisServerTest extends ContextResolutionTest
// add `import 'package:analyzer/dart/analysis/features.dart';`
// and list the necessary experiments here.
List<String> get experiments => [
Feature.augmentations.enableString,
Feature.enhanced_parts.enableString,
Feature.macros.enableString,
];
@@ -25,6 +25,8 @@ class DartTextDocumentContentProviderTest
AnalysisServerOptions get serverOptions => AnalysisServerOptions()
..enabledExperiments = [
...super.serverOptions.enabledExperiments,
Feature.augmentations.enableString,
Feature.enhanced_parts.enableString,
Feature.macros.enableString,
];
@@ -27,6 +27,8 @@ class DefinitionTest extends AbstractLspAnalysisServerTest {
AnalysisServerOptions get serverOptions => AnalysisServerOptions()
..enabledExperiments = [
...super.serverOptions.enabledExperiments,
Feature.augmentations.enableString,
Feature.enhanced_parts.enableString,
Feature.macros.enableString,
];
@@ -25,6 +25,8 @@ class HoverTest extends AbstractLspAnalysisServerTest {
@override
AnalysisServerOptions get serverOptions => AnalysisServerOptions()
..enabledExperiments = [
Feature.augmentations.enableString,
Feature.enhanced_parts.enableString,
Feature.macros.enableString,
];
@@ -30,6 +30,8 @@ class SemanticTokensTest extends AbstractLspAnalysisServerTest {
@override
AnalysisServerOptions get serverOptions => AnalysisServerOptions()
..enabledExperiments = [
Feature.augmentations.enableString,
Feature.enhanced_parts.enableString,
Feature.macros.enableString,
];
@@ -9,6 +9,9 @@ import 'package:pub_semver/pub_semver.dart';
/// depends on the supported Dart SDK version, and possibly on the presence of
/// experimental flags.
abstract class Feature {
/// Feature information for augmentations.
static final augmentations = ExperimentalFeatures.augmentations;
/// Feature information for class modifiers.
static final class_modifiers = ExperimentalFeatures.class_modifiers;
@@ -31,6 +34,9 @@ abstract class Feature {
/// Feature information for enhanced enums.
static final enhanced_enums = ExperimentalFeatures.enhanced_enums;
/// Feature information for enhanced parts.
static final enhanced_parts = ExperimentalFeatures.enhanced_parts;
/// Feature information for extension methods.
static final extension_methods = ExperimentalFeatures.extension_methods;
+9 -1
View File
@@ -109,6 +109,9 @@ class AstBuilder extends StackListener {
bool parseFunctionBodies = true;
/// Whether the 'augmentations' feature is enabled.
final bool enableAugmentations;
/// `true` if triple-shift behavior is enabled
final bool enableTripleShift;
@@ -130,7 +133,10 @@ class AstBuilder extends StackListener {
/// `true` if enhanced enums are enabled
final bool enableEnhancedEnums;
/// `true` if macros are enabled
/// Whether the 'enhanced_parts' feature is enabled.
final bool enableEnhancedParts;
/// Whether the 'macros' feature is enabled.
final bool enableMacros;
/// `true` if records are enabled
@@ -164,6 +170,7 @@ class AstBuilder extends StackListener {
this._featureSet, this._lineInfo,
[Uri? uri])
: errorReporter = FastaErrorReporter(errorReporter),
enableAugmentations = _featureSet.isEnabled(Feature.augmentations),
enableTripleShift = _featureSet.isEnabled(Feature.triple_shift),
enableNonFunctionTypeAliases =
_featureSet.isEnabled(Feature.nonfunction_type_aliases),
@@ -174,6 +181,7 @@ class AstBuilder extends StackListener {
_featureSet.isEnabled(Feature.named_arguments_anywhere),
enableSuperParameters = _featureSet.isEnabled(Feature.super_parameters),
enableEnhancedEnums = _featureSet.isEnabled(Feature.enhanced_enums),
enableEnhancedParts = _featureSet.isEnabled(Feature.enhanced_parts),
enableMacros = _featureSet.isEnabled(Feature.macros),
enableRecords = _featureSet.isEnabled(Feature.records),
enableUnnamedLibraries =
@@ -337,7 +337,9 @@ class PubPackageResolutionTest extends ContextResolutionTest
List<String> get experiments {
return [
Feature.augmentations.enableString,
Feature.digit_separators.enableString,
Feature.enhanced_parts.enableString,
Feature.macros.enableString,
Feature.wildcard_variables.enableString,
];
+2
View File
@@ -47,6 +47,8 @@ class FeatureSets {
static final FeatureSet latestWithExperiments = FeatureSet.fromEnableFlags2(
sdkLanguageVersion: ExperimentStatus.currentVersion,
flags: [
Feature.augmentations.enableString,
Feature.enhanced_parts.enableString,
Feature.macros.enableString,
],
);