From 2aa6e73ae7f8de65ea8333c8683209626eab7b91 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Wed, 18 Dec 2019 00:43:44 +0000 Subject: [PATCH] [dartdevc] Cleanup all temporary nnbd modular tests All of these tests are now running under the regular test infrastructure. The only reason they were created as modular tests was because we wanted more control over the SDK sources used. Change-Id: I2ad5aa616ff8bccd10cfac2d49bfaa39ab50c192 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128801 Reviewed-by: Mark Zhou Commit-Queue: Nicholas Shahan --- pkg/modular_test/lib/src/loader.dart | 1 - sdk_nnbd/lib/libraries_nnbd_mix_hack.json | 485 ------------------ .../modular/nnbd_strong_subtype/main.dart | 300 ----------- .../modular/nnbd_strong_subtype/modules.yaml | 12 - .../nnbd_strong_subtype/runtime_utils.dart | 82 --- .../runtime_utils_nnbd.dart | 30 -- .../modular/nnbd_type_normalization/main.dart | 40 -- .../nnbd_type_normalization/modules.yaml | 11 - .../runtime_utils_nnbd.dart | 30 -- .../modular/nnbd_weak_subtype/main.dart | 300 ----------- .../modular/nnbd_weak_subtype/modules.yaml | 12 - .../nnbd_weak_subtype/runtime_utils.dart | 82 --- .../nnbd_weak_subtype/runtime_utils_nnbd.dart | 30 -- .../nnbd_basic_assignment.dart} | 8 +- tests/modular/nnbd/modules.yaml | 9 - tools/bots/test_matrix.json | 11 - 16 files changed, 6 insertions(+), 1437 deletions(-) delete mode 100644 sdk_nnbd/lib/libraries_nnbd_mix_hack.json delete mode 100644 tests/compiler/dartdevc/modular/nnbd_strong_subtype/main.dart delete mode 100644 tests/compiler/dartdevc/modular/nnbd_strong_subtype/modules.yaml delete mode 100644 tests/compiler/dartdevc/modular/nnbd_strong_subtype/runtime_utils.dart delete mode 100644 tests/compiler/dartdevc/modular/nnbd_strong_subtype/runtime_utils_nnbd.dart delete mode 100644 tests/compiler/dartdevc/modular/nnbd_type_normalization/main.dart delete mode 100644 tests/compiler/dartdevc/modular/nnbd_type_normalization/modules.yaml delete mode 100644 tests/compiler/dartdevc/modular/nnbd_type_normalization/runtime_utils_nnbd.dart delete mode 100644 tests/compiler/dartdevc/modular/nnbd_weak_subtype/main.dart delete mode 100644 tests/compiler/dartdevc/modular/nnbd_weak_subtype/modules.yaml delete mode 100644 tests/compiler/dartdevc/modular/nnbd_weak_subtype/runtime_utils.dart delete mode 100644 tests/compiler/dartdevc/modular/nnbd_weak_subtype/runtime_utils_nnbd.dart rename tests/{modular/nnbd/main.dart => compiler/dartdevc_native/nnbd_basic_assignment.dart} (86%) delete mode 100644 tests/modular/nnbd/modules.yaml diff --git a/pkg/modular_test/lib/src/loader.dart b/pkg/modular_test/lib/src/loader.dart index 5bfdc370755..4efd9e61904 100644 --- a/pkg/modular_test/lib/src/loader.dart +++ b/pkg/modular_test/lib/src/loader.dart @@ -206,7 +206,6 @@ Future _createSdkModule(Uri root) async { Uri.parse('sdk/lib/libraries.json'), // TODO(#38701) Cleanup after merging the forked SDK into mainline. Uri.parse('sdk_nnbd/lib/libraries.json'), - Uri.parse('sdk_nnbd/lib/libraries_nnbd_mix_hack.json') ]; // Include all dart2js, ddc, vm library sources and patch files. diff --git a/sdk_nnbd/lib/libraries_nnbd_mix_hack.json b/sdk_nnbd/lib/libraries_nnbd_mix_hack.json deleted file mode 100644 index 8931386ba4a..00000000000 --- a/sdk_nnbd/lib/libraries_nnbd_mix_hack.json +++ /dev/null @@ -1,485 +0,0 @@ -{ - "comment:0": "NOTE: THIS FILE IS COPIED FROM A GENERATED VERSION.", - "comment:1": "It contains edits to build the current SDK for DDC with the NNBD dart:_runtime library.", - "comment:2": "This is only a temporary hack to unblock DDC development while the NNBD SDK is migrating and does not compile.", - "vm": { - "libraries": { - "_builtin": { - "uri": "_internal/vm/bin/builtin.dart" - }, - "cli": { - "patches": [ - "_internal/vm/bin/cli_patch.dart" - ], - "uri": "cli/cli.dart" - }, - "core": { - "patches": [ - "_internal/vm/lib/core_patch.dart", - "_internal/vm/lib/array.dart", - "_internal/vm/lib/array_patch.dart", - "_internal/vm/lib/bigint_patch.dart", - "_internal/vm/lib/bool_patch.dart", - "_internal/vm/lib/date_patch.dart", - "_internal/vm/lib/double.dart", - "_internal/vm/lib/double_patch.dart", - "_internal/vm/lib/errors_patch.dart", - "_internal/vm/lib/expando_patch.dart", - "_internal/vm/lib/function.dart", - "_internal/vm/lib/function_patch.dart", - "_internal/vm/lib/growable_array.dart", - "_internal/vm/lib/identical_patch.dart", - "_internal/vm/lib/immutable_map.dart", - "_internal/vm/lib/integers.dart", - "_internal/vm/lib/integers_patch.dart", - "_internal/vm/lib/invocation_mirror_patch.dart", - "_internal/vm/lib/lib_prefix.dart", - "_internal/vm/lib/map_patch.dart", - "_internal/vm/lib/null_patch.dart", - "_internal/vm/lib/object_patch.dart", - "_internal/vm/lib/regexp_patch.dart", - "_internal/vm/lib/stacktrace.dart", - "_internal/vm/lib/stopwatch_patch.dart", - "_internal/vm/lib/string_buffer_patch.dart", - "_internal/vm/lib/string_patch.dart", - "_internal/vm/lib/type_patch.dart", - "_internal/vm/lib/uri_patch.dart", - "_internal/vm/lib/weak_property.dart" - ], - "uri": "core/core.dart" - }, - "async": { - "patches": [ - "_internal/vm/lib/async_patch.dart", - "_internal/vm/lib/deferred_load_patch.dart", - "_internal/vm/lib/schedule_microtask_patch.dart", - "_internal/vm/lib/timer_patch.dart" - ], - "uri": "async/async.dart" - }, - "collection": { - "patches": [ - "_internal/vm/lib/collection_patch.dart", - "_internal/vm/lib/compact_hash.dart" - ], - "uri": "collection/collection.dart" - }, - "ffi": { - "patches": [ - "_internal/vm/lib/ffi_patch.dart", - "_internal/vm/lib/ffi_dynamic_library_patch.dart", - "_internal/vm/lib/ffi_native_type_patch.dart" - ], - "uri": "ffi/ffi.dart" - }, - "typed_data": { - "patches": "_internal/vm/lib/typed_data_patch.dart", - "uri": "typed_data/typed_data.dart" - }, - "nativewrappers": { - "uri": "html/dartium/nativewrappers.dart" - }, - "mirrors": { - "patches": [ - "_internal/vm/lib/mirrors_patch.dart", - "_internal/vm/lib/mirrors_impl.dart", - "_internal/vm/lib/mirror_reference.dart" - ], - "uri": "mirrors/mirrors.dart" - }, - "developer": { - "patches": [ - "_internal/vm/lib/developer.dart", - "_internal/vm/lib/profiler.dart", - "_internal/vm/lib/timeline.dart" - ], - "uri": "developer/developer.dart" - }, - "isolate": { - "patches": [ - "_internal/vm/lib/isolate_patch.dart", - "_internal/vm/lib/timer_impl.dart" - ], - "uri": "isolate/isolate.dart" - }, - "_vmservice": { - "uri": "vmservice/vmservice.dart" - }, - "wasm": { - "patches": [ - "_internal/vm/lib/wasm_patch.dart" - ], - "uri": "wasm/wasm.dart" - }, - "io": { - "patches": [ - "_internal/vm/bin/common_patch.dart", - "_internal/vm/bin/directory_patch.dart", - "_internal/vm/bin/eventhandler_patch.dart", - "_internal/vm/bin/file_patch.dart", - "_internal/vm/bin/file_system_entity_patch.dart", - "_internal/vm/bin/filter_patch.dart", - "_internal/vm/bin/io_service_patch.dart", - "_internal/vm/bin/namespace_patch.dart", - "_internal/vm/bin/platform_patch.dart", - "_internal/vm/bin/process_patch.dart", - "_internal/vm/bin/socket_patch.dart", - "_internal/vm/bin/stdio_patch.dart", - "_internal/vm/bin/secure_socket_patch.dart", - "_internal/vm/bin/sync_socket_patch.dart" - ], - "uri": "io/io.dart" - }, - "_internal": { - "patches": [ - "_internal/vm/lib/internal_patch.dart", - "_internal/vm/lib/class_id_fasta.dart", - "_internal/vm/lib/print_patch.dart", - "_internal/vm/lib/symbol_patch.dart", - "internal/patch.dart" - ], - "uri": "internal/internal.dart" - }, - "convert": { - "patches": "_internal/vm/lib/convert_patch.dart", - "uri": "convert/convert.dart" - }, - "math": { - "patches": "_internal/vm/lib/math_patch.dart", - "uri": "math/math.dart" - }, - "_http": { - "uri": "_http/http.dart" - }, - "vmservice_io": { - "uri": "../../runtime/bin/vmservice/vmservice_io.dart" - } - } - }, - "none": { - "libraries": {} - }, - "dart2js": { - "libraries": { - "async": { - "patches": "_internal/js_runtime/lib/async_patch.dart", - "uri": "async/async.dart" - }, - "_interceptors": { - "uri": "_internal/js_runtime/lib/interceptors.dart" - }, - "mirrors": { - "patches": "_internal/js_runtime/lib/mirrors_patch_cfe.dart", - "supported": false, - "uri": "mirrors/mirrors.dart" - }, - "_js_embedded_names": { - "uri": "_internal/js_runtime/lib/shared/embedded_names.dart" - }, - "io": { - "patches": "_internal/js_runtime/lib/io_patch.dart", - "supported": false, - "uri": "io/io.dart" - }, - "_internal": { - "patches": "_internal/js_runtime/lib/internal_patch.dart", - "uri": "internal/internal.dart" - }, - "_metadata": { - "uri": "html/html_common/metadata.dart" - }, - "_async_await_error_codes": { - "uri": "_internal/js_runtime/lib/shared/async_await_error_codes.dart" - }, - "_http": { - "uri": "_http/http.dart" - }, - "_js_primitives": { - "uri": "_internal/js_runtime/lib/js_primitives.dart" - }, - "_js_helper": { - "uri": "_internal/js_runtime/lib/js_helper.dart" - }, - "js": { - "uri": "js/dart2js/js_dart2js.dart" - }, - "html_common": { - "uri": "html/html_common/html_common_dart2js.dart" - }, - "_recipe_syntax": { - "uri": "_internal/js_runtime/lib/shared/recipe_syntax.dart" - }, - "_native_typed_data": { - "uri": "_internal/js_runtime/lib/native_typed_data.dart" - }, - "_js_names": { - "uri": "_internal/js_runtime/lib/js_names.dart" - }, - "core": { - "patches": "_internal/js_runtime/lib/core_patch.dart", - "uri": "core/core.dart" - }, - "collection": { - "patches": "_internal/js_runtime/lib/collection_patch.dart", - "uri": "collection/collection.dart" - }, - "js_util": { - "uri": "js_util/dart2js/js_util_dart2js.dart" - }, - "typed_data": { - "patches": "_internal/js_runtime/lib/typed_data_patch.dart", - "uri": "typed_data/typed_data.dart" - }, - "web_audio": { - "uri": "web_audio/dart2js/web_audio_dart2js.dart" - }, - "html": { - "uri": "html/dart2js/html_dart2js.dart" - }, - "isolate": { - "patches": "_internal/js_runtime/lib/isolate_patch.dart", - "supported": false, - "uri": "isolate/isolate.dart" - }, - "developer": { - "patches": "_internal/js_runtime/lib/developer_patch.dart", - "uri": "developer/developer.dart" - }, - "web_gl": { - "uri": "web_gl/dart2js/web_gl_dart2js.dart" - }, - "indexed_db": { - "uri": "indexed_db/dart2js/indexed_db_dart2js.dart" - }, - "_js": { - "patches": "js/_js_client.dart", - "uri": "js/_js.dart" - }, - "convert": { - "patches": "_internal/js_runtime/lib/convert_patch.dart", - "uri": "convert/convert.dart" - }, - "math": { - "patches": "_internal/js_runtime/lib/math_patch.dart", - "uri": "math/math.dart" - }, - "_foreign_helper": { - "uri": "_internal/js_runtime/lib/foreign_helper.dart" - }, - "web_sql": { - "uri": "web_sql/dart2js/web_sql_dart2js.dart" - }, - "_rti": { - "uri": "_internal/js_runtime/lib/rti.dart" - }, - "svg": { - "uri": "svg/dart2js/svg_dart2js.dart" - } - } - }, - "dartdevc": { - "libraries": { - "async": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/async_patch.dart", - "uri": "../../sdk_nnbd/lib/async/async.dart" - }, - "_runtime": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart" - }, - "_interceptors": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/private/interceptors.dart" - }, - "mirrors": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/mirrors_patch.dart", - "supported": false, - "uri": "../../sdk_nnbd/lib/mirrors/mirrors.dart" - }, - "_debugger": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/private/debugger.dart" - }, - "io": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/io_patch.dart", - "supported": false, - "uri": "../../sdk_nnbd/lib/io/io.dart" - }, - "_internal": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/internal_patch.dart", - "uri": "../../sdk_nnbd/lib/internal/internal.dart" - }, - "_metadata": { - "uri": "../../sdk_nnbd/lib/html/html_common/metadata.dart" - }, - "_http": { - "uri": "../../sdk_nnbd/lib/_http/http.dart" - }, - "_js_primitives": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/private/js_primitives.dart" - }, - "_js_helper": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/private/js_helper.dart" - }, - "js": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/lib/js/dart2js/js_dart2js.dart" - }, - "_js_mirrors": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/private/js_mirrors.dart" - }, - "html_common": { - "uri": "../../sdk_nnbd/lib/html/html_common/html_common_dart2js.dart" - }, - "_native_typed_data": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/private/native_typed_data.dart" - }, - "core": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/core_patch.dart", - "uri": "../../sdk_nnbd/lib/core/core.dart" - }, - "js_util": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/lib/js_util/dart2js/js_util_dart2js.dart" - }, - "collection": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/collection_patch.dart", - "uri": "../../sdk_nnbd/lib/collection/collection.dart" - }, - "typed_data": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/typed_data_patch.dart", - "uri": "../../sdk_nnbd/lib/typed_data/typed_data.dart" - }, - "web_audio": { - "uri": "../../sdk_nnbd/lib/web_audio/dart2js/web_audio_dart2js.dart" - }, - "html": { - "uri": "../../sdk_nnbd/lib/html/dart2js/html_dart2js.dart" - }, - "developer": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/developer_patch.dart", - "uri": "../../sdk_nnbd/lib/developer/developer.dart" - }, - "isolate": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/isolate_patch.dart", - "supported": false, - "uri": "../../sdk_nnbd/lib/isolate/isolate.dart" - }, - "web_gl": { - "uri": "../../sdk_nnbd/lib/web_gl/dart2js/web_gl_dart2js.dart" - }, - "indexed_db": { - "uri": "../../sdk_nnbd/lib/indexed_db/dart2js/indexed_db_dart2js.dart" - }, - "convert": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/convert_patch.dart", - "uri": "../../sdk_nnbd/lib/convert/convert.dart" - }, - "_isolate_helper": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/private/isolate_helper.dart" - }, - "math": { - "patches": "../../sdk_nnbd/lib/_internal/js_dev_runtime/patch/math_patch.dart", - "uri": "../../sdk_nnbd/lib/math/math.dart" - }, - "_foreign_helper": { - "uri": "../../sdk_nnbd/lib/_internal/js_dev_runtime/private/foreign_helper.dart" - }, - "web_sql": { - "uri": "../../sdk_nnbd/lib/web_sql/dart2js/web_sql_dart2js.dart" - }, - "svg": { - "uri": "../../sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart" - } - } - }, - "dart2js_server": { - "libraries": { - "async": { - "patches": "_internal/js_runtime/lib/async_patch.dart", - "uri": "async/async.dart" - }, - "mirrors": { - "patches": "_internal/js_runtime/lib/mirrors_patch_cfe.dart", - "supported": false, - "uri": "mirrors/mirrors.dart" - }, - "_interceptors": { - "uri": "_internal/js_runtime/lib/interceptors.dart" - }, - "_js_embedded_names": { - "uri": "_internal/js_runtime/lib/shared/embedded_names.dart" - }, - "io": { - "patches": "_internal/js_runtime/lib/io_patch.dart", - "supported": false, - "uri": "io/io.dart" - }, - "_internal": { - "patches": "_internal/js_runtime/lib/internal_patch.dart", - "uri": "internal/internal.dart" - }, - "_async_await_error_codes": { - "uri": "_internal/js_runtime/lib/shared/async_await_error_codes.dart" - }, - "_http": { - "uri": "_http/http.dart" - }, - "_js_helper": { - "uri": "_internal/js_runtime/lib/js_helper.dart" - }, - "_js_primitives": { - "uri": "_internal/js_runtime/lib/js_primitives.dart" - }, - "js": { - "uri": "js/dart2js/js_dart2js.dart" - }, - "_recipe_syntax": { - "uri": "_internal/js_runtime/lib/shared/recipe_syntax.dart" - }, - "_native_typed_data": { - "uri": "_internal/js_runtime/lib/native_typed_data.dart" - }, - "core": { - "patches": "_internal/js_runtime/lib/core_patch.dart", - "uri": "core/core.dart" - }, - "_js_names": { - "uri": "_internal/js_runtime/lib/js_names.dart" - }, - "js_util": { - "uri": "js_util/dart2js/js_util_dart2js.dart" - }, - "collection": { - "patches": "_internal/js_runtime/lib/collection_patch.dart", - "uri": "collection/collection.dart" - }, - "typed_data": { - "patches": "_internal/js_runtime/lib/typed_data_patch.dart", - "uri": "typed_data/typed_data.dart" - }, - "isolate": { - "patches": "_internal/js_runtime/lib/isolate_patch.dart", - "supported": false, - "uri": "isolate/isolate.dart" - }, - "developer": { - "patches": "_internal/js_runtime/lib/developer_patch.dart", - "uri": "developer/developer.dart" - }, - "_js": { - "patches": "js/_js_server.dart", - "uri": "js/_js.dart" - }, - "convert": { - "patches": "_internal/js_runtime/lib/convert_patch.dart", - "uri": "convert/convert.dart" - }, - "math": { - "patches": "_internal/js_runtime/lib/math_patch.dart", - "uri": "math/math.dart" - }, - "_foreign_helper": { - "uri": "_internal/js_runtime/lib/foreign_helper.dart" - }, - "_rti": { - "uri": "_internal/js_runtime/lib/rti.dart" - } - } - } -} \ No newline at end of file diff --git a/tests/compiler/dartdevc/modular/nnbd_strong_subtype/main.dart b/tests/compiler/dartdevc/modular/nnbd_strong_subtype/main.dart deleted file mode 100644 index 86a3ddd96a7..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_strong_subtype/main.dart +++ /dev/null @@ -1,300 +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. - -// Copied from tests/compiler/dartdevc_native/nnbd_strong_subtype_test.dart. - -// Requirements=nnbd-strong - -import 'dart:async'; - -import 'runtime_utils.dart'; -import 'runtime_utils_nnbd.dart'; - -class A {} - -class B extends A {} - -class C extends B {} - -class D {} - -class E {} - -class F extends E {} - -void main() { - // Run tests with strict subtype checks. - strictSubtypeChecks(true); - - // Top type symmetry. - // Object? <: dynamic - checkSubtype(nullable(Object), dynamic); - // dynamic <: Object? - checkSubtype(dynamic, nullable(Object)); - // Object? <: void - checkSubtype(nullable(Object), voidType); - // void <: Object? - checkSubtype(voidType, nullable(Object)); - // void <: dynamic - checkSubtype(voidType, dynamic); - // dynamic <: void - checkSubtype(dynamic, voidType); - - // Bottom is subtype of top. - // never <: dynamic - checkProperSubtype(neverType, dynamic); - // never <: void - checkProperSubtype(neverType, voidType); - // never <: Object? - checkProperSubtype(neverType, nullable(Object)); - - // Object is between top and bottom. - // Object <: Object? - checkProperSubtype(Object, nullable(Object)); - // never <: Object - checkProperSubtype(neverType, Object); - - // Null is between top and bottom. - // Null <: Object? - checkProperSubtype(Null, nullable(Object)); - // never <: Null - checkProperSubtype(neverType, Null); - - // Class is between Object and bottom. - // A <: Object - checkProperSubtype(A, dynamic); - // never <: A - checkProperSubtype(neverType, A); - - // Nullable types are a union of T and Null. - // A <: A? - checkProperSubtype(A, nullable(A)); - // Null <: A? - checkProperSubtype(Null, nullable(A)); - // A? <: Object? - checkProperSubtype(nullable(A), nullable(Object)); - - // Legacy types will eventually be migrated to T or T? but until then are - // symmetric with both. - // Object* <: Object - checkSubtype(legacy(Object), Object); - // Object <: Object* - checkSubtype(Object, legacy(Object)); - // Object* <: Object? - checkSubtype(legacy(Object), nullable(Object)); - // Object? <: Object* - checkSubtype(nullable(Object), legacy(Object)); - // Null <: Object* - checkSubtype(Null, legacy(Object)); - // never <: Object* - checkSubtype(neverType, legacy(Object)); - // A* <: A - checkSubtype(legacy(A), A); - // A <: A* - checkSubtype(A, legacy(A)); - // A* <: A? - checkSubtype(legacy(A), nullable(A)); - // A? <: A* - checkSubtype(nullable(A), legacy(A)); - // A* <: Object - checkProperSubtype(legacy(A), Object); - // A* <: Object? - checkProperSubtype(legacy(A), nullable(Object)); - // Null <: A* - checkProperSubtype(Null, legacy(A)); - // never <: A* - checkProperSubtype(neverType, legacy(A)); - - // Futures. - // Null <: FutureOr - checkProperSubtype(Null, generic1(FutureOr, nullable(Object))); - // Object <: FutureOr - checkProperSubtype(Object, generic1(FutureOr, nullable(Object))); - // Object? <: FutureOr - checkSubtype(nullable(Object), generic1(FutureOr, nullable(Object))); - // Object <: FutureOr - checkSubtype(Object, generic1(FutureOr, Object)); - // FutureOr <: Object - checkSubtype(generic1(FutureOr, Object), Object); - // Object <: FutureOr - checkProperSubtype(Object, generic1(FutureOr, dynamic)); - // Object <: FutureOr - checkProperSubtype(Object, generic1(FutureOr, voidType)); - // Future <: FutureOr - checkProperSubtype( - generic1(Future, Object), generic1(FutureOr, nullable(Object))); - // Future <: FutureOr - checkProperSubtype( - generic1(Future, nullable(Object)), generic1(FutureOr, nullable(Object))); - // FutureOr <: Future - checkSubtype(generic1(FutureOr, neverType), generic1(Future, neverType)); - // Future <: FutureOr - checkProperSubtype(generic1(Future, B), generic1(FutureOr, A)); - // B <: <: FutureOr - checkProperSubtype(B, generic1(FutureOr, A)); - // Future <: Future - checkProperSubtype(generic1(Future, B), generic1(Future, A)); - - // Interface subtypes. - // A <: A - checkSubtype(A, A); - // B <: A - checkProperSubtype(B, A); - // C <: B - checkProperSubtype(C, B); - // C <: A - checkProperSubtype(C, A); - - // Functions. - // A -> B <: Function - checkProperSubtype(function1(B, A), Function); - - // A -> B <: A -> B - checkSubtype(function1(B, A), function1(B, A)); - - // A -> B <: B -> B - checkProperSubtype(function1(B, A), function1(B, B)); - // TODO(nshahan) Subtype check with covariant keyword? - - // A -> B <: A -> A - checkSubtype(function1(B, A), function1(A, A)); - - // Generic Function Subtypes. - // Bound is a built in type. - // void -> void <: void -> void - checkSubtype(genericFunction(int), genericFunction(int)); - - // A -> T <: B -> T - checkProperSubtype( - functionGenericReturn(String, A), functionGenericReturn(String, B)); - - // T -> B <: T -> A - checkProperSubtype( - functionGenericArg(double, B), functionGenericArg(double, A)); - - // Bound is a function type. - // B> void -> void <: B> void -> void - checkSubtype( - genericFunction(function1(B, A)), genericFunction(function1(B, A))); - - // B> A -> T <: B> B -> T - checkProperSubtype(functionGenericReturn(function1(B, A), A), - functionGenericReturn(function1(B, A), B)); - - // B> T -> B <: B> T -> A - checkProperSubtype(functionGenericArg(function1(B, A), B), - functionGenericArg(function1(B, A), A)); - - // Bound is a user defined class. - // void -> void <: void -> void - checkSubtype(genericFunction(B), genericFunction(B)); - - // A -> T <: B -> T - checkProperSubtype(functionGenericReturn(B, A), functionGenericReturn(B, B)); - - // T -> B <: T -> A - checkProperSubtype(functionGenericArg(B, B), functionGenericArg(B, A)); - - // Bound is a Future. - // > void -> void <: > void -> void - checkSubtype(genericFunction(generic1(Future, B)), - genericFunction(generic1(Future, B))); - - // > A -> T <: > B -> T - checkProperSubtype(functionGenericReturn(generic1(Future, B), A), - functionGenericReturn(generic1(Future, B), B)); - - // > T -> B <: > T -> A - checkProperSubtype(functionGenericArg(generic1(Future, B), B), - functionGenericArg(generic1(Future, B), A)); - - // Bound is a FutureOr. - // > void -> void <: - // > void -> void - checkSubtype(genericFunction(generic1(FutureOr, B)), - genericFunction(generic1(FutureOr, B))); - - // > A -> T <: > B -> T - checkProperSubtype(functionGenericReturn(generic1(FutureOr, B), A), - functionGenericReturn(generic1(FutureOr, B), B)); - - // > T -> B <: > T -> A - checkProperSubtype(functionGenericArg(generic1(FutureOr, B), B), - functionGenericArg(generic1(FutureOr, B), A)); - - // Generics. - // D <: D - checkSubtype(D, generic1(D, B)); - // D <: D - checkSubtype(generic1(D, B), D); - // D <: D - checkProperSubtype(generic1(D, C), generic1(D, B)); - - // F <: E - checkProperSubtype(F, E); - // F <: E - checkProperSubtype(F, generic2(E, A, A)); - // E <: E - checkProperSubtype(generic2(E, B, B), E); - // E <: E - checkProperSubtype(generic2(E, B, B), generic2(E, A, A)); - - // Nullable interface subtypes. - // B <: A? - checkProperSubtype(B, nullable(A)); - // C <: A? - checkProperSubtype(C, nullable(A)); - // B? <: A? - checkProperSubtype(nullable(B), nullable(A)); - // C? <: A? - checkProperSubtype(nullable(C), nullable(A)); - - // Mixed mode. - // B* <: A - checkProperSubtype(legacy(B), A); - // B* <: A? - checkProperSubtype(legacy(B), nullable(A)); - // A* <\: B - checkSubtypeFailure(legacy(A), B); - // B? <: A* - checkProperSubtype(nullable(B), legacy(A)); - // B <: A* - checkProperSubtype(B, legacy(A)); - // A <: B* - checkSubtypeFailure(A, legacy(B)); - // A? <: B* - checkSubtypeFailure(nullable(A), legacy(B)); - - // Allowed in weak mode. - // dynamic <\: Object - checkSubtypeFailure(dynamic, Object); - // void <\: Object - checkSubtypeFailure(voidType, Object); - // Object? <\: Object - checkSubtypeFailure(nullable(Object), Object); - // A? <\: Object - checkSubtypeFailure(nullable(A), Object); - // A? <\: A - checkSubtypeFailure(nullable(A), A); - // Null <\: never - checkSubtypeFailure(Null, neverType); - // Null <\: Object - checkSubtypeFailure(Null, Object); - // Null <\: A - checkSubtypeFailure(Null, A); - // Null <\: FutureOr - checkSubtypeFailure(Null, generic1(FutureOr, A)); - // Null <\: Future - checkSubtypeFailure(Null, generic1(Future, A)); - // FutureOr <\: Future - checkSubtypeFailure(generic1(FutureOr, Null), generic1(Future, Null)); - // Null <\: Future - checkSubtypeFailure(Null, generic1(Future, nullable(A))); - // FutureOr <\: Object - checkSubtypeFailure(generic1(FutureOr, nullable(Object)), Object); - // FutureOr <\: Object - checkSubtypeFailure(generic1(FutureOr, dynamic), Object); - // FutureOr <\: Object - checkSubtypeFailure(generic1(FutureOr, voidType), Object); -} diff --git a/tests/compiler/dartdevc/modular/nnbd_strong_subtype/modules.yaml b/tests/compiler/dartdevc/modular/nnbd_strong_subtype/modules.yaml deleted file mode 100644 index 5c3492e7617..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_strong_subtype/modules.yaml +++ /dev/null @@ -1,12 +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. -# -# NNBD Strong runtime subtype tests. -# Copied from test/compiler/dartdevc_native suite. This is temporary until the -# forked NNBD SDK can build again. -dependencies: - main: [runtime_utils, runtime_utils_nnbd] - runtime_utils: expect -flags: - - non-nullable \ No newline at end of file diff --git a/tests/compiler/dartdevc/modular/nnbd_strong_subtype/runtime_utils.dart b/tests/compiler/dartdevc/modular/nnbd_strong_subtype/runtime_utils.dart deleted file mode 100644 index 8c6bbdc0a7b..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_strong_subtype/runtime_utils.dart +++ /dev/null @@ -1,82 +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. - -// Copied from tests/compiler/dartdevc_native/runtime_utils.dart. - -import 'dart:_foreign_helper' show JS; -import 'dart:_runtime' as dart; - -import 'package:expect/expect.dart'; - -// The runtime representation of the void type. -final voidType = dart.wrapType(dart.void_); - -// Returns sWrapped as a wrapped type. -Type generic1(Type sWrapped, Type tWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - var sGeneric = dart.getGenericClass(s); - return dart.wrapType(JS('', '#(#)', sGeneric, t)); -} - -// Returns sWrapped as a wrapped type. -Type generic2(Type sWrapped, Type tWrapped, Type rWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - var r = dart.unwrapType(rWrapped); - var sGeneric = dart.getGenericClass(s); - return dart.wrapType(JS('', '#(#, #)', sGeneric, t, r)); -} - -// Returns a function type of argWrapped -> returnWrapped as a wrapped type. -Type function1(Type returnWrapped, Type argWrapped) { - var returnType = dart.unwrapType(returnWrapped); - var argType = dart.unwrapType(argWrapped); - var fun = dart.fnType(returnType, [argType]); - return dart.wrapType(fun); -} - -// Returns a function type with a bounded type argument that takes no argument -// and returns void as a wrapped type. -Type genericFunction(Type boundWrapped) => dart.wrapType(dart.gFnType( - (T) => [dart.VoidType, []], (T) => [dart.unwrapType(boundWrapped)])); - -// Returns a function type with a bounded generic return type of -// argWrapped -> T as a wrapped type. -Type functionGenericReturn(Type boundWrapped, Type argWrapped) => - dart.wrapType(dart.gFnType( - (T) => [ - T, - [dart.unwrapType(argWrapped)] - ], - (T) => [dart.unwrapType(boundWrapped)])); - -// Returns a function with a bounded generic argument type of -// T -> returnWrapped as a wrapped type. -Type functionGenericArg(Type boundWrapped, Type returnWrapped) => - dart.wrapType(dart.gFnType( - (T) => [ - dart.unwrapType(returnWrapped), - [T] - ], - (T) => [dart.unwrapType(boundWrapped)])); - -void checkSubtype(Type sWrapped, Type tWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - Expect.isTrue(dart.isSubtypeOf(s, t), '$s should be subtype of $t.'); -} - -void checkProperSubtype(Type sWrapped, Type tWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - Expect.isTrue(dart.isSubtypeOf(s, t), '$s should be subtype of $t.'); - checkSubtypeFailure(tWrapped, sWrapped); -} - -void checkSubtypeFailure(Type sWrapped, Type tWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - Expect.isFalse(dart.isSubtypeOf(s, t), '$s should not be subtype of $t.'); -} diff --git a/tests/compiler/dartdevc/modular/nnbd_strong_subtype/runtime_utils_nnbd.dart b/tests/compiler/dartdevc/modular/nnbd_strong_subtype/runtime_utils_nnbd.dart deleted file mode 100644 index c4cc4b8ce7b..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_strong_subtype/runtime_utils_nnbd.dart +++ /dev/null @@ -1,30 +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. - -// Copied from tests/compiler/dartdevc_native/runtime_utils_nnbd.dart. - -import 'dart:_runtime' as dart; - -/// The runtime representation of the never type. -final neverType = dart.wrapType(dart.never_); - -/// Sets the mode of the runtime subtype checks. -/// -/// In tests the mode should be set only once at the very beginning of the test. -/// Changing the mode after any calls to dart.isSubtype() is not supported. -void strictSubtypeChecks(bool flag) => dart.strictSubtypeChecks(flag); - -/// Returns tWrapped? as a wrapped type. -Type nullable(Type tWrapped) { - var t = dart.unwrapType(tWrapped); - var tNullable = dart.nullable(t); - return dart.wrapType(tNullable); -} - -/// Returns tWrapped* as a wrapped type. -Type legacy(Type tWrapped) { - var t = dart.unwrapType(tWrapped); - var tLegacy = dart.legacy(t); - return dart.wrapType(tLegacy); -} diff --git a/tests/compiler/dartdevc/modular/nnbd_type_normalization/main.dart b/tests/compiler/dartdevc/modular/nnbd_type_normalization/main.dart deleted file mode 100644 index 24a3ff0aaa5..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_type_normalization/main.dart +++ /dev/null @@ -1,40 +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. - -// Copied from tests/compiler/dartdevc_native/nnbd_type_normalization_test.dart. - -// Requirements=nnbd - -import 'dart:_runtime' as dart; - -import 'package:expect/expect.dart'; - -import 'runtime_utils_nnbd.dart'; - -class A {} - -void main() { - // A?? == A? - Expect.identical(nullable(nullable(A)), nullable(A)); - // A?* == A? - Expect.identical(legacy(nullable(A)), nullable(A)); - // A*? == A? - Expect.identical(nullable(legacy(A)), nullable(A)); - // A** == A* - Expect.identical(legacy(legacy(A)), legacy(A)); - // Null? == Null - Expect.identical(nullable(Null), Null); - // Never? == Null - Expect.identical(nullable(dart.wrapType(dart.never_)), Null); - // dynamic? == dynamic - Expect.identical(nullable(dynamic), dynamic); - // void? == void - Expect.identical( - nullable(dart.wrapType(dart.void_)), dart.wrapType(dart.void_)); - // dynamic* == dynamic - Expect.identical(legacy(dynamic), dynamic); - // void* == void - Expect.identical( - legacy(dart.wrapType(dart.void_)), dart.wrapType(dart.void_)); -} diff --git a/tests/compiler/dartdevc/modular/nnbd_type_normalization/modules.yaml b/tests/compiler/dartdevc/modular/nnbd_type_normalization/modules.yaml deleted file mode 100644 index 73a81312a29..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_type_normalization/modules.yaml +++ /dev/null @@ -1,11 +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. -# -# NNBD type normalization tests. -# Copied from test/compiler/dartdevc_native suite. This is temporary until the -# forked NNBD SDK can build again. -dependencies: - main: [expect, runtime_utils_nnbd] -flags: - - non-nullable \ No newline at end of file diff --git a/tests/compiler/dartdevc/modular/nnbd_type_normalization/runtime_utils_nnbd.dart b/tests/compiler/dartdevc/modular/nnbd_type_normalization/runtime_utils_nnbd.dart deleted file mode 100644 index c4cc4b8ce7b..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_type_normalization/runtime_utils_nnbd.dart +++ /dev/null @@ -1,30 +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. - -// Copied from tests/compiler/dartdevc_native/runtime_utils_nnbd.dart. - -import 'dart:_runtime' as dart; - -/// The runtime representation of the never type. -final neverType = dart.wrapType(dart.never_); - -/// Sets the mode of the runtime subtype checks. -/// -/// In tests the mode should be set only once at the very beginning of the test. -/// Changing the mode after any calls to dart.isSubtype() is not supported. -void strictSubtypeChecks(bool flag) => dart.strictSubtypeChecks(flag); - -/// Returns tWrapped? as a wrapped type. -Type nullable(Type tWrapped) { - var t = dart.unwrapType(tWrapped); - var tNullable = dart.nullable(t); - return dart.wrapType(tNullable); -} - -/// Returns tWrapped* as a wrapped type. -Type legacy(Type tWrapped) { - var t = dart.unwrapType(tWrapped); - var tLegacy = dart.legacy(t); - return dart.wrapType(tLegacy); -} diff --git a/tests/compiler/dartdevc/modular/nnbd_weak_subtype/main.dart b/tests/compiler/dartdevc/modular/nnbd_weak_subtype/main.dart deleted file mode 100644 index 21c8bb11d00..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_weak_subtype/main.dart +++ /dev/null @@ -1,300 +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. - -// Copied from tests/compiler/dartdevc_native/nnbd_weak_subtype_test.dart. - -// Requirements=nnbd-weak - -import 'dart:async'; - -import 'runtime_utils.dart'; -import 'runtime_utils_nnbd.dart'; - -class A {} - -class B extends A {} - -class C extends B {} - -class D {} - -class E {} - -class F extends E {} - -void main() { - // Run tests with weak subtype checks. - strictSubtypeChecks(false); - - // Top type symmetry. - // Object? <: dynamic - checkSubtype(nullable(Object), dynamic); - // dynamic <: Object? - checkSubtype(dynamic, nullable(Object)); - // Object? <: void - checkSubtype(nullable(Object), voidType); - // void <: Object? - checkSubtype(voidType, nullable(Object)); - // void <: dynamic - checkSubtype(voidType, dynamic); - // dynamic <: void - checkSubtype(dynamic, voidType); - - // Bottom is subtype of top. - // never <: dynamic - checkProperSubtype(neverType, dynamic); - // never <: void - checkProperSubtype(neverType, voidType); - // never <: Object? - checkProperSubtype(neverType, nullable(Object)); - - // Object is between top and bottom. - // Object <: Object? - checkSubtype(Object, nullable(Object)); - // never <: Object - checkProperSubtype(neverType, Object); - - // Null is between top and bottom. - // Null <: Object? - checkProperSubtype(Null, nullable(Object)); - // never <: Null - checkSubtype(neverType, Null); - - // Class is between Object and bottom. - // A <: Object - checkProperSubtype(A, dynamic); - // never <: A - checkProperSubtype(neverType, A); - - // Nullable types are a union of T and Null. - // A <: A? - checkSubtype(A, nullable(A)); - // Null <: A? - checkProperSubtype(Null, nullable(A)); - // A? <: Object? - checkProperSubtype(nullable(A), nullable(Object)); - - // Legacy types will eventually be migrated to T or T? but until then are - // symmetric with both. - // Object* <: Object - checkSubtype(legacy(Object), Object); - // Object <: Object* - checkSubtype(Object, legacy(Object)); - // Object* <: Object? - checkSubtype(legacy(Object), nullable(Object)); - // Object? <: Object* - checkSubtype(nullable(Object), legacy(Object)); - // Null <: Object* - checkSubtype(Null, legacy(Object)); - // never <: Object* - checkSubtype(neverType, legacy(Object)); - // A* <: A - checkSubtype(legacy(A), A); - // A <: A* - checkSubtype(A, legacy(A)); - // A* <: A? - checkSubtype(legacy(A), nullable(A)); - // A? <: A* - checkSubtype(nullable(A), legacy(A)); - // A* <: Object - checkProperSubtype(legacy(A), Object); - // A* <: Object? - checkProperSubtype(legacy(A), nullable(Object)); - // Null <: A* - checkProperSubtype(Null, legacy(A)); - // never <: A* - checkProperSubtype(neverType, legacy(A)); - - // Futures. - // Null <: FutureOr - checkProperSubtype(Null, generic1(FutureOr, nullable(Object))); - // Object <: FutureOr - checkSubtype(Object, generic1(FutureOr, nullable(Object))); - // Object? <: FutureOr - checkSubtype(nullable(Object), generic1(FutureOr, nullable(Object))); - // Object <: FutureOr - checkSubtype(Object, generic1(FutureOr, Object)); - // FutureOr <: Object - checkSubtype(generic1(FutureOr, Object), Object); - // Object <: FutureOr - checkSubtype(Object, generic1(FutureOr, dynamic)); - // Object <: FutureOr - checkSubtype(Object, generic1(FutureOr, voidType)); - // Future <: FutureOr - checkProperSubtype( - generic1(Future, Object), generic1(FutureOr, nullable(Object))); - // Future <: FutureOr - checkProperSubtype( - generic1(Future, nullable(Object)), generic1(FutureOr, nullable(Object))); - // FutureOr <: Future - checkSubtype(generic1(FutureOr, neverType), generic1(Future, neverType)); - // Future <: FutureOr - checkProperSubtype(generic1(Future, B), generic1(FutureOr, A)); - // B <: <: FutureOr - checkProperSubtype(B, generic1(FutureOr, A)); - // Future <: Future - checkProperSubtype(generic1(Future, B), generic1(Future, A)); - - // Interface subtypes. - // A <: A - checkSubtype(A, A); - // B <: A - checkProperSubtype(B, A); - // C <: B - checkProperSubtype(C, B); - // C <: A - checkProperSubtype(C, A); - - // Functions. - // A -> B <: Function - checkProperSubtype(function1(B, A), Function); - - // A -> B <: A -> B - checkSubtype(function1(B, A), function1(B, A)); - - // A -> B <: B -> B - checkProperSubtype(function1(B, A), function1(B, B)); - // TODO(nshahan) Subtype check with covariant keyword? - - // A -> B <: A -> A - checkSubtype(function1(B, A), function1(A, A)); - - // Generic Function Subtypes. - // Bound is a built in type. - // void -> void <: void -> void - checkSubtype(genericFunction(int), genericFunction(int)); - - // A -> T <: B -> T - checkProperSubtype( - functionGenericReturn(String, A), functionGenericReturn(String, B)); - - // T -> B <: T -> A - checkProperSubtype( - functionGenericArg(double, B), functionGenericArg(double, A)); - - // Bound is a function type. - // B> void -> void <: B> void -> void - checkSubtype( - genericFunction(function1(B, A)), genericFunction(function1(B, A))); - - // B> A -> T <: B> B -> T - checkProperSubtype(functionGenericReturn(function1(B, A), A), - functionGenericReturn(function1(B, A), B)); - - // B> T -> B <: B> T -> A - checkProperSubtype(functionGenericArg(function1(B, A), B), - functionGenericArg(function1(B, A), A)); - - // Bound is a user defined class. - // void -> void <: void -> void - checkSubtype(genericFunction(B), genericFunction(B)); - - // A -> T <: B -> T - checkProperSubtype(functionGenericReturn(B, A), functionGenericReturn(B, B)); - - // T -> B <: T -> A - checkProperSubtype(functionGenericArg(B, B), functionGenericArg(B, A)); - - // Bound is a Future. - // > void -> void <: > void -> void - checkSubtype(genericFunction(generic1(Future, B)), - genericFunction(generic1(Future, B))); - - // > A -> T <: > B -> T - checkProperSubtype(functionGenericReturn(generic1(Future, B), A), - functionGenericReturn(generic1(Future, B), B)); - - // > T -> B <: > T -> A - checkProperSubtype(functionGenericArg(generic1(Future, B), B), - functionGenericArg(generic1(Future, B), A)); - - // Bound is a FutureOr. - // > void -> void <: - // > void -> void - checkSubtype(genericFunction(generic1(FutureOr, B)), - genericFunction(generic1(FutureOr, B))); - - // > A -> T <: > B -> T - checkProperSubtype(functionGenericReturn(generic1(FutureOr, B), A), - functionGenericReturn(generic1(FutureOr, B), B)); - - // > T -> B <: > T -> A - checkProperSubtype(functionGenericArg(generic1(FutureOr, B), B), - functionGenericArg(generic1(FutureOr, B), A)); - - // Generics. - // D <: D - checkSubtype(D, generic1(D, B)); - // D <: D - checkSubtype(generic1(D, B), D); - // D <: D - checkProperSubtype(generic1(D, C), generic1(D, B)); - - // F <: E - checkProperSubtype(F, E); - // F <: E - checkProperSubtype(F, generic2(E, A, A)); - // E <: E - checkProperSubtype(generic2(E, B, B), E); - // E <: E - checkProperSubtype(generic2(E, B, B), generic2(E, A, A)); - - // Nullable interface subtypes. - // B <: A? - checkProperSubtype(B, nullable(A)); - // C <: A? - checkProperSubtype(C, nullable(A)); - // B? <: A? - checkProperSubtype(nullable(B), nullable(A)); - // C? <: A? - checkProperSubtype(nullable(C), nullable(A)); - - // Mixed mode. - // B* <: A - checkProperSubtype(legacy(B), A); - // B* <: A? - checkProperSubtype(legacy(B), nullable(A)); - // A* <\: B - checkSubtypeFailure(legacy(A), B); - // B? <: A* - checkProperSubtype(nullable(B), legacy(A)); - // B <: A* - checkProperSubtype(B, legacy(A)); - // A <: B* - checkSubtypeFailure(A, legacy(B)); - // A? <: B* - checkSubtypeFailure(nullable(A), legacy(B)); - - // Allowed in weak mode. - // dynamic <: Object - checkSubtype(dynamic, Object); - // void <: Object - checkSubtype(voidType, Object); - // Object? <: Object - checkSubtype(nullable(Object), Object); - // A? <: Object - checkProperSubtype(nullable(A), Object); - // A? <: A - checkSubtype(nullable(A), A); - // Null <: never - checkSubtype(Null, neverType); - // Null <: Object - checkProperSubtype(Null, Object); - // Null <: A - checkProperSubtype(Null, A); - // Null <: FutureOr - checkProperSubtype(Null, generic1(FutureOr, A)); - // Null <: Future - checkProperSubtype(Null, generic1(Future, A)); - // FutureOr <: Future - checkSubtype(generic1(FutureOr, Null), generic1(Future, Null)); - // Null <: Future - checkProperSubtype(Null, generic1(Future, nullable(A))); - // FutureOr <: Object - checkSubtype(generic1(FutureOr, nullable(Object)), Object); - // FutureOr <: Object - checkSubtype(generic1(FutureOr, dynamic), Object); - // FutureOr <: Object - checkSubtype(generic1(FutureOr, voidType), Object); -} diff --git a/tests/compiler/dartdevc/modular/nnbd_weak_subtype/modules.yaml b/tests/compiler/dartdevc/modular/nnbd_weak_subtype/modules.yaml deleted file mode 100644 index 5c3492e7617..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_weak_subtype/modules.yaml +++ /dev/null @@ -1,12 +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. -# -# NNBD Strong runtime subtype tests. -# Copied from test/compiler/dartdevc_native suite. This is temporary until the -# forked NNBD SDK can build again. -dependencies: - main: [runtime_utils, runtime_utils_nnbd] - runtime_utils: expect -flags: - - non-nullable \ No newline at end of file diff --git a/tests/compiler/dartdevc/modular/nnbd_weak_subtype/runtime_utils.dart b/tests/compiler/dartdevc/modular/nnbd_weak_subtype/runtime_utils.dart deleted file mode 100644 index 8c6bbdc0a7b..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_weak_subtype/runtime_utils.dart +++ /dev/null @@ -1,82 +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. - -// Copied from tests/compiler/dartdevc_native/runtime_utils.dart. - -import 'dart:_foreign_helper' show JS; -import 'dart:_runtime' as dart; - -import 'package:expect/expect.dart'; - -// The runtime representation of the void type. -final voidType = dart.wrapType(dart.void_); - -// Returns sWrapped as a wrapped type. -Type generic1(Type sWrapped, Type tWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - var sGeneric = dart.getGenericClass(s); - return dart.wrapType(JS('', '#(#)', sGeneric, t)); -} - -// Returns sWrapped as a wrapped type. -Type generic2(Type sWrapped, Type tWrapped, Type rWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - var r = dart.unwrapType(rWrapped); - var sGeneric = dart.getGenericClass(s); - return dart.wrapType(JS('', '#(#, #)', sGeneric, t, r)); -} - -// Returns a function type of argWrapped -> returnWrapped as a wrapped type. -Type function1(Type returnWrapped, Type argWrapped) { - var returnType = dart.unwrapType(returnWrapped); - var argType = dart.unwrapType(argWrapped); - var fun = dart.fnType(returnType, [argType]); - return dart.wrapType(fun); -} - -// Returns a function type with a bounded type argument that takes no argument -// and returns void as a wrapped type. -Type genericFunction(Type boundWrapped) => dart.wrapType(dart.gFnType( - (T) => [dart.VoidType, []], (T) => [dart.unwrapType(boundWrapped)])); - -// Returns a function type with a bounded generic return type of -// argWrapped -> T as a wrapped type. -Type functionGenericReturn(Type boundWrapped, Type argWrapped) => - dart.wrapType(dart.gFnType( - (T) => [ - T, - [dart.unwrapType(argWrapped)] - ], - (T) => [dart.unwrapType(boundWrapped)])); - -// Returns a function with a bounded generic argument type of -// T -> returnWrapped as a wrapped type. -Type functionGenericArg(Type boundWrapped, Type returnWrapped) => - dart.wrapType(dart.gFnType( - (T) => [ - dart.unwrapType(returnWrapped), - [T] - ], - (T) => [dart.unwrapType(boundWrapped)])); - -void checkSubtype(Type sWrapped, Type tWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - Expect.isTrue(dart.isSubtypeOf(s, t), '$s should be subtype of $t.'); -} - -void checkProperSubtype(Type sWrapped, Type tWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - Expect.isTrue(dart.isSubtypeOf(s, t), '$s should be subtype of $t.'); - checkSubtypeFailure(tWrapped, sWrapped); -} - -void checkSubtypeFailure(Type sWrapped, Type tWrapped) { - var s = dart.unwrapType(sWrapped); - var t = dart.unwrapType(tWrapped); - Expect.isFalse(dart.isSubtypeOf(s, t), '$s should not be subtype of $t.'); -} diff --git a/tests/compiler/dartdevc/modular/nnbd_weak_subtype/runtime_utils_nnbd.dart b/tests/compiler/dartdevc/modular/nnbd_weak_subtype/runtime_utils_nnbd.dart deleted file mode 100644 index c4cc4b8ce7b..00000000000 --- a/tests/compiler/dartdevc/modular/nnbd_weak_subtype/runtime_utils_nnbd.dart +++ /dev/null @@ -1,30 +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. - -// Copied from tests/compiler/dartdevc_native/runtime_utils_nnbd.dart. - -import 'dart:_runtime' as dart; - -/// The runtime representation of the never type. -final neverType = dart.wrapType(dart.never_); - -/// Sets the mode of the runtime subtype checks. -/// -/// In tests the mode should be set only once at the very beginning of the test. -/// Changing the mode after any calls to dart.isSubtype() is not supported. -void strictSubtypeChecks(bool flag) => dart.strictSubtypeChecks(flag); - -/// Returns tWrapped? as a wrapped type. -Type nullable(Type tWrapped) { - var t = dart.unwrapType(tWrapped); - var tNullable = dart.nullable(t); - return dart.wrapType(tNullable); -} - -/// Returns tWrapped* as a wrapped type. -Type legacy(Type tWrapped) { - var t = dart.unwrapType(tWrapped); - var tLegacy = dart.legacy(t); - return dart.wrapType(tLegacy); -} diff --git a/tests/modular/nnbd/main.dart b/tests/compiler/dartdevc_native/nnbd_basic_assignment.dart similarity index 86% rename from tests/modular/nnbd/main.dart rename to tests/compiler/dartdevc_native/nnbd_basic_assignment.dart index 70b498a6ad1..5bc08a738b7 100644 --- a/tests/modular/nnbd/main.dart +++ b/tests/compiler/dartdevc_native/nnbd_basic_assignment.dart @@ -3,15 +3,19 @@ // BSD-style license that can be found in the LICENSE file. import 'package:expect/expect.dart'; +// Requirements=nnbd + void main() { int x = 42; int? y; Expect.equals(null, y); - Expect.throws(() { x = y!;}); + Expect.throws(() { + x = y!; + }); Expect.equals(42, x); y = 17; x = y!; Expect.equals(17, x); -} \ No newline at end of file +} diff --git a/tests/modular/nnbd/modules.yaml b/tests/modular/nnbd/modules.yaml deleted file mode 100644 index 9b672536eaf..00000000000 --- a/tests/modular/nnbd/modules.yaml +++ /dev/null @@ -1,9 +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. -# -# NNBD modular test -dependencies: - main: expect -flags: - - non-nullable \ No newline at end of file diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json index df7ee28b280..e6ae529f2ae 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json @@ -1269,17 +1269,6 @@ "--use-sdk" ] }, - { - "name": "ddc kernel modular NNBD tests", - "script": "out/ReleaseX64/dart-sdk/bin/dart", - "testRunner": true, - "arguments": [ - "pkg/dev_compiler/test/modular_suite_nnbd.dart", - "-ndartdevk-nnbd-${system}-release", - "--verbose", - "--use-sdk" - ] - }, { "name": "ddk sourcemap tests", "script": "out/ReleaseX64/dart",