From 56636971dc4e38517fa55f0cb69321355c2511af Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Mon, 2 Jun 2025 10:59:31 -0700 Subject: [PATCH] [test_runner] Remove nnbd mode options. In particular, this means the VM tests stop getting invoked with the now-invalid --sound-null-safety flag. Change-Id: Ia8f5a59e0bf1fd7094508fdc4bb146ebf3034148 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431360 Reviewed-by: Bob Nystrom Reviewed-by: Kallen Tu Commit-Queue: Ryan Macnak --- .../lib/src/compiler_configuration.dart | 21 - pkg/test_runner/lib/src/configuration.dart | 13 +- pkg/test_runner/lib/src/environment.dart | 1 - pkg/test_runner/lib/src/feature.dart | 22 - pkg/test_runner/lib/src/options.dart | 20 +- pkg/test_runner/lib/src/test_suite.dart | 1 - pkg/test_runner/test/options_test.dart | 25 +- pkg/test_runner/test/test_file_test.dart | 7 - pkg/test_runner/test/test_matrix.json | 6 +- pkg/test_runner/test/test_suite_test.dart | 28 - runtime/tests/vm/dart/regress_34755_test.dart | 19 - runtime/tests/vm/dart/regress_42656_test.dart | 28 - runtime/tests/vm/vm.status | 4 - tests/corelib/cast_strong_test.dart | 2 - tests/corelib/cast_weak_test.dart | 99 ---- tests/corelib/regress_42502_test.dart | 1 - tests/dartdevc/basic_assignment_test.dart | 2 - .../dartdevc/hot_restart_js_interop_test.dart | 2 - tests/dartdevc/js_interop_test.dart | 2 - tests/dartdevc/subtype_test.dart | 2 - tests/dartdevc/subtype_weak_test.dart | 277 --------- .../weak_null_safety_errors_test.dart | 45 -- tests/ffi/ffi.status | 3 - tests/language/async/await_flatten_test.dart | 2 - .../language/async/await_type_check_test.dart | 2 - tests/language/bool/check_strong_test.dart | 2 - tests/language/bool/check_weak_test.dart | 17 - .../bool/condition_check_strong_test.dart | 2 - .../bool/condition_check_weak_test.dart | 26 - .../closure/param_null_to_object_test.dart | 1 - .../param_null_to_object_weak_test.dart | 31 - .../constructor12_strong_test.dart | 2 - .../constructor/constructor12_weak_test.dart | 18 - .../for_dynamic_null_strong_test.dart | 1 - .../for_dynamic_null_weak_test.dart | 23 - .../if_dynamic_null_strong_test.dart | 1 - .../if_dynamic_null_weak_test.dart | 13 - .../regress41680_strong_test.dart | 2 - .../regress41680_weak_test.dart | 26 - .../boolean_conversion_strong_test.dart | 2 - ...potentially_constant_types_error_test.dart | 2 - .../potentially_constant_types_test.dart | 2 - .../language/nnbd/never/never_error_test.dart | 2 - .../never_null_assignability_strong_test.dart | 2 - ...issing_required_argument_dynamic_test.dart | 2 - .../required_named_args_strong_test.dart | 1 - .../required_named_args_weak_test.dart | 27 - .../function_type_bounds_strong_test.dart | 2 - .../function_type_bounds_weak_test.dart | 25 - .../function_type_required_params_test.dart | 1 - .../nnbd/subtyping/regress41272_test.dart | 1 - .../nnbd/subtyping/regress41939_test.dart | 2 - .../subtyping/type_casts_strong_test.dart | 2 - .../nnbd/syntax/nullable_type_test.dart | 2 - .../required_modifier_dynamic_error_test.dart | 1 - .../futureOr_normalization_test.dart | 2 - .../generic_function_type_equality_test.dart | 2 - .../nnbd/type_object/equality_test.dart | 2 - .../type_object/futureor_tostring_test.dart | 2 - tests/lib/async/future_or_strong_test.dart | 2 - tests/lib/async/future_or_type_test.dart | 1 - .../async/regress154963234_strong_test.dart | 2 - .../lib/async/regress154963234_weak_test.dart | 16 - .../js/static_interop_test/number_test.dart | 2 - tests/lib/typed_data/float32x4_weak_test.dart | 534 ------------------ tests/lib/typed_data/int32x4_test.dart | 2 - tests/lib/typed_data/int32x4_weak_test.dart | 88 --- .../simd_type_null_params_error_test.dart | 2 - .../simd_type_null_params_test.dart | 2 - .../simd_type_null_params_weak_test.dart | 169 ------ .../empty_lines_test.dart | 27 - .../empty_package_dir_test.dart | 22 - .../mixed_line_ends_test.dart | 27 - tests/web/deferred/deferred_apply_test.dart | 2 - .../rti/required_named_parameters_test.dart | 2 - .../flag_disabled_non_web_test.dart | 1 - .../flag_disabled_web_test.dart | 1 - .../flag_enabled_non_web_test.dart | 1 - .../flag_enabled_optimized_web_test.dart | 1 - .../flag_enabled_unsound_web_test.dart | 17 - .../flag_enabled_web_test.dart | 1 - .../no_flag_optimized_web_test.dart | 1 - .../no_flag_web_test.dart | 1 - tests/web/regress/issue/49588_test.dart | 2 - 84 files changed, 13 insertions(+), 1796 deletions(-) delete mode 100644 runtime/tests/vm/dart/regress_34755_test.dart delete mode 100644 runtime/tests/vm/dart/regress_42656_test.dart delete mode 100644 tests/corelib/cast_weak_test.dart delete mode 100644 tests/dartdevc/subtype_weak_test.dart delete mode 100644 tests/dartdevc/weak_null_safety_errors_test.dart delete mode 100644 tests/language/bool/check_weak_test.dart delete mode 100644 tests/language/bool/condition_check_weak_test.dart delete mode 100644 tests/language/closure/param_null_to_object_weak_test.dart delete mode 100644 tests/language/constructor/constructor12_weak_test.dart delete mode 100644 tests/language/control_flow_collections/for_dynamic_null_weak_test.dart delete mode 100644 tests/language/control_flow_collections/if_dynamic_null_weak_test.dart delete mode 100644 tests/language/function_subtype/regress41680_weak_test.dart delete mode 100644 tests/language/nnbd/required_named_parameters/required_named_args_weak_test.dart delete mode 100644 tests/language/nnbd/subtyping/function_type_bounds_weak_test.dart delete mode 100644 tests/lib/async/regress154963234_weak_test.dart delete mode 100644 tests/lib/typed_data/float32x4_weak_test.dart delete mode 100644 tests/lib/typed_data/int32x4_weak_test.dart delete mode 100644 tests/lib/typed_data/simd_type_null_params_weak_test.dart delete mode 100644 tests/standalone/package/scenarios/packages_file_strange_formatting/empty_lines_test.dart delete mode 100644 tests/standalone/package/scenarios/packages_file_strange_formatting/empty_package_dir_test.dart delete mode 100644 tests/standalone/package/scenarios/packages_file_strange_formatting/mixed_line_ends_test.dart delete mode 100644 tests/web/native/native_null_assertions/flag_enabled_unsound_web_test.dart diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart index e0557fb3427..ac4796340b6 100644 --- a/pkg/test_runner/lib/src/compiler_configuration.dart +++ b/pkg/test_runner/lib/src/compiler_configuration.dart @@ -34,19 +34,6 @@ List _experimentsArgument( return ['--enable-experiment=${experiments.join(',')}']; } -List _nnbdModeArgument(TestConfiguration configuration) { - switch (configuration.nnbdMode) { - case NnbdMode.legacy: - return []; - case NnbdMode.strong: - return ['--sound-null-safety']; - case NnbdMode.weak: - return ['--no-sound-null-safety']; - } - - throw 'unreachable'; -} - /// Grouping of a command with its expected result. class CommandArtifact { final List commands; @@ -193,7 +180,6 @@ class NoneCompilerConfiguration extends CompilerConfiguration { else if (_configuration.hotReloadRollback) '--hot-reload-rollback-test-mode', ...vmOptions, - ..._nnbdModeArgument(_configuration), ...testFile.sharedOptions, ..._configuration.sharedOptions, ..._experimentsArgument(_configuration, testFile), @@ -249,7 +235,6 @@ class VMKernelCompilerConfiguration extends CompilerConfiguration ..._configuration.sharedOptions, ..._experimentsArgument(_configuration, testFile), ...vmOptions, - ..._nnbdModeArgument(_configuration), ...args ]; } @@ -275,7 +260,6 @@ class VMKernelCompilerConfiguration extends CompilerConfiguration else if (_configuration.hotReloadRollback) '--hot-reload-rollback-test-mode', ...vmOptions, - ..._nnbdModeArgument(_configuration), ...testFile.sharedOptions, ..._configuration.sharedOptions, ..._experimentsArgument(_configuration, testFile), @@ -985,7 +969,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration '--no-sim-use-hardfp', ], if (_configuration.isMinified) '--obfuscate', - ..._nnbdModeArgument(_configuration), if (arguments.contains('--print-flow-graph-optimized')) '--redirect-isolate-log-to=$tempDir/out.il', if (arguments.contains('--print-flow-graph-optimized') && @@ -1192,7 +1175,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration return [ if (_enableAsserts) '--enable_asserts', ...vmOptions, - ..._nnbdModeArgument(_configuration), ...testFile.sharedOptions, ..._configuration.sharedOptions, ..._experimentsArgument(_configuration, testFile), @@ -1254,7 +1236,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration { return [ if (_enableAsserts) '--enable_asserts', ...vmOptions, - ..._nnbdModeArgument(_configuration), ...testFile.sharedOptions, ..._configuration.sharedOptions, ..._experimentsArgument(_configuration, testFile), @@ -1273,7 +1254,6 @@ class AppJitCompilerConfiguration extends CompilerConfiguration { return [ if (_enableAsserts) '--enable_asserts', ...vmOptions, - ..._nnbdModeArgument(_configuration), ...testFile.sharedOptions, ..._configuration.sharedOptions, ..._experimentsArgument(_configuration, testFile), @@ -1427,7 +1407,6 @@ abstract mixin class VMKernelCompilerMixin { arguments.contains('--enable-asserts') || arguments.contains('--enable_asserts')) '--enable-asserts', - ..._nnbdModeArgument(_configuration), ..._configuration.genKernelOptions, ]; diff --git a/pkg/test_runner/lib/src/configuration.dart b/pkg/test_runner/lib/src/configuration.dart index b8844f08ab7..b9311e0a2c6 100644 --- a/pkg/test_runner/lib/src/configuration.dart +++ b/pkg/test_runner/lib/src/configuration.dart @@ -109,7 +109,6 @@ class TestConfiguration { Mode get mode => configuration.mode; Runtime get runtime => configuration.runtime; System get system => configuration.system; - NnbdMode get nnbdMode => configuration.nnbdMode; Sanitizer get sanitizer => configuration.sanitizer; // Boolean getters @@ -408,23 +407,15 @@ class TestConfiguration { /// The set of [Feature]s supported by this configuration. Set get supportedFeatures { - // The analyzer should parse all tests that don't require legacy support. + // The analyzer should handle all tests. if (compiler == Compiler.dart2analyzer) { - return {...Feature.all.where((f) => !Feature.legacy.contains(f))}; + return {...Feature.all}; } var isDart2jsProduction = dart2jsOptions.contains('-O3'); var isOptimizedDart2Wasm = dart2wasmOptions.contains('-O1'); var isJsCompiler = compiler == Compiler.dart2js || compiler == Compiler.ddc; return { - // The supported NNBD features depending on the `nnbdMode`. - if (NnbdMode.legacy == configuration.nnbdMode) - Feature.nnbdLegacy - else - Feature.nnbd, - if (NnbdMode.weak == configuration.nnbdMode) Feature.nnbdWeak, - if (NnbdMode.strong == configuration.nnbdMode) Feature.nnbdStrong, - // The configurations with the following builder tags and configurations // with the `minified` flag set to `true` will obfuscate `Type.toString` // strings. diff --git a/pkg/test_runner/lib/src/environment.dart b/pkg/test_runner/lib/src/environment.dart index 3ac7819c9f3..2ca142b4753 100644 --- a/pkg/test_runner/lib/src/environment.dart +++ b/pkg/test_runner/lib/src/environment.dart @@ -26,7 +26,6 @@ final _variables = { "jscl": _Variable.bool((c) => c.runtime.isJSCommandLine), "minified": _Variable.bool((c) => c.isMinified), "mode": _Variable((c) => c.mode.name, Mode.names), - "nnbd": _Variable((TestConfiguration c) => c.nnbdMode.name, NnbdMode.names), "qemu": _Variable.bool((c) => c.useQemu), "runtime": _Variable(_runtimeName, _runtimeNames), "sanitizer": _Variable((c) => c.sanitizer.name, Sanitizer.names), diff --git a/pkg/test_runner/lib/src/feature.dart b/pkg/test_runner/lib/src/feature.dart index 012f6deda38..9b3f4128854 100644 --- a/pkg/test_runner/lib/src/feature.dart +++ b/pkg/test_runner/lib/src/feature.dart @@ -36,21 +36,6 @@ class Feature { /// Supports native number semantics. static const nativeNumbers = Feature._("native-numbers"); - /// Opted out of NNBD and still using the legacy semantics. - static const nnbdLegacy = Feature._("nnbd-legacy"); - - /// Opted in to NNBD features. - /// - /// Note that this does not imply either strong or weak checking. A test that - /// only requires "nnbd" should run in both weak and strong checking modes. - static const nnbd = Feature._("nnbd"); - - /// Weak checking of NNBD features. - static const nnbdWeak = Feature._("nnbd-weak"); - - /// Full strong checking of NNBD features. - static const nnbdStrong = Feature._("nnbd-strong"); - /// Expects [Type.toString] to show the original type name and original /// names in function type named parameters. static const readableTypeStrings = Feature._("readable-type-strings"); @@ -61,16 +46,9 @@ class Feature { checkedParameters, jsNumbers, nativeNumbers, - nnbdLegacy, - nnbd, - nnbdWeak, - nnbdStrong, readableTypeStrings, ]; - /// All modes that should be tested on a platform that support legacy code. - static const legacy = [nnbdLegacy, nnbdWeak]; - final String name; const Feature._(this.name); diff --git a/pkg/test_runner/lib/src/options.dart b/pkg/test_runner/lib/src/options.dart index 41b256da089..300a4ae6795 100644 --- a/pkg/test_runner/lib/src/options.dart +++ b/pkg/test_runner/lib/src/options.dart @@ -250,10 +250,6 @@ test options, specifying how tests should be run.''') hide: true, help: 'Path to safari browser executable.') ..addFlag('use-sdk', aliases: ['use_sdk'], help: 'Use compiler or runtime from the SDK.') - ..addOption('nnbd', - allowed: NnbdMode.names, - defaultsTo: NnbdMode.strong.name, - help: 'Which set of non-nullable type features to use.') ..addOption('output-directory', aliases: ['output_directory'], defaultsTo: "logs", @@ -408,7 +404,6 @@ has been specified on the command line.''') 'compiler', 'runtime', 'timeout', - 'nnbd', 'sanitizer', 'enable-asserts', 'use-cfe', @@ -628,14 +623,13 @@ has been specified on the command line.''') } var progress = Progress.find(data["progress"] as String); - var nnbdMode = NnbdMode.find(data["nnbd"] as String); void addConfiguration(Configuration innerConfiguration, [String? namedConfiguration]) { var configuration = TestConfiguration( configuration: innerConfiguration, progress: progress, - selectors: _expandSelectors(data, innerConfiguration.nnbdMode), + selectors: _expandSelectors(data), build: data["build"] as bool, testList: data["test-list-contents"] as List?, repeat: int.parse(data["repeat"] as String), @@ -784,7 +778,6 @@ has been specified on the command line.''') mode, runtime, system, - nnbdMode: nnbdMode, sanitizer: sanitizer, timeout: timeout, enableAsserts: data['enable-asserts'] as bool, @@ -819,7 +812,7 @@ has been specified on the command line.''') /// /// If no selectors are explicitly given, uses the default suite patterns. Map _expandSelectors( - Map configuration, NnbdMode nnbdMode) { + Map configuration) { var selectors = configuration['selectors'] as List? ?? []; if (selectors.isEmpty || configuration['default-suites'] as bool) { @@ -904,7 +897,7 @@ class OptionParseException implements Exception { /// given filter options. /// /// If any of the options `--system`, `--arch`, `--mode`, `--compiler`, -/// `--nnbd`, or `--runtime` (or their abbreviations) are passed, then only +/// or `--runtime` (or their abbreviations) are passed, then only /// configurations matching those are shown. void findConfigurations(Map options) { var testMatrix = TestMatrix.fromPath('tools/bots/test_matrix.json'); @@ -935,11 +928,6 @@ void findConfigurations(Map options) { var compilers = [...(options['compiler'] as List).map(Compiler.find)]; var runtimes = [...(options['runtime'] as List).map(Runtime.find)]; - NnbdMode? nnbdMode; - if (options.containsKey('nnbd')) { - nnbdMode = NnbdMode.find(options['nnbd'] as String); - } - var names = SplayTreeSet(); for (var configuration in testMatrix.configurations) { if (system != null && configuration.system != system) continue; @@ -954,7 +942,6 @@ void findConfigurations(Map options) { if (runtimes.isNotEmpty && !runtimes.contains(configuration.runtime)) { continue; } - if (nnbdMode != null && configuration.nnbdMode != nnbdMode) continue; names.add(configuration.name); } @@ -965,7 +952,6 @@ void findConfigurations(Map options) { if (modes.isNotEmpty) "mode=$modes", if (compilers.isNotEmpty) "compiler=$compilers", if (runtimes.isNotEmpty) "runtime=$runtimes", - if (nnbdMode != null) "nnbd=$nnbdMode", ]; if (filters.isEmpty) { diff --git a/pkg/test_runner/lib/src/test_suite.dart b/pkg/test_runner/lib/src/test_suite.dart index d4ba498b958..c13bd5949c6 100644 --- a/pkg/test_runner/lib/src/test_suite.dart +++ b/pkg/test_runner/lib/src/test_suite.dart @@ -349,7 +349,6 @@ class VMTestSuite extends TestSuite { if (expectations.contains(Expectation.crash)) '--suppress-core-dump', if (experiments.isNotEmpty) '--enable-experiment=${experiments.join(",")}', - if (configuration.nnbdMode == NnbdMode.strong) '--sound-null-safety', ...configuration.standardOptions, ...configuration.vmOptions, test.name diff --git a/pkg/test_runner/test/options_test.dart b/pkg/test_runner/test/options_test.dart index 449a003f976..8daf10e4d13 100644 --- a/pkg/test_runner/test/options_test.dart +++ b/pkg/test_runner/test/options_test.dart @@ -18,7 +18,7 @@ void main() { void testDefaults() { // TODO(rnystrom): Test other options. var configuration = parseConfiguration([]); - Expect.equals(NnbdMode.strong, configuration.nnbdMode); + Expect.equals(Progress.line, configuration.progress); } void testOptions() { @@ -28,15 +28,12 @@ void testOptions() { Expect.equals(Mode.debug, configurations[0].mode); Expect.equals(Mode.release, configurations[1].mode); - var configuration = parseConfiguration(['--nnbd=weak']); - Expect.equals(NnbdMode.weak, configuration.nnbdMode); - // Filter invalid configurations when not passing a named configuration. configurations = parseConfigurations(['--arch=simarm', '--system=android']); Expect.isEmpty(configurations); // Special handling for *-options. - configuration = parseConfiguration([ + var configuration = parseConfiguration([ '--dart2js-options=a b c', '--vm-options=d e f', '--shared-options=g h i' @@ -90,25 +87,15 @@ void testValidation() { expectValidationError(['--progress=compact,silent'], '"compact,silent" is not an allowed value for option "--progress".'); - expectValidationError(['--nnbd=unknown'], - '"unknown" is not an allowed value for option "--nnbd".'); - // Don't allow multiple. - expectValidationError(['--nnbd=weak,strong'], - '"weak,strong" is not an allowed value for option "--nnbd".'); - // Don't allow invalid named configurations. expectValidationError(['-ninvalid-vm-android-simarm'], 'The named configuration "invalid-vm-android-simarm" is invalid.'); } void testSelectors() { - // Default null safe suites. - for (var arguments in [ - [], - ['--nnbd=strong'], - ['-nvm-strong'] - ]) { - var configuration = parseConfiguration(arguments); + // Default suites. + { + final configuration = parseConfiguration([]); Expect.setEquals({ 'samples', 'standalone', @@ -119,7 +106,7 @@ void testSelectors() { 'lib', 'kernel', 'ffi', - }, configuration.selectors.keys, "suites for $arguments"); + }, configuration.selectors.keys, "default suites"); } // The test runner can run individual tests by being given the diff --git a/pkg/test_runner/test/test_file_test.dart b/pkg/test_runner/test/test_file_test.dart index f2e36928181..8a5c31052cc 100644 --- a/pkg/test_runner/test/test_file_test.dart +++ b/pkg/test_runner/test/test_file_test.dart @@ -7,7 +7,6 @@ import 'dart:io'; import 'package:expect/expect.dart'; -import 'package:test_runner/src/feature.dart'; import 'package:test_runner/src/path.dart'; import 'package:test_runner/src/static_error.dart'; import 'package:test_runner/src/test_file.dart'; @@ -112,7 +111,6 @@ void testParseOtherOptions() { /\/ ddcOptions=ddc options /\/ OtherResources=other resources /\/ SharedObjects=shared objects - /\/ Requirements=nnbd nnbd-strong """); Expect.listEquals(["dart", "options"], file.dartOptions); Expect.listEquals(["shared", "options"], file.sharedOptions); @@ -120,7 +118,6 @@ void testParseOtherOptions() { Expect.listEquals(["dart2wasm", "options"], file.dart2wasmOptions); Expect.listEquals(["ddc", "options"], file.ddcOptions); Expect.listEquals(["other", "resources"], file.otherResources); - Expect.listEquals([Feature.nnbd, Feature.nnbdStrong], file.requirements); // Disallows multiple lines for some options. expectParseThrows(""" @@ -143,10 +140,6 @@ void testParseOtherOptions() { /\/ ddcOptions=first /\/ ddcOptions=second """); - expectParseThrows(""" - /\/ Requirements=nnbd - /\/ Requirements=nnbd-strong - """); // Merges multiple lines for others. file = createTestFile(source: """ diff --git a/pkg/test_runner/test/test_matrix.json b/pkg/test_runner/test/test_matrix.json index 86ee96cf5f1..57fe082d697 100644 --- a/pkg/test_runner/test/test_matrix.json +++ b/pkg/test_runner/test/test_matrix.json @@ -7,8 +7,6 @@ "options": { "compiler": "dartkp" } - }, - "vm-legacy": {}, - "vm-strong": {} + } } -} \ No newline at end of file +} diff --git a/pkg/test_runner/test/test_suite_test.dart b/pkg/test_runner/test/test_suite_test.dart index 3460ef07889..dc948a7dcc2 100644 --- a/pkg/test_runner/test/test_suite_test.dart +++ b/pkg/test_runner/test/test_suite_test.dart @@ -10,37 +10,9 @@ import 'package:test_runner/src/test_file.dart'; import 'utils.dart'; void main() { - testNnbdRequirements(); testVmOptions(); } -void testNnbdRequirements() { - // Note: The backslashes are to avoid the test_runner thinking these are - // Requirements markers for this file itself. - var testFiles = [ - createTestFile(source: "", path: "none_test.dart"), - createTestFile(source: "/\/ Requirements=nnbd", path: "nnbd_test.dart"), - createTestFile( - source: "/\/ Requirements=nnbd-legacy", path: "legacy_test.dart"), - createTestFile( - source: "/\/ Requirements=nnbd-weak", path: "weak_test.dart"), - createTestFile( - source: "/\/ Requirements=nnbd-strong", path: "strong_test.dart"), - ]; - - expectTestCases([], testFiles, - ["language/none_test", "language/nnbd_test", "language/strong_test"]); - - expectTestCases(["--nnbd=legacy"], testFiles, - ["language/none_test", "language/legacy_test"]); - - expectTestCases(["--nnbd=weak"], testFiles, - ["language/none_test", "language/nnbd_test", "language/weak_test"]); - - expectTestCases(["--nnbd=strong"], testFiles, - ["language/none_test", "language/nnbd_test", "language/strong_test"]); -} - void testVmOptions() { // Note: The backslashes are to avoid the test_runner thinking these are // Requirements markers for this file itself. diff --git a/runtime/tests/vm/dart/regress_34755_test.dart b/runtime/tests/vm/dart/regress_34755_test.dart deleted file mode 100644 index 9b9956ef500..00000000000 --- a/runtime/tests/vm/dart/regress_34755_test.dart +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2018, 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. - -// Test checking that null is handled correctly at the call-sites that -// are tracking static type exactness. - -// Requirements=nnbd-weak - -import 'package:expect/expect.dart'; - -void invokeAdd(List l) { - l.add(10); -} - -void main() { - dynamic myNull; - Expect.throws(() => invokeAdd(myNull), (error) => error is NoSuchMethodError); -} diff --git a/runtime/tests/vm/dart/regress_42656_test.dart b/runtime/tests/vm/dart/regress_42656_test.dart deleted file mode 100644 index d41d4eda940..00000000000 --- a/runtime/tests/vm/dart/regress_42656_test.dart +++ /dev/null @@ -1,28 +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. - -// Verifies that mixin deduplication correctly handles identical anonymous -// mixins from opt-in and opt-out libraries. -// Regression test for https://github.com/dart-lang/sdk/issues/42656. - -// Requirements=nnbd-weak - -import 'package:expect/expect.dart'; -import 'regress_42656_opt_in_lib.dart'; -import 'regress_42656_opt_out_lib.dart'; - -void main() { - Expect.equals('MixinA', C2().toString()); - Expect.equals('MixinB', D2().toString()); - Expect.equals('MixinA', E2().toString()); - Expect.equals('MixinB', F2().toString()); - Expect.isFalse(C2() == C2()); - Expect.isFalse(D2() == D2()); - Expect.isFalse(E2() == E2()); - Expect.isFalse(F2() == F2()); - Expect.equals(42, C2().x); - Expect.equals(3, D2().y); - Expect.equals(42, E2().x); - Expect.equals(3, F2().y); -} diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status index 947e3966cdb..b739a6a6d5b 100644 --- a/runtime/tests/vm/vm.status +++ b/runtime/tests/vm/vm.status @@ -29,7 +29,6 @@ dart/gen_snapshot_include_resolved_urls_test: Pass, Slow # Spawns several subpro dart/hash_map_probes_limit_test: Pass, Slow # Test includes large program compilation. dart/incompatible_loading_unit_test: Pass, Slow # Spawns several subprocesses dart/isolates/*: Pass, Slow # Tests use many isolates and take a longer time. -dart/isolates/concurrency_stress_sanity_test: Pass, Slow # Spawns subprocesses dart/isolates/fast_object_copy_test: Pass, Slow # Slow due to doing a lot of transitive object copies. dart/minimal_kernel_test: Pass, Slow # Spawns several subprocesses dart/print_object_layout_test: Pass, Slow # Spawns several subprocesses @@ -114,9 +113,6 @@ cc/CreateMirrorSystem: SkipByDesign # Imports dart:mirrors cc/StandaloneSnapshotSize: SkipByDesign # Imports dart:mirrors dart/gen_snapshot_include_resolved_urls_test: SkipByDesign # Script URLs not included in product gen_snapshot -[ $nnbd == legacy ] -dart/*: SkipByDesign # Migrated tests are not supposed to run on non-NNBD bots. - [ $sanitizer == asan ] dart/transferable_throws_oom_test: SkipByDesign # This test tries to allocate too much memory on purpose. Still dartbug.com/37188 diff --git a/tests/corelib/cast_strong_test.dart b/tests/corelib/cast_strong_test.dart index 4301e892175..3f321512247 100644 --- a/tests/corelib/cast_strong_test.dart +++ b/tests/corelib/cast_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import "dart:collection"; import "package:expect/expect.dart"; import 'cast_helper.dart'; diff --git a/tests/corelib/cast_weak_test.dart b/tests/corelib/cast_weak_test.dart deleted file mode 100644 index dcb4191ca44..00000000000 --- a/tests/corelib/cast_weak_test.dart +++ /dev/null @@ -1,99 +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. - -// Requirements=nnbd-weak - -import "dart:collection"; -import "package:expect/expect.dart"; -import 'cast_helper.dart'; - -void main() { - testIterable(); - testList(); - testMap(); - testSet(); -} - -testIterable() { - var iterable = new Iterable.generate(elements.length, (n) => elements[n]); - // Downcast non-nullable. - - // An iterable that (likely) can do direct access. - var dIterableDirect = Iterable.castFrom(iterable); - Expect.equals(d, dIterableDirect.elementAt(1)); - Expect.equals(null, dIterableDirect.skip(3).elementAt(1)); - - // An iterable that cannot do direct access. - var dIterableNonDirect = Iterable.castFrom( - iterable.where((_) => true), - ); - Expect.equals(d, dIterableNonDirect.elementAt(1)); - Expect.equals(null, dIterableNonDirect.skip(3).elementAt(1)); - - // Iterable that definitely won't survive accessing element 3. - var iterableLimited = new Iterable.generate( - elements.length, - (n) => n == 3 ? throw "untouchable" : elements[n], - ); - var dIterableLimited = Iterable.castFrom(iterableLimited); - Expect.equals(d, dIterableLimited.elementAt(1)); - Expect.equals(null, dIterableLimited.skip(3).elementAt(1)); - - // Upcast non-nullable. - var objectIterable = Iterable.castFrom(iterable); - Expect.equals(null, objectIterable.skip(3).elementAt(1)); -} - -testList() { - var list = new List.from(elements); - - // Downcast non-nullable. - var dList = List.castFrom(list); - Expect.equals(d, dList[1]); - Expect.equals(null, dList.last); - - // Upcast non-nullable. - var objectList = List.castFrom(list); - Expect.equals(null, objectList.last); -} - -testMap() { - var map = new Map.fromIterables(elements, elements); - - // Downcast non-nullable. - var dMap = Map.castFrom(map); - Expect.equals(d, dMap[d]); - Expect.isTrue(dMap.containsKey(null)); - Expect.equals(null, dMap[null]); - - // Test keys and values - Expect.isTrue(dMap.keys is Iterable); - Expect.isTrue(dMap.values is Iterable); - Expect.throws(() => dMap.keys.toList()); - Expect.throws(() => dMap.values.toList()); - - // Upcast non-nullable. - var objectMap = Map.castFrom(map); - Expect.isTrue(objectMap.containsKey(null)); - Expect.equals(null, objectMap[null]); - - // Test keys and values - Expect.isTrue(objectMap.keys is Iterable); - Expect.isTrue(objectMap.values is Iterable); - var expectedValues = new List.from(elements); - Expect.listEquals(expectedValues, objectMap.values.toList()); -} - -testSet() { - var setEls = new Set.from(elements); - - // Downcast non-nullable. - var dSet = Set.castFrom(setEls); - Expect.equals(d, dSet.elementAt(1)); - Expect.equals(null, dSet.last); - - // Upcast non-nullable. - var objectSet = Set.castFrom(setEls); - Expect.equals(null, objectSet.last); -} diff --git a/tests/corelib/regress_42502_test.dart b/tests/corelib/regress_42502_test.dart index c3bac6770c2..5eaa8d7cd88 100644 --- a/tests/corelib/regress_42502_test.dart +++ b/tests/corelib/regress_42502_test.dart @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. // Regression test for https://github.com/dart-lang/sdk/issues/42502. -// Requirements=nnbd-strong import "package:expect/expect.dart"; diff --git a/tests/dartdevc/basic_assignment_test.dart b/tests/dartdevc/basic_assignment_test.dart index f9f7fb8d59f..ba9bdb32be3 100644 --- a/tests/dartdevc/basic_assignment_test.dart +++ b/tests/dartdevc/basic_assignment_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd - import 'package:expect/expect.dart'; void main() { diff --git a/tests/dartdevc/hot_restart_js_interop_test.dart b/tests/dartdevc/hot_restart_js_interop_test.dart index e3899df6bff..2183e4db2ff 100644 --- a/tests/dartdevc/hot_restart_js_interop_test.dart +++ b/tests/dartdevc/hot_restart_js_interop_test.dart @@ -4,8 +4,6 @@ // Tests that JS interop works with hot restart. -// Requirements=nnbd - @JS() library hot_restart_js_interop_test; diff --git a/tests/dartdevc/js_interop_test.dart b/tests/dartdevc/js_interop_test.dart index 3d4e63bebe4..4efb1214b87 100644 --- a/tests/dartdevc/js_interop_test.dart +++ b/tests/dartdevc/js_interop_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd - @JS() library js_interop_test; diff --git a/tests/dartdevc/subtype_test.dart b/tests/dartdevc/subtype_test.dart index 4fb025b87b1..13eb1c2e531 100644 --- a/tests/dartdevc/subtype_test.dart +++ b/tests/dartdevc/subtype_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import 'dart:_foreign_helper' show TYPE_REF; import 'dart:async' show FutureOr; diff --git a/tests/dartdevc/subtype_weak_test.dart b/tests/dartdevc/subtype_weak_test.dart deleted file mode 100644 index 67a6bfa386e..00000000000 --- a/tests/dartdevc/subtype_weak_test.dart +++ /dev/null @@ -1,277 +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. - -// Requirements=nnbd-weak - -import 'dart:_foreign_helper' show TYPE_REF; -import 'dart:async'; - -import 'runtime_utils.dart' - show - checkSubtype, - checkProperSubtype, - checkMutualSubtype, - checkSubtypeFailure; - -class A {} - -class B extends A {} - -class C extends B {} - -class D {} - -class E {} - -class F extends E {} - -void main() { - // Top type symmetry. - // Object? <:> dynamic - checkMutualSubtype(TYPE_REF(), TYPE_REF()); - // Object? <:> void - checkMutualSubtype(TYPE_REF(), TYPE_REF()); - // void <:> dynamic - checkMutualSubtype(TYPE_REF(), TYPE_REF()); - - // Bottom is subtype of top. - // Never <: dynamic - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // Never <: void - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // Never <: Object? - checkProperSubtype(TYPE_REF(), TYPE_REF()); - - // Object is between top and bottom. - // Object <: Object? - checkSubtype(TYPE_REF(), TYPE_REF()); - // Never <: Object - checkProperSubtype(TYPE_REF(), TYPE_REF()); - - // Null is between top and bottom. - // Null <: Object? - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // Never <: Null - checkSubtype(TYPE_REF(), TYPE_REF()); - - // Class is between Object and bottom. - // A <: Object - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // Never <: A - checkProperSubtype(TYPE_REF(), TYPE_REF()); - - // Nullable types are a union of T and Null. - // A <: A? - checkSubtype(TYPE_REF(), TYPE_REF()); - // Null <: A? - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // A? <: Object? - checkProperSubtype(TYPE_REF(), TYPE_REF()); - - // Futures. - // Null <: FutureOr - checkProperSubtype(TYPE_REF(), TYPE_REF>()); - // Object <: FutureOr - checkSubtype(TYPE_REF(), TYPE_REF>()); - // Object? <:> FutureOr - checkMutualSubtype(TYPE_REF(), TYPE_REF>()); - // Object <:> FutureOr - checkMutualSubtype(TYPE_REF(), TYPE_REF>()); - // Object <:> FutureOr - checkMutualSubtype(TYPE_REF(), TYPE_REF>()); - // Object <:> FutureOr - checkMutualSubtype(TYPE_REF(), TYPE_REF>()); - // Future <: FutureOr - checkProperSubtype(TYPE_REF>(), TYPE_REF>()); - // Future <: FutureOr - checkProperSubtype( - TYPE_REF>(), - TYPE_REF>(), - ); - // FutureOr <: Future - checkSubtype(TYPE_REF>(), TYPE_REF>()); - // Future <: FutureOr - checkProperSubtype(TYPE_REF>(), TYPE_REF>()); - // B <: <: FutureOr - checkProperSubtype(TYPE_REF(), TYPE_REF>()); - // Future <: Future - checkProperSubtype(TYPE_REF>(), TYPE_REF>()); - - // Interface subtypes. - // A <: A - checkSubtype(TYPE_REF(), TYPE_REF()); - // B <: A - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // C <: B - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // C <: A - checkProperSubtype(TYPE_REF(), TYPE_REF()); - - // Functions. - // A -> B <: Function - checkProperSubtype(TYPE_REF(), TYPE_REF()); - - // A -> B <: A -> B - checkSubtype(TYPE_REF(), TYPE_REF()); - - // A -> B <: B -> B - checkProperSubtype(TYPE_REF(), TYPE_REF()); - - // A -> B <: A -> A - checkProperSubtype(TYPE_REF(), TYPE_REF()); - - // Generic Function Subtypes. - // Bound is a built in type. - // void -> void <: void -> void - checkSubtype( - TYPE_REF()>(), - TYPE_REF()>(), - ); - - // A -> T <: B -> T - checkProperSubtype( - TYPE_REF(A)>(), - TYPE_REF(B)>(), - ); - - // T -> B <: T -> A - checkProperSubtype( - TYPE_REF(T)>(), - TYPE_REF(T)>(), - ); - - // Bound is a function type. - // B> void -> void <: B> void -> void - checkSubtype( - TYPE_REF()>(), - TYPE_REF()>(), - ); - - // B> A -> T <: B> B -> T - checkProperSubtype( - TYPE_REF(A)>(), - TYPE_REF(B)>(), - ); - - // B> T -> B <: B> T -> A - checkProperSubtype( - TYPE_REF(T)>(), - TYPE_REF(T)>(), - ); - - // Bound is a user defined class. - // void -> void <: void -> void - checkSubtype( - TYPE_REF()>(), - TYPE_REF()>(), - ); - - // A -> T <: B -> T - checkProperSubtype( - TYPE_REF(A)>(), - TYPE_REF(B)>(), - ); - - // T -> B <: T -> A - checkProperSubtype( - TYPE_REF(T)>(), - TYPE_REF(T)>(), - ); - - // Bound is a Future. - // > void -> void <: > void -> void - checkSubtype( - TYPE_REF>()>(), - TYPE_REF>()>(), - ); - - // > A -> T <: > B -> T - checkProperSubtype( - TYPE_REF>(A)>(), - TYPE_REF>(B)>(), - ); - - // > T -> B <: > T -> A - checkProperSubtype( - TYPE_REF>(T)>(), - TYPE_REF>(T)>(), - ); - - // Bound is a FutureOr. - // > void -> void <: - // > void -> void - checkSubtype( - TYPE_REF>()>(), - TYPE_REF>()>(), - ); - - // > A -> T <: > B -> T - checkProperSubtype( - TYPE_REF>(A)>(), - TYPE_REF>(B)>(), - ); - - // > T -> B <: > T -> A - checkProperSubtype( - TYPE_REF>(T)>(), - TYPE_REF>(T)>(), - ); - - // Generics. - // D <:> D - checkMutualSubtype(TYPE_REF(), TYPE_REF>()); - // D <: D - checkProperSubtype(TYPE_REF>(), TYPE_REF>()); - - // F <: E - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // F <: E - checkProperSubtype(TYPE_REF(), TYPE_REF>()); - // E <: E - checkProperSubtype(TYPE_REF>(), TYPE_REF()); - // E <: E - checkProperSubtype(TYPE_REF>(), TYPE_REF>()); - - // Nullable interface subtypes. - // B <: A? - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // C <: A? - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // B? <: A? - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // C? <: A? - checkProperSubtype(TYPE_REF(), TYPE_REF()); - - // Allowed in weak mode. - // dynamic <: Object - checkSubtype(TYPE_REF(), TYPE_REF()); - // void <: Object - checkSubtype(TYPE_REF(), TYPE_REF()); - // Object? <: Object - checkSubtype(TYPE_REF(), TYPE_REF()); - // A? <: Object - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // A? <: A - checkSubtype(TYPE_REF(), TYPE_REF()); - // Null <: Never - checkSubtype(TYPE_REF(), TYPE_REF()); - // Null <: Object - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // Null <: A - checkProperSubtype(TYPE_REF(), TYPE_REF()); - // Null <: FutureOr - checkProperSubtype(TYPE_REF(), TYPE_REF>()); - // Null <: Future - checkProperSubtype(TYPE_REF(), TYPE_REF>()); - // FutureOr <: Future - checkSubtype(TYPE_REF>(), TYPE_REF>()); - // Null <: Future - checkProperSubtype(TYPE_REF(), TYPE_REF>()); - // FutureOr <: Object - checkSubtype(TYPE_REF>(), TYPE_REF()); - // FutureOr <: Object - checkSubtype(TYPE_REF>(), TYPE_REF()); - // FutureOr <: Object - checkSubtype(TYPE_REF>(), TYPE_REF()); -} diff --git a/tests/dartdevc/weak_null_safety_errors_test.dart b/tests/dartdevc/weak_null_safety_errors_test.dart deleted file mode 100644 index 229f1c2c125..00000000000 --- a/tests/dartdevc/weak_null_safety_errors_test.dart +++ /dev/null @@ -1,45 +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. - -// Requirements=nnbd-weak - -// ddcOptions=--weak-null-safety-errors - -import 'package:expect/expect.dart'; - -/// Code that runs without error when running with unsound null safety but -/// should throw in sound mode or when running DDC with -/// `--weak-null-safety-errors`. - -void fn(StringBuffer arg) {} -void testArg(T t) => throw 'do not call'; -T testReturn() => throw 'do not call'; - -const c = C(); - -class C { - covariantCheck(List t) {} - const C(); -} - -void main() { - Expect.throwsTypeError(() => null as int); - dynamic dynamicNull = null; - Expect.throwsTypeError(() => fn(dynamicNull)); - - Expect.throwsTypeError(() => [Duration(days: 1), null] as List); - - // Constants get legacy types introduced in their type arguments. - C c2 = c; - Expect.throwsTypeError(() => c2.covariantCheck([Duration(days: 1), null])); - - // Tearoff instantiations are "potentially constant" and are treated as a - // constant by the CFE. - // When compiling for unsound null safety the resulting type signature - // attached to the tearoff is `void Function(Duration*)` which is a valid - // subtype of `void Function(Duration?)`. In sound null safety the signature - // is `void Function(Duration)` which should fail in the cast. - Expect.throwsTypeError(() => (testArg) as void Function(Duration?)); - Expect.throwsTypeError(() => (testReturn) as Duration Function()); -} diff --git a/tests/ffi/ffi.status b/tests/ffi/ffi.status index e276f331c03..cef9772d5d3 100644 --- a/tests/ffi/ffi.status +++ b/tests/ffi/ffi.status @@ -43,9 +43,6 @@ function_callbacks_structs_by_value_generated_test: Pass, Slow [ $mode == product ] regress_47594_test: Skip # Profiler is not available in Product. -[ $nnbd == weak ] -vmspecific_pointer_load_il_test: SkipByDesign # Unsound NNBD boxes things because of nulls. - [ $system == android ] *: Pass, Slow # https://github.com/dart-lang/sdk/issues/38489 regress_47594_test: Skip # DartDev is not available on Android. diff --git a/tests/language/async/await_flatten_test.dart b/tests/language/async/await_flatten_test.dart index 05f65ffc6ac..9163607685b 100644 --- a/tests/language/async/await_flatten_test.dart +++ b/tests/language/async/await_flatten_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import 'dart:async'; import 'package:expect/expect.dart'; import 'package:expect/static_type_helper.dart'; diff --git a/tests/language/async/await_type_check_test.dart b/tests/language/async/await_type_check_test.dart index 448039b1edb..9bde79073e0 100644 --- a/tests/language/async/await_type_check_test.dart +++ b/tests/language/async/await_type_check_test.dart @@ -8,8 +8,6 @@ // // Regression test for https://github.com/dart-lang/sdk/issues/49396. -// Requirements=nnbd-strong - import 'dart:async'; import 'package:expect/expect.dart'; import 'package:expect/static_type_helper.dart'; diff --git a/tests/language/bool/check_strong_test.dart b/tests/language/bool/check_strong_test.dart index bafdb473080..b26eba7f931 100644 --- a/tests/language/bool/check_strong_test.dart +++ b/tests/language/bool/check_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import "package:expect/expect.dart"; main() { diff --git a/tests/language/bool/check_weak_test.dart b/tests/language/bool/check_weak_test.dart deleted file mode 100644 index ab206908195..00000000000 --- a/tests/language/bool/check_weak_test.dart +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2014, 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. - -// Requirements=nnbd-weak - -import "package:expect/expect.dart"; - -main() { - Expect.throwsAssertionError(() { - if (null as dynamic) {} - }); - - Expect.throwsTypeError(() { - if ("true" as dynamic) {} - }); -} diff --git a/tests/language/bool/condition_check_strong_test.dart b/tests/language/bool/condition_check_strong_test.dart index 39f9b2499b7..87129899545 100644 --- a/tests/language/bool/condition_check_strong_test.dart +++ b/tests/language/bool/condition_check_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - // Check that passing `null` for a boolean typed parameter will still cause // a boolean conversion error when used in a condition. diff --git a/tests/language/bool/condition_check_weak_test.dart b/tests/language/bool/condition_check_weak_test.dart deleted file mode 100644 index ade0fd029b5..00000000000 --- a/tests/language/bool/condition_check_weak_test.dart +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2015, 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. - -// Requirements=nnbd-weak - -// Check that passing `null` for a boolean typed parameter will still cause -// a boolean conversion error when used in a condition. - -import 'package:expect/expect.dart'; - -@pragma('dart2js:noInline') -String check({bool? a, bool? b}) { - String aString = (a as dynamic) ? 'a' : ''; - String bString = (b as dynamic) ? 'b' : ''; - return '$aString$bString'; -} - -class Class { - final String field; - Class({bool? a = false, bool? b = true}) : this.field = check(a: a, b: b); -} - -main() { - Expect.throwsAssertionError(() => new Class(a: null, b: null).field); -} diff --git a/tests/language/closure/param_null_to_object_test.dart b/tests/language/closure/param_null_to_object_test.dart index b1139f3a9c1..ff7ef12fc1b 100644 --- a/tests/language/closure/param_null_to_object_test.dart +++ b/tests/language/closure/param_null_to_object_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong import "package:expect/expect.dart"; main() { diff --git a/tests/language/closure/param_null_to_object_weak_test.dart b/tests/language/closure/param_null_to_object_weak_test.dart deleted file mode 100644 index 31b8208ffd5..00000000000 --- a/tests/language/closure/param_null_to_object_weak_test.dart +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2017, 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. - -// Requirements=nnbd-weak -import "package:expect/expect.dart"; - -main() { - // Pre-NNBD bottom type. - int Function(Null) f = (x) => 1; // Runtime type is int Function(Object?) - Expect.isTrue(f is int Function(Null)); - Expect.isTrue(f is int Function(Never)); - Expect.isTrue(f is int Function(String)); - Expect.isTrue(f is int Function(Object)); - Expect.isTrue(f is int Function(Object?)); - - // NNBD bottom type. - int Function(Never) g = (x) => 1; // Runtime type is int Function(Object?) - Expect.isTrue(g is int Function(Null)); - Expect.isTrue(g is int Function(Never)); - Expect.isTrue(g is int Function(String)); - Expect.isTrue(g is int Function(Object)); - Expect.isTrue(g is int Function(Object?)); - - int Function(String) h = (x) => 1; // Runtime type is int Function(String) - Expect.isTrue(h is int Function(Null)); - Expect.isTrue(h is int Function(Never)); - Expect.isTrue(h is int Function(String)); - Expect.isFalse(h is int Function(Object)); - Expect.isFalse(h is int Function(Object?)); -} diff --git a/tests/language/constructor/constructor12_strong_test.dart b/tests/language/constructor/constructor12_strong_test.dart index bcc26728f97..2cd79255ac0 100644 --- a/tests/language/constructor/constructor12_strong_test.dart +++ b/tests/language/constructor/constructor12_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - // Copied from constructor12_test.dart to break out a single expectation that // is different in weak and strong modes. diff --git a/tests/language/constructor/constructor12_weak_test.dart b/tests/language/constructor/constructor12_weak_test.dart deleted file mode 100644 index 2a4d2f69a21..00000000000 --- a/tests/language/constructor/constructor12_weak_test.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2015, 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. - -// Requirements=nnbd-weak - -// Copied from constructor12_test.dart to break out a single expectation that -// is different in weak and strong modes. - -import "package:expect/expect.dart"; - -import 'constructor12_lib.dart'; - -main() { - var a2 = confuse(new A(2)); - // Only true in weak mode. - Expect.isTrue(a2 is A); -} diff --git a/tests/language/control_flow_collections/for_dynamic_null_strong_test.dart b/tests/language/control_flow_collections/for_dynamic_null_strong_test.dart index a0565d87128..a201bd8a117 100644 --- a/tests/language/control_flow_collections/for_dynamic_null_strong_test.dart +++ b/tests/language/control_flow_collections/for_dynamic_null_strong_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong import 'package:expect/expect.dart'; void main() { diff --git a/tests/language/control_flow_collections/for_dynamic_null_weak_test.dart b/tests/language/control_flow_collections/for_dynamic_null_weak_test.dart deleted file mode 100644 index 59047829d6b..00000000000 --- a/tests/language/control_flow_collections/for_dynamic_null_weak_test.dart +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Requirements=nnbd-weak -import 'package:expect/expect.dart'; - -void main() { - // Null condition expression. - dynamic nullBool = null; - Expect.throwsAssertionError(() => [for (; nullBool;) 1]); - Expect.throwsAssertionError(() => {for (; nullBool;) 1: 1}); - Expect.throwsAssertionError(() => {for (; nullBool;) 1}); - - // Null iterable. - dynamic nullIterable = null; - // The current behavior is inconsistent across the backends. The VM currently - // tries calling .iterable and throws a NoSuchMethodError. DDC throws a - // TypeError. - Expect.throws(() => [for (var i in nullIterable) 1]); - Expect.throws(() => {for (var i in nullIterable) 1: 1}); - Expect.throws(() => {for (var i in nullIterable) 1}); -} diff --git a/tests/language/control_flow_collections/if_dynamic_null_strong_test.dart b/tests/language/control_flow_collections/if_dynamic_null_strong_test.dart index 0450c0b99e9..4e7970c13e8 100644 --- a/tests/language/control_flow_collections/if_dynamic_null_strong_test.dart +++ b/tests/language/control_flow_collections/if_dynamic_null_strong_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong import 'package:expect/expect.dart'; void main() { diff --git a/tests/language/control_flow_collections/if_dynamic_null_weak_test.dart b/tests/language/control_flow_collections/if_dynamic_null_weak_test.dart deleted file mode 100644 index 4e76cf38f2a..00000000000 --- a/tests/language/control_flow_collections/if_dynamic_null_weak_test.dart +++ /dev/null @@ -1,13 +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. - -// Requirements=nnbd-weak -import 'package:expect/expect.dart'; - -void main() { - dynamic nullBool; - Expect.throwsAssertionError(() => [if (nullBool) 1]); - Expect.throwsAssertionError(() => {if (nullBool) 1: 1}); - Expect.throwsAssertionError(() => {if (nullBool) 1}); -} diff --git a/tests/language/function_subtype/regress41680_strong_test.dart b/tests/language/function_subtype/regress41680_strong_test.dart index 756fd82de2d..b723675b9cd 100644 --- a/tests/language/function_subtype/regress41680_strong_test.dart +++ b/tests/language/function_subtype/regress41680_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import "package:expect/expect.dart"; import 'package:expect/variations.dart' as v; diff --git a/tests/language/function_subtype/regress41680_weak_test.dart b/tests/language/function_subtype/regress41680_weak_test.dart deleted file mode 100644 index 570ccd57297..00000000000 --- a/tests/language/function_subtype/regress41680_weak_test.dart +++ /dev/null @@ -1,26 +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. - -// Requirements=nnbd-weak - -import "package:expect/expect.dart"; - -typedef dynamicToDynamic = dynamic Function(dynamic); - -typedef voidToT = T Function(); - -dynamic dynamicNull = null; - -dynamic cast(dynamic value) => value as T; - -bool allowsArgument(T Function() fn) => true; - -main() { - // In weak mode Null should be allowed as a subtype of function types. - Expect.equals(null, dynamicNull as Function); - Expect.equals(null, dynamicNull as dynamicToDynamic); - Expect.equals(null, cast(dynamicNull)); - Expect.equals(null, dynamicNull as voidToT); - Expect.equals(true, allowsArgument(dynamicNull)); -} diff --git a/tests/language/nnbd/boolean_conversion/boolean_conversion_strong_test.dart b/tests/language/nnbd/boolean_conversion/boolean_conversion_strong_test.dart index a64664f629b..38e4063932c 100644 --- a/tests/language/nnbd/boolean_conversion/boolean_conversion_strong_test.dart +++ b/tests/language/nnbd/boolean_conversion/boolean_conversion_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - // Test implicit casts and null conversions for boolean expressions // in strong mode. diff --git a/tests/language/nnbd/const/potentially_constant_types_error_test.dart b/tests/language/nnbd/const/potentially_constant_types_error_test.dart index b0adce348e3..c0bac4644d4 100644 --- a/tests/language/nnbd/const/potentially_constant_types_error_test.dart +++ b/tests/language/nnbd/const/potentially_constant_types_error_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - /// Test instance checks and casts in constants may use potentially constant /// types, and cause compile time errors when the casts fail. diff --git a/tests/language/nnbd/const/potentially_constant_types_test.dart b/tests/language/nnbd/const/potentially_constant_types_test.dart index d940b8ab32b..6e3c3f1d40e 100644 --- a/tests/language/nnbd/const/potentially_constant_types_test.dart +++ b/tests/language/nnbd/const/potentially_constant_types_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - /// Test instance checks and casts in constants may use potentially constant /// types, and evaluate appropriately. diff --git a/tests/language/nnbd/never/never_error_test.dart b/tests/language/nnbd/never/never_error_test.dart index 1ac1330f7e9..e79913a7f2a 100644 --- a/tests/language/nnbd/never/never_error_test.dart +++ b/tests/language/nnbd/never/never_error_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - /// Test that `Never` has all members, and that as a result no extensions /// apply to it. Also test that `Never` is inferred as the type of a /// throw expression, and as the return type of function literals that diff --git a/tests/language/nnbd/never/never_null_assignability_strong_test.dart b/tests/language/nnbd/never/never_null_assignability_strong_test.dart index 8e9264a1fcf..d8134625f01 100644 --- a/tests/language/nnbd/never/never_null_assignability_strong_test.dart +++ b/tests/language/nnbd/never/never_null_assignability_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import 'package:expect/expect.dart'; import 'never_null_assignability_lib1.dart'; diff --git a/tests/language/nnbd/required_named_parameters/missing_required_argument_dynamic_test.dart b/tests/language/nnbd/required_named_parameters/missing_required_argument_dynamic_test.dart index df73094f5e6..9060f860d11 100644 --- a/tests/language/nnbd/required_named_parameters/missing_required_argument_dynamic_test.dart +++ b/tests/language/nnbd/required_named_parameters/missing_required_argument_dynamic_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import 'package:expect/expect.dart'; // Test that it is an error if a named parameter that is part of a required diff --git a/tests/language/nnbd/required_named_parameters/required_named_args_strong_test.dart b/tests/language/nnbd/required_named_parameters/required_named_args_strong_test.dart index 4851b68734c..b92a5eb5ab1 100644 --- a/tests/language/nnbd/required_named_parameters/required_named_args_strong_test.dart +++ b/tests/language/nnbd/required_named_parameters/required_named_args_strong_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong // Tests runtime type semantics for functions with required named parameters // in strong mode. import 'package:expect/expect.dart'; diff --git a/tests/language/nnbd/required_named_parameters/required_named_args_weak_test.dart b/tests/language/nnbd/required_named_parameters/required_named_args_weak_test.dart deleted file mode 100644 index 556ca2de69b..00000000000 --- a/tests/language/nnbd/required_named_parameters/required_named_args_weak_test.dart +++ /dev/null @@ -1,27 +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. - -// Requirements=nnbd-weak -// Tests runtime type semantics for functions with required named parameters -// in weak mode. -import 'package:expect/expect.dart'; -import 'required_named_args_lib.dart'; - -main() { - dynamic f = func; - - // Valid: Subtype may redeclare optional parameters as required in weak mode. - Function(String p0, {required int p1, String p2}) t2 = f; - - // Valid: Subtype may declare new required named parameters in weak mode. - Function(String p0, {required int p1}) t3 = f; - - // Valid: Invocation may pass null as a required named argument in weak mode. - f("", p1: null, p2: null); - Function.apply(f, [""], {#p1: null, #p2: null}); - - // Valid: Invocation may omit a required named argument in weak mode. - f("", p1: 100); - Function.apply(f, [""], {#p1: 100}); -} diff --git a/tests/language/nnbd/subtyping/function_type_bounds_strong_test.dart b/tests/language/nnbd/subtyping/function_type_bounds_strong_test.dart index ebacbf7e0aa..4c80dff6d16 100644 --- a/tests/language/nnbd/subtyping/function_type_bounds_strong_test.dart +++ b/tests/language/nnbd/subtyping/function_type_bounds_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import 'package:expect/expect.dart'; import 'function_type_bounds_null_safe_lib.dart'; diff --git a/tests/language/nnbd/subtyping/function_type_bounds_weak_test.dart b/tests/language/nnbd/subtyping/function_type_bounds_weak_test.dart deleted file mode 100644 index 86b065ad577..00000000000 --- a/tests/language/nnbd/subtyping/function_type_bounds_weak_test.dart +++ /dev/null @@ -1,25 +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. - -// Requirements=nnbd-weak - -import 'package:expect/expect.dart'; - -import 'function_type_bounds_null_safe_lib.dart'; - -main() { - // void fn() is void Function() - // Should pass with weak checking because when the nullability information on - // Object and Object? are erased the type bounds are equivalent. - Expect.isTrue(fnWithNonNullObjectBound is fnTypeWithNullableObjectBound); - const test1 = fnWithNonNullObjectBound is fnTypeWithNullableObjectBound; - Expect.isTrue(test1); - - // void fn() is void Function() - // Should pass with weak checking because Null becomes equivalent to - // the bottom type. - Expect.isTrue(fnWithNullBound is fnTypeWithNeverBound); - const test2 = fnWithNullBound is fnTypeWithNeverBound; - Expect.isTrue(test2); -} diff --git a/tests/language/nnbd/subtyping/function_type_required_params_test.dart b/tests/language/nnbd/subtyping/function_type_required_params_test.dart index d6d0fdc504d..ee05c03e917 100644 --- a/tests/language/nnbd/subtyping/function_type_required_params_test.dart +++ b/tests/language/nnbd/subtyping/function_type_required_params_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong import 'package:expect/expect.dart'; int f({required int i}) { diff --git a/tests/language/nnbd/subtyping/regress41272_test.dart b/tests/language/nnbd/subtyping/regress41272_test.dart index 2519404ec1c..7c83c5e919e 100644 --- a/tests/language/nnbd/subtyping/regress41272_test.dart +++ b/tests/language/nnbd/subtyping/regress41272_test.dart @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. // VMOptions=--optimization_counter_threshold=10 --deterministic -// Requirements=nnbd-strong // Verifies that null cannot be casted to Object. // Regression test for https://github.com/dart-lang/sdk/issues/41272. diff --git a/tests/language/nnbd/subtyping/regress41939_test.dart b/tests/language/nnbd/subtyping/regress41939_test.dart index 8d4b1e7adfb..4158de7afab 100644 --- a/tests/language/nnbd/subtyping/regress41939_test.dart +++ b/tests/language/nnbd/subtyping/regress41939_test.dart @@ -5,8 +5,6 @@ // Formatting can break multitests, so don't format them. // dart format off -// Requirements=nnbd-strong - // Regression test for https://github.com/dart-lang/sdk/issues/41939 void checkme0(T? t) {} diff --git a/tests/language/nnbd/subtyping/type_casts_strong_test.dart b/tests/language/nnbd/subtyping/type_casts_strong_test.dart index 7d7c2e56224..e21c887c6cc 100644 --- a/tests/language/nnbd/subtyping/type_casts_strong_test.dart +++ b/tests/language/nnbd/subtyping/type_casts_strong_test.dart @@ -4,8 +4,6 @@ // VMOptions=--optimization_counter_threshold=10 --deterministic -// Requirements=nnbd-strong - import 'package:expect/expect.dart'; class C {} diff --git a/tests/language/nnbd/syntax/nullable_type_test.dart b/tests/language/nnbd/syntax/nullable_type_test.dart index 7dabed96bff..406dd6c4f18 100644 --- a/tests/language/nnbd/syntax/nullable_type_test.dart +++ b/tests/language/nnbd/syntax/nullable_type_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - // Test that the trailing "?" is accepted after all type syntaxes. Verify that // the compiler understands the resulting type to be nullable by trying to // construct a list containing `null`. Verify that the runtime understands the diff --git a/tests/language/nnbd/syntax/required_modifier_dynamic_error_test.dart b/tests/language/nnbd/syntax/required_modifier_dynamic_error_test.dart index 755bb0beaad..27e566e7123 100644 --- a/tests/language/nnbd/syntax/required_modifier_dynamic_error_test.dart +++ b/tests/language/nnbd/syntax/required_modifier_dynamic_error_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong import 'package:expect/expect.dart'; class Foo { diff --git a/tests/language/nnbd/type_equality/futureOr_normalization_test.dart b/tests/language/nnbd/type_equality/futureOr_normalization_test.dart index 0f0b4bd3bf6..cf5db34ba73 100644 --- a/tests/language/nnbd/type_equality/futureOr_normalization_test.dart +++ b/tests/language/nnbd/type_equality/futureOr_normalization_test.dart @@ -3,8 +3,6 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async'; -// Requirements=nnbd - import 'package:expect/expect.dart'; import 'futureOr_normalization_null_safe_lib.dart'; diff --git a/tests/language/nnbd/type_equality/generic_function_type_equality_test.dart b/tests/language/nnbd/type_equality/generic_function_type_equality_test.dart index b96ca056cac..e84544d6a5c 100644 --- a/tests/language/nnbd/type_equality/generic_function_type_equality_test.dart +++ b/tests/language/nnbd/type_equality/generic_function_type_equality_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd - import 'package:expect/expect.dart'; import 'generic_function_type_equality_null_safe_lib.dart'; diff --git a/tests/language/nnbd/type_object/equality_test.dart b/tests/language/nnbd/type_object/equality_test.dart index e96d8fbef8e..8c654ef84e9 100644 --- a/tests/language/nnbd/type_object/equality_test.dart +++ b/tests/language/nnbd/type_object/equality_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd - import "package:expect/expect.dart"; class A {} diff --git a/tests/language/type_object/futureor_tostring_test.dart b/tests/language/type_object/futureor_tostring_test.dart index 07f77043083..f73aeba488b 100644 --- a/tests/language/type_object/futureor_tostring_test.dart +++ b/tests/language/type_object/futureor_tostring_test.dart @@ -16,8 +16,6 @@ // Also checks for types `T` where normalization removes or changes // the `FutureOr`. -// Requirements=nnbd-strong - import "dart:async" show FutureOr; import "package:expect/expect.dart"; diff --git a/tests/lib/async/future_or_strong_test.dart b/tests/lib/async/future_or_strong_test.dart index 6645aa43c27..17488712986 100644 --- a/tests/lib/async/future_or_strong_test.dart +++ b/tests/lib/async/future_or_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - // In strong mode, `FutureOr` should be equivalent to the union of `Future` // and `T`. diff --git a/tests/lib/async/future_or_type_test.dart b/tests/lib/async/future_or_type_test.dart index d2b71bc1601..80bf99b94e7 100644 --- a/tests/lib/async/future_or_type_test.dart +++ b/tests/lib/async/future_or_type_test.dart @@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. // In strong mode, `FutureOr` should be a valid type in most locations. -// Requirements=nnbd-strong import 'dart:async'; import 'package:expect/expect.dart'; diff --git a/tests/lib/async/regress154963234_strong_test.dart b/tests/lib/async/regress154963234_strong_test.dart index d2e537bd014..c4239638c6b 100644 --- a/tests/lib/async/regress154963234_strong_test.dart +++ b/tests/lib/async/regress154963234_strong_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import "package:expect/expect.dart"; main() { diff --git a/tests/lib/async/regress154963234_weak_test.dart b/tests/lib/async/regress154963234_weak_test.dart deleted file mode 100644 index 0c689f70f45..00000000000 --- a/tests/lib/async/regress154963234_weak_test.dart +++ /dev/null @@ -1,16 +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. - -// Requirements=nnbd-weak - -import "package:expect/expect.dart"; - -main() { - var shortDuration = Duration(milliseconds: 5); - - Expect.isTrue(Future.delayed(shortDuration) is Future); - // In weak mode passing computation is not required because any type passed as - // the type argument can be nullable. - Expect.isTrue(Future.delayed(shortDuration) is Future); -} diff --git a/tests/lib/js/static_interop_test/number_test.dart b/tests/lib/js/static_interop_test/number_test.dart index b3eccda3619..d0d74d9ebbf 100644 --- a/tests/lib/js/static_interop_test/number_test.dart +++ b/tests/lib/js/static_interop_test/number_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - // Test that external members returning numbers have correct semantics. import 'dart:js_interop'; diff --git a/tests/lib/typed_data/float32x4_weak_test.dart b/tests/lib/typed_data/float32x4_weak_test.dart deleted file mode 100644 index 38923779e9a..00000000000 --- a/tests/lib/typed_data/float32x4_weak_test.dart +++ /dev/null @@ -1,534 +0,0 @@ -// Copyright (c) 2013, 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. -// VMOptions=--max_deoptimization_counter_threshold=1000 --optimization-counter-threshold=10 --no-background-compilation -// VMOptions=--no-intrinsify - -// Requirements=nnbd-weak - -// Library tag to be able to run in html test framework. -library float32x4_test; - -import 'dart:typed_data'; -import "package:expect/expect.dart"; - -testAdd() { - var m = new Float32x4(-1.0, -2.0, -3.0, -4.0); - var n = new Float32x4(1.0, 2.0, 3.0, 4.0); - var o = m + n; - Expect.equals(0.0, o.x); - Expect.equals(0.0, o.y); - Expect.equals(0.0, o.z); - Expect.equals(0.0, o.w); -} - -testNegate() { - var m = new Float32x4(1.0, 2.0, -3.0, -4.0); - m = -m; - Expect.equals(-1.0, m.x); - Expect.equals(-2.0, m.y); - Expect.equals(3.0, m.z); - Expect.equals(4.0, m.w); -} - -testSub() { - var m = new Float32x4(-1.0, -2.0, -3.0, -4.0); - var n = new Float32x4(1.0, 2.0, 3.0, 4.0); - var o = m - n; - Expect.equals(-2.0, o.x); - Expect.equals(-4.0, o.y); - Expect.equals(-6.0, o.z); - Expect.equals(-8.0, o.w); -} - -testMul() { - var m = new Float32x4(-1.0, -2.0, -3.0, -4.0); - var n = new Float32x4(1.0, 2.0, 3.0, 4.0); - var o = m * n; - Expect.equals(-1.0, o.x); - Expect.equals(-4.0, o.y); - Expect.equals(-9.0, o.z); - Expect.equals(-16.0, o.w); -} - -testDiv() { - var m = new Float32x4(-1.0, -2.0, -3.0, -4.0); - var n = new Float32x4(1.0, 2.0, 3.0, 4.0); - var o = m / n; - Expect.equals(-1.0, o.x); - Expect.equals(-1.0, o.y); - Expect.equals(-1.0, o.z); - Expect.equals(-1.0, o.w); -} - -testComparison() { - var m = new Float32x4(1.0, 2.0, 0.1, 0.001); - var n = new Float32x4(2.0, 2.0, 0.001, 0.1); - var cmp; - cmp = m.lessThan(n); - Expect.equals(-1, cmp.x); - Expect.equals(0x0, cmp.y); - Expect.equals(0x0, cmp.z); - Expect.equals(-1, cmp.w); - - cmp = m.lessThanOrEqual(n); - Expect.equals(-1, cmp.x); - Expect.equals(-1, cmp.y); - Expect.equals(0x0, cmp.z); - Expect.equals(-1, cmp.w); - - cmp = m.equal(n); - Expect.equals(0x0, cmp.x); - Expect.equals(-1, cmp.y); - Expect.equals(0x0, cmp.z); - Expect.equals(0x0, cmp.w); - - cmp = m.notEqual(n); - Expect.equals(-1, cmp.x); - Expect.equals(0x0, cmp.y); - Expect.equals(-1, cmp.z); - Expect.equals(-1, cmp.w); - - cmp = m.greaterThanOrEqual(n); - Expect.equals(0x0, cmp.x); - Expect.equals(-1, cmp.y); - Expect.equals(-1, cmp.z); - Expect.equals(0x0, cmp.w); - - cmp = m.greaterThan(n); - Expect.equals(0x0, cmp.x); - Expect.equals(0x0, cmp.y); - Expect.equals(-1, cmp.z); - Expect.equals(0x0, cmp.w); -} - -testAbs() { - var m = new Float32x4(1.0, -2.0, 3.0, -4.0); - m = m.abs(); - Expect.equals(1.0, m.x); - Expect.equals(2.0, m.y); - Expect.equals(3.0, m.z); - Expect.equals(4.0, m.w); -} - -testScale() { - var m = new Float32x4(1.0, -2.0, 3.0, -4.0); - m = m.scale(20.0); - Expect.equals(20.0, m.x); - Expect.equals(-40.0, m.y); - Expect.equals(60.0, m.z); - Expect.equals(-80.0, m.w); -} - -testClamp() { - var m = new Float32x4(1.0, -2.0, 3.0, -4.0); - var lo = new Float32x4(0.0, 0.0, 0.0, 0.0); - var hi = new Float32x4(2.0, 2.0, 2.0, 2.0); - m = m.clamp(lo, hi); - Expect.equals(1.0, m.x); - Expect.equals(0.0, m.y); - Expect.equals(2.0, m.z); - Expect.equals(0.0, m.w); -} - -testShuffle() { - var m = new Float32x4(1.0, 2.0, 3.0, 4.0); - var xxxx = m.shuffle(Float32x4.xxxx); - Expect.equals(1.0, xxxx.x); - Expect.equals(1.0, xxxx.y); - Expect.equals(1.0, xxxx.z); - Expect.equals(1.0, xxxx.w); - var yyyy = m.shuffle(Float32x4.yyyy); - Expect.equals(2.0, yyyy.x); - Expect.equals(2.0, yyyy.y); - Expect.equals(2.0, yyyy.z); - Expect.equals(2.0, yyyy.w); - var zzzz = m.shuffle(Float32x4.zzzz); - Expect.equals(3.0, zzzz.x); - Expect.equals(3.0, zzzz.y); - Expect.equals(3.0, zzzz.z); - Expect.equals(3.0, zzzz.w); - var wwww = m.shuffle(Float32x4.wwww); - Expect.equals(4.0, wwww.x); - Expect.equals(4.0, wwww.y); - Expect.equals(4.0, wwww.z); - Expect.equals(4.0, wwww.w); - var wzyx = m.shuffle(Float32x4.wzyx); - Expect.equals(4.0, wzyx.x); - Expect.equals(3.0, wzyx.y); - Expect.equals(2.0, wzyx.z); - Expect.equals(1.0, wzyx.w); - var wwzz = m.shuffle(Float32x4.wwzz); - Expect.equals(4.0, wwzz.x); - Expect.equals(4.0, wwzz.y); - Expect.equals(3.0, wwzz.z); - Expect.equals(3.0, wwzz.w); - var xxyy = m.shuffle(Float32x4.xxyy); - Expect.equals(1.0, xxyy.x); - Expect.equals(1.0, xxyy.y); - Expect.equals(2.0, xxyy.z); - Expect.equals(2.0, xxyy.w); - var yyww = m.shuffle(Float32x4.yyww); - Expect.equals(2.0, yyww.x); - Expect.equals(2.0, yyww.y); - Expect.equals(4.0, yyww.z); - Expect.equals(4.0, yyww.w); -} - -testMin() { - var m = new Float32x4(1.0, 2.0, 3.0, 4.0); - var n = new Float32x4(1.0, 0.0, 2.5, 5.0); - m = m.min(n); - Expect.equals(1.0, m.x); - Expect.equals(0.0, m.y); - Expect.equals(2.5, m.z); - Expect.equals(4.0, m.w); -} - -testMax() { - var m = new Float32x4(1.0, 2.0, 3.0, 4.0); - var n = new Float32x4(1.0, 0.0, 2.5, 5.0); - m = m.max(n); - Expect.equals(1.0, m.x); - Expect.equals(2.0, m.y); - Expect.equals(3.0, m.z); - Expect.equals(5.0, m.w); -} - -testSqrt() { - var m = new Float32x4(1.0, 4.0, 9.0, 16.0); - m = m.sqrt(); - Expect.equals(1.0, m.x); - Expect.equals(2.0, m.y); - Expect.equals(3.0, m.z); - Expect.equals(4.0, m.w); -} - -testReciprocal() { - var m = new Float32x4(1.0, 4.0, 9.0, 16.0); - m = m.reciprocal(); - Expect.approxEquals(1.0, m.x, 0.001); - Expect.approxEquals(0.25, m.y, 0.001); - Expect.approxEquals(0.1111111, m.z, 0.001); - Expect.approxEquals(0.0625, m.w, 0.001); -} - -testReciprocalSqrt() { - var m = new Float32x4(1.0, 0.25, 0.111111, 0.0625); - m = m.reciprocalSqrt(); - Expect.approxEquals(1.0, m.x, 0.001); - Expect.approxEquals(2.0, m.y, 0.001); - Expect.approxEquals(3.0, m.z, 0.001); - Expect.approxEquals(4.0, m.w, 0.001); -} - -testSelect() { - var m = new Int32x4.bool(true, true, false, false); - var t = new Float32x4(1.0, 2.0, 3.0, 4.0); - var f = new Float32x4(5.0, 6.0, 7.0, 8.0); - var s = m.select(t, f); - Expect.equals(1.0, s.x); - Expect.equals(2.0, s.y); - Expect.equals(7.0, s.z); - Expect.equals(8.0, s.w); -} - -testConversions() { - var m = new Int32x4(0x3F800000, 0x40000000, 0x40400000, 0x40800000); - var n = new Float32x4.fromInt32x4Bits(m); - Expect.equals(1.0, n.x); - Expect.equals(2.0, n.y); - Expect.equals(3.0, n.z); - Expect.equals(4.0, n.w); - n = new Float32x4(5.0, 6.0, 7.0, 8.0); - m = new Int32x4.fromFloat32x4Bits(n); - Expect.equals(0x40A00000, m.x); - Expect.equals(0x40C00000, m.y); - Expect.equals(0x40E00000, m.z); - Expect.equals(0x41000000, m.w); - // Flip sign using bit-wise operators. - n = new Float32x4(9.0, 10.0, 11.0, 12.0); - m = new Int32x4(0x80000000, 0x80000000, 0x80000000, 0x80000000); - var nMask = new Int32x4.fromFloat32x4Bits(n); - nMask = nMask ^ m; // flip sign. - n = new Float32x4.fromInt32x4Bits(nMask); - Expect.equals(-9.0, n.x); - Expect.equals(-10.0, n.y); - Expect.equals(-11.0, n.z); - Expect.equals(-12.0, n.w); - nMask = new Int32x4.fromFloat32x4Bits(n); - nMask = nMask ^ m; // flip sign. - n = new Float32x4.fromInt32x4Bits(nMask); - Expect.equals(9.0, n.x); - Expect.equals(10.0, n.y); - Expect.equals(11.0, n.z); - Expect.equals(12.0, n.w); -} - -testBitOperators() { - var m = new Int32x4(0xAAAAAAA, 0xAAAAAAA, 0xAAAAAAA, 0xAAAAAAA); - var n = new Int32x4(0x5555555, 0x5555555, 0x5555555, 0x5555555); - Expect.equals(0xAAAAAAA, m.x); - Expect.equals(0xAAAAAAA, m.y); - Expect.equals(0xAAAAAAA, m.z); - Expect.equals(0xAAAAAAA, m.w); - Expect.equals(0x5555555, n.x); - Expect.equals(0x5555555, n.y); - Expect.equals(0x5555555, n.z); - Expect.equals(0x5555555, n.w); - Expect.equals(true, n.flagX); - Expect.equals(true, n.flagY); - Expect.equals(true, n.flagZ); - Expect.equals(true, n.flagW); - var o = m | n; // or - Expect.equals(0xFFFFFFF, o.x); - Expect.equals(0xFFFFFFF, o.y); - Expect.equals(0xFFFFFFF, o.z); - Expect.equals(0xFFFFFFF, o.w); - Expect.equals(true, o.flagX); - Expect.equals(true, o.flagY); - Expect.equals(true, o.flagZ); - Expect.equals(true, o.flagW); - o = m & n; // and - Expect.equals(0x0, o.x); - Expect.equals(0x0, o.y); - Expect.equals(0x0, o.z); - Expect.equals(0x0, o.w); - n = n.withX(0xAAAAAAA); - n = n.withY(0xAAAAAAA); - n = n.withZ(0xAAAAAAA); - n = n.withW(0xAAAAAAA); - Expect.equals(0xAAAAAAA, n.x); - Expect.equals(0xAAAAAAA, n.y); - Expect.equals(0xAAAAAAA, n.z); - Expect.equals(0xAAAAAAA, n.w); - o = m ^ n; // xor - Expect.equals(0x0, o.x); - Expect.equals(0x0, o.y); - Expect.equals(0x0, o.z); - Expect.equals(0x0, o.w); - Expect.equals(false, o.flagX); - Expect.equals(false, o.flagY); - Expect.equals(false, o.flagZ); - Expect.equals(false, o.flagW); -} - -testSetters() { - var f = new Float32x4.zero(); - Expect.equals(0.0, f.x); - Expect.equals(0.0, f.y); - Expect.equals(0.0, f.z); - Expect.equals(0.0, f.w); - f = f.withX(4.0); - Expect.equals(4.0, f.x); - f = f.withY(3.0); - Expect.equals(3.0, f.y); - f = f.withZ(2.0); - Expect.equals(2.0, f.z); - f = f.withW(1.0); - Expect.equals(1.0, f.w); - f = new Float32x4.zero(); - f = f.withX(4.0).withZ(2.0).withW(1.0).withY(3.0); - Expect.equals(4.0, f.x); - Expect.equals(3.0, f.y); - Expect.equals(2.0, f.z); - Expect.equals(1.0, f.w); - var m = new Int32x4.bool(false, false, false, false); - Expect.equals(false, m.flagX); - Expect.equals(false, m.flagY); - Expect.equals(false, m.flagZ); - Expect.equals(false, m.flagW); - m = m.withFlagX(true); - Expect.equals(true, m.flagX); - Expect.equals(false, m.flagY); - Expect.equals(false, m.flagZ); - Expect.equals(false, m.flagW); - m = m.withFlagY(true); - Expect.equals(true, m.flagX); - Expect.equals(true, m.flagY); - Expect.equals(false, m.flagZ); - Expect.equals(false, m.flagW); - m = m.withFlagZ(true); - Expect.equals(true, m.flagX); - Expect.equals(true, m.flagY); - Expect.equals(true, m.flagZ); - Expect.equals(false, m.flagW); - m = m.withFlagW(true); - Expect.equals(true, m.flagX); - Expect.equals(true, m.flagY); - Expect.equals(true, m.flagZ); - Expect.equals(true, m.flagW); -} - -testGetters() { - var f = new Float32x4(1.0, 2.0, 3.0, 4.0); - Expect.equals(1.0, f.x); - Expect.equals(2.0, f.y); - Expect.equals(3.0, f.z); - Expect.equals(4.0, f.w); - var m = new Int32x4.bool(false, true, true, false); - Expect.equals(false, m.flagX); - Expect.equals(true, m.flagY); - Expect.equals(true, m.flagZ); - Expect.equals(false, m.flagW); -} - -void testSplat() { - var f = new Float32x4.splat(2.0); - Expect.equals(2.0, f.x); - Expect.equals(2.0, f.y); - Expect.equals(2.0, f.z); - Expect.equals(2.0, f.w); -} - -void testZero() { - var f = new Float32x4.zero(); - Expect.equals(0.0, f.x); - Expect.equals(0.0, f.y); - Expect.equals(0.0, f.z); - Expect.equals(0.0, f.w); -} - -void testConstructor() { - var f = new Float32x4(1.0, 2.0, 3.0, 4.0); - Expect.equals(1.0, f.x); - Expect.equals(2.0, f.y); - Expect.equals(3.0, f.z); - Expect.equals(4.0, f.w); -} - -void testBadArguments() { - // This test runs in weak checking mode, so `e as double` will complete - // normally when `e` evaluates to the null object. This means that we do - // not get the `TypeError` that we would have in strong checking mode, but - // we happen to get an `ArgumentError` from the body of the constructor. - - dynamic dynamicNull = null; - Expect.throwsArgumentError(() => new Float32x4(dynamicNull, 2.0, 3.0, 4.0)); - Expect.throwsArgumentError(() => new Float32x4(1.0, dynamicNull, 3.0, 4.0)); - Expect.throwsArgumentError(() => new Float32x4(1.0, 2.0, dynamicNull, 4.0)); - Expect.throwsArgumentError(() => new Float32x4(1.0, 2.0, 3.0, dynamicNull)); - - bool isTypeError(e) => e is TypeError; - - // Use local variable typed as "dynamic" to avoid static warnings. - // When `e` evaluates to a string, `e as double` will fail, so we do get - // the `TypeError`. - dynamic str = "foo"; - Expect.throws(() => new Float32x4(str, 2.0, 3.0, 4.0), isTypeError); - Expect.throws(() => new Float32x4(1.0, str, 3.0, 4.0), isTypeError); - Expect.throws(() => new Float32x4(1.0, 2.0, str, 4.0), isTypeError); - Expect.throws(() => new Float32x4(1.0, 2.0, 3.0, str), isTypeError); -} - -void testSpecialValues() { - /// Same as Expect.identical, but also works with NaNs and -0.0 for dart2js. - void checkEquals(expected, actual) { - if (expected.isNaN) { - Expect.isTrue(actual.isNaN); - } else if (expected == 0.0 && expected.isNegative) { - Expect.isTrue(actual == 0.0 && actual.isNegative); - } else { - Expect.equals(expected, actual); - } - } - - var pairs = [ - [0.0, 0.0], - [5e-324, 0.0], - [2.225073858507201e-308, 0.0], - [2.2250738585072014e-308, 0.0], - [0.9999999999999999, 1.0], - [1.0, 1.0], - [1.0000000000000002, 1.0], - [4294967295.0, 4294967296.0], - [4294967296.0, 4294967296.0], - [4503599627370495.5, 4503599627370496.0], - [9007199254740992.0, 9007199254740992.0], - [1.7976931348623157e+308, double.infinity], - [0.49999999999999994, 0.5], - [4503599627370497.0, 4503599627370496.0], - [9007199254740991.0, 9007199254740992.0], - [double.infinity, double.infinity], - [double.nan, double.nan], - ]; - - var conserved = [ - 1.401298464324817e-45, - 1.1754942106924411e-38, - 1.1754943508222875e-38, - 0.9999999403953552, - 1.0000001192092896, - 8388607.5, - 8388608.0, - 3.4028234663852886e+38, - 8388609.0, - 16777215.0, - ]; - - var minusPairs = pairs.map((pair) { - return [-pair[0], -pair[1]]; - }); - var conservedPairs = conserved.map((value) => [value, value]); - - var allTests = [pairs, minusPairs, conservedPairs].expand((x) => x); - - for (var pair in allTests) { - var input = pair[0]; - var expected = pair[1]; - var f; - f = new Float32x4(input, 2.0, 3.0, 4.0); - checkEquals(expected, f.x); - Expect.equals(2.0, f.y); - Expect.equals(3.0, f.z); - Expect.equals(4.0, f.w); - - f = new Float32x4(1.0, input, 3.0, 4.0); - Expect.equals(1.0, f.x); - checkEquals(expected, f.y); - Expect.equals(3.0, f.z); - Expect.equals(4.0, f.w); - - f = new Float32x4(1.0, 2.0, input, 4.0); - Expect.equals(1.0, f.x); - Expect.equals(2.0, f.y); - checkEquals(expected, f.z); - Expect.equals(4.0, f.w); - - f = new Float32x4(1.0, 2.0, 3.0, input); - Expect.equals(1.0, f.x); - Expect.equals(2.0, f.y); - Expect.equals(3.0, f.z); - checkEquals(expected, f.w); - } -} - -main() { - for (int i = 0; i < 20; i++) { - testConstructor(); - testSplat(); - testZero(); - testAdd(); - testGetters(); - testSetters(); - testBitOperators(); - testConversions(); - testSelect(); - testShuffle(); - testSub(); - testNegate(); - testMul(); - testDiv(); - testComparison(); - testScale(); - testClamp(); - testAbs(); - testMin(); - testMax(); - testSqrt(); - testReciprocal(); - testReciprocalSqrt(); - testBadArguments(); - testSpecialValues(); - } -} diff --git a/tests/lib/typed_data/int32x4_test.dart b/tests/lib/typed_data/int32x4_test.dart index aa0a117187c..b113d0bfed8 100644 --- a/tests/lib/typed_data/int32x4_test.dart +++ b/tests/lib/typed_data/int32x4_test.dart @@ -4,8 +4,6 @@ // VMOptions=--max_deoptimization_counter_threshold=1000 --optimization-counter-threshold=10 --no-background-compilation // VMOptions=--no-intrinsify -// Requirements=nnbd-strong - library int32x4_test; import 'dart:typed_data'; diff --git a/tests/lib/typed_data/int32x4_weak_test.dart b/tests/lib/typed_data/int32x4_weak_test.dart deleted file mode 100644 index 15134989550..00000000000 --- a/tests/lib/typed_data/int32x4_weak_test.dart +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014, 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. -// VMOptions=--max_deoptimization_counter_threshold=1000 --optimization-counter-threshold=10 --no-background-compilation -// VMOptions=--no-intrinsify - -// Requirements=nnbd-weak - -library int32x4_test; - -import 'dart:typed_data'; -import 'package:expect/expect.dart'; - -void testBadArguments() { - // This test runs in weak checking mode, so `e as int` will complete - // normally when `e` evaluates to the null object. This means that we do - // not get the `TypeError` that we would have in strong checking mode, but - // we happen to get an `ArgumentError` from the body of the constructor. - - dynamic dynamicNull = null; - Expect.throwsArgumentError(() => new Int32x4(dynamicNull, 2, 3, 4)); - Expect.throwsArgumentError(() => new Int32x4(1, dynamicNull, 3, 4)); - Expect.throwsArgumentError(() => new Int32x4(1, 2, dynamicNull, 4)); - Expect.throwsArgumentError(() => new Int32x4(1, 2, 3, dynamicNull)); - - bool isTypeError(e) => e is TypeError; - - // Use a local variable typed as dynamic to avoid static warnings. - dynamic str = "foo"; - Expect.throws(() => new Int32x4(str, 2, 3, 4), isTypeError); - Expect.throws(() => new Int32x4(1, str, 3, 4), isTypeError); - Expect.throws(() => new Int32x4(1, 2, str, 4), isTypeError); - Expect.throws(() => new Int32x4(1, 2, 3, str), isTypeError); - // Use a local variable typed as dynamic to avoid static warnings. - dynamic d = 0.5; - Expect.throws(() => new Int32x4(d, 2, 3, 4), isTypeError); - Expect.throws(() => new Int32x4(1, d, 3, 4), isTypeError); - Expect.throws(() => new Int32x4(1, 2, d, 4), isTypeError); - Expect.throws(() => new Int32x4(1, 2, 3, d), isTypeError); -} - -void testBigArguments() { - var tests = [ - [0x8901234567890, 0x34567890], - [0x89012A4567890, -1537836912], - [0x80000000, -2147483648], - [-0x80000000, -2147483648], - [0x7fffffff, 2147483647], - [-0x7fffffff, -2147483647], - ]; - var int32x4; - - for (var test in tests) { - var input = test[0]; - var expected = test[1]; - - int32x4 = new Int32x4(input, 2, 3, 4); - Expect.equals(expected, int32x4.x); - Expect.equals(2, int32x4.y); - Expect.equals(3, int32x4.z); - Expect.equals(4, int32x4.w); - - int32x4 = new Int32x4(1, input, 3, 4); - Expect.equals(1, int32x4.x); - Expect.equals(expected, int32x4.y); - Expect.equals(3, int32x4.z); - Expect.equals(4, int32x4.w); - - int32x4 = new Int32x4(1, 2, input, 4); - Expect.equals(1, int32x4.x); - Expect.equals(2, int32x4.y); - Expect.equals(expected, int32x4.z); - Expect.equals(4, int32x4.w); - - int32x4 = new Int32x4(1, 2, 3, input); - Expect.equals(1, int32x4.x); - Expect.equals(2, int32x4.y); - Expect.equals(3, int32x4.z); - Expect.equals(expected, int32x4.w); - } -} - -main() { - for (int i = 0; i < 20; i++) { - testBigArguments(); - testBadArguments(); - } -} diff --git a/tests/lib/typed_data/simd_type_null_params_error_test.dart b/tests/lib/typed_data/simd_type_null_params_error_test.dart index ac51f9552a6..2331cc16b51 100644 --- a/tests/lib/typed_data/simd_type_null_params_error_test.dart +++ b/tests/lib/typed_data/simd_type_null_params_error_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - // Many other tests will check that static nullability checks are applied to // actual arguments of regular function invocations. This test is still not // redundant, because it involves a built-in type and methods subject to diff --git a/tests/lib/typed_data/simd_type_null_params_test.dart b/tests/lib/typed_data/simd_type_null_params_test.dart index 5a88def48e7..60146cc8f5e 100644 --- a/tests/lib/typed_data/simd_type_null_params_test.dart +++ b/tests/lib/typed_data/simd_type_null_params_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import 'dart:typed_data'; import "package:expect/expect.dart"; diff --git a/tests/lib/typed_data/simd_type_null_params_weak_test.dart b/tests/lib/typed_data/simd_type_null_params_weak_test.dart deleted file mode 100644 index b23c2cabd9a..00000000000 --- a/tests/lib/typed_data/simd_type_null_params_weak_test.dart +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Requirements=nnbd-weak - -import 'dart:typed_data'; -import "package:expect/expect.dart"; - -bool throwsSomeError(void Function() f) { - try { - f(); - } catch (e) { - return e is TypeError || - e is NoSuchMethodError || - e is ArgumentError || - e is AssertionError; - } - return false; -} - -main() { - dynamic dynamicNull = null; - // Float32x4 - final float32x4 = Float32x4(0.0, 0.0, 0.0, 0.0); - Expect.equals(true, throwsSomeError(() => float32x4 + dynamicNull)); - Expect.equals(true, throwsSomeError(() => float32x4 - dynamicNull)); - Expect.equals(true, throwsSomeError(() => float32x4 * dynamicNull)); - Expect.equals(true, throwsSomeError(() => float32x4 / dynamicNull)); - Expect.equals(true, throwsSomeError(() => float32x4.lessThan(dynamicNull))); - Expect.equals( - true, - throwsSomeError(() => float32x4.lessThanOrEqual(dynamicNull)), - ); - Expect.equals( - true, - throwsSomeError(() => float32x4.greaterThan(dynamicNull)), - ); - Expect.equals( - true, - throwsSomeError(() => float32x4.greaterThanOrEqual(dynamicNull)), - ); - Expect.equals(true, throwsSomeError(() => float32x4.equal(dynamicNull))); - Expect.equals(true, throwsSomeError(() => float32x4.notEqual(dynamicNull))); - Expect.equals(true, throwsSomeError(() => float32x4.scale(dynamicNull))); - Expect.equals( - true, - throwsSomeError(() => float32x4.clamp(dynamicNull, float32x4)), - ); - Expect.equals( - true, - throwsSomeError(() => float32x4.clamp(float32x4, dynamicNull)), - ); - Expect.equals(true, throwsSomeError(() => float32x4.shuffle(dynamicNull))); - Expect.equals( - true, - throwsSomeError(() => float32x4.shuffleMix(float32x4, dynamicNull)), - ); - Expect.equals( - true, - throwsSomeError(() => float32x4.shuffleMix(dynamicNull, 0)), - ); - Expect.equals(true, throwsSomeError(() => float32x4.withX(dynamicNull))); - Expect.equals(true, throwsSomeError(() => float32x4.withY(dynamicNull))); - Expect.equals(true, throwsSomeError(() => float32x4.withZ(dynamicNull))); - Expect.equals(true, throwsSomeError(() => float32x4.withW(dynamicNull))); - Expect.equals(true, throwsSomeError(() => float32x4.min(dynamicNull))); - Expect.equals(true, throwsSomeError(() => float32x4.max(dynamicNull))); - Expect.equals( - true, - throwsSomeError(() => Float32x4(dynamicNull, 0.0, 0.0, 0.0)), - ); - Expect.equals( - true, - throwsSomeError(() => Float32x4(0.0, dynamicNull, 0.0, 0.0)), - ); - Expect.equals( - true, - throwsSomeError(() => Float32x4(0.0, 0.0, dynamicNull, 0.0)), - ); - Expect.equals( - true, - throwsSomeError(() => Float32x4(0.0, 0.0, 0.0, dynamicNull)), - ); - - // Float32x4.splat - Expect.equals(true, throwsSomeError(() => Float32x4.splat(dynamicNull))); - - // Float64x2 - final float64x2 = Float64x2(0.0, 0.0); - Expect.equals(true, throwsSomeError(() => float64x2 + dynamicNull)); - Expect.equals(true, throwsSomeError(() => float64x2 - dynamicNull)); - Expect.equals(true, throwsSomeError(() => float64x2 * dynamicNull)); - Expect.equals(true, throwsSomeError(() => float64x2 / dynamicNull)); - Expect.equals(true, throwsSomeError(() => float64x2.scale(dynamicNull))); - Expect.equals( - true, - throwsSomeError(() => float64x2.clamp(dynamicNull, float64x2)), - ); - Expect.equals( - true, - throwsSomeError(() => float64x2.clamp(float64x2, dynamicNull)), - ); - Expect.equals(true, throwsSomeError(() => float64x2.withX(dynamicNull))); - Expect.equals(true, throwsSomeError(() => float64x2.withY(dynamicNull))); - Expect.equals(true, throwsSomeError(() => Float64x2(dynamicNull, 0.0))); - Expect.equals(true, throwsSomeError(() => Float64x2(0.0, dynamicNull))); - Expect.equals(true, throwsSomeError(() => float64x2.min(dynamicNull))); - Expect.equals(true, throwsSomeError(() => float64x2.max(dynamicNull))); - - // Float64x2.splat - Expect.equals(true, throwsSomeError(() => Float64x2.splat(dynamicNull))); - - // Int32x4 - final int32x4 = Int32x4(0, 0, 0, 0); - Expect.equals(true, throwsSomeError(() => int32x4 + dynamicNull)); - Expect.equals(true, throwsSomeError(() => int32x4 - dynamicNull)); - Expect.equals(true, throwsSomeError(() => int32x4 ^ dynamicNull)); - Expect.equals(true, throwsSomeError(() => int32x4 & dynamicNull)); - Expect.equals(true, throwsSomeError(() => int32x4 | dynamicNull)); - Expect.equals(true, throwsSomeError(() => int32x4.shuffle(dynamicNull))); - Expect.equals( - true, - throwsSomeError(() => int32x4.shuffleMix(int32x4, dynamicNull)), - ); - Expect.equals( - true, - throwsSomeError(() => int32x4.shuffleMix(dynamicNull, 0)), - ); - Expect.equals(true, throwsSomeError(() => int32x4.withX(dynamicNull))); - Expect.equals(true, throwsSomeError(() => int32x4.withY(dynamicNull))); - Expect.equals(true, throwsSomeError(() => int32x4.withZ(dynamicNull))); - Expect.equals(true, throwsSomeError(() => int32x4.withW(dynamicNull))); - Expect.equals(true, throwsSomeError(() => int32x4.withFlagX(dynamicNull))); - Expect.equals(true, throwsSomeError(() => int32x4.withFlagY(dynamicNull))); - Expect.equals(true, throwsSomeError(() => int32x4.withFlagZ(dynamicNull))); - Expect.equals(true, throwsSomeError(() => int32x4.withFlagW(dynamicNull))); - - Expect.equals(true, throwsSomeError(() => Int32x4(dynamicNull, 0, 0, 0))); - Expect.equals(true, throwsSomeError(() => Int32x4(0, dynamicNull, 0, 0))); - Expect.equals(true, throwsSomeError(() => Int32x4(0, 0, dynamicNull, 0))); - Expect.equals(true, throwsSomeError(() => Int32x4(0, 0, 0, dynamicNull))); - Expect.equals( - true, - throwsSomeError(() => int32x4.select(dynamicNull, float32x4)), - ); - Expect.equals( - true, - throwsSomeError(() => int32x4.select(float32x4, dynamicNull)), - ); - - // Int32x4.bool - Expect.equals( - true, - throwsSomeError(() => Int32x4.bool(dynamicNull, false, false, false)), - ); - Expect.equals( - true, - throwsSomeError(() => Int32x4.bool(false, dynamicNull, false, false)), - ); - Expect.equals( - true, - throwsSomeError(() => Int32x4.bool(false, false, dynamicNull, false)), - ); - Expect.equals( - true, - throwsSomeError(() => Int32x4.bool(false, false, false, dynamicNull)), - ); -} diff --git a/tests/standalone/package/scenarios/packages_file_strange_formatting/empty_lines_test.dart b/tests/standalone/package/scenarios/packages_file_strange_formatting/empty_lines_test.dart deleted file mode 100644 index 1b77992def1..00000000000 --- a/tests/standalone/package/scenarios/packages_file_strange_formatting/empty_lines_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2015, 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. - -// Packages=empty_lines.packages - -// This test verifies handling of legacy .packages file and cannot be run in -// null safety (strong) mode as strong mode needs new package_config.json. -// Requirements=nnbd-weak - -library empty_lines_test; - -import 'package:foo/foo.dart' as foo; -import 'package:bar/bar.dart' as bar; -import 'package:baz/baz.dart' as baz; - -main() { - if (foo.foo != 'foo') { - throw new Exception('package "foo" was not resolved correctly'); - } - if (bar.bar != 'bar') { - throw new Exception('package "bar" was not resolved correctly'); - } - if (baz.baz != 'baz') { - throw new Exception('package "baz" was not resolved correctly'); - } -} diff --git a/tests/standalone/package/scenarios/packages_file_strange_formatting/empty_package_dir_test.dart b/tests/standalone/package/scenarios/packages_file_strange_formatting/empty_package_dir_test.dart deleted file mode 100644 index 0dd8b09386f..00000000000 --- a/tests/standalone/package/scenarios/packages_file_strange_formatting/empty_package_dir_test.dart +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2015, 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. - -// Formatting can break multitests, so don't format them. -// dart format off - -// Packages=empty_package_dir.packages - -// This test verifies handling of legacy .packages file and cannot be run in -// null safety (strong) mode as strong mode needs new package_config.json. -// Requirements=nnbd-weak - -// In this test, we give a packages file that associates the package 'foo' with -// the empty string. This causes both the VM and dart2js to resolve -// 'package:foo' imports relative to the root directory. So the import statement -// `import 'package:foo/foo.dart'` is equivalent to `import '/foo.dart'`. -library empty_package_dir_test; - -import 'package:foo/foo.dart'; //# 01: compile-time error - -main() {} diff --git a/tests/standalone/package/scenarios/packages_file_strange_formatting/mixed_line_ends_test.dart b/tests/standalone/package/scenarios/packages_file_strange_formatting/mixed_line_ends_test.dart deleted file mode 100644 index b41423a6394..00000000000 --- a/tests/standalone/package/scenarios/packages_file_strange_formatting/mixed_line_ends_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2015, 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. - -// Packages=mixed_line_ends.packages - -// This test verifies handling of legacy .packages file and cannot be run in -// null safety (strong) mode as strong mode needs new package_config.json. -// Requirements=nnbd-weak - -library mixed_line_ends_test; - -import 'package:foo/foo.dart' as foo; -import 'package:bar/bar.dart' as bar; -import 'package:baz/baz.dart' as baz; - -main() { - if (foo.foo != 'foo') { - throw new Exception('package "foo" was not resolved correctly'); - } - if (bar.bar != 'bar') { - throw new Exception('package "bar" was not resolved correctly'); - } - if (baz.baz != 'baz') { - throw new Exception('package "baz" was not resolved correctly'); - } -} diff --git a/tests/web/deferred/deferred_apply_test.dart b/tests/web/deferred/deferred_apply_test.dart index c01dc76a3d6..a2037e1b451 100644 --- a/tests/web/deferred/deferred_apply_test.dart +++ b/tests/web/deferred/deferred_apply_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import 'package:expect/expect.dart'; import 'deferred_apply_lib.dart' deferred as lib; diff --git a/tests/web/internal/rti/required_named_parameters_test.dart b/tests/web/internal/rti/required_named_parameters_test.dart index 54b50e1dd80..9229e482c72 100644 --- a/tests/web/internal/rti/required_named_parameters_test.dart +++ b/tests/web/internal/rti/required_named_parameters_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd - import 'dart:_rti' as rti; import 'dart:_foreign_helper' show JS; import "package:expect/expect.dart"; diff --git a/tests/web/native/native_null_assertions/flag_disabled_non_web_test.dart b/tests/web/native/native_null_assertions/flag_disabled_non_web_test.dart index 660a5464ade..7ed8c58dd35 100644 --- a/tests/web/native/native_null_assertions/flag_disabled_non_web_test.dart +++ b/tests/web/native/native_null_assertions/flag_disabled_non_web_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong // dart2jsOptions=--no-native-null-assertions import 'non_web_library_interfaces.dart'; diff --git a/tests/web/native/native_null_assertions/flag_disabled_web_test.dart b/tests/web/native/native_null_assertions/flag_disabled_web_test.dart index 8b7ee4cce1d..ee0d648cbf7 100644 --- a/tests/web/native/native_null_assertions/flag_disabled_web_test.dart +++ b/tests/web/native/native_null_assertions/flag_disabled_web_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong // dart2jsOptions=--no-native-null-assertions import 'null_assertions_test_lib.dart'; diff --git a/tests/web/native/native_null_assertions/flag_enabled_non_web_test.dart b/tests/web/native/native_null_assertions/flag_enabled_non_web_test.dart index e9236573ae0..61c018ba5e6 100644 --- a/tests/web/native/native_null_assertions/flag_enabled_non_web_test.dart +++ b/tests/web/native/native_null_assertions/flag_enabled_non_web_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong // dart2jsOptions=--native-null-assertions import 'non_web_library_interfaces.dart'; diff --git a/tests/web/native/native_null_assertions/flag_enabled_optimized_web_test.dart b/tests/web/native/native_null_assertions/flag_enabled_optimized_web_test.dart index 43d97105aa8..517e3e9fe99 100644 --- a/tests/web/native/native_null_assertions/flag_enabled_optimized_web_test.dart +++ b/tests/web/native/native_null_assertions/flag_enabled_optimized_web_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong // dart2jsOptions=-O3 --native-null-assertions import 'null_assertions_test_lib.dart'; diff --git a/tests/web/native/native_null_assertions/flag_enabled_unsound_web_test.dart b/tests/web/native/native_null_assertions/flag_enabled_unsound_web_test.dart deleted file mode 100644 index b5ba3630755..00000000000 --- a/tests/web/native/native_null_assertions/flag_enabled_unsound_web_test.dart +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2023, 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. - -// Requirements=nnbd-weak -// dart2jsOptions=--native-null-assertions - -import 'null_assertions_test_lib.dart'; -import 'web_library_interfaces.dart'; - -void main() { - // To avoid a breaking change, we don't enable checks even if the user passes - // the flag in unsound mode. - var flagEnabled = false; - testNativeNullAssertions(flagEnabled); - testJSInvocationNullAssertions(flagEnabled); -} diff --git a/tests/web/native/native_null_assertions/flag_enabled_web_test.dart b/tests/web/native/native_null_assertions/flag_enabled_web_test.dart index 2c41d2a8426..71baddfc8d3 100644 --- a/tests/web/native/native_null_assertions/flag_enabled_web_test.dart +++ b/tests/web/native/native_null_assertions/flag_enabled_web_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong // dart2jsOptions=--native-null-assertions import 'null_assertions_test_lib.dart'; diff --git a/tests/web/native/native_null_assertions/no_flag_optimized_web_test.dart b/tests/web/native/native_null_assertions/no_flag_optimized_web_test.dart index 7e42f3dbbeb..26a68db095a 100644 --- a/tests/web/native/native_null_assertions/no_flag_optimized_web_test.dart +++ b/tests/web/native/native_null_assertions/no_flag_optimized_web_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong // dart2jsOptions=-O3 import 'null_assertions_test_lib.dart'; diff --git a/tests/web/native/native_null_assertions/no_flag_web_test.dart b/tests/web/native/native_null_assertions/no_flag_web_test.dart index fe3dd226b52..5f8ef05b8bf 100644 --- a/tests/web/native/native_null_assertions/no_flag_web_test.dart +++ b/tests/web/native/native_null_assertions/no_flag_web_test.dart @@ -2,7 +2,6 @@ // 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. -// Requirements=nnbd-strong // dart2jsOptions=-O1 import 'null_assertions_test_lib.dart'; diff --git a/tests/web/regress/issue/49588_test.dart b/tests/web/regress/issue/49588_test.dart index ed11171fc1d..dce1ffb6969 100644 --- a/tests/web/regress/issue/49588_test.dart +++ b/tests/web/regress/issue/49588_test.dart @@ -2,8 +2,6 @@ // 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. -// Requirements=nnbd-strong - import 'package:expect/expect.dart'; class Foo {