mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
[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 <markzipan@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
7ef8822c2a
commit
2aa6e73ae7
|
@ -206,7 +206,6 @@ Future<Module> _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.
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<T extends B> {}
|
||||
|
||||
class E<T, S> {}
|
||||
|
||||
class F extends E<B, B> {}
|
||||
|
||||
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<Object?>
|
||||
checkProperSubtype(Null, generic1(FutureOr, nullable(Object)));
|
||||
// Object <: FutureOr<Object?>
|
||||
checkProperSubtype(Object, generic1(FutureOr, nullable(Object)));
|
||||
// Object? <: FutureOr<Object?>
|
||||
checkSubtype(nullable(Object), generic1(FutureOr, nullable(Object)));
|
||||
// Object <: FutureOr<Object>
|
||||
checkSubtype(Object, generic1(FutureOr, Object));
|
||||
// FutureOr<Object> <: Object
|
||||
checkSubtype(generic1(FutureOr, Object), Object);
|
||||
// Object <: FutureOr<dynamic>
|
||||
checkProperSubtype(Object, generic1(FutureOr, dynamic));
|
||||
// Object <: FutureOr<void>
|
||||
checkProperSubtype(Object, generic1(FutureOr, voidType));
|
||||
// Future<Object> <: FutureOr<Object?>
|
||||
checkProperSubtype(
|
||||
generic1(Future, Object), generic1(FutureOr, nullable(Object)));
|
||||
// Future<Object?> <: FutureOr<Object?>
|
||||
checkProperSubtype(
|
||||
generic1(Future, nullable(Object)), generic1(FutureOr, nullable(Object)));
|
||||
// FutureOr<Never> <: Future<Never>
|
||||
checkSubtype(generic1(FutureOr, neverType), generic1(Future, neverType));
|
||||
// Future<B> <: FutureOr<A>
|
||||
checkProperSubtype(generic1(Future, B), generic1(FutureOr, A));
|
||||
// B <: <: FutureOr<A>
|
||||
checkProperSubtype(B, generic1(FutureOr, A));
|
||||
// Future<B> <: Future<A>
|
||||
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.
|
||||
// <T extends int> void -> void <: <T extends int> void -> void
|
||||
checkSubtype(genericFunction(int), genericFunction(int));
|
||||
|
||||
// <T extends String> A -> T <: <T extends String> B -> T
|
||||
checkProperSubtype(
|
||||
functionGenericReturn(String, A), functionGenericReturn(String, B));
|
||||
|
||||
// <T extends double> T -> B <: <T extends double> T -> A
|
||||
checkProperSubtype(
|
||||
functionGenericArg(double, B), functionGenericArg(double, A));
|
||||
|
||||
// Bound is a function type.
|
||||
// <T extends A -> B> void -> void <: <T extends A -> B> void -> void
|
||||
checkSubtype(
|
||||
genericFunction(function1(B, A)), genericFunction(function1(B, A)));
|
||||
|
||||
// <T extends A -> B> A -> T <: <T extends A -> B> B -> T
|
||||
checkProperSubtype(functionGenericReturn(function1(B, A), A),
|
||||
functionGenericReturn(function1(B, A), B));
|
||||
|
||||
// <T extends A -> B> T -> B <: <T extends A -> B> T -> A
|
||||
checkProperSubtype(functionGenericArg(function1(B, A), B),
|
||||
functionGenericArg(function1(B, A), A));
|
||||
|
||||
// Bound is a user defined class.
|
||||
// <T extends B> void -> void <: <T extends B> void -> void
|
||||
checkSubtype(genericFunction(B), genericFunction(B));
|
||||
|
||||
// <T extends B> A -> T <: <T extends B> B -> T
|
||||
checkProperSubtype(functionGenericReturn(B, A), functionGenericReturn(B, B));
|
||||
|
||||
// <T extends B> T -> B <: <T extends B> T -> A
|
||||
checkProperSubtype(functionGenericArg(B, B), functionGenericArg(B, A));
|
||||
|
||||
// Bound is a Future.
|
||||
// <T extends Future<B>> void -> void <: <T extends Future<B>> void -> void
|
||||
checkSubtype(genericFunction(generic1(Future, B)),
|
||||
genericFunction(generic1(Future, B)));
|
||||
|
||||
// <T extends Future<B>> A -> T <: <T extends Future<B>> B -> T
|
||||
checkProperSubtype(functionGenericReturn(generic1(Future, B), A),
|
||||
functionGenericReturn(generic1(Future, B), B));
|
||||
|
||||
// <T extends Future<B>> T -> B <: <T extends Future<B>> T -> A
|
||||
checkProperSubtype(functionGenericArg(generic1(Future, B), B),
|
||||
functionGenericArg(generic1(Future, B), A));
|
||||
|
||||
// Bound is a FutureOr.
|
||||
// <T extends FutureOr<B>> void -> void <:
|
||||
// <T extends FutureOr<B>> void -> void
|
||||
checkSubtype(genericFunction(generic1(FutureOr, B)),
|
||||
genericFunction(generic1(FutureOr, B)));
|
||||
|
||||
// <T extends FutureOr<B>> A -> T <: <T extends FutureOr<B>> B -> T
|
||||
checkProperSubtype(functionGenericReturn(generic1(FutureOr, B), A),
|
||||
functionGenericReturn(generic1(FutureOr, B), B));
|
||||
|
||||
// <T extends FutureOr<B>> T -> B <: <T extends FutureOr<B>> T -> A
|
||||
checkProperSubtype(functionGenericArg(generic1(FutureOr, B), B),
|
||||
functionGenericArg(generic1(FutureOr, B), A));
|
||||
|
||||
// Generics.
|
||||
// D <: D<B>
|
||||
checkSubtype(D, generic1(D, B));
|
||||
// D<B> <: D
|
||||
checkSubtype(generic1(D, B), D);
|
||||
// D<C> <: D<B>
|
||||
checkProperSubtype(generic1(D, C), generic1(D, B));
|
||||
|
||||
// F <: E
|
||||
checkProperSubtype(F, E);
|
||||
// F <: E<A, A>
|
||||
checkProperSubtype(F, generic2(E, A, A));
|
||||
// E<B, B> <: E<A, A>
|
||||
checkProperSubtype(generic2(E, B, B), E);
|
||||
// E<B, B> <: E<A, A>
|
||||
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<A>
|
||||
checkSubtypeFailure(Null, generic1(FutureOr, A));
|
||||
// Null <\: Future<A>
|
||||
checkSubtypeFailure(Null, generic1(Future, A));
|
||||
// FutureOr<Null> <\: Future<Null>
|
||||
checkSubtypeFailure(generic1(FutureOr, Null), generic1(Future, Null));
|
||||
// Null <\: Future<A?>
|
||||
checkSubtypeFailure(Null, generic1(Future, nullable(A)));
|
||||
// FutureOr<Object?> <\: Object
|
||||
checkSubtypeFailure(generic1(FutureOr, nullable(Object)), Object);
|
||||
// FutureOr<dynamic> <\: Object
|
||||
checkSubtypeFailure(generic1(FutureOr, dynamic), Object);
|
||||
// FutureOr<void> <\: Object
|
||||
checkSubtypeFailure(generic1(FutureOr, voidType), Object);
|
||||
}
|
|
@ -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
|
|
@ -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<tWrapped> 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<tWrapped, rWrapped> 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
|
||||
// <T extends boundWrapped> 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 extends boundWrapped> 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.');
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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_));
|
||||
}
|
|
@ -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
|
|
@ -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);
|
||||
}
|
|
@ -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<T extends B> {}
|
||||
|
||||
class E<T, S> {}
|
||||
|
||||
class F extends E<B, B> {}
|
||||
|
||||
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<Object?>
|
||||
checkProperSubtype(Null, generic1(FutureOr, nullable(Object)));
|
||||
// Object <: FutureOr<Object?>
|
||||
checkSubtype(Object, generic1(FutureOr, nullable(Object)));
|
||||
// Object? <: FutureOr<Object?>
|
||||
checkSubtype(nullable(Object), generic1(FutureOr, nullable(Object)));
|
||||
// Object <: FutureOr<Object>
|
||||
checkSubtype(Object, generic1(FutureOr, Object));
|
||||
// FutureOr<Object> <: Object
|
||||
checkSubtype(generic1(FutureOr, Object), Object);
|
||||
// Object <: FutureOr<dynamic>
|
||||
checkSubtype(Object, generic1(FutureOr, dynamic));
|
||||
// Object <: FutureOr<void>
|
||||
checkSubtype(Object, generic1(FutureOr, voidType));
|
||||
// Future<Object> <: FutureOr<Object?>
|
||||
checkProperSubtype(
|
||||
generic1(Future, Object), generic1(FutureOr, nullable(Object)));
|
||||
// Future<Object?> <: FutureOr<Object?>
|
||||
checkProperSubtype(
|
||||
generic1(Future, nullable(Object)), generic1(FutureOr, nullable(Object)));
|
||||
// FutureOr<Never> <: Future<Never>
|
||||
checkSubtype(generic1(FutureOr, neverType), generic1(Future, neverType));
|
||||
// Future<B> <: FutureOr<A>
|
||||
checkProperSubtype(generic1(Future, B), generic1(FutureOr, A));
|
||||
// B <: <: FutureOr<A>
|
||||
checkProperSubtype(B, generic1(FutureOr, A));
|
||||
// Future<B> <: Future<A>
|
||||
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.
|
||||
// <T extends int> void -> void <: <T extends int> void -> void
|
||||
checkSubtype(genericFunction(int), genericFunction(int));
|
||||
|
||||
// <T extends String> A -> T <: <T extends String> B -> T
|
||||
checkProperSubtype(
|
||||
functionGenericReturn(String, A), functionGenericReturn(String, B));
|
||||
|
||||
// <T extends double> T -> B <: <T extends double> T -> A
|
||||
checkProperSubtype(
|
||||
functionGenericArg(double, B), functionGenericArg(double, A));
|
||||
|
||||
// Bound is a function type.
|
||||
// <T extends A -> B> void -> void <: <T extends A -> B> void -> void
|
||||
checkSubtype(
|
||||
genericFunction(function1(B, A)), genericFunction(function1(B, A)));
|
||||
|
||||
// <T extends A -> B> A -> T <: <T extends A -> B> B -> T
|
||||
checkProperSubtype(functionGenericReturn(function1(B, A), A),
|
||||
functionGenericReturn(function1(B, A), B));
|
||||
|
||||
// <T extends A -> B> T -> B <: <T extends A -> B> T -> A
|
||||
checkProperSubtype(functionGenericArg(function1(B, A), B),
|
||||
functionGenericArg(function1(B, A), A));
|
||||
|
||||
// Bound is a user defined class.
|
||||
// <T extends B> void -> void <: <T extends B> void -> void
|
||||
checkSubtype(genericFunction(B), genericFunction(B));
|
||||
|
||||
// <T extends B> A -> T <: <T extends B> B -> T
|
||||
checkProperSubtype(functionGenericReturn(B, A), functionGenericReturn(B, B));
|
||||
|
||||
// <T extends B> T -> B <: <T extends B> T -> A
|
||||
checkProperSubtype(functionGenericArg(B, B), functionGenericArg(B, A));
|
||||
|
||||
// Bound is a Future.
|
||||
// <T extends Future<B>> void -> void <: <T extends Future<B>> void -> void
|
||||
checkSubtype(genericFunction(generic1(Future, B)),
|
||||
genericFunction(generic1(Future, B)));
|
||||
|
||||
// <T extends Future<B>> A -> T <: <T extends Future<B>> B -> T
|
||||
checkProperSubtype(functionGenericReturn(generic1(Future, B), A),
|
||||
functionGenericReturn(generic1(Future, B), B));
|
||||
|
||||
// <T extends Future<B>> T -> B <: <T extends Future<B>> T -> A
|
||||
checkProperSubtype(functionGenericArg(generic1(Future, B), B),
|
||||
functionGenericArg(generic1(Future, B), A));
|
||||
|
||||
// Bound is a FutureOr.
|
||||
// <T extends FutureOr<B>> void -> void <:
|
||||
// <T extends FutureOr<B>> void -> void
|
||||
checkSubtype(genericFunction(generic1(FutureOr, B)),
|
||||
genericFunction(generic1(FutureOr, B)));
|
||||
|
||||
// <T extends FutureOr<B>> A -> T <: <T extends FutureOr<B>> B -> T
|
||||
checkProperSubtype(functionGenericReturn(generic1(FutureOr, B), A),
|
||||
functionGenericReturn(generic1(FutureOr, B), B));
|
||||
|
||||
// <T extends FutureOr<B>> T -> B <: <T extends FutureOr<B>> T -> A
|
||||
checkProperSubtype(functionGenericArg(generic1(FutureOr, B), B),
|
||||
functionGenericArg(generic1(FutureOr, B), A));
|
||||
|
||||
// Generics.
|
||||
// D <: D<B>
|
||||
checkSubtype(D, generic1(D, B));
|
||||
// D<B> <: D
|
||||
checkSubtype(generic1(D, B), D);
|
||||
// D<C> <: D<B>
|
||||
checkProperSubtype(generic1(D, C), generic1(D, B));
|
||||
|
||||
// F <: E
|
||||
checkProperSubtype(F, E);
|
||||
// F <: E<A, A>
|
||||
checkProperSubtype(F, generic2(E, A, A));
|
||||
// E<B, B> <: E<A, A>
|
||||
checkProperSubtype(generic2(E, B, B), E);
|
||||
// E<B, B> <: E<A, A>
|
||||
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<A>
|
||||
checkProperSubtype(Null, generic1(FutureOr, A));
|
||||
// Null <: Future<A>
|
||||
checkProperSubtype(Null, generic1(Future, A));
|
||||
// FutureOr<Null> <: Future<Null>
|
||||
checkSubtype(generic1(FutureOr, Null), generic1(Future, Null));
|
||||
// Null <: Future<A?>
|
||||
checkProperSubtype(Null, generic1(Future, nullable(A)));
|
||||
// FutureOr<Object?> <: Object
|
||||
checkSubtype(generic1(FutureOr, nullable(Object)), Object);
|
||||
// FutureOr<dynamic> <: Object
|
||||
checkSubtype(generic1(FutureOr, dynamic), Object);
|
||||
// FutureOr<void> <: Object
|
||||
checkSubtype(generic1(FutureOr, voidType), Object);
|
||||
}
|
|
@ -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
|
|
@ -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<tWrapped> 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<tWrapped, rWrapped> 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
|
||||
// <T extends boundWrapped> 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 extends boundWrapped> 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.');
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue