[cfe] Remove nnbd mode
TEST=existing
Change-Id: I30bbadb74e81c7f4aaa444d1e2f6f5ffc2005d4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412881
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index 7f2fb27..b9c1417 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -1492,18 +1492,6 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Null> codeCompilingWithoutSoundNullSafety =
- messageCompilingWithoutSoundNullSafety;
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const MessageCode messageCompilingWithoutSoundNullSafety = const MessageCode(
- "CompilingWithoutSoundNullSafety",
- severity: Severity.info,
- problemMessage: r"""Compiling without sound null safety!
-Dart 3 will only support sound null safety, see https://dart.dev/null-safety""",
-);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String string, String string2)>
templateConflictingModifiers =
const Template<Message Function(String string, String string2)>(
diff --git a/pkg/compiler/lib/src/ir/constants.dart b/pkg/compiler/lib/src/ir/constants.dart
index cc8e2fd..32174e4 100644
--- a/pkg/compiler/lib/src/ir/constants.dart
+++ b/pkg/compiler/lib/src/ir/constants.dart
@@ -19,7 +19,6 @@
ir.ReportErrorFunction reportError, {
Environment? environment,
super.supportReevaluationForTesting,
- required super.evaluationMode,
}) : super(
const Dart2jsDartLibrarySupport(),
const Dart2jsConstantsBackend(supportsUnevaluatedConstants: false),
diff --git a/pkg/compiler/lib/src/phase/load_kernel.dart b/pkg/compiler/lib/src/phase/load_kernel.dart
index e377f6a..10ea40b 100644
--- a/pkg/compiler/lib/src/phase/load_kernel.dart
+++ b/pkg/compiler/lib/src/phase/load_kernel.dart
@@ -164,10 +164,6 @@
reportMessage,
environmentDefines: options.environment,
classHierarchy: classHierarchy,
- evaluationMode:
- options.useLegacySubtyping
- ? fe.EvaluationMode.weak
- : fe.EvaluationMode.strong,
shouldNotInline: shouldNotInline,
removeAsserts: !options.enableUserAssertions,
).run();
@@ -198,10 +194,6 @@
(fe.LocatedMessage message, List<fe.LocatedMessage>? context) =>
reportLocatedMessage(reporter, message, context),
environment: Environment(options.environment),
- evaluationMode:
- options.useLegacySubtyping
- ? fe.EvaluationMode.weak
- : fe.EvaluationMode.strong,
);
StaticInteropClassEraser(coreTypes).visitComponent(component);
global_transforms.transformLibraries(
@@ -347,8 +339,6 @@
options.packageConfig,
explicitExperimentalFlags: options.explicitExperimentalFlags,
environmentDefines: environment,
- nnbdMode:
- options.useLegacySubtyping ? fe.NnbdMode.Weak : fe.NnbdMode.Strong,
invocationModes: options.cfeInvocationModes,
verbosity: verbosity,
);
diff --git a/pkg/compiler/test/end_to_end/dill_loader_test.dart b/pkg/compiler/test/end_to_end/dill_loader_test.dart
index eeb3307f..fc16b72 100644
--- a/pkg/compiler/test/end_to_end/dill_loader_test.dart
+++ b/pkg/compiler/test/end_to_end/dill_loader_test.dart
@@ -29,7 +29,6 @@
var options =
CompilerOptions()
..target = Dart2jsTarget("dart2js", TargetFlags())
- ..nnbdMode = NnbdMode.Strong
..packagesFileUri = Uri.base.resolve('.dart_tool/package_config.json')
..additionalDills = <Uri>[
computePlatformBinariesLocation().resolve("dart2js_platform.dill"),
diff --git a/pkg/compiler/test/end_to_end/modular_loader_test.dart b/pkg/compiler/test/end_to_end/modular_loader_test.dart
index a1c5690..6b4695c 100644
--- a/pkg/compiler/test/end_to_end/modular_loader_test.dart
+++ b/pkg/compiler/test/end_to_end/modular_loader_test.dart
@@ -115,7 +115,6 @@
CompilerOptions()
..target = Dart2jsTarget("dart2js", TargetFlags())
..fileSystem = TestFileSystem(fs)
- ..nnbdMode = NnbdMode.Strong
..additionalDills = additionalDills
..packagesFileUri = toTestUri('.dart_tool/package_config.json')
..explicitExperimentalFlags = {ExperimentalFlag.nonNullable: true};
diff --git a/pkg/compiler/test/model/cfe_constant_evaluation_common.dart b/pkg/compiler/test/model/cfe_constant_evaluation_common.dart
index 29df78a..8619924 100644
--- a/pkg/compiler/test/model/cfe_constant_evaluation_common.dart
+++ b/pkg/compiler/test/model/cfe_constant_evaluation_common.dart
@@ -904,10 +904,6 @@
},
environment: Environment(env),
supportReevaluationForTesting: true,
- evaluationMode:
- compiler.options.useLegacySubtyping
- ? ir.EvaluationMode.weak
- : ir.EvaluationMode.strong,
);
ir.Constant evaluatedConstant = evaluator.evaluate(
ir.StaticTypeContext(node, typeEnvironment),
diff --git a/pkg/dart2wasm/lib/compile.dart b/pkg/dart2wasm/lib/compile.dart
index 55e92da..ba782be 100644
--- a/pkg/dart2wasm/lib/compile.dart
+++ b/pkg/dart2wasm/lib/compile.dart
@@ -15,7 +15,6 @@
CompilerResult,
DiagnosticMessage,
kernelForProgram,
- NnbdMode,
Severity;
import 'package:kernel/ast.dart';
import 'package:kernel/class_hierarchy.dart';
@@ -136,8 +135,7 @@
}
..explicitExperimentalFlags = options.feExperimentalFlags
..verbose = false
- ..onDiagnostic = diagnosticMessageHandler
- ..nnbdMode = NnbdMode.Strong;
+ ..onDiagnostic = diagnosticMessageHandler;
if (options.multiRootScheme != null) {
compilerOptions.fileSystem = MultiRootFileSystem(
options.multiRootScheme!,
diff --git a/pkg/dart2wasm/lib/constant_evaluator.dart b/pkg/dart2wasm/lib/constant_evaluator.dart
index aa38c6d..c3b19c6 100644
--- a/pkg/dart2wasm/lib/constant_evaluator.dart
+++ b/pkg/dart2wasm/lib/constant_evaluator.dart
@@ -50,7 +50,6 @@
enableTripleShift: true,
enableAsserts: options.translatorOptions.enableAsserts,
errorOnUnevaluatedConstant: true,
- evaluationMode: kernel.EvaluationMode.strong,
);
@override
diff --git a/pkg/dart2wasm/lib/target.dart b/pkg/dart2wasm/lib/target.dart
index ff1936e..98e9af8 100644
--- a/pkg/dart2wasm/lib/target.dart
+++ b/pkg/dart2wasm/lib/target.dart
@@ -10,7 +10,7 @@
import 'package:front_end/src/api_prototype/const_conditional_simplifier.dart'
show ConstConditionalSimplifier;
import 'package:front_end/src/api_prototype/constant_evaluator.dart'
- as constantEvaluator show ConstantEvaluator, EvaluationMode;
+ as constantEvaluator show ConstantEvaluator;
import 'package:kernel/ast.dart';
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/clone.dart';
@@ -320,7 +320,6 @@
component,
reportError,
environmentDefines: environmentDefines,
- evaluationMode: constantEvaluator.EvaluationMode.strong,
coreTypes: coreTypes,
classHierarchy: hierarchy,
removeAsserts: removeAsserts,
diff --git a/pkg/dev_compiler/lib/src/command/command.dart b/pkg/dev_compiler/lib/src/command/command.dart
index 5062f06..f592a4e 100644
--- a/pkg/dev_compiler/lib/src/command/command.dart
+++ b/pkg/dev_compiler/lib/src/command/command.dart
@@ -292,9 +292,7 @@
soundNullSafety: options.soundNullSafety)),
fileSystem: fileSystem,
explicitExperimentalFlags: explicitExperimentalFlags,
- environmentDefines: declaredVariables,
- nnbdMode:
- options.soundNullSafety ? fe.NnbdMode.Strong : fe.NnbdMode.Weak);
+ environmentDefines: declaredVariables);
result = await fe.compile(compilerState, inputs, diagnosticMessageHandler);
} else {
// If digests weren't given and if not in worker mode, create fake data and
@@ -334,9 +332,7 @@
fileSystem: fileSystem,
explicitExperimentalFlags: explicitExperimentalFlags,
environmentDefines: declaredVariables,
- trackNeededDillLibraries: recordUsedInputs,
- nnbdMode:
- options.soundNullSafety ? fe.NnbdMode.Strong : fe.NnbdMode.Weak);
+ trackNeededDillLibraries: recordUsedInputs);
var incrementalCompiler = compilerState.incrementalCompiler!;
var cachedSdkInput = compileSdk
? null
diff --git a/pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart b/pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart
index 9313ef3..90a9a72 100644
--- a/pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart
+++ b/pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart
@@ -244,7 +244,6 @@
}, enableAsserts: enableAsserts)
..explicitExperimentalFlags = explicitExperimentalFlags
..onDiagnostic = _onDiagnosticHandler(errors, warnings, infos)
- ..nnbdMode = soundNullSafety ? NnbdMode.Strong : NnbdMode.Weak
..verbose = verbose;
requestStream ??= stdin
.transform(utf8.decoder.fuse(json.decoder))
@@ -470,7 +469,7 @@
sourceMap: true,
summarizeApi: false,
moduleName: moduleName,
- soundNullSafety: _compilerOptions.nnbdMode == NnbdMode.Strong,
+ soundNullSafety: true,
canaryFeatures: _canaryFeatures,
enableAsserts: _enableAsserts,
),
diff --git a/pkg/dev_compiler/test/memory_compiler.dart b/pkg/dev_compiler/test/memory_compiler.dart
index 20475cc..2c88fda 100644
--- a/pkg/dev_compiler/test/memory_compiler.dart
+++ b/pkg/dev_compiler/test/memory_compiler.dart
@@ -72,8 +72,7 @@
TargetFlags(trackWidgetCreation: false, soundNullSafety: true)),
fileSystem: fe.HybridFileSystem(memoryFileSystem),
environmentDefines: {},
- explicitExperimentalFlags: explicitExperimentalFlags,
- nnbdMode: fe.NnbdMode.Strong);
+ explicitExperimentalFlags: explicitExperimentalFlags);
var result =
await fe.compile(compilerState, [entryPoint], diagnosticMessageHandler);
if (result == null) {
diff --git a/pkg/dev_compiler/test/nullable_inference_test.dart b/pkg/dev_compiler/test/nullable_inference_test.dart
index f09eef1..6cd1703 100644
--- a/pkg/dev_compiler/test/nullable_inference_test.dart
+++ b/pkg/dev_compiler/test/nullable_inference_test.dart
@@ -822,7 +822,6 @@
fileSystem: _fileSystem,
explicitExperimentalFlags: const {},
environmentDefines: addGeneratedVariables({}, enableAsserts: true),
- nnbdMode: fe.NnbdMode.Strong,
);
if (!identical(oldCompilerState, _compilerState)) inference = null;
var result =
diff --git a/pkg/dev_compiler/test/shared_test_options.dart b/pkg/dev_compiler/test/shared_test_options.dart
index c6dcd61..e854bed 100644
--- a/pkg/dev_compiler/test/shared_test_options.dart
+++ b/pkg/dev_compiler/test/shared_test_options.dart
@@ -58,7 +58,6 @@
..sdkSummary = buildRoot.resolve('ddc_outline.dill')
..environmentDefines =
addGeneratedVariables({}, enableAsserts: enableAsserts)
- ..nnbdMode = fe.NnbdMode.Strong
..explicitExperimentalFlags = fe.parseExperimentalFlags(
fe.parseExperimentalArguments(enableExperiments),
onError: (e) => throw e);
diff --git a/pkg/front_end/lib/src/api_prototype/compiler_options.dart b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
index 697802f..22e9f67 100644
--- a/pkg/front_end/lib/src/api_prototype/compiler_options.dart
+++ b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
@@ -13,7 +13,6 @@
import 'package:kernel/target/targets.dart' show Target;
import '../api_unstable/util.dart';
-import '../base/nnbd_mode.dart';
import 'experimental_flags.dart'
show
AllowedExperimentalFlags,
@@ -223,9 +222,6 @@
/// Whether to write a file (e.g. a dill file) when reporting a crash.
bool writeFileOnCrashReport = true;
- /// Whether nnbd weak or strong mode is used.
- NnbdMode nnbdMode = NnbdMode.Strong;
-
/// The current sdk version string, e.g. "2.6.0-edge.sha1hash".
/// For instance used for language versioning (specifying the maximum
/// version).
@@ -349,7 +345,6 @@
}
if (skipForDebugging != other.skipForDebugging) return false;
if (writeFileOnCrashReport != other.writeFileOnCrashReport) return false;
- if (nnbdMode != other.nnbdMode) return false;
if (currentSdkVersion != other.currentSdkVersion) return false;
if (emitDeps != other.emitDeps) return false;
if (!equalSets(invocationModes, other.invocationModes)) return false;
diff --git a/pkg/front_end/lib/src/api_prototype/constant_evaluator.dart b/pkg/front_end/lib/src/api_prototype/constant_evaluator.dart
index ee02127..a251980 100644
--- a/pkg/front_end/lib/src/api_prototype/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/api_prototype/constant_evaluator.dart
@@ -9,7 +9,6 @@
ConstantEvaluator,
ConstantsTransformer,
ErrorReporter,
- EvaluationMode,
EvaluationEnvironment,
SimpleErrorReporter,
transformLibraries;
diff --git a/pkg/front_end/lib/src/api_unstable/bazel_worker.dart b/pkg/front_end/lib/src/api_unstable/bazel_worker.dart
index b4c931b..e8dd608 100644
--- a/pkg/front_end/lib/src/api_unstable/bazel_worker.dart
+++ b/pkg/front_end/lib/src/api_unstable/bazel_worker.dart
@@ -15,7 +15,6 @@
import '../api_prototype/experimental_flags.dart' show ExperimentalFlag;
import '../api_prototype/file_system.dart' show FileSystem;
import '../api_prototype/front_end.dart' show CompilerResult;
-import '../base/nnbd_mode.dart' show NnbdMode;
import '../base/processed_options.dart' show ProcessedOptions;
import '../kernel_generator_impl.dart' show generateKernel;
import 'compiler_state.dart' show InitializedCompilerState;
@@ -33,7 +32,6 @@
export '../api_prototype/standard_file_system.dart' show StandardFileSystem;
export '../api_prototype/terminal_color_support.dart'
show printDiagnosticMessage;
-export '../base/nnbd_mode.dart' show NnbdMode;
export '../kernel/utils.dart' show serializeComponent;
export 'compiler_state.dart' show InitializedCompilerState;
@@ -56,7 +54,6 @@
Map<String, String> environmentDefines, {
bool trackNeededDillLibraries = false,
bool verbose = false,
- NnbdMode nnbdMode = NnbdMode.Strong,
bool requirePrebuiltMacros = false,
List<String> precompiledMacros = const [],
SerializationMode macroSerializationMode = SerializationMode.byteData,
@@ -82,8 +79,7 @@
omitPlatform: true,
trackNeededDillLibraries: trackNeededDillLibraries,
environmentDefines: environmentDefines,
- verbose: verbose,
- nnbdMode: nnbdMode);
+ verbose: verbose);
}
InitializedCompilerState initializeCompiler(
@@ -96,8 +92,7 @@
FileSystem fileSystem,
Iterable<String> experiments,
Map<String, String>? environmentDefines,
- {bool verbose = false,
- NnbdMode nnbdMode = NnbdMode.Strong}) {
+ {bool verbose = false}) {
// TODO(sigmund): use incremental compiler when it supports our use case.
// Note: it is common for the summary worker to invoke the compiler with the
// same input summary URIs, but with different contents, so we'd need to be
@@ -114,8 +109,7 @@
..explicitExperimentalFlags = parseExperimentalFlags(
parseExperimentalArguments(experiments),
onError: (e) => throw e)
- ..verbose = verbose
- ..nnbdMode = nnbdMode;
+ ..verbose = verbose;
ProcessedOptions processedOpts = new ProcessedOptions(options: options);
diff --git a/pkg/front_end/lib/src/api_unstable/dart2js.dart b/pkg/front_end/lib/src/api_unstable/dart2js.dart
index b671a10..9058e17 100644
--- a/pkg/front_end/lib/src/api_unstable/dart2js.dart
+++ b/pkg/front_end/lib/src/api_unstable/dart2js.dart
@@ -16,7 +16,6 @@
import '../api_prototype/file_system.dart' show FileSystem, NullFileSystem;
import '../api_prototype/kernel_generator.dart' show CompilerResult;
import '../base/compiler_context.dart' show CompilerContext;
-import '../base/nnbd_mode.dart' show NnbdMode;
import '../base/processed_options.dart' show ProcessedOptions;
import '../kernel_generator_impl.dart' show generateKernelInternal;
import 'compiler_state.dart' show InitializedCompilerState;
@@ -85,7 +84,6 @@
show uriUsesLegacyLanguageVersion;
export '../api_prototype/standard_file_system.dart' show DataFileSystemEntity;
export '../api_prototype/try_constant_evaluator.dart';
-export '../base/nnbd_mode.dart' show NnbdMode;
export '../base/operator.dart' show Operator;
export '../compute_platform_binaries_location.dart'
show computePlatformBinariesLocation;
@@ -102,7 +100,6 @@
{required Map<ExperimentalFlag, bool> explicitExperimentalFlags,
Map<String, String>? environmentDefines,
bool verify = false,
- NnbdMode? nnbdMode,
Set<InvocationMode> invocationModes = const <InvocationMode>{},
Verbosity verbosity = Verbosity.all}) {
additionalDills.sort((a, b) => a.toString().compareTo(b.toString()));
@@ -118,7 +115,6 @@
explicitExperimentalFlags) &&
equalMaps(oldState.options.environmentDefines, environmentDefines) &&
oldState.options.verify == verify &&
- oldState.options.nnbdMode == nnbdMode &&
equalSets(oldState.options.invocationModes, invocationModes) &&
oldState.options.verbosity == verbosity) {
return oldState;
@@ -135,7 +131,6 @@
..verify = verify
..invocationModes = invocationModes
..verbosity = verbosity;
- if (nnbdMode != null) options.nnbdMode = nnbdMode;
ProcessedOptions processedOpts = new ProcessedOptions(options: options);
diff --git a/pkg/front_end/lib/src/api_unstable/ddc.dart b/pkg/front_end/lib/src/api_unstable/ddc.dart
index 9533328..ff315b4 100644
--- a/pkg/front_end/lib/src/api_unstable/ddc.dart
+++ b/pkg/front_end/lib/src/api_unstable/ddc.dart
@@ -13,7 +13,6 @@
import '../api_prototype/file_system.dart' show FileSystem;
import '../api_prototype/kernel_generator.dart' show CompilerResult;
import '../api_prototype/standard_file_system.dart' show StandardFileSystem;
-import '../base/nnbd_mode.dart' show NnbdMode;
import '../base/processed_options.dart' show ProcessedOptions;
import '../kernel_generator_impl.dart' show generateKernel;
import 'compiler_state.dart' show InitializedCompilerState;
@@ -39,7 +38,6 @@
export '../base/hybrid_file_system.dart' show HybridFileSystem;
export '../base/incremental_compiler.dart' show IncrementalCompiler;
export '../base/incremental_serializer.dart' show IncrementalSerializer;
-export '../base/nnbd_mode.dart' show NnbdMode;
export '../base/processed_options.dart' show ProcessedOptions;
export '../base/ticker.dart' show Ticker;
export '../compute_platform_binaries_location.dart'
@@ -103,8 +101,7 @@
Target target,
{FileSystem? fileSystem,
Map<ExperimentalFlag, bool>? explicitExperimentalFlags,
- Map<String, String>? environmentDefines,
- required NnbdMode nnbdMode}) {
+ Map<String, String>? environmentDefines}) {
additionalDills.sort((a, b) => a.toString().compareTo(b.toString()));
if (oldState != null &&
@@ -112,7 +109,6 @@
oldState.options.sdkSummary == sdkSummary &&
oldState.options.packagesFileUri == packagesFile &&
oldState.options.librariesSpecificationUri == librariesSpecificationUri &&
- oldState.options.nnbdMode == nnbdMode &&
equalLists(oldState.options.additionalDills, additionalDills) &&
equalMaps(oldState.options.explicitExperimentalFlags,
explicitExperimentalFlags) &&
@@ -130,8 +126,7 @@
..librariesSpecificationUri = librariesSpecificationUri
..target = target
..fileSystem = fileSystem ?? StandardFileSystem.instance
- ..environmentDefines = environmentDefines
- ..nnbdMode = nnbdMode;
+ ..environmentDefines = environmentDefines;
if (explicitExperimentalFlags != null) {
options.explicitExperimentalFlags = explicitExperimentalFlags;
}
@@ -160,8 +155,7 @@
{FileSystem? fileSystem,
required Map<ExperimentalFlag, bool> explicitExperimentalFlags,
required Map<String, String> environmentDefines,
- bool trackNeededDillLibraries = false,
- required NnbdMode nnbdMode}) {
+ bool trackNeededDillLibraries = false}) {
return modular.initializeIncrementalCompiler(
oldState,
tags,
@@ -179,8 +173,7 @@
environmentDefines: environmentDefines,
outlineOnly: false,
omitPlatform: false,
- trackNeededDillLibraries: trackNeededDillLibraries,
- nnbdMode: nnbdMode);
+ trackNeededDillLibraries: trackNeededDillLibraries);
}
Future<DdcResult?> compile(InitializedCompilerState compilerState,
diff --git a/pkg/front_end/lib/src/api_unstable/frontend_server.dart b/pkg/front_end/lib/src/api_unstable/frontend_server.dart
index 0549db4..62c2edb 100644
--- a/pkg/front_end/lib/src/api_unstable/frontend_server.dart
+++ b/pkg/front_end/lib/src/api_unstable/frontend_server.dart
@@ -3,5 +3,4 @@
// BSD-style license that can be found in the LICENSE file.
export '../base/uri_translator.dart' show UriTranslator;
-export '../base/nnbd_mode.dart' show NnbdMode;
export '../kernel/utils.dart' show serializeComponent;
diff --git a/pkg/front_end/lib/src/api_unstable/modular_incremental_compilation.dart b/pkg/front_end/lib/src/api_unstable/modular_incremental_compilation.dart
index 314325b..9af7ada 100644
--- a/pkg/front_end/lib/src/api_unstable/modular_incremental_compilation.dart
+++ b/pkg/front_end/lib/src/api_unstable/modular_incremental_compilation.dart
@@ -12,7 +12,6 @@
import '../api_prototype/file_system.dart' show FileSystem;
import '../base/compiler_context.dart' show CompilerContext;
import '../base/incremental_compiler.dart' show IncrementalCompiler;
-import '../base/nnbd_mode.dart' show NnbdMode;
import '../base/processed_options.dart' show ProcessedOptions;
import 'compiler_state.dart'
show InitializedCompilerState, WorkerInputComponent, digestsEqual;
@@ -47,8 +46,7 @@
bool? outlineOnly,
bool omitPlatform = false,
bool trackNeededDillLibraries = false,
- bool verbose = false,
- NnbdMode nnbdMode = NnbdMode.Strong}) async {
+ bool verbose = false}) async {
bool isRetry = false;
while (true) {
try {
@@ -74,7 +72,6 @@
oldState.incrementalCompiler == null ||
oldState.options.compileSdk != compileSdk ||
oldState.incrementalCompiler!.outlineOnly != outlineOnly ||
- oldState.options.nnbdMode != nnbdMode ||
!equalMaps(oldState.options.explicitExperimentalFlags,
explicitExperimentalFlags) ||
!equalMaps(oldState.options.environmentDefines, environmentDefines) ||
@@ -99,8 +96,7 @@
..omitPlatform = omitPlatform
..environmentDefines = environmentDefines
..explicitExperimentalFlags = explicitExperimentalFlags
- ..verbose = verbose
- ..nnbdMode = nnbdMode;
+ ..verbose = verbose;
processedOpts = new ProcessedOptions(options: options);
if (sdkSummary != null && sdkDigest != null) {
diff --git a/pkg/front_end/lib/src/api_unstable/vm.dart b/pkg/front_end/lib/src/api_unstable/vm.dart
index c187c93..2e9415cb 100644
--- a/pkg/front_end/lib/src/api_unstable/vm.dart
+++ b/pkg/front_end/lib/src/api_unstable/vm.dart
@@ -39,7 +39,6 @@
show printDiagnosticMessage, enableColors;
export '../base/compiler_context.dart' show CompilerContext;
export '../base/hybrid_file_system.dart' show HybridFileSystem;
-export '../base/nnbd_mode.dart' show NnbdMode;
export '../base/processed_options.dart' show ProcessedOptions;
export '../codes/cfe_codes.dart'
show
diff --git a/pkg/front_end/lib/src/base/incremental_compiler.dart b/pkg/front_end/lib/src/base/incremental_compiler.dart
index 90f46f1..3895b71 100644
--- a/pkg/front_end/lib/src/base/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/base/incremental_compiler.dart
@@ -67,7 +67,6 @@
import '../api_prototype/lowering_predicates.dart'
show isExtensionThisName, syntheticThisName;
import '../api_prototype/memory_file_system.dart' show MemoryFileSystem;
-import '../base/nnbd_mode.dart';
import '../builder/builder.dart' show Builder;
import '../builder/declaration_builders.dart'
show ClassBuilder, ExtensionBuilder, ExtensionTypeDeclarationBuilder;
@@ -953,23 +952,11 @@
// Check compilation mode up against what we've seen here and set
// `hasInvalidNnbdModeLibrary` accordingly.
if (c.options.globalFeatures.nonNullable.isEnabled) {
- switch (c.options.nnbdMode) {
- case NnbdMode.Weak:
- // Coverage-ignore(suite): Not run.
- // Don't expect strong or invalid.
- if (seenModes[NonNullableByDefaultCompiledMode.Strong.index] ||
- seenModes[NonNullableByDefaultCompiledMode.Invalid.index]) {
- kernelTarget.loader.hasInvalidNnbdModeLibrary = true;
- }
- break;
- case NnbdMode.Strong:
- // Don't expect weak or invalid.
- if (seenModes[NonNullableByDefaultCompiledMode.Weak.index] ||
- seenModes[NonNullableByDefaultCompiledMode.Invalid.index]) {
- // Coverage-ignore-block(suite): Not run.
- kernelTarget.loader.hasInvalidNnbdModeLibrary = true;
- }
- break;
+ // Don't expect weak or invalid.
+ if (seenModes[NonNullableByDefaultCompiledMode.Weak.index] ||
+ seenModes[NonNullableByDefaultCompiledMode.Invalid.index]) {
+ // Coverage-ignore-block(suite): Not run.
+ kernelTarget.loader.hasInvalidNnbdModeLibrary = true;
}
} else {
// Coverage-ignore-block(suite): Not run.
@@ -2635,19 +2622,8 @@
checkCanonicalNames: true, createView: true)!;
// Compute "output nnbd mode".
- NonNullableByDefaultCompiledMode compiledMode;
- if (context.options.globalFeatures.nonNullable.isEnabled) {
- switch (context.options.nnbdMode) {
- case NnbdMode.Weak:
- compiledMode = NonNullableByDefaultCompiledMode.Weak;
- break;
- case NnbdMode.Strong:
- compiledMode = NonNullableByDefaultCompiledMode.Strong;
- break;
- }
- } else {
- compiledMode = NonNullableByDefaultCompiledMode.Weak;
- }
+ NonNullableByDefaultCompiledMode compiledMode =
+ NonNullableByDefaultCompiledMode.Strong;
// Check the any package-urls still point to the same file
// (e.g. the package still exists and hasn't been updated).
diff --git a/pkg/front_end/lib/src/base/nnbd_mode.dart b/pkg/front_end/lib/src/base/nnbd_mode.dart
deleted file mode 100644
index 416d0f5..0000000
--- a/pkg/front_end/lib/src/base/nnbd_mode.dart
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright (c) 2020, 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.
-
-enum NnbdMode {
- Strong,
- Weak,
-}
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index ef3790d..0ad9353 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -24,12 +24,7 @@
import 'package:package_config/package_config.dart';
import '../api_prototype/compiler_options.dart'
- show
- CompilerOptions,
- InvocationMode,
- HooksForTesting,
- Verbosity,
- DiagnosticMessage;
+ show CompilerOptions, HooksForTesting, Verbosity, DiagnosticMessage;
import '../api_prototype/experimental_flags.dart' as flags;
import '../api_prototype/file_system.dart'
show FileSystem, FileSystemEntity, FileSystemException;
@@ -43,7 +38,6 @@
PlainAndColorizedString,
messageCantInferPackagesFromManyInputs,
messageCantInferPackagesFromPackageUri,
- messageCompilingWithoutSoundNullSafety,
messageInternalProblemProvidedBothCompileSdkAndSdkSummary,
messageMissingInput,
noLength,
@@ -62,7 +56,6 @@
import 'command_line_reporting.dart' as command_line_reporting;
import 'compiler_context.dart';
import 'messages.dart' show getLocation;
-import 'nnbd_mode.dart';
import 'problems.dart' show DebugAbort, unimplemented;
import 'ticker.dart' show Ticker;
import 'uri_translator.dart' show UriTranslator;
@@ -205,8 +198,6 @@
// Coverage-ignore(suite): Not run.
bool get emitDeps => _raw.emitDeps;
- NnbdMode get nnbdMode => _raw.nnbdMode;
-
// Coverage-ignore(suite): Not run.
bool get enableUnscheduledExperiments => _raw.enableUnscheduledExperiments;
@@ -356,22 +347,6 @@
reportNoSourceLine(message.withoutLocation(), severity);
}
- /// If `CompilerOptions.invocationModes` contains `InvocationMode.compile`, an
- /// info message about the null safety compilation mode is emitted.
- void reportNullSafetyCompilationModeInfo() {
- if (_raw.invocationModes.contains(InvocationMode.compile)) {
- // Coverage-ignore-block(suite): Not run.
- switch (nnbdMode) {
- case NnbdMode.Weak:
- reportWithoutLocation(messageCompilingWithoutSoundNullSafety,
- messageCompilingWithoutSoundNullSafety.severity);
- break;
- case NnbdMode.Strong:
- break;
- }
- }
- }
-
/// Returns `true` if the options have been validated.
bool get haveBeenValidated => _validated;
@@ -479,8 +454,7 @@
Target? _target;
Target get target => _target ??= _raw.target ??
// Coverage-ignore(suite): Not run.
- new NoneTarget(
- new TargetFlags(soundNullSafety: nnbdMode == NnbdMode.Strong));
+ new NoneTarget(new TargetFlags(soundNullSafety: true));
/// Returns the global state of the experimental features.
flags.GlobalFeatures get globalFeatures => _raw.globalFeatures;
@@ -510,8 +484,7 @@
'safety mode and does not support null safety:\n'
'${component.libraries.join('\n')}');
}
- if (nnbdMode == NnbdMode.Strong &&
- component.mode != NonNullableByDefaultCompiledMode.Strong) {
+ if (component.mode != NonNullableByDefaultCompiledMode.Strong) {
throw new FormatException(
'Provided .dill file for the following libraries does not '
'support sound null safety:\n'
diff --git a/pkg/front_end/lib/src/compute_platform_binaries_location.dart b/pkg/front_end/lib/src/compute_platform_binaries_location.dart
index 53e9662..a6053ab 100644
--- a/pkg/front_end/lib/src/compute_platform_binaries_location.dart
+++ b/pkg/front_end/lib/src/compute_platform_binaries_location.dart
@@ -8,7 +8,6 @@
import 'package:kernel/target/targets.dart';
import 'base/compiler_context.dart' show CompilerContext;
-import 'base/nnbd_mode.dart' show NnbdMode;
import 'base/processed_options.dart' show ProcessedOptions;
/// Returns the name of the default platform dill file name for the [target]
@@ -16,42 +15,19 @@
///
/// If the target doesn't have a default platform dill file for the nnbd mode,
/// [onError] is called.
-String? computePlatformDillName(
- Target target, NnbdMode nnbdMode, void Function() onError) {
+String? computePlatformDillName(Target target, void Function() onError) {
switch (target.name) {
case 'dartdevc':
- switch (nnbdMode) {
- case NnbdMode.Strong:
- // DDC is always compiled against the outline so we use it here by
- // default.
- return 'ddc_outline.dill';
- // Coverage-ignore(suite): Not run.
- //TODO(johnniwinther): Support using the full dill.
- //return 'ddc_platform.dill';
- case NnbdMode.Weak:
- // DDC is always compiled against the outline so we use it here by
- // default.
- return 'ddc_outline_unsound.dill';
- //TODO(johnniwinther): Support using the full dill.
- //return 'ddc_platform_unsound.dill';
- }
+ // DDC is always compiled against the outline so we use it here by
+ // default.
+ return 'ddc_outline.dill';
+ // Coverage-ignore(suite): Not run.
+ //TODO(johnniwinther): Support using the full dill.
+ //return 'ddc_platform.dill';
case 'dart2js':
- switch (nnbdMode) {
- case NnbdMode.Strong:
- return 'dart2js_platform.dill';
- // Coverage-ignore(suite): Not run.
- case NnbdMode.Weak:
- return 'dart2js_platform_unsound.dill';
- }
+ return 'dart2js_platform.dill';
case 'dart2js_server':
- switch (nnbdMode) {
- // Coverage-ignore(suite): Not run.
- case NnbdMode.Strong:
- return 'dart2js_server_platform.dill';
- // Coverage-ignore(suite): Not run.
- case NnbdMode.Weak:
- return 'dart2js_server_platform_unsound.dill';
- }
+ return 'dart2js_server_platform.dill';
case 'vm':
// TODO(johnniwinther): Stop generating 'vm_platform.dill' and rename
// 'vm_platform_strong.dill' to 'vm_platform.dill'.
@@ -59,27 +35,10 @@
case 'none':
return "vm_platform_strong.dill";
case 'wasm':
- switch (nnbdMode) {
- case NnbdMode.Strong:
- return 'dart2wasm_outline.dill';
- // Coverage-ignore(suite): Not run.
- //TODO(johnniwinther): Support using the full dill.
- //return 'dart2wasm_platform.dill';
- case NnbdMode.Weak:
- break;
- }
- break;
+ return 'dart2wasm_outline.dill';
// Coverage-ignore(suite): Not run.
case 'wasm_js_compatibility':
- switch (nnbdMode) {
- case NnbdMode.Strong:
- return 'dart2wasm_js_compatibility_outline.dill';
- //TODO(johnniwinther): Support using the full dill.
- //return 'dart2wasm_js_compatibility_platform.dill';
- case NnbdMode.Weak:
- break;
- }
- break;
+ return 'dart2wasm_js_compatibility_outline.dill';
default:
break;
}
diff --git a/pkg/front_end/lib/src/kernel/const_conditional_simplifier.dart b/pkg/front_end/lib/src/kernel/const_conditional_simplifier.dart
index 23e3148..ad8e566 100644
--- a/pkg/front_end/lib/src/kernel/const_conditional_simplifier.dart
+++ b/pkg/front_end/lib/src/kernel/const_conditional_simplifier.dart
@@ -8,7 +8,6 @@
import 'package:kernel/target/targets.dart';
import 'package:kernel/type_environment.dart';
-import 'constant_evaluator.dart';
import 'try_constant_evaluator.dart';
class ConstConditionalSimplifier extends RemovingTransformer {
@@ -24,7 +23,6 @@
this._component,
ReportErrorFunction _reportError, {
Map<String, String>? environmentDefines,
- required EvaluationMode evaluationMode,
bool Function(TreeNode)? shouldNotInline,
CoreTypes? coreTypes,
ClassHierarchy? classHierarchy,
@@ -42,7 +40,6 @@
_typeEnvironment,
_reportError,
environmentDefines: environmentDefines,
- evaluationMode: evaluationMode,
shouldNotInline: shouldNotInline,
);
}
@@ -133,9 +130,7 @@
_ConstantEvaluator(super.librarySupport, super.constantsBackend,
super.component, super.typeEnvironment, super.reportError,
- {super.environmentDefines,
- required super.evaluationMode,
- bool Function(TreeNode)? shouldNotInline})
+ {super.environmentDefines, bool Function(TreeNode)? shouldNotInline})
: _shouldNotInline = shouldNotInline ?? ((_) => false);
void _clearLocalCaches() {
diff --git a/pkg/front_end/lib/src/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/kernel/constant_evaluator.dart
index bf8eb54..babd712 100644
--- a/pkg/front_end/lib/src/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/kernel/constant_evaluator.dart
@@ -25,7 +25,6 @@
import 'package:_fe_analyzer_shared/src/exhaustiveness/static_type.dart';
import 'package:kernel/ast.dart';
import 'package:kernel/core_types.dart';
-import 'package:kernel/src/const_canonical_type.dart';
import 'package:kernel/src/find_type_visitor.dart';
import 'package:kernel/src/legacy_erasure.dart';
import 'package:kernel/src/norm.dart';
@@ -38,7 +37,6 @@
import '../api_prototype/lowering_predicates.dart';
import '../base/common.dart';
import '../base/problems.dart';
-import '../base/nnbd_mode.dart';
import '../codes/cfe_codes.dart';
import '../type_inference/delayed_expressions.dart';
import '../type_inference/external_ast_helper.dart';
@@ -58,7 +56,6 @@
Map<String, String>? environmentDefines,
TypeEnvironment typeEnvironment,
ErrorReporter errorReporter,
- EvaluationMode evaluationMode,
{required bool evaluateAnnotations,
required bool enableTripleShift,
required bool enableConstFunctions,
@@ -76,7 +73,6 @@
component,
typeEnvironment,
errorReporter,
- evaluationMode,
exhaustivenessDataForTesting: exhaustivenessDataForTesting);
for (final Library library in libraries) {
constantsTransformer.convertLibrary(library);
@@ -95,7 +91,6 @@
Map<String, String>? environmentDefines,
TypeEnvironment typeEnvironment,
ErrorReporter errorReporter,
- EvaluationMode evaluationMode,
{required bool evaluateAnnotations,
required bool enableTripleShift,
required bool enableConstFunctions,
@@ -111,25 +106,10 @@
errorOnUnevaluatedConstant,
component,
typeEnvironment,
- errorReporter,
- evaluationMode);
+ errorReporter);
constantsTransformer.convertProcedure(procedure);
}
-enum EvaluationMode {
- weak,
- strong;
-
- static EvaluationMode fromNnbdMode(NnbdMode nnbdMode) {
- switch (nnbdMode) {
- case NnbdMode.Weak:
- return EvaluationMode.weak;
- case NnbdMode.Strong:
- return EvaluationMode.strong;
- }
- }
-}
-
class ConstantsTransformer extends RemovingTransformer {
final ConstantsBackend backend;
final ConstantEvaluator constantEvaluator;
@@ -159,7 +139,6 @@
Component component,
this.typeEnvironment,
ErrorReporter errorReporter,
- EvaluationMode evaluationMode,
{ExhaustivenessDataForTesting? exhaustivenessDataForTesting})
: this.backend = target.constantsBackend,
this.isLateLocalLoweringEnabled = target.isLateLocalLoweringEnabled(
@@ -173,8 +152,7 @@
errorReporter,
enableTripleShift: enableTripleShift,
enableConstFunctions: enableConstFunctions,
- errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
- evaluationMode: evaluationMode),
+ errorOnUnevaluatedConstant: errorOnUnevaluatedConstant),
_exhaustivenessDataForTesting = exhaustivenessDataForTesting {}
/// Whether to preserve constant [Field]s. All use-sites will be rewritten.
@@ -914,49 +892,6 @@
}
}
- if (isAlwaysExhaustiveType &&
- !hasDefault &&
- constantEvaluator.evaluationMode != EvaluationMode.strong) {
- // Coverage-ignore-block(suite): Not run.
- if (!node.lastCaseTerminates) {
- PatternSwitchCase lastCase = node.cases.last;
- Statement body = lastCase.body;
-
- LabeledStatement target;
- if (node.parent is LabeledStatement) {
- target = node.parent as LabeledStatement;
- } else {
- target =
- outerLabeledStatement = new LabeledStatement(dummyStatement);
- }
- BreakStatement breakStatement =
- createBreakStatement(target, fileOffset: lastCase.fileOffset);
- if (body is Block) {
- body.statements.add(breakStatement);
- } else {
- body = createBlock([body, breakStatement],
- fileOffset: lastCase.fileOffset)
- ..parent = lastCase;
- }
- }
- switchCases.add(new SwitchCase(
- [],
- [],
- isDefault: true,
- createExpressionStatement(createThrow(
- createConstructorInvocation(
- typeEnvironment.coreTypes.reachabilityErrorConstructor,
- createArguments([
- createStringLiteral(
- messageNeverReachableSwitchStatementError
- .problemMessage,
- fileOffset: node.fileOffset)
- ], fileOffset: node.fileOffset),
- fileOffset: node.fileOffset),
- forErrorHandling: true)))
- ..fileOffset = node.fileOffset);
- }
-
replacement = createSwitchStatement(node.expression, switchCases,
isExplicitlyExhaustive: !hasDefault && isAlwaysExhaustiveType,
expressionType: scrutineeType,
@@ -982,8 +917,8 @@
MatchingCache matchingCache = createMatchingCache();
MatchingExpressionVisitor matchingExpressionVisitor =
- new MatchingExpressionVisitor(matchingCache,
- typeEnvironment.coreTypes, constantEvaluator.evaluationMode);
+ new MatchingExpressionVisitor(
+ matchingCache, typeEnvironment.coreTypes);
CacheableExpression matchedExpression =
matchingCache.createRootExpression(node.expression, scrutineeType);
// This expression is used, even if no case reads it.
@@ -1023,9 +958,7 @@
bool needsThrowForNull = false;
bool forUnsoundness = false;
if (isAlwaysExhaustiveType && !hasDefault) {
- if (constantEvaluator.evaluationMode != EvaluationMode.strong) {
- needsThrowForNull = true;
- } else if (currentLibrary.languageVersion <= const Version(3, 2)) {
+ if (currentLibrary.languageVersion <= const Version(3, 2)) {
needsThrowForNull = forUnsoundness = true;
}
}
@@ -1411,8 +1344,7 @@
MatchingCache matchingCache = createMatchingCache();
MatchingExpressionVisitor matchingExpressionVisitor =
- new MatchingExpressionVisitor(matchingCache, typeEnvironment.coreTypes,
- constantEvaluator.evaluationMode);
+ new MatchingExpressionVisitor(matchingCache, typeEnvironment.coreTypes);
CacheableExpression matchedExpression = matchingCache.createRootExpression(
node.expression, node.matchedValueType!);
// This expression is used, even if the matching expression doesn't read it.
@@ -1505,8 +1437,7 @@
MatchingCache matchingCache = createMatchingCache();
MatchingExpressionVisitor matchingExpressionVisitor =
- new MatchingExpressionVisitor(matchingCache, typeEnvironment.coreTypes,
- constantEvaluator.evaluationMode);
+ new MatchingExpressionVisitor(matchingCache, typeEnvironment.coreTypes);
DartType matchedType = node.matchedValueType!;
CacheableExpression matchedExpression =
matchingCache.createRootExpression(node.initializer, matchedType);
@@ -1581,8 +1512,7 @@
MatchingCache matchingCache = createMatchingCache();
MatchingExpressionVisitor matchingExpressionVisitor =
- new MatchingExpressionVisitor(matchingCache, typeEnvironment.coreTypes,
- constantEvaluator.evaluationMode);
+ new MatchingExpressionVisitor(matchingCache, typeEnvironment.coreTypes);
DartType matchedType = node.matchedValueType!;
CacheableExpression matchedExpression =
matchingCache.createRootExpression(node.expression, matchedType);
@@ -1790,25 +1720,6 @@
..fileOffset;
switchCases.add(switchCase);
}
- if (constantEvaluator.evaluationMode != EvaluationMode.strong) {
- // Coverage-ignore-block(suite): Not run.
- switchCases.add(new SwitchCase(
- [],
- [],
- isDefault: true,
- createExpressionStatement(createThrow(
- createConstructorInvocation(
- typeEnvironment.coreTypes.reachabilityErrorConstructor,
- createArguments([
- createStringLiteral(
- messageNeverReachableSwitchExpressionError
- .problemMessage,
- fileOffset: node.fileOffset)
- ], fileOffset: node.fileOffset),
- fileOffset: node.fileOffset),
- forErrorHandling: true)))
- ..fileOffset = node.fileOffset);
- }
labeledStatement.body = createSwitchStatement(
node.expression, switchCases,
@@ -1826,8 +1737,8 @@
} else {
MatchingCache matchingCache = createMatchingCache();
MatchingExpressionVisitor matchingExpressionVisitor =
- new MatchingExpressionVisitor(matchingCache,
- typeEnvironment.coreTypes, constantEvaluator.evaluationMode);
+ new MatchingExpressionVisitor(
+ matchingCache, typeEnvironment.coreTypes);
CacheableExpression matchedExpression =
matchingCache.createRootExpression(node.expression, scrutineeType);
// This expression is used, even if no case reads it.
@@ -1923,9 +1834,7 @@
}
bool forUnsoundness = false;
bool needsThrow = false;
- if (constantEvaluator.evaluationMode != EvaluationMode.strong) {
- needsThrow = true;
- } else if (currentLibrary.languageVersion <= const Version(3, 2)) {
+ if (currentLibrary.languageVersion <= const Version(3, 2)) {
needsThrow = forUnsoundness = true;
}
if (needsThrow) {
@@ -2231,7 +2140,6 @@
final TypeEnvironment typeEnvironment;
StaticTypeContext? _staticTypeContext;
final ErrorReporter errorReporter;
- final EvaluationMode evaluationMode;
final bool enableTripleShift;
final bool enableAsserts;
@@ -2276,8 +2184,7 @@
{this.enableTripleShift = false,
this.enableConstFunctions = false,
this.enableAsserts = true,
- this.errorOnUnevaluatedConstant = false,
- this.evaluationMode = EvaluationMode.weak})
+ this.errorOnUnevaluatedConstant = false})
: numberSemantics = backend.numberSemantics,
coreTypes = typeEnvironment.coreTypes,
canonicalizationCache = <Constant, Constant>{},
@@ -2344,27 +2251,11 @@
bool get hasEnvironment => _environmentDefines != null;
DartType convertType(DartType type) {
- switch (evaluationMode) {
- case EvaluationMode.strong:
- return norm(coreTypes, type);
- // Coverage-ignore(suite): Not run.
- case EvaluationMode.weak:
- type = norm(coreTypes, type);
- return computeConstCanonicalType(type, coreTypes) ?? type;
- }
+ return norm(coreTypes, type);
}
List<DartType> convertTypes(List<DartType> types) {
- switch (evaluationMode) {
- case EvaluationMode.strong:
- return types.map((DartType type) => norm(coreTypes, type)).toList();
- // Coverage-ignore(suite): Not run.
- case EvaluationMode.weak:
- return types.map((DartType type) {
- type = norm(coreTypes, type);
- return computeConstCanonicalType(type, coreTypes) ?? type;
- }).toList();
- }
+ return types.map((DartType type) => norm(coreTypes, type)).toList();
}
LocatedMessage createLocatedMessage(TreeNode? node, Message message) {
@@ -4688,13 +4579,7 @@
}
}
- switch (evaluationMode) {
- case EvaluationMode.strong:
- return makeBoolConstant(performIs(constant, strongMode: true));
- // Coverage-ignore(suite): Not run.
- case EvaluationMode.weak:
- return makeBoolConstant(performIs(constant, strongMode: false));
- }
+ return makeBoolConstant(performIs(constant, strongMode: true));
}
@override
@@ -4998,17 +4883,7 @@
/// Note that this returns an error-constant on error and as such the
/// return value should be checked.
Constant ensureIsSubtype(Constant constant, DartType type, TreeNode node) {
- bool result;
- switch (evaluationMode) {
- case EvaluationMode.strong:
- result = isSubtype(constant, type, SubtypeCheckMode.withNullabilities);
- break;
- // Coverage-ignore(suite): Not run.
- case EvaluationMode.weak:
- result =
- isSubtype(constant, type, SubtypeCheckMode.ignoringNullabilities);
- break;
- }
+ bool result = isSubtype(constant, type, SubtypeCheckMode.withNullabilities);
if (!result) {
return createEvaluationErrorConstant(
node,
diff --git a/pkg/front_end/lib/src/kernel/kernel_target.dart b/pkg/front_end/lib/src/kernel/kernel_target.dart
index fadace7..9b01e3a 100644
--- a/pkg/front_end/lib/src/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/kernel/kernel_target.dart
@@ -40,7 +40,6 @@
templateFinalFieldNotInitializedByConstructor,
templateMissingImplementationCause,
templateSuperclassHasNoDefaultConstructor;
-import '../base/nnbd_mode.dart';
import '../base/processed_options.dart' show ProcessedOptions;
import '../base/scope.dart' show AmbiguousBuilder;
import '../base/ticker.dart' show Ticker;
@@ -71,7 +70,6 @@
import 'cfe_verifier.dart' show verifyComponent, verifyGetStaticType;
import 'constant_evaluator.dart' as constants
show
- EvaluationMode,
transformLibraries,
transformProcedure,
ConstantCoverage,
@@ -753,19 +751,8 @@
Component component = backendTarget.configureComponent(new Component(
nameRoot: nameRoot, libraries: libraries, uriToSource: uriToSource));
- NonNullableByDefaultCompiledMode? compiledMode = null;
- if (globalFeatures.nonNullable.isEnabled) {
- switch (loader.nnbdMode) {
- case NnbdMode.Weak:
- compiledMode = NonNullableByDefaultCompiledMode.Weak;
- break;
- case NnbdMode.Strong:
- compiledMode = NonNullableByDefaultCompiledMode.Strong;
- break;
- }
- } else {
- compiledMode = NonNullableByDefaultCompiledMode.Weak;
- }
+ NonNullableByDefaultCompiledMode? compiledMode =
+ NonNullableByDefaultCompiledMode.Strong;
if (loader.hasInvalidNnbdModeLibrary) {
compiledMode = NonNullableByDefaultCompiledMode.Invalid;
}
@@ -1588,7 +1575,6 @@
TypeEnvironment environment =
new TypeEnvironment(loader.coreTypes, loader.hierarchy);
- constants.EvaluationMode evaluationMode = _getConstantEvaluationMode();
constants.ConstantEvaluationData constantEvaluationData =
constants.transformLibraries(
@@ -1598,7 +1584,6 @@
environmentDefines,
environment,
new KernelConstantErrorReporter(loader),
- evaluationMode,
evaluateAnnotations: true,
enableTripleShift: globalFeatures.tripleShift.isEnabled,
enableConstFunctions: globalFeatures.constFunctions.isEnabled,
@@ -1641,8 +1626,6 @@
void runProcedureTransformations(Procedure procedure) {
TypeEnvironment environment =
new TypeEnvironment(loader.coreTypes, loader.hierarchy);
- constants.EvaluationMode evaluationMode = _getConstantEvaluationMode();
-
constants.transformProcedure(
procedure,
backendTarget,
@@ -1650,7 +1633,6 @@
environmentDefines,
environment,
new KernelConstantErrorReporter(loader),
- evaluationMode,
evaluateAnnotations: true,
enableTripleShift: globalFeatures.tripleShift.isEnabled,
enableConstFunctions: globalFeatures.constFunctions.isEnabled,
@@ -1664,22 +1646,6 @@
logger: (String msg) => ticker.logMs(msg));
}
- constants.EvaluationMode getConstantEvaluationModeForTesting() =>
- _getConstantEvaluationMode();
-
- constants.EvaluationMode _getConstantEvaluationMode() {
- // If nnbd is not enabled we will use weak evaluation mode. This is needed
- // because the SDK might be agnostic and therefore needs to be weakened
- // for legacy mode.
- assert(
- globalFeatures.nonNullable.isEnabled ||
- // Coverage-ignore(suite): Not run.
- loader.nnbdMode == NnbdMode.Weak,
- "Non-weak nnbd mode found without experiment enabled: "
- "${loader.nnbdMode}.");
- return constants.EvaluationMode.fromNnbdMode(loader.nnbdMode);
- }
-
void _verify({required bool allowVerificationErrorForTesting}) {
// TODO(ahe): How to handle errors.
List<LocatedMessage> errors = verifyComponent(
diff --git a/pkg/front_end/lib/src/kernel/late_lowering.dart b/pkg/front_end/lib/src/kernel/late_lowering.dart
index cd6ed1b..b5db63b 100644
--- a/pkg/front_end/lib/src/kernel/late_lowering.dart
+++ b/pkg/front_end/lib/src/kernel/late_lowering.dart
@@ -5,7 +5,6 @@
import 'package:kernel/ast.dart';
import 'package:kernel/core_types.dart';
-import '../base/nnbd_mode.dart';
import '../source/source_library_builder.dart';
const String lateFieldPrefix = '_#';
@@ -524,15 +523,7 @@
IsSetStrategy computeIsSetStrategy(SourceLibraryBuilder libraryBuilder) {
IsSetStrategy isSetStrategy = IsSetStrategy.useIsSetFieldOrNull;
if (libraryBuilder.loader.target.backendTarget.supportsLateLoweringSentinel) {
- if (libraryBuilder.loader.nnbdMode != NnbdMode.Strong) {
- // Non-nullable fields/locals might contain `null` so we always use the
- // sentinel.
- isSetStrategy = IsSetStrategy.forceUseSentinel;
- } else {
- isSetStrategy = IsSetStrategy.useSentinelOrNull;
- }
- } else if (libraryBuilder.loader.nnbdMode != NnbdMode.Strong) {
- isSetStrategy = IsSetStrategy.forceUseIsSetField;
+ isSetStrategy = IsSetStrategy.useSentinelOrNull;
}
return isSetStrategy;
}
diff --git a/pkg/front_end/lib/src/kernel/try_constant_evaluator.dart b/pkg/front_end/lib/src/kernel/try_constant_evaluator.dart
index 668e55b..cc3b8d6 100644
--- a/pkg/front_end/lib/src/kernel/try_constant_evaluator.dart
+++ b/pkg/front_end/lib/src/kernel/try_constant_evaluator.dart
@@ -26,12 +26,10 @@
TypeEnvironment typeEnvironment,
ReportErrorFunction reportError,
{Map<String, String>? environmentDefines,
- required EvaluationMode evaluationMode,
bool supportReevaluationForTesting = false})
: this._(librarySupport, constantsBackend, component, typeEnvironment,
new _ErrorReporter(reportError),
environmentDefines: environmentDefines,
- evaluationMode: evaluationMode,
supportReevaluationForTesting: supportReevaluationForTesting);
TryConstantEvaluator._(
@@ -41,7 +39,6 @@
TypeEnvironment typeEnvironment,
this.errorReporter,
{Map<String, String>? environmentDefines,
- required super.evaluationMode,
bool supportReevaluationForTesting = false})
: _supportReevaluationForTesting = supportReevaluationForTesting,
super(librarySupport, constantsBackend, component,
diff --git a/pkg/front_end/lib/src/kernel_generator_impl.dart b/pkg/front_end/lib/src/kernel_generator_impl.dart
index fd7bc45..52b7f3f 100644
--- a/pkg/front_end/lib/src/kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/kernel_generator_impl.dart
@@ -19,7 +19,6 @@
import 'base/compiler_context.dart' show CompilerContext;
import 'base/crash.dart' show withCrashReporting;
import 'base/instrumentation.dart';
-import 'base/nnbd_mode.dart';
import 'base/processed_options.dart' show ProcessedOptions;
import 'base/uri_offset.dart';
import 'base/uri_translator.dart' show UriTranslator;
@@ -70,7 +69,6 @@
ProcessedOptions options = compilerContext.options;
assert(options.haveBeenValidated, "Options have not been validated");
- options.reportNullSafetyCompilationModeInfo();
FileSystem fs = options.fileSystem;
SourceLoader? sourceLoader;
@@ -189,15 +187,7 @@
trimmedSummaryComponent.uriToSource.addAll(summaryComponent.uriToSource);
NonNullableByDefaultCompiledMode compiledMode =
- NonNullableByDefaultCompiledMode.Weak;
- switch (options.nnbdMode) {
- case NnbdMode.Weak:
- compiledMode = NonNullableByDefaultCompiledMode.Weak;
- break;
- case NnbdMode.Strong:
- compiledMode = NonNullableByDefaultCompiledMode.Strong;
- break;
- }
+ NonNullableByDefaultCompiledMode.Strong;
if (kernelTarget.loader.hasInvalidNnbdModeLibrary) {
compiledMode = NonNullableByDefaultCompiledMode.Invalid;
}
diff --git a/pkg/front_end/lib/src/source/source_compilation_unit.dart b/pkg/front_end/lib/src/source/source_compilation_unit.dart
index 2f0e7ea..6ec6a3e 100644
--- a/pkg/front_end/lib/src/source/source_compilation_unit.dart
+++ b/pkg/front_end/lib/src/source/source_compilation_unit.dart
@@ -992,16 +992,8 @@
@override
void buildOutlineNode(Library library) {
- switch (loader.nnbdMode) {
- case NnbdMode.Weak:
- library.nonNullableByDefaultCompiledMode =
- NonNullableByDefaultCompiledMode.Weak;
- break;
- case NnbdMode.Strong:
- library.nonNullableByDefaultCompiledMode =
- NonNullableByDefaultCompiledMode.Strong;
- break;
- }
+ library.nonNullableByDefaultCompiledMode =
+ NonNullableByDefaultCompiledMode.Strong;
for (LibraryPart libraryPart in _builderFactoryResult.libraryParts) {
library.addPart(libraryPart);
}
diff --git a/pkg/front_end/lib/src/source/source_library_builder.dart b/pkg/front_end/lib/src/source/source_library_builder.dart
index 39d5f8b..f6618a8 100644
--- a/pkg/front_end/lib/src/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/source/source_library_builder.dart
@@ -28,7 +28,6 @@
import '../base/import.dart' show Import;
import '../base/messages.dart';
import '../base/name_space.dart';
-import '../base/nnbd_mode.dart';
import '../base/problems.dart' show unexpected, unhandled;
import '../base/scope.dart';
import '../base/uri_offset.dart';
diff --git a/pkg/front_end/lib/src/source/source_loader.dart b/pkg/front_end/lib/src/source/source_loader.dart
index 4bfa130..484171a 100644
--- a/pkg/front_end/lib/src/source/source_loader.dart
+++ b/pkg/front_end/lib/src/source/source_loader.dart
@@ -39,7 +39,6 @@
import '../base/instrumentation.dart' show Instrumentation;
import '../base/loader.dart' show Loader, untranslatableUriScheme;
import '../base/local_scope.dart';
-import '../base/nnbd_mode.dart';
import '../base/problems.dart' show internalProblem;
import '../base/scope.dart';
import '../base/ticker.dart' show Ticker;
@@ -618,19 +617,9 @@
registerNnbdMismatchLibrary(
libraryBuilder, messageInvalidNnbdDillLibrary);
} else {
- switch (nnbdMode) {
- case NnbdMode.Weak:
- if (libraryMode != NonNullableByDefaultCompiledMode.Weak) {
- registerNnbdMismatchLibrary(
- libraryBuilder, messageWeakWithStrongDillLibrary);
- }
- break;
- case NnbdMode.Strong:
- if (libraryMode != NonNullableByDefaultCompiledMode.Strong) {
- registerNnbdMismatchLibrary(
- libraryBuilder, messageStrongWithWeakDillLibrary);
- }
- break;
+ if (libraryMode != NonNullableByDefaultCompiledMode.Strong) {
+ registerNnbdMismatchLibrary(
+ libraryBuilder, messageStrongWithWeakDillLibrary);
}
}
}
@@ -937,8 +926,6 @@
formalParameterScope: formalParameterScope);
}
- NnbdMode get nnbdMode => target.context.options.nnbdMode;
-
CoreTypes get coreTypes {
assert(_coreTypes != null, "CoreTypes has not been computed.");
return _coreTypes!;
diff --git a/pkg/front_end/lib/src/testing/id_testing_helper.dart b/pkg/front_end/lib/src/testing/id_testing_helper.dart
index 9127a4e..de0823b 100644
--- a/pkg/front_end/lib/src/testing/id_testing_helper.dart
+++ b/pkg/front_end/lib/src/testing/id_testing_helper.dart
@@ -17,7 +17,6 @@
show printDiagnosticMessage;
import '../base/common.dart';
import '../base/messages.dart' show FormattedMessage;
-import '../base/nnbd_mode.dart';
import '../kernel_generator_impl.dart' show InternalCompilerResult;
import 'compiler_common.dart' show compileScript, toTestUri;
import 'id_extractor.dart' show DataExtractor;
@@ -39,7 +38,6 @@
// classes/members only.
final bool compileSdk;
final TestTargetFlags targetFlags;
- final NnbdMode nnbdMode;
const CfeTestConfig(super.marker, super.name,
{this.explicitExperimentalFlags = const {},
@@ -47,8 +45,7 @@
this.librariesSpecificationUri,
this.packageConfigUri,
this.compileSdk = false,
- this.targetFlags = const TestTargetFlags(),
- this.nnbdMode = NnbdMode.Strong});
+ this.targetFlags = const TestTargetFlags()});
/// Called before running test on [testData].
///
@@ -210,7 +207,6 @@
new NoneTarget(config.targetFlags), config.targetFlags);
options.explicitExperimentalFlags.addAll(config.explicitExperimentalFlags);
options.allowedExperimentalFlagsForTesting = config.allowedExperimentalFlags;
- options.nnbdMode = config.nnbdMode;
if (config.librariesSpecificationUri != null) {
Set<Uri> testFiles =
testData.memorySourceFiles.keys.map(createUriForFileName).toSet();
diff --git a/pkg/front_end/lib/src/type_inference/inference_visitor_base.dart b/pkg/front_end/lib/src/type_inference/inference_visitor_base.dart
index 832ff59..f17efc1 100644
--- a/pkg/front_end/lib/src/type_inference/inference_visitor_base.dart
+++ b/pkg/front_end/lib/src/type_inference/inference_visitor_base.dart
@@ -27,7 +27,6 @@
InstrumentationValueForMember,
InstrumentationValueForType,
InstrumentationValueForTypeArgs;
-import '../base/nnbd_mode.dart';
import '../base/problems.dart' show internalProblem, unhandled;
import '../base/scope.dart';
import '../builder/declaration_builders.dart';
@@ -177,8 +176,6 @@
bool get isInferenceUpdate1Enabled =>
libraryBuilder.isInferenceUpdate1Enabled;
- NnbdMode get nnbdMode => libraryBuilder.loader.nnbdMode;
-
LibraryFeatures get libraryFeatures => libraryBuilder.libraryFeatures;
DartType get bottomType => const NeverType.nonNullable();
@@ -269,7 +266,8 @@
/// Returns `true` if exceptions should be thrown in paths reachable only due
/// to unsoundness in flow analysis in mixed mode.
- bool get shouldThrowUnsoundnessException => nnbdMode != NnbdMode.Strong;
+ // TODO(johnniwinther): Remove this.
+ bool get shouldThrowUnsoundnessException => false;
void registerIfUnreachableForTesting(TreeNode node, {bool? isReachable}) {
if (dataForTesting == null) return;
diff --git a/pkg/front_end/lib/src/type_inference/matching_expressions.dart b/pkg/front_end/lib/src/type_inference/matching_expressions.dart
index 156b73b..6a29a13 100644
--- a/pkg/front_end/lib/src/type_inference/matching_expressions.dart
+++ b/pkg/front_end/lib/src/type_inference/matching_expressions.dart
@@ -9,18 +9,14 @@
import 'package:kernel/core_types.dart';
import 'package:kernel/names.dart';
-import '../api_prototype/constant_evaluator.dart';
-
/// Visitor that creates the [DelayedExpression] needed to match expressions,
/// using [MatchingCache] to create cacheable expressions.
class MatchingExpressionVisitor
implements PatternVisitor1<DelayedExpression, CacheableExpression> {
final MatchingCache matchingCache;
final CoreTypes coreTypes;
- final EvaluationMode evaluationMode;
- MatchingExpressionVisitor(
- this.matchingCache, this.coreTypes, this.evaluationMode);
+ MatchingExpressionVisitor(this.matchingCache, this.coreTypes);
DelayedExpression visitPattern(
Pattern node, CacheableExpression matchedExpression) {
@@ -312,29 +308,22 @@
node.indexGetTarget, node.indexGetType!, [keyExpression],
fileOffset: entry.fileOffset),
fileOffset: entry.fileOffset);
- if (evaluationMode == EvaluationMode.strong) {
- matchingExpression = DelayedAndExpression.merge(
- matchingExpression,
- new DelayedOrExpression(
- new DelayedNullCheckExpression(valueExpression,
- fileOffset: entry.fileOffset),
- new DelayedAndExpression(
- new DelayedIsExpression(
- new FixedExpression(
- createNullLiteral(fileOffset: entry.fileOffset),
- const NullType()),
- valueType,
- fileOffset: entry.fileOffset),
- containsExpression,
- fileOffset: entry.fileOffset),
- fileOffset: entry.fileOffset),
- fileOffset: entry.fileOffset);
- } else {
- // Coverage-ignore-block(suite): Not run.
- matchingExpression = DelayedAndExpression.merge(
- matchingExpression, containsExpression,
- fileOffset: entry.fileOffset);
- }
+ matchingExpression = DelayedAndExpression.merge(
+ matchingExpression,
+ new DelayedOrExpression(
+ new DelayedNullCheckExpression(valueExpression,
+ fileOffset: entry.fileOffset),
+ new DelayedAndExpression(
+ new DelayedIsExpression(
+ new FixedExpression(
+ createNullLiteral(fileOffset: entry.fileOffset),
+ const NullType()),
+ valueType,
+ fileOffset: entry.fileOffset),
+ containsExpression,
+ fileOffset: entry.fileOffset),
+ fileOffset: entry.fileOffset),
+ fileOffset: entry.fileOffset);
valueExpression =
new PromotedCacheableExpression(valueExpression, valueType);
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 3dd5aee..72084cb 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -994,7 +994,6 @@
problemMessage: "Members of classes can't be declared to be 'abstract'."
correctionMessage: "Try removing the 'abstract' keyword. You can add the 'abstract' keyword before the class declaration."
analyzerCode: ParserErrorCode.ABSTRACT_CLASS_MEMBER
- configuration: nnbd-weak
script:
- |
abstract class C {abstract C.c();}
@@ -1299,7 +1298,6 @@
problemMessage: "Fields can't be declared to be 'external'."
correctionMessage: "Try removing the keyword 'external', or replacing the field by an external getter and/or setter."
analyzerCode: ParserErrorCode.EXTERNAL_FIELD
- configuration: nnbd-weak
ExternalFieldInitializer:
problemMessage: "External fields cannot have initializers."
@@ -3762,7 +3760,6 @@
SwitchExpressionNotAssignable:
problemMessage: "Type '#type' of the switch expression isn't assignable to the type '#type2' of this case expression."
analyzerCode: SWITCH_EXPRESSION_NOT_ASSIGNABLE
- configuration: nnbd-weak
SwitchExpressionNotAssignableCause:
problemMessage: "The switch expression is here."
@@ -3770,7 +3767,6 @@
SwitchExpressionNotSubtype:
problemMessage: "Type '#type' of the case expression is not a subtype of type '#type2' of this switch expression."
- configuration: nnbd-weak
script:
- |
// @dart=2.19
@@ -4744,7 +4740,6 @@
InvokeNonFunction:
problemMessage: "'#name' isn't a function or method and can't be invoked."
analyzerCode: INVOCATION_OF_NON_FUNCTION
- configuration: nnbd-weak
script: |
abstract class Foo {
int get f;
@@ -6161,13 +6156,6 @@
exampleAllowMoreCodes: true
analyzerCode: UNEXPECTED_TOKEN
-CompilingWithoutSoundNullSafety:
- problemMessage: "Compiling without sound null safety!\nDart 3 will only support sound null safety, see https://dart.dev/null-safety"
- configuration: nnbd-weak,compile
- severity: INFO
- script: |
- main() {}
-
UnsupportedDartExt:
problemMessage: "Dart native extensions are no longer supported."
correctionMessage: "Migrate to using FFI instead (https://dart.dev/guides/libraries/c-interop)"
diff --git a/pkg/front_end/test/compile_platform_coverage.dart b/pkg/front_end/test/compile_platform_coverage.dart
index f7d2787..2cafa45 100644
--- a/pkg/front_end/test/compile_platform_coverage.dart
+++ b/pkg/front_end/test/compile_platform_coverage.dart
@@ -30,7 +30,6 @@
"dart:core",
"-Ddart.vm.product=false",
"-Ddart.isVM=true",
- "--nnbd-strong",
"--single-root-scheme=org-dartlang-sdk",
"--single-root-base=.",
"org-dartlang-sdk:///sdk/lib/libraries.json",
diff --git a/pkg/front_end/test/constant_evaluator_benchmark.dart b/pkg/front_end/test/constant_evaluator_benchmark.dart
index 3fec42a4..578cc98 100644
--- a/pkg/front_end/test/constant_evaluator_benchmark.dart
+++ b/pkg/front_end/test/constant_evaluator_benchmark.dart
@@ -19,7 +19,7 @@
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
import 'package:front_end/src/kernel/constant_evaluator.dart' as constants
- show EvaluationMode, transformLibraries, ErrorReporter;
+ show transformLibraries, ErrorReporter;
import 'package:front_end/src/kernel/kernel_target.dart';
import 'package:front_end/src/kernel/utils.dart' show serializeComponent;
import 'package:kernel/ast.dart';
@@ -43,8 +43,6 @@
void benchmark(Component component, List<Library> libraries) {
if (tryWithNoEnvironment == null) throw "tryWithNoEnvironment not set";
KernelTarget target = incrementalCompiler.kernelTargetForTesting!;
- constants.EvaluationMode evaluationMode =
- target.getConstantEvaluationModeForTesting();
Uint8List serializedComponent = serializeComponent(component);
@@ -86,7 +84,6 @@
environmentDefines,
environment,
new SilentErrorReporter(),
- evaluationMode,
evaluateAnnotations: true,
enableTripleShift: target.globalFeatures.tripleShift.isEnabled,
enableConstFunctions:
diff --git a/pkg/front_end/test/expression_suite.dart b/pkg/front_end/test/expression_suite.dart
index 4e6eb4f..faf7834 100644
--- a/pkg/front_end/test/expression_suite.dart
+++ b/pkg/front_end/test/expression_suite.dart
@@ -20,7 +20,6 @@
import 'package:front_end/src/base/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/base/incremental_compiler.dart'
show IncrementalCompiler;
-import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
import 'package:front_end/src/compute_platform_binaries_location.dart'
@@ -738,14 +737,13 @@
errors.add(message);
}
..environmentDefines = const {}
- // TODO(johnniwinther): We should default to strong mode.
- ..nnbdMode = NnbdMode.Weak
..explicitExperimentalFlags = {}
..allowedExperimentalFlagsForTesting = const AllowedExperimentalFlags();
final ProcessedOptions options =
new ProcessedOptions(options: optionBuilder, inputs: [entryPoint]);
+ // TODO(jensj): Remove this. We don't support no-nnbd anymore.
final CompilerOptions optionBuilderNoNNBD = new CompilerOptions()
..target = new VmTarget(new TargetFlags())
..verbose = true
@@ -757,7 +755,6 @@
errors.add(message);
}
..environmentDefines = const {}
- ..nnbdMode = NnbdMode.Weak
..explicitExperimentalFlags = {ExperimentalFlag.nonNullable: false}
..allowedExperimentalFlagsForTesting = const AllowedExperimentalFlags();
diff --git a/pkg/front_end/test/incremental_dartino_suite.dart b/pkg/front_end/test/incremental_dartino_suite.dart
index 3fac42e..307de2b 100644
--- a/pkg/front_end/test/incremental_dartino_suite.dart
+++ b/pkg/front_end/test/incremental_dartino_suite.dart
@@ -17,7 +17,6 @@
import 'package:front_end/src/base/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/base/incremental_compiler.dart'
show IncrementalCompiler;
-import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
import 'package:front_end/src/compute_platform_binaries_location.dart'
@@ -214,7 +213,6 @@
..verbose = true
..fileSystem = fs
..sdkSummary = sdkSummary
- ..nnbdMode = NnbdMode.Weak
..onDiagnostic = (DiagnosticMessage message) {
printDiagnosticMessage(message, print);
if (message.severity == Severity.error) {
diff --git a/pkg/front_end/test/incremental_load_from_invalid_dill_test.dart b/pkg/front_end/test/incremental_load_from_invalid_dill_test.dart
index f3349f1..4efdb23 100644
--- a/pkg/front_end/test/incremental_load_from_invalid_dill_test.dart
+++ b/pkg/front_end/test/incremental_load_from_invalid_dill_test.dart
@@ -10,8 +10,6 @@
import 'package:expect/expect.dart' show Expect;
import 'package:front_end/src/api_prototype/compiler_options.dart'
show CompilerOptions;
-import 'package:front_end/src/api_prototype/experimental_flags.dart'
- show ExperimentalFlag;
import 'package:front_end/src/api_prototype/incremental_kernel_generator.dart'
show IncrementalCompilerResult;
import "package:front_end/src/api_prototype/memory_file_system.dart"
@@ -19,7 +17,6 @@
import 'package:front_end/src/base/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/base/incremental_compiler.dart'
show IncrementalCompiler, RecorderForTesting;
-import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
import 'package:front_end/src/codes/cfe_codes.dart'
@@ -32,8 +29,7 @@
import 'package:front_end/src/compute_platform_binaries_location.dart'
show computePlatformBinariesLocation;
import 'package:front_end/src/kernel/utils.dart' show serializeComponent;
-import 'package:kernel/kernel.dart'
- show Component, Library, NonNullableByDefaultCompiledMode;
+import 'package:kernel/kernel.dart' show Component, Library;
import 'incremental_suite.dart' show getOptions;
@@ -235,64 +231,6 @@
// Should be ok (for now), but we shouldn't actually initialize from dill.
fs.entityForUri(initializeFrom).writeAsBytesSync(dataLinkedToSdkWithFoo);
await compileExpectOk(false, entryPoint);
-
- // Try to initialize from a dill which contains mixed compilation modes:
- // Should be ok, but we shouldn't actually initialize from dill.
- List<int> mixedPart1;
- {
- // Create a component that is compiled without NNBD.
- Map<ExperimentalFlag, bool>? prevTesting =
- options.defaultExperimentFlagsForTesting;
- options.defaultExperimentFlagsForTesting = {
- ExperimentalFlag.nonNullable: false
- };
- NnbdMode prevNnbd = options.nnbdMode;
- options.nnbdMode = NnbdMode.Weak;
- compiler = new IncrementalCompiler(
- new CompilerContext(
- new ProcessedOptions(options: options, inputs: [helper2File])),
- null);
-
- IncrementalCompilerResult result = await compiler.computeDelta();
- Component c = result.component;
- c.setMainMethodAndMode(
- null, false, NonNullableByDefaultCompiledMode.Weak);
- mixedPart1 = serializeComponent(c);
- options.defaultExperimentFlagsForTesting = prevTesting;
- options.nnbdMode = prevNnbd;
- }
-
- List<int> mixedPart2;
- {
- // Create a component that is compiled with strong NNBD.
- Map<ExperimentalFlag, bool>? prevTesting =
- options.defaultExperimentFlagsForTesting;
- options.defaultExperimentFlagsForTesting = {
- ExperimentalFlag.nonNullable: true
- };
- NnbdMode prevNnbd = options.nnbdMode;
- options.nnbdMode = NnbdMode.Strong;
- compiler = new IncrementalCompiler(
- new CompilerContext(
- new ProcessedOptions(options: options, inputs: [helperFile])),
- null);
- IncrementalCompilerResult result = await compiler.computeDelta();
- Component c = result.component;
- c.setMainMethodAndMode(
- null, false, NonNullableByDefaultCompiledMode.Strong);
- mixedPart2 = serializeComponent(c);
- options.defaultExperimentFlagsForTesting = prevTesting;
- options.nnbdMode = prevNnbd;
- }
-
- // Now mix the two components together and try to initialize from them.
- // We expect the compilation to be OK but that the dill is not actually
- // used to initialize from (as it's invalid because of the mixed mode).
- List<int> mixed = [];
- mixed.addAll(mixedPart1);
- mixed.addAll(mixedPart2);
- fs.entityForUri(initializeFrom).writeAsBytesSync(mixed);
- await compileExpectOk(false, entryPoint);
}
}
diff --git a/pkg/front_end/test/incremental_suite.dart b/pkg/front_end/test/incremental_suite.dart
index 314c4a7..8aefea1 100644
--- a/pkg/front_end/test/incremental_suite.dart
+++ b/pkg/front_end/test/incremental_suite.dart
@@ -27,7 +27,6 @@
show AdvancedInvalidationResult, IncrementalCompiler, RecorderForTesting;
import 'package:front_end/src/base/incremental_serializer.dart'
show IncrementalSerializer;
-import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
import 'package:front_end/src/codes/cfe_codes.dart'
@@ -139,11 +138,6 @@
'incrementalSerialization', BoolValue(),
defaultValue: false);
- static const String nnbdMode_weak = 'weak';
-
- static const Property<String?> nnbdMode =
- Property.optional('nnbdMode', StringValue(options: {nnbdMode_weak}));
-
static const String target_none = 'none';
static const String target_dartdevc = 'dartdevc';
static const String target_dart2js = 'dart2js';
@@ -189,11 +183,6 @@
static const Property<String?> experiments =
Property.optional("experiments", StringValue());
- static const String nnbdMode_weak = 'weak';
-
- static const Property<String?> nnbdMode =
- Property.optional("nnbdMode", StringValue(options: {nnbdMode_weak}));
-
static const Property<List<String>> entry = Property.required(
'entry', ListValue(StringValue(), supportSingleton: true));
@@ -615,10 +604,6 @@
NewWorldTestProperties.trackWidgetCreation.read(map, keys),
incrementalSerialization:
NewWorldTestProperties.incrementalSerialization.read(map, keys),
- nnbdMode: NewWorldTestProperties.nnbdMode.read(map, keys) ==
- NewWorldTestProperties.nnbdMode_weak
- ? NnbdMode.Weak
- : NnbdMode.Strong,
modules: NewWorldTestProperties.modules.read(map, keys),
targetName: NewWorldTestProperties.target.read(map, keys),
).newWorldTest();
@@ -821,7 +806,6 @@
final bool enableStringReplacement;
final String? packageConfigFile;
final String? experiments;
- final String? nnbdModeString;
final List<String> entries;
final bool outlineOnly;
final bool skipOutlineBodyCheck;
@@ -876,7 +860,6 @@
required this.enableStringReplacement,
required this.packageConfigFile,
required this.experiments,
- required this.nnbdModeString,
required this.entries,
required this.outlineOnly,
required this.skipOutlineBodyCheck,
@@ -937,8 +920,6 @@
String? experiments = WorldProperties.experiments.read(world, keys);
- String? nnbdModeString = WorldProperties.nnbdMode.read(world, keys);
-
List<String> entries = WorldProperties.entry.read(world, keys);
bool outlineOnly = WorldProperties.outlineOnly.read(world, keys);
@@ -1044,7 +1025,6 @@
enableStringReplacement: enableStringReplacement,
packageConfigFile: packageConfigFile,
experiments: experiments,
- nnbdModeString: nnbdModeString,
entries: entries,
outlineOnly: outlineOnly,
skipOutlineBodyCheck: skipOutlineBodyCheck,
@@ -1092,7 +1072,6 @@
final bool forceLateLoweringForTesting;
final bool trackWidgetCreation;
final bool incrementalSerialization;
- final NnbdMode nnbdMode;
final String? targetName;
// These are fields in a class to make it easier to track down memory leaks
@@ -1112,7 +1091,6 @@
required this.forceLateLoweringForTesting,
required this.trackWidgetCreation,
required this.incrementalSerialization,
- required this.nnbdMode,
required this.targetName,
});
@@ -1146,9 +1124,8 @@
String sdkSummary = computePlatformDillName(
target,
- nnbdMode,
() => throw new UnsupportedError(
- "No platform dill for target '${targetName}' with $nnbdMode."))!;
+ "No platform dill for target '${targetName}'."))!;
final Uri base = Uri.parse("org-dartlang-test:///");
final Uri sdkSummaryUri = base.resolve(sdkSummary);
@@ -1254,7 +1231,6 @@
if (!world.updateWorldType) {
options = getOptions(target: target, sdkSummary: sdkSummary);
- options.nnbdMode = nnbdMode;
options.fileSystem = fs;
options.sdkRoot = null;
options.sdkSummary = sdkSummaryUri;
@@ -1275,18 +1251,6 @@
} else {
options.explicitExperimentalFlags = {};
}
- // A separate "world" can also change nnbd mode ---
- // notice that the platform is not updated though!
- if (world.nnbdModeString != null) {
- String nnbdMode = world.nnbdModeString!;
- switch (nnbdMode) {
- case WorldProperties.nnbdMode_weak:
- options.nnbdMode = NnbdMode.Weak;
- break;
- default:
- throw "Not supported nnbd mode: $nnbdMode";
- }
- }
}
if (packagesUri != null) {
options!.packagesFileUri = packagesUri;
diff --git a/pkg/front_end/test/messages_suite.dart b/pkg/front_end/test/messages_suite.dart
index b476ccd..0597bb0 100644
--- a/pkg/front_end/test/messages_suite.dart
+++ b/pkg/front_end/test/messages_suite.dart
@@ -11,11 +11,7 @@
import 'package:_fe_analyzer_shared/src/messages/severity.dart'
show Severity, severityEnumValues;
import 'package:front_end/src/api_prototype/compiler_options.dart'
- show
- CompilerOptions,
- InvocationMode,
- parseExperimentalArguments,
- parseExperimentalFlags;
+ show CompilerOptions, parseExperimentalArguments, parseExperimentalFlags;
import 'package:front_end/src/api_prototype/experimental_flags.dart'
show ExperimentalFlag, defaultExperimentalFlags;
import 'package:front_end/src/api_prototype/memory_file_system.dart'
@@ -24,7 +20,6 @@
as command_line_reporting;
import 'package:front_end/src/base/hybrid_file_system.dart'
show HybridFileSystem;
-import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
import 'package:front_end/src/compute_platform_binaries_location.dart'
show computePlatformBinariesLocation;
import 'package:kernel/ast.dart' show Location, Source;
@@ -57,24 +52,6 @@
this.example, this.problem);
}
-class Configuration {
- final NnbdMode? nnbdMode;
- final Set<InvocationMode> invocationModes;
-
- const Configuration(this.nnbdMode, this.invocationModes);
-
- CompilerOptions apply(CompilerOptions options) {
- if (nnbdMode != null) {
- options.nnbdMode = nnbdMode!;
- }
- options.invocationModes = invocationModes;
- return options;
- }
-
- static const Configuration defaultConfiguration =
- const Configuration(null, const {});
-}
-
class MessageTestSuite extends ChainContext {
@override
final List<Step> steps = const <Step>[
@@ -155,7 +132,6 @@
const String spellingPostMessage = "\nIf the word(s) look okay, update "
"'spell_checking_list_messages.txt' or "
"'spell_checking_list_common.txt'.";
- Configuration? configuration;
Map<ExperimentalFlag, bool>? experimentalFlags;
Source? source;
@@ -345,30 +321,6 @@
}
break;
- case "configuration":
- if (value is String) {
- NnbdMode? nnbdMode;
- Set<InvocationMode> invocationModes = {};
- for (String part in value.split(',')) {
- if (part.isEmpty) continue;
- if (part == "nnbd-weak") {
- nnbdMode = NnbdMode.Weak;
- } else if (part == "nnbd-strong") {
- nnbdMode = NnbdMode.Strong;
- } else {
- InvocationMode? invocationMode =
- InvocationMode.fromName(part);
- if (invocationMode != null) {
- invocationModes.add(invocationMode);
- } else {
- throw new ArgumentError("Unknown configuration '$part'.");
- }
- }
- }
- configuration = new Configuration(nnbdMode, invocationModes);
- }
- break;
-
case "experiments":
if (value is String) {
experimentalFlags = parseExperimentalFlags(
@@ -404,8 +356,6 @@
}
}
for (Example example in examples) {
- example.configuration =
- configuration ?? Configuration.defaultConfiguration;
example.experimentalFlags =
experimentalFlags ?? defaultExperimentalFlags;
}
@@ -548,8 +498,6 @@
bool allowMoreCodes = false;
- late Configuration configuration;
-
Map<ExperimentalFlag, bool>? experimentalFlags;
Example(this.name, this.expectedCode);
@@ -683,7 +631,6 @@
PartWrapExample(String name, String code, this.allowMoreCodes, this.example)
: super(name, code) {
- configuration = example.configuration;
experimentalFlags = example.experimentalFlags;
}
@@ -790,7 +737,7 @@
List<DiagnosticMessage> messages = <DiagnosticMessage>[];
await suite.compiler.batchCompile(
- example.configuration.apply(new CompilerOptions()
+ new CompilerOptions()
..sdkSummary = computePlatformBinariesLocation(forceBuildDir: true)
.resolve("vm_platform_strong.dill")
..explicitExperimentalFlags = example.experimentalFlags ?? {}
@@ -799,7 +746,7 @@
..packagesFileUri = packageConfigUri
..onDiagnostic = messages.add
..environmentDefines = const {}
- ..omitPlatform = true),
+ ..omitPlatform = true,
main,
output);
diff --git a/pkg/front_end/test/modular_suite.dart b/pkg/front_end/test/modular_suite.dart
index 581688e..fc5c550 100644
--- a/pkg/front_end/test/modular_suite.dart
+++ b/pkg/front_end/test/modular_suite.dart
@@ -9,7 +9,6 @@
Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
environment[EnvironmentKeys.compilationMode] = CompileMode.modular.name;
- environment[EnvironmentKeys.soundNullSafety] = "true";
return FastaContext.create(suite, environment);
}
diff --git a/pkg/front_end/test/outline_suite.dart b/pkg/front_end/test/outline_suite.dart
index b18bf75..024a481 100644
--- a/pkg/front_end/test/outline_suite.dart
+++ b/pkg/front_end/test/outline_suite.dart
@@ -3,12 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
import 'utils/suite_utils.dart' show internalMain;
-import 'testing/environment_keys.dart';
import 'testing/suite.dart';
Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
- environment[EnvironmentKeys.soundNullSafety] = "true";
return FastaContext.create(suite, environment);
}
diff --git a/pkg/front_end/test/predicates/predicate_test.dart b/pkg/front_end/test/predicates/predicate_test.dart
index 4ec2e9c..134f29e 100644
--- a/pkg/front_end/test/predicates/predicate_test.dart
+++ b/pkg/front_end/test/predicates/predicate_test.dart
@@ -10,7 +10,6 @@
show DataInterpreter, runTests;
import 'package:front_end/src/api_prototype/experimental_flags.dart';
import 'package:front_end/src/api_prototype/lowering_predicates.dart';
-import 'package:front_end/src/base/nnbd_mode.dart';
import 'package:front_end/src/testing/id_extractor.dart';
import 'package:front_end/src/testing/id_testing_helper.dart';
import 'package:front_end/src/testing/id_testing_utils.dart';
@@ -36,8 +35,7 @@
forceConstructorTearOffLoweringForTesting:
ConstructorTearOffLowering.all,
forceLateLoweringsForTesting: LateLowering.all,
- forceLateLoweringSentinelForTesting: false),
- nnbdMode: NnbdMode.Strong),
+ forceLateLoweringSentinelForTesting: false)),
const CfeTestConfig(sentinelMarker, 'use sentinel',
explicitExperimentalFlags: const {
ExperimentalFlag.nonNullable: true
@@ -46,8 +44,7 @@
forceConstructorTearOffLoweringForTesting:
ConstructorTearOffLowering.all,
forceLateLoweringsForTesting: LateLowering.all,
- forceLateLoweringSentinelForTesting: true),
- nnbdMode: NnbdMode.Strong)
+ forceLateLoweringSentinelForTesting: true))
]));
}
diff --git a/pkg/front_end/test/strong_suite.dart b/pkg/front_end/test/strong_suite.dart
index 708c9fc..28f1115 100644
--- a/pkg/front_end/test/strong_suite.dart
+++ b/pkg/front_end/test/strong_suite.dart
@@ -9,7 +9,6 @@
Future<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
environment[EnvironmentKeys.compilationMode] = CompileMode.full.name;
- environment[EnvironmentKeys.soundNullSafety] = "true";
environment[EnvironmentKeys.semiFuzz] ??= "true";
return FastaContext.create(suite, environment);
}
diff --git a/pkg/front_end/test/testing/environment_keys.dart b/pkg/front_end/test/testing/environment_keys.dart
index ec4ff45..df124e1 100644
--- a/pkg/front_end/test/testing/environment_keys.dart
+++ b/pkg/front_end/test/testing/environment_keys.dart
@@ -12,7 +12,6 @@
static const String semiFuzz = "semiFuzz";
static const String skipTests = "skipTests";
static const String skipVm = "skipVm";
- static const String soundNullSafety = "soundNullSafety";
static const String trace = "trace";
static const String updateComments = "updateComments";
static const String updateExpectations = "updateExpectations";
diff --git a/pkg/front_end/test/testing/suite.dart b/pkg/front_end/test/testing/suite.dart
index d89fda9..305517a 100644
--- a/pkg/front_end/test/testing/suite.dart
+++ b/pkg/front_end/test/testing/suite.dart
@@ -19,13 +19,9 @@
import 'package:front_end/src/api_prototype/compiler_options.dart'
show CompilerOptions, DiagnosticMessage;
import 'package:front_end/src/api_prototype/constant_evaluator.dart'
- show ConstantEvaluator, ErrorReporter, EvaluationMode;
+ show ConstantEvaluator, ErrorReporter;
import 'package:front_end/src/api_prototype/experimental_flags.dart'
- show
- AllowedExperimentalFlags,
- ExperimentalFlag,
- LibraryFeatures,
- isExperimentEnabled;
+ show AllowedExperimentalFlags, ExperimentalFlag, LibraryFeatures;
import 'package:front_end/src/api_prototype/file_system.dart'
show FileSystem, FileSystemEntity, FileSystemException;
import 'package:front_end/src/api_prototype/incremental_kernel_generator.dart'
@@ -35,7 +31,6 @@
import 'package:front_end/src/base/incremental_compiler.dart'
show AdvancedInvalidationResult, IncrementalCompiler;
import 'package:front_end/src/base/messages.dart' show LocatedMessage;
-import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
import 'package:front_end/src/base/problems.dart';
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
@@ -220,7 +215,6 @@
final bool skipVm;
final bool semiFuzz;
final bool verify;
- final bool soundNullSafety;
final Uri platformBinaries;
final Map<Uri, Uri?> _librariesJson = {};
final SuiteFolderOptions suiteFolderOptions;
@@ -265,8 +259,7 @@
this.skipVm,
this.semiFuzz,
this.compileMode,
- this.verify,
- this.soundNullSafety)
+ this.verify)
: steps = <Step>[
new Outline(compileMode, updateComments: updateComments),
const Print(),
@@ -277,13 +270,8 @@
],
suiteFolderOptions = new SuiteFolderOptions(baseUri),
suiteTestOptions = new SuiteTestOptions() {
- String prefix;
+ String prefix = '.strong';
String infix;
- if (soundNullSafety) {
- prefix = '.strong';
- } else {
- prefix = '.weak';
- }
switch (compileMode) {
case CompileMode.outline:
infix = '.outline';
@@ -369,24 +357,23 @@
Expectation get verificationError => expectationSet["VerificationError"];
- Uri _getPlatformUri(Target target, NnbdMode nnbdMode) {
+ Uri _getPlatformUri(Target target) {
String fileName = computePlatformDillName(
target,
- nnbdMode,
() => throw new UnsupportedError(
- "No platform dill for target '${target.name}' with $nnbdMode."))!;
+ "No platform dill for target '${target.name}'."))!;
return platformBinaries.resolve(fileName);
}
- Component loadPlatform(Target target, NnbdMode nnbdMode) {
- Uri uri = _getPlatformUri(target, nnbdMode);
+ Component loadPlatform(Target target) {
+ Uri uri = _getPlatformUri(target);
return _platforms.putIfAbsent(uri, () {
return loadComponentFromBytes(new File.fromUri(uri).readAsBytesSync());
});
}
- void clearPlatformCache(Target target, NnbdMode nnbdMode) {
- Uri uri = _getPlatformUri(target, nnbdMode);
+ void clearPlatformCache(Target target) {
+ Uri uri = _getPlatformUri(target);
_platforms.remove(uri);
}
@@ -435,7 +422,6 @@
static Future<FastaContext> create(
Chain suite, Map<String, String> environment) {
const Set<String> knownEnvironmentKeys = {
- EnvironmentKeys.soundNullSafety,
EnvironmentKeys.ignoreExpectations,
EnvironmentKeys.updateExpectations,
EnvironmentKeys.updateComments,
@@ -453,8 +439,6 @@
Map<ExperimentalFlag, bool> experimentalFlags =
SuiteFolderOptions.computeForcedExperimentalFlags(environment);
- bool soundNullSafety =
- environment[EnvironmentKeys.soundNullSafety] == "true";
bool ignoreExpectations =
environment[EnvironmentKeys.ignoreExpectations] == "true";
bool updateExpectations =
@@ -480,8 +464,7 @@
skipVm,
semiFuzz,
compileModeFromName(environment[EnvironmentKeys.compilationMode]),
- verify,
- soundNullSafety));
+ verify));
}
}
@@ -574,7 +557,6 @@
environment,
!target.backendTarget.supportsSetLiterals,
result.options.errorOnUnevaluatedConstant,
- target.getConstantEvaluationModeForTesting(),
);
for (Library lib in result.component.libraries) {
if (!result.isUserLibrary(lib)) continue;
@@ -613,8 +595,7 @@
bool enableTripleShift,
TypeEnvironment typeEnvironment,
bool desugarSets,
- bool errorOnUnevaluatedConstant,
- EvaluationMode evaluationMode) {
+ bool errorOnUnevaluatedConstant) {
constantEvaluator = new ConstantEvaluator(
target.dartLibrarySupport,
target.constantsBackend,
@@ -623,8 +604,7 @@
typeEnvironment,
this,
enableTripleShift: enableTripleShift,
- errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
- evaluationMode: evaluationMode);
+ errorOnUnevaluatedConstant: errorOnUnevaluatedConstant);
constantEvaluatorWithEmptyEnvironment = new ConstantEvaluator(
target.dartLibrarySupport,
target.constantsBackend,
@@ -633,8 +613,7 @@
typeEnvironment,
this,
enableTripleShift: enableTripleShift,
- errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
- evaluationMode: evaluationMode);
+ errorOnUnevaluatedConstant: errorOnUnevaluatedConstant);
}
Library? currentLibrary;
@@ -752,7 +731,6 @@
final ProcessedOptions options;
final List<Iterable<String>> errors;
final CompilerOptions Function(
- NnbdMode nnbdMode,
AllowedExperimentalFlags? allowedExperimentalFlags,
Map<ExperimentalFlag, Version>? experimentEnabledVersion,
Map<ExperimentalFlag, Version>? experimentReleasedVersion,
@@ -786,15 +764,9 @@
context.suiteFolderOptions.computeFolderOptions(description);
Map<ExperimentalFlag, bool> experimentalFlags = folderOptions
.computeExplicitExperimentalFlags(context.forcedExperimentalFlags);
- NnbdMode nnbdMode = !context.soundNullSafety ||
- !isExperimentEnabled(ExperimentalFlag.nonNullable,
- explicitExperimentalFlags: experimentalFlags)
- ? NnbdMode.Weak
- : NnbdMode.Strong;
List<Uri> inputs = <Uri>[description.uri];
CompilerOptions createCompilerOptions(
- NnbdMode nnbdMode,
AllowedExperimentalFlags? allowedExperimentalFlags,
Map<ExperimentalFlag, Version>? experimentEnabledVersion,
Map<ExperimentalFlag, Version>? experimentReleasedVersion,
@@ -807,7 +779,6 @@
folderOptions.enableUnscheduledExperiments ?? false
..environmentDefines = folderOptions.defines
..explicitExperimentalFlags = experimentalFlags
- ..nnbdMode = nnbdMode
..librariesSpecificationUri = librariesSpecificationUri
..allowedExperimentalFlagsForTesting = allowedExperimentalFlags
..experimentEnabledVersionForTesting = experimentEnabledVersion
@@ -828,7 +799,7 @@
compilerOptions.verify = forceVerifyTo;
}
compilerOptions.sdkSummary =
- context._getPlatformUri(compilerOptions.target!, nnbdMode);
+ context._getPlatformUri(compilerOptions.target!);
if (folderOptions.overwriteCurrentSdkVersion != null) {
compilerOptions.currentSdkVersion =
folderOptions.overwriteCurrentSdkVersion!;
@@ -845,14 +816,12 @@
colors.enableColors = false;
CompilerOptions compilerOptions = createCompilerOptions(
- nnbdMode,
testOptions.allowedExperimentalFlags,
testOptions.experimentEnabledVersion,
testOptions.experimentReleasedVersion,
testOptions.dynamicInterfaceSpecificationUri);
ProcessedOptions options = createProcessedOptions(compilerOptions);
- options.sdkSummaryComponent =
- context.loadPlatform(options.target, options.nnbdMode);
+ options.sdkSummaryComponent = context.loadPlatform(options.target);
return new CompilationSetup(testOptions, folderOptions, compilerOptions,
options, errors, createCompilerOptions, createProcessedOptions);
}
@@ -885,8 +854,7 @@
backendTarget.performModularTransformations = true;
}
- Component platform =
- context.loadPlatform(backendTarget, compilationSetup.options.nnbdMode);
+ Component platform = context.loadPlatform(backendTarget);
final bool hasErrors;
{
@@ -1940,7 +1908,6 @@
folderOptions.forceNoExplicitGetterCalls,
forceConstructorTearOffLoweringForTesting:
folderOptions.forceConstructorTearOffLowering,
- soundNullSafety: context.soundNullSafety,
supportedDartLibraries: {'_supported.by.target'},
unsupportedDartLibraries: {'unsupported.by.target'},
);
@@ -2041,17 +2008,6 @@
compilationSetup.testOptions.component == null) {
// Compile linked dependency.
ProcessedOptions linkOptions = compilationSetup.options;
- if (compilationSetup.testOptions.nnbdMode != null) {
- linkOptions = compilationSetup.createProcessedOptions(
- compilationSetup.createCompilerOptions(
- compilationSetup.testOptions.nnbdMode!,
- compilationSetup.testOptions.allowedExperimentalFlags,
- compilationSetup.testOptions.experimentEnabledVersion,
- compilationSetup.testOptions.experimentReleasedVersion,
- compilationSetup.testOptions.dynamicInterfaceSpecificationUri));
- linkOptions.sdkSummaryComponent =
- context.loadPlatform(linkOptions.target, linkOptions.nnbdMode);
- }
await CompilerContext.runWithOptions(linkOptions,
(CompilerContext c) async {
Target backendTarget = linkOptions.target;
@@ -2187,8 +2143,7 @@
backendTarget.performGlobalTransformations(sourceTarget, component);
// Clear the currently cached platform since the global transformation
// might have modified it.
- context.clearPlatformCache(
- backendTarget, result.compilationSetup.options.nnbdMode);
+ context.clearPlatformCache(backendTarget);
}
return pass(new ComponentResult(result.description, component,
diff --git a/pkg/front_end/test/testing/test_options.dart b/pkg/front_end/test/testing/test_options.dart
index c344e4f..b8cec92 100644
--- a/pkg/front_end/test/testing/test_options.dart
+++ b/pkg/front_end/test/testing/test_options.dart
@@ -10,8 +10,6 @@
AllowedExperimentalFlags,
ExperimentalFlag,
defaultAllowedExperimentalFlags;
-import 'package:front_end/src/base/command_line_options.dart';
-import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
import 'package:kernel/ast.dart' show Component, Version;
import 'package:testing/testing.dart' show TestDescription;
@@ -22,8 +20,6 @@
const Option('--dynamic-interface', const UriValue());
const List<Option> testOptionsSpecification = [
- Options.nnbdStrongMode,
- Options.nnbdWeakMode,
fixNnbdReleaseVersion,
dynamicInterface,
];
@@ -39,7 +35,6 @@
File optionsFile =
new File.fromUri(directory.uri.resolve('test.options'));
Set<Uri> linkDependencies = new Set<Uri>();
- NnbdMode? nnbdMode;
AllowedExperimentalFlags? allowedExperimentalFlags;
Map<ExperimentalFlag, Version>? experimentEnabledVersion;
Map<ExperimentalFlag, Version>? experimentReleasedVersion;
@@ -49,16 +44,6 @@
ParsedOptions.readOptionsFile(optionsFile.readAsStringSync());
ParsedOptions parsedOptions =
ParsedOptions.parse(arguments, testOptionsSpecification);
- if (Options.nnbdStrongMode.read(parsedOptions)) {
- nnbdMode = NnbdMode.Strong;
- }
- if (Options.nnbdWeakMode.read(parsedOptions)) {
- if (nnbdMode != null) {
- throw new UnsupportedError(
- 'Nnbd mode $nnbdMode already specified.');
- }
- nnbdMode = NnbdMode.Weak;
- }
if (fixNnbdReleaseVersion.read(parsedOptions)) {
// Allow package:allowed_package to use nnbd features from version
// 2.9.
@@ -92,7 +77,6 @@
}
}
testOptions = new TestOptions(linkDependencies,
- nnbdMode: nnbdMode,
allowedExperimentalFlags: allowedExperimentalFlags,
experimentEnabledVersion: experimentEnabledVersion,
experimentReleasedVersion: experimentReleasedVersion,
@@ -109,7 +93,6 @@
/// setting up custom experimental flag defaults for a single test.
class TestOptions {
final Set<Uri> linkDependencies;
- final NnbdMode? nnbdMode;
final AllowedExperimentalFlags? allowedExperimentalFlags;
final Map<ExperimentalFlag, Version>? experimentEnabledVersion;
final Map<ExperimentalFlag, Version>? experimentReleasedVersion;
@@ -118,8 +101,7 @@
List<Iterable<String>>? errors;
TestOptions(this.linkDependencies,
- {required this.nnbdMode,
- required this.allowedExperimentalFlags,
+ {required this.allowedExperimentalFlags,
required this.experimentEnabledVersion,
required this.experimentReleasedVersion,
required this.dynamicInterfaceSpecificationUri});
diff --git a/pkg/front_end/test/text_representation/text_representation_test.dart b/pkg/front_end/test/text_representation/text_representation_test.dart
index de6059c..171845e 100644
--- a/pkg/front_end/test/text_representation/text_representation_test.dart
+++ b/pkg/front_end/test/text_representation/text_representation_test.dart
@@ -6,10 +6,6 @@
import 'package:_fe_analyzer_shared/src/testing/id.dart';
import 'package:_fe_analyzer_shared/src/testing/id_testing.dart';
-import 'package:front_end/src/api_prototype/compiler_options.dart';
-import 'package:front_end/src/api_prototype/experimental_flags.dart'
- show ExperimentalFlag;
-import 'package:front_end/src/base/nnbd_mode.dart';
import 'package:front_end/src/testing/id_testing_helper.dart';
import 'package:kernel/ast.dart';
import 'package:kernel/src/printer.dart';
@@ -72,28 +68,12 @@
onFailure: onFailure,
preserveWhitespaceInAnnotations: true,
runTest: runTestFor(const TextRepresentationDataComputer(), [
- const TextRepresentationConfig(normalMarker, 'normal'),
- const TextRepresentationConfig(verboseMarker, 'verbose'),
- const TextRepresentationConfig(limitedMarker, 'limited'),
+ const CfeTestConfig(normalMarker, 'normal'),
+ const CfeTestConfig(verboseMarker, 'verbose'),
+ const CfeTestConfig(limitedMarker, 'limited'),
]));
}
-class TextRepresentationConfig extends CfeTestConfig {
- const TextRepresentationConfig(String marker, String name)
- : super(marker, name,
- explicitExperimentalFlags: const {
- ExperimentalFlag.nonNullable: true
- },
- nnbdMode: NnbdMode.Strong);
-
- @override
- void customizeCompilerOptions(CompilerOptions options, TestData testData) {
- if (testData.name.endsWith('_opt_out.dart')) {
- options.nnbdMode = NnbdMode.Weak;
- }
- }
-}
-
class TextRepresentationDataComputer extends CfeDataComputer<String> {
const TextRepresentationDataComputer();
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart
deleted file mode 100644
index 2bae522..0000000
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart
+++ /dev/null
@@ -1,5 +0,0 @@
-import "strong_lib.dart";
-
-main() {
- foo();
-}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.expect
deleted file mode 100644
index db3c7cb..0000000
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.expect
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Problems in component:
-//
-// pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-library;
-import self as self;
-import "strong_lib.dart" as str;
-
-import "org-dartlang-testcase:///strong_lib.dart";
-
-static method main() → dynamic {
- str::foo();
-}
-
-library;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart:1:1: Error: The specified language version 2.11 is too low. The lowest supported language version is 2.12.
-// // @dart = 2.11
-// ^^^^^^^^^^^^^^^
-//
-import self as str;
-import "dart:core" as core;
-
-static method foo() → void {
- core::print("hello");
-}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.modular.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.modular.expect
deleted file mode 100644
index dc3744c..0000000
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.modular.expect
+++ /dev/null
@@ -1,14 +0,0 @@
-//
-// Problems in component:
-//
-// pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-library;
-import self as self;
-import "strong_lib.dart" as str;
-
-import "org-dartlang-testcase:///strong_lib.dart";
-
-static method main() → dynamic {
- str::foo();
-}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.outline.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.outline.expect
deleted file mode 100644
index dc7708e..0000000
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.outline.expect
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// Problems in component:
-//
-// pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-library;
-import self as self;
-
-import "org-dartlang-testcase:///strong_lib.dart";
-
-static method main() → dynamic
- ;
-
-library;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart:1:1: Error: The specified language version 2.11 is too low. The lowest supported language version is 2.12.
-// // @dart = 2.11
-// ^^^^^^^^^^^^^^^
-//
-import self as self2;
-
-static method foo() → void
- ;
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.transformed.expect
deleted file mode 100644
index db3c7cb..0000000
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.strong.transformed.expect
+++ /dev/null
@@ -1,29 +0,0 @@
-//
-// Problems in component:
-//
-// pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-library;
-import self as self;
-import "strong_lib.dart" as str;
-
-import "org-dartlang-testcase:///strong_lib.dart";
-
-static method main() → dynamic {
- str::foo();
-}
-
-library;
-//
-// Problems in library:
-//
-// pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart:1:1: Error: The specified language version 2.11 is too low. The lowest supported language version is 2.12.
-// // @dart = 2.11
-// ^^^^^^^^^^^^^^^
-//
-import self as str;
-import "dart:core" as core;
-
-static method foo() → void {
- core::print("hello");
-}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.textual_outline.expect
deleted file mode 100644
index 3bb0a74..0000000
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.textual_outline.expect
+++ /dev/null
@@ -1,3 +0,0 @@
-import "strong_lib.dart";
-
-main() {}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.textual_outline_modelled.expect
deleted file mode 100644
index 3bb0a74..0000000
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong.dart.textual_outline_modelled.expect
+++ /dev/null
@@ -1,3 +0,0 @@
-import "strong_lib.dart";
-
-main() {}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart
deleted file mode 100644
index a6f40bc..0000000
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/strong_lib.dart
+++ /dev/null
@@ -1,5 +0,0 @@
-// @dart = 2.11
-
-void foo() {
- print("hello");
-}
diff --git a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/test.options b/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/test.options
deleted file mode 100644
index 1883904..0000000
--- a/pkg/front_end/testcases/nnbd/strong_lib_not_ok_from_dill/test.options
+++ /dev/null
@@ -1,2 +0,0 @@
-strong_lib.dart
---nnbd-weak
\ No newline at end of file
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/.dart_tool/package_config.json b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/.dart_tool/package_config.json
deleted file mode 100644
index 7b53290..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/.dart_tool/package_config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "configVersion": 2,
- "packages": [
- {
- "name": "opt_out_package",
- "rootUri": "../opt_out_package/lib/",
- "languageVersion": "2.11"
- },
- {
- "name": "opt_in_package",
- "rootUri": "../opt_in_package/lib/"
- }
-
- ]
-}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_in_lib.dart b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_in_lib.dart
deleted file mode 100644
index a08c72e..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_in_lib.dart
+++ /dev/null
@@ -1,3 +0,0 @@
-// Copyright (c) 2020, 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.
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_out_lib.dart b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_out_lib.dart
deleted file mode 100644
index 8de228b..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_out_lib.dart
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (c) 2020, 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.
-
-// @dart=2.11
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart
deleted file mode 100644
index a08c72e..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart
+++ /dev/null
@@ -1,3 +0,0 @@
-// Copyright (c) 2020, 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.
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart
deleted file mode 100644
index a08c72e..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart
+++ /dev/null
@@ -1,3 +0,0 @@
-// Copyright (c) 2020, 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.
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart
deleted file mode 100644
index f3ef4f5..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) 2020, 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.
-
-import 'package:opt_in_package/opt_in_lib.dart';
-import 'package:opt_in_package/opt_out_lib.dart';
-import 'package:opt_out_package/regular_lib1.dart';
-import 'package:opt_out_package/regular_lib2.dart';
-
-main() {}
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.expect
deleted file mode 100644
index 414c45c..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.expect
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Problems in component:
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_in_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_out_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-library;
-import self as self;
-
-import "package:opt_in_package/opt_in_lib.dart";
-import "package:opt_in_package/opt_out_lib.dart";
-import "package:opt_out_package/regular_lib1.dart";
-import "package:opt_out_package/regular_lib2.dart";
-
-static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.modular.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.modular.expect
deleted file mode 100644
index 414c45c..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.modular.expect
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Problems in component:
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_in_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_out_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-library;
-import self as self;
-
-import "package:opt_in_package/opt_in_lib.dart";
-import "package:opt_in_package/opt_out_lib.dart";
-import "package:opt_out_package/regular_lib1.dart";
-import "package:opt_out_package/regular_lib2.dart";
-
-static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.outline.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.outline.expect
deleted file mode 100644
index 93b05ff..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.outline.expect
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// Problems in component:
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_in_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_out_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-library;
-import self as self;
-
-import "package:opt_in_package/opt_in_lib.dart";
-import "package:opt_in_package/opt_out_lib.dart";
-import "package:opt_out_package/regular_lib1.dart";
-import "package:opt_out_package/regular_lib2.dart";
-
-static method main() → dynamic
- ;
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.transformed.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.transformed.expect
deleted file mode 100644
index 414c45c..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.strong.transformed.expect
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Problems in component:
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_in_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_in_package/lib/opt_out_lib.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib1.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-// pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/opt_out_package/lib/regular_lib2.dart: Error: Loaded library is compiled with unsound null safety and cannot be used in compilation for sound null safety.
-//
-library;
-import self as self;
-
-import "package:opt_in_package/opt_in_lib.dart";
-import "package:opt_in_package/opt_out_lib.dart";
-import "package:opt_out_package/regular_lib1.dart";
-import "package:opt_out_package/regular_lib2.dart";
-
-static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.textual_outline.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.textual_outline.expect
deleted file mode 100644
index a0d88d6..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.textual_outline.expect
+++ /dev/null
@@ -1,9 +0,0 @@
-import 'package:opt_in_package/opt_in_lib.dart';
-
-import 'package:opt_in_package/opt_out_lib.dart';
-
-import 'package:opt_out_package/regular_lib1.dart';
-
-import 'package:opt_out_package/regular_lib2.dart';
-
-main() {}
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.textual_outline_modelled.expect
deleted file mode 100644
index 3127540..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/strong.dart.textual_outline_modelled.expect
+++ /dev/null
@@ -1,6 +0,0 @@
-import 'package:opt_in_package/opt_in_lib.dart';
-import 'package:opt_in_package/opt_out_lib.dart';
-import 'package:opt_out_package/regular_lib1.dart';
-import 'package:opt_out_package/regular_lib2.dart';
-
-main() {}
diff --git a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/test.options b/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/test.options
deleted file mode 100644
index 5d06f3f..0000000
--- a/pkg/front_end/testcases/nnbd/strong_package_not_ok_from_dill/test.options
+++ /dev/null
@@ -1,5 +0,0 @@
-package:opt_in_package/opt_in_lib.dart
-package:opt_in_package/opt_out_lib.dart
-package:opt_out_package/regular_lib1.dart
-package:opt_out_package/regular_lib2.dart
---nnbd-weak
\ No newline at end of file
diff --git a/pkg/front_end/tool/command_line.dart b/pkg/front_end/tool/command_line.dart
index eb7b12a..82cbbed 100644
--- a/pkg/front_end/tool/command_line.dart
+++ b/pkg/front_end/tool/command_line.dart
@@ -12,7 +12,7 @@
show SingleRootFileSystem;
import 'package:front_end/src/api_prototype/compiler_options.dart';
import 'package:front_end/src/api_prototype/experimental_flags.dart'
- show ExperimentalFlag, isExperimentEnabled;
+ show ExperimentalFlag;
import 'package:front_end/src/api_prototype/file_system.dart' show FileSystem;
import 'package:front_end/src/api_prototype/standard_file_system.dart'
show StandardFileSystem;
@@ -20,7 +20,6 @@
import 'package:front_end/src/base/command_line_options.dart';
import 'package:front_end/src/base/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/base/file_system_dependency_tracker.dart';
-import 'package:front_end/src/base/nnbd_mode.dart';
import 'package:front_end/src/base/problems.dart' show DebugAbort;
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
@@ -123,9 +122,7 @@
forceConstructorTearOffLoweringForTesting:
Options.forceConstructorTearOffLowering.read(parsedOptions),
forceLateLoweringSentinelForTesting:
- Options.forceLateLoweringSentinel.read(parsedOptions),
- soundNullSafety: isExperimentEnabled(ExperimentalFlag.nonNullable,
- explicitExperimentalFlags: explicitExperimentalFlags));
+ Options.forceLateLoweringSentinel.read(parsedOptions));
final Target? target = getTarget(targetName, flags);
if (target == null) {
@@ -168,12 +165,6 @@
final String? singleRootScheme = Options.singleRootScheme.read(parsedOptions);
final Uri? singleRootBase = Options.singleRootBase.read(parsedOptions);
- final bool nnbdStrongMode = Options.nnbdStrongMode.read(parsedOptions);
-
- final bool nnbdWeakMode = Options.nnbdWeakMode.read(parsedOptions);
-
- final NnbdMode nnbdMode = nnbdWeakMode ? NnbdMode.Weak : NnbdMode.Strong;
-
final bool enableUnscheduledExperiments =
Options.enableUnscheduledExperiments.read(parsedOptions);
@@ -185,12 +176,6 @@
final String verbosity = Options.verbosity.read(parsedOptions);
- if (nnbdStrongMode && nnbdWeakMode) {
- return throw new CommandLineProblem.deprecated(
- "Can't specify both '${Flags.nnbdStrongMode}' and "
- "'${Flags.nnbdWeakMode}'.");
- }
-
FileSystem fileSystem;
if (tracker != null) {
fileSystem = StandardFileSystem.instanceWithTracking(tracker);
@@ -238,7 +223,6 @@
..skipPlatformVerification = skipPlatformVerification
..explicitExperimentalFlags = explicitExperimentalFlags
..environmentDefines = environmentDefines
- ..nnbdMode = nnbdMode
..enableUnscheduledExperiments = enableUnscheduledExperiments
..additionalDills = linkDependencies
..emitDeps = !noDeps
@@ -283,7 +267,7 @@
? null
: (Options.platform.read(parsedOptions) ??
computePlatformBinariesLocation(forceBuildDir: true)
- .resolve(computePlatformDillName(target, nnbdMode, () {
+ .resolve(computePlatformDillName(target, () {
throwCommandLineProblem(
"Target '${target.name}' requires an explicit "
"'${Flags.platform}' option.");
diff --git a/pkg/front_end/tool/entry_points.dart b/pkg/front_end/tool/entry_points.dart
index 1d55642..ec777ba 100644
--- a/pkg/front_end/tool/entry_points.dart
+++ b/pkg/front_end/tool/entry_points.dart
@@ -301,9 +301,6 @@
incrementalCompilerOptions.rawOptionsForTesting.onDiagnostic =
_onDiagnostic;
- // This is a weird one, but apparently this is how it's done.
- incrementalCompilerOptions.reportNullSafetyCompilationModeInfo();
-
assert(options.omitPlatform,
"Platform must be omitted for the batch compiler.");
assert(!options.hasAdditionalDills,
diff --git a/pkg/front_end/tool/incremental_perf.dart b/pkg/front_end/tool/incremental_perf.dart
index 8115f34..c33b438 100644
--- a/pkg/front_end/tool/incremental_perf.dart
+++ b/pkg/front_end/tool/incremental_perf.dart
@@ -51,7 +51,6 @@
import 'package:front_end/src/api_prototype/incremental_kernel_generator.dart';
import 'package:front_end/src/api_prototype/memory_file_system.dart';
import 'package:front_end/src/api_prototype/standard_file_system.dart';
-import 'package:front_end/src/base/nnbd_mode.dart';
import 'package:front_end/src/base/processed_options.dart';
import 'package:front_end/src/base/uri_translator.dart';
@@ -109,7 +108,6 @@
..fileSystem = overlayFs
..onDiagnostic = onDiagnosticMessageHandler()
..target = createTarget(isFlutter: isFlutter)
- ..nnbdMode = NnbdMode.Weak
..environmentDefines = const {};
if (sdkSummary != null) {
compilerOptions.sdkSummary = _resolveOverlayUri(sdkSummary);
diff --git a/pkg/frontend_server/lib/compute_kernel.dart b/pkg/frontend_server/lib/compute_kernel.dart
index df70620..1f55020 100644
--- a/pkg/frontend_server/lib/compute_kernel.dart
+++ b/pkg/frontend_server/lib/compute_kernel.dart
@@ -98,6 +98,7 @@
help: 'Enable a language experiment when invoking the CFE.')
..addMultiOption('define', abbr: 'D')
..addFlag('verbose', defaultsTo: false)
+ // TODO(jensj): Remove this.
..addFlag('sound-null-safety', defaultsTo: true)
..addFlag('null-environment', defaultsTo: false, negatable: false)
..addOption('verbosity',
@@ -170,9 +171,6 @@
(parsedArgs['source'] as List<String>).map(toUri).toList();
bool excludeNonSources = parsedArgs['exclude-non-sources'] as bool;
- fe.NnbdMode nnbdMode = parsedArgs['sound-null-safety'] as bool
- ? fe.NnbdMode.Strong
- : fe.NnbdMode.Weak;
bool summaryOnly = parsedArgs['summary-only'] as bool;
bool summary = parsedArgs['summary'] as bool;
if (summaryOnly && !summary) {
@@ -184,9 +182,8 @@
// compatible while we migrate existing clients of this tool.
String targetName =
(parsedArgs['target'] as String?) ?? (summaryOnly ? 'ddc' : 'vm');
- TargetFlags targetFlags = new TargetFlags(
- trackWidgetCreation: trackWidgetCreation,
- soundNullSafety: nnbdMode == fe.NnbdMode.Strong);
+ TargetFlags targetFlags =
+ new TargetFlags(trackWidgetCreation: trackWidgetCreation);
Target target;
switch (targetName) {
case 'vm':
@@ -305,8 +302,7 @@
fileSystem,
parsedArgs['enable-experiment'] as List<String>,
nullableEnvironmentDefines,
- verbose: verbose,
- nnbdMode: nnbdMode);
+ verbose: verbose);
UriTranslator uriTranslator = await helper.processedOpts.getUriTranslator();
_FakeFileSystem fakeFileSystem =
fileSystem = new _FakeFileSystem(fileSystem);
@@ -356,7 +352,6 @@
nullableEnvironmentDefines!,
trackNeededDillLibraries: recordUsedInputs,
verbose: verbose,
- nnbdMode: nnbdMode,
requirePrebuiltMacros: parsedArgs['require-prebuilt-macros'],
precompiledMacros: parsedArgs['precompiled-macro'],
macroSerializationMode: macroSerializationMode);
@@ -372,8 +367,7 @@
fileSystem,
parsedArgs['enable-experiment'] as List<String>,
nullableEnvironmentDefines,
- verbose: verbose,
- nnbdMode: nnbdMode);
+ verbose: verbose);
}
void onDiagnostic(fe.DiagnosticMessage message) {
diff --git a/pkg/frontend_server/lib/src/binary_protocol.dart b/pkg/frontend_server/lib/src/binary_protocol.dart
index 9e42b73..662c202 100644
--- a/pkg/frontend_server/lib/src/binary_protocol.dart
+++ b/pkg/frontend_server/lib/src/binary_protocol.dart
@@ -76,7 +76,6 @@
final fe.CompilerOptions compilerOptions = new fe.CompilerOptions()
..environmentDefines = {}
..fileSystem = new _FileSystem(_channel, _dills)
- ..nnbdMode = fe.NnbdMode.Strong
..sdkSummary = Uri.parse(sdkSummaryUriStr)
..target = new vm.VmTarget(new fe.TargetFlags());
diff --git a/pkg/kernel/lib/src/const_canonical_type.dart b/pkg/kernel/lib/src/const_canonical_type.dart
deleted file mode 100644
index 92dfc49..0000000
--- a/pkg/kernel/lib/src/const_canonical_type.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2021, 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.
-
-import '../ast.dart';
-import '../core_types.dart';
-
-import 'replacement_visitor.dart';
-
-class _ConstCanonicalTypeVisitor extends ReplacementVisitor {
- final CoreTypes coreTypes;
-
- _ConstCanonicalTypeVisitor(this.coreTypes);
-
- @override
- DartType? visitDynamicType(DynamicType node, Variance variance) {
- // CONST_CANONICAL_TYPE(T) = T if T is dynamic, void, Null
- return null;
- }
-
- @override
- DartType? visitVoidType(VoidType node, Variance variance) {
- // CONST_CANONICAL_TYPE(T) = T if T is dynamic, void, Null
- return null;
- }
-
- @override
- DartType? visitNullType(NullType node, Variance variance) {
- // CONST_CANONICAL_TYPE(T) = T if T is dynamic, void, Null
- return null;
- }
-
- @override
- Nullability? visitNullability(DartType node) {
- if (node.declaredNullability == Nullability.nullable ||
- node.declaredNullability == Nullability.legacy) {
- return null;
- } else if (node.declaredNullability == Nullability.nonNullable ||
- node.declaredNullability == Nullability.undetermined) {
- return Nullability.legacy;
- } else {
- throw new StateError("Unhandled '${node.declaredNullability}' "
- "of a '${node.runtimeType}'.");
- }
- }
-}
-
-/// Computes CONST_CANONICAL_TYPE
-///
-/// The algorithm is specified at
-/// https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/feature-specification.md#constant-instances
-DartType? computeConstCanonicalType(DartType type, CoreTypes coreTypes) {
- return type.accept1(
- new _ConstCanonicalTypeVisitor(coreTypes), Variance.covariant);
-}
diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart
index dcdda51..6fbe666 100644
--- a/pkg/kernel/lib/target/targets.dart
+++ b/pkg/kernel/lib/target/targets.dart
@@ -734,12 +734,10 @@
this.forceStaticFieldLoweringForTesting,
this.forceNoExplicitGetterCallsForTesting,
this.forceConstructorTearOffLoweringForTesting,
- bool soundNullSafety = false,
this.supportedDartLibraries = const {},
this.unsupportedDartLibraries = const {}})
: super(
- trackWidgetCreation: trackWidgetCreation,
- soundNullSafety: soundNullSafety);
+ trackWidgetCreation: trackWidgetCreation);
}
mixin TestTargetMixin on Target {
diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart
index 6246edb..ad2788c 100644
--- a/pkg/test_runner/lib/src/compiler_configuration.dart
+++ b/pkg/test_runner/lib/src/compiler_configuration.dart
@@ -1529,9 +1529,6 @@
...options,
..._configuration.sharedOptions,
..._experimentsArgument(_configuration, testFile),
- if (_configuration.configuration.nnbdMode == NnbdMode.weak) ...[
- "--nnbd-weak"
- ]
];
for (var argument in args) {
if (argument == "--ignore-unrecognized-flags") continue;
diff --git a/pkg/test_runner/tool/update_static_error_tests.dart b/pkg/test_runner/tool/update_static_error_tests.dart
index 17f0e50..0669833 100644
--- a/pkg/test_runner/tool/update_static_error_tests.dart
+++ b/pkg/test_runner/tool/update_static_error_tests.dart
@@ -22,7 +22,6 @@
import 'package:glob/list_local_fs.dart';
import 'package:path/path.dart' as p;
import 'package:test_runner/src/command_output.dart';
-import 'package:test_runner/src/feature.dart' show Feature;
import 'package:test_runner/src/path.dart';
import 'package:test_runner/src/static_error.dart';
import 'package:test_runner/src/test_file.dart';
@@ -167,10 +166,6 @@
...testFile.sharedOptions,
if (testFile.experiments.isNotEmpty)
"--enable-experiment=${testFile.experiments.join(',')}",
- if (cfe) ...[
- if (testFile.requirements.contains(Feature.nnbdWeak)) "--nnbd-weak",
- if (testFile.requirements.contains(Feature.nnbdStrong)) "--nnbd-strong",
- ]
];
}
diff --git a/pkg/vm/lib/transformations/vm_constant_evaluator.dart b/pkg/vm/lib/transformations/vm_constant_evaluator.dart
index aea97f9..0745fb2 100644
--- a/pkg/vm/lib/transformations/vm_constant_evaluator.dart
+++ b/pkg/vm/lib/transformations/vm_constant_evaluator.dart
@@ -10,7 +10,7 @@
import 'package:kernel/type_environment.dart';
import 'package:front_end/src/api_prototype/constant_evaluator.dart'
- show ConstantEvaluator, ErrorReporter, EvaluationMode, SimpleErrorReporter;
+ show ConstantEvaluator, ErrorReporter, SimpleErrorReporter;
import '../target_os.dart';
import 'pragma.dart';
@@ -58,7 +58,6 @@
enableConstFunctions: true,
enableAsserts: enableAsserts,
errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
- evaluationMode: EvaluationMode.strong,
) {
// Only add Platform fields if the Platform class is part of the component
// being evaluated.
diff --git a/pkg/vm/test/modular_kernel_plus_aot_test.dart b/pkg/vm/test/modular_kernel_plus_aot_test.dart
index 45699a0..b55e64d 100644
--- a/pkg/vm/test/modular_kernel_plus_aot_test.dart
+++ b/pkg/vm/test/modular_kernel_plus_aot_test.dart
@@ -122,7 +122,6 @@
StandardFileSystem.instance,
const <String>[],
const <String, String>{},
- nnbdMode: fe.NnbdMode.Strong,
);
void onDiagnostic(fe.DiagnosticMessage message) {
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index 2212cc6..6afe2bb 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -259,7 +259,6 @@
args += [
"-Ddart.vm.product=$is_product_flag",
"-Ddart.isVM=true",
- "--nnbd-strong",
]
if (defined(invoker.exclude_source) && invoker.exclude_source) {
args += [ "--exclude-source" ]
diff --git a/tools/bots/flutter/compile_flutter.sh b/tools/bots/flutter/compile_flutter.sh
index fb2d6bc..c7e2be8 100755
--- a/tools/bots/flutter/compile_flutter.sh
+++ b/tools/bots/flutter/compile_flutter.sh
@@ -78,7 +78,6 @@
dart:core \
-Ddart.vm.product=false \
-Ddart.isVM=true \
- --nnbd-strong \
--single-root-scheme=org-dartlang-sdk \
--single-root-base=$checkout/ \
org-dartlang-sdk:///sdk/lib/libraries.json \
@@ -89,7 +88,6 @@
$checkout/tools/sdks/dart-sdk/bin/dart \
--packages=$checkout/.dart_tool/package_config.json \
$checkout/pkg/front_end/tool/compile_platform.dart \
- --nnbd-strong \
--target=flutter \
dart:core \
--single-root-scheme=org-dartlang-sdk \
diff --git a/utils/dart2wasm/BUILD.gn b/utils/dart2wasm/BUILD.gn
index 8c5a2fa..08a9c96 100644
--- a/utils/dart2wasm/BUILD.gn
+++ b/utils/dart2wasm/BUILD.gn
@@ -55,7 +55,6 @@
args = [
"--target=dart2wasm",
"dart:core",
- "--nnbd-strong",
]
}
@@ -73,7 +72,6 @@
"--target=dart2wasm_js_compatibility",
"-Ddart.wasm.js_compatibility=true",
"dart:core",
- "--nnbd-strong",
]
}