dart-sdk/tools
Paul Berry a19ae4ee68 Enable the extension types language feature.
This language feature allows the user to declare a static type using
`extension type` syntax, for example:

    extension type IdNumber(int i) {
      operator <(IdNumber other) => i < other.i;
      bool isValid(Some parameters) => ...;
    }

This behaves similarly to a "wrapper" class:

    class IdNumber {
      final int i;
      IdNumber(this.i);
      operator <(IdNumber other) => i < other.i;
      bool isValid(Some parameters) => ...;
    }

However, at runtime, no wrapper objects are created; instead, an
instance of the extension type is represented directly by its
"representation type" (`int` in the above example), and methods like
`isValid` are resolved statically. This gives developers an
abstraction mechanism with the advantage of zero runtime performance
cost, since no extra heap space is required, and no extra instructions
are needed to convert between an extension type and its underlying
representation.

The disadvantage of using extension types as an abstraction mechanism
is that since no wrapper objects are created at runtime, the
abstraction can be bypassed using `dynamic`, runtime casts, or by
"laundering" the object through contravariant generic methods like
`List.add` (which are runtime checked in Dart). For example:

    main() {
      var id = IdNumber(1);
      var list1 = <int>[];
      List<Object> list2 = list1;
      list2.add(id); // OK at compile time because `IdNumber` is a
                     // subtype of `Object`. OK at runtime because
		     // at runtime, `IdNumber` and `int` are
		     // indistinguishable.
      int i = list1[0];
      print(i);
    }

Extension types are expected to be particularly useful for
low-overhead decoding of external data formats (such as JSON), and for
inter-operation with other languages (such as Javascript).

For additional information see the feature specification:
https://github.com/dart-lang/language/blob/main/accepted/future-releases/extension-types/feature-specification.md

Change-Id: I900a3a25dcfc38bfa9c9f9b5b9fa20f362883653
Tested: Standard trybots
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335062
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-11-21 19:14:49 +00:00
..
bots [gardening/stress] Clean up references to redundant nnbd from stress test steps. 2023-11-20 23:58:56 +00:00
buildtools Spelling tools 2022-12-21 17:26:48 +00:00
dart2js Change : to = in tools/ and DOM templates. 2022-08-24 14:21:01 +00:00
dom [dart:html] Fix incorrect parameter mention in drawImageScaledFromSource docs 2023-08-23 00:25:29 +00:00
fuchsia [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
linux_dist_support [ffi] Reland the iNativeCallable.listener example test. 2023-09-28 22:41:42 +00:00
package_deps [bisect_dart] Enable further analysis for bisect_dart tool 2023-10-24 16:21:14 +00:00
patches Spelling tools 2023-01-09 15:48:57 +00:00
sdks Checked in SDKs are now automatically uploaded. 2023-04-21 13:57:15 +00:00
spec_parser Adjust Dart.g such that an extension can not have the name type 2023-10-27 16:21:41 +00:00
test_generators Change "dartfmt" -> "dart format" in test generator. 2021-10-04 17:11:27 +00:00
testing [infra] Remove obsolete webdriver/selenium support from testing 2019-06-18 06:59:09 +00:00
verify_docs Mark deprecated Hints with Warning aliases as deprecated 2023-04-13 20:07:36 +00:00
.gitignore Reland https://dart-review.googlesource.com/c/sdk/+/96500 2019-03-13 21:03:01 +00:00
3xhead_flutter_hooks.sh [infra] Extend 3head patching to apply patches for flutter/flutter depending on pinned engine commit 2019-02-04 12:37:10 +00:00
addlatexhash.dart [deps] rev package:file 2022-05-10 00:08:42 +00:00
analysis_options.yaml [repo] improve the analysis of the tools/ directory 2022-02-17 19:09:52 +00:00
bisect.dart [tool] Bisection tool 2023-07-13 13:22:26 +00:00
build.py [infra] Reland "Begin RBE Linux x64 support." 2023-10-24 14:36:19 +00:00
copy_dart.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
copy_tree.py Spelling tools 2023-01-09 15:48:57 +00:00
create_pkg_manifest.py [tools] Update all iteritems -> items 2021-05-20 11:36:52 +00:00
diff_results.dart Spelling tools 2023-01-09 15:48:57 +00:00
download_chromium_sysroot.sh [infra] Remove wheezy left overs from SDK 2020-06-04 18:32:29 +00:00
experimental_features.yaml Enable the extension types language feature. 2023-11-21 19:14:49 +00:00
FAKE_COMMITS [flip-modifiers]: flip the flags for sealed classes and class modifiers 2023-03-10 05:27:57 +00:00
find_builders.dart [tools] Fixes to find_builders.dart 2023-07-26 16:02:56 +00:00
find_depot_tools.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
gen_fuchsia_test_manifest.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
generate_buildfiles.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
generate_experimental_flags.dart Reland "Bump version to 3.3." 2023-10-06 19:00:58 +00:00
generate_idefiles.py [tool] generate_idefiles sanitizer argument 2023-09-08 15:49:28 +00:00
generate_package_config.dart Add sample directories to the package config. 2023-11-02 21:00:41 +00:00
generate_package_config.py [infra] re-land work to auto-generate .dart_tool/package_config.json 2022-04-12 17:21:02 +00:00
generate_sdk_version_file.py [sdk] Generate a version file for the unpatched SDK 2022-05-05 10:36:05 +00:00
generate_shim_headers.py add tools for generating shim headers 2023-04-19 01:37:48 +00:00
get_dot_git_folder.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
git_cl_try.sh [vm] Update bot list in tools/git_cl_try.sh 2022-04-22 15:35:20 +00:00
gn.py [build] Switch to Fuchsia core SDK. 2023-11-10 19:23:11 +00:00
gn_helpers.py Mass format python with yapf 2019-08-05 20:34:31 +00:00
line_doc_comments.dart Fix typos 2022-06-15 11:08:28 +00:00
list_dart_files.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
list_dart_files_as_depfile.py Reapply "[build] Track glob dependencies via depfiles, instead of always re-executing scripts at GN time." 2021-05-12 00:27:28 +00:00
make_version.py Reland "Forward compatibility for renaming the be channel to main." 2023-09-27 14:27:40 +00:00
manage_deps.dart [deps] update the rev script to handle 'main' branches 2023-02-06 18:04:11 +00:00
minidump.py [tool] Fixes crash in tools/minidump.py 2021-05-17 10:30:30 +00:00
opt_out_files.dart [repo] improve the analysis of the tools/ directory 2022-02-17 19:09:52 +00:00
OWNERS Add myself and Ben to owners of package:dap 2023-05-15 19:12:16 +00:00
OWNERS_ANALYZER update analyzer owners 2023-08-09 22:44:26 +00:00
OWNERS_BUILD [infra] Give VM engineers OWNERS over tools/gn.py et al. 2022-04-25 17:47:23 +00:00
OWNERS_CFE [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
OWNERS_DEVTOOLS Update OWNERS_DEVTOOLS to include all members of the DevTools team 2023-08-22 14:35:00 +00:00
OWNERS_ECOSYSTEM [owners] add mosum@ to the OWNERS_ECOSYSTEM file 2022-09-16 17:51:55 +00:00
OWNERS_ENG add a tools/OWNERS_GOOGLE3 owners file 2022-04-19 21:31:07 +00:00
OWNERS_FOUNDATION [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
OWNERS_GOOGLE3 add a tools/OWNERS_GOOGLE3 owners file 2022-04-19 21:31:07 +00:00
OWNERS_INFRA [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
OWNERS_LANGUAGE Use OWNERS files to restrict editing of tests/language to language team. 2023-11-16 18:18:00 +00:00
OWNERS_PRODUCT [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
OWNERS_PUB Add OWNERS_PUB 2022-03-07 13:33:42 +00:00
OWNERS_VM [OWNERS] Fix VM owners file entries. 2022-11-11 20:25:03 +00:00
OWNERS_WASM [wasm] Add Omer to tools/OWNERS_WASM 2023-05-22 11:12:02 +00:00
OWNERS_WEB [owners] Add Nate to OWNERS_WEB 2022-06-09 16:47:43 +00:00
presubmit.sh
publish_pkg.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
rev_sdk_deps.dart [deps] ensure individual review of specific deps 2023-09-27 17:26:35 +00:00
run_offsets_extractor.dart [vm] Rewrite tools/offset_extractors.sh in Dart 2023-07-24 12:47:52 +00:00
run_with_coredumps_enabled.py [gardening] Add coredump archiving support to iso-stress builder. 2021-10-04 08:49:28 +00:00
set_ia32_sysroot.sh [build] Move to Jessie sysroots from Wheezy sysroots. 2018-10-25 15:05:22 +00:00
set_x64_sysroot.sh [build] Move to Jessie sysroots from Wheezy sysroots. 2018-10-25 15:05:22 +00:00
spec_parse.py Migrate tools/spec_parse.py to use python3 2021-04-19 15:33:38 +00:00
task_kill.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
test.dart [tools] migrate the rest of tools/ to null safety 2022-06-24 16:38:39 +00:00
test.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
utils.py Remove obsolete checked-in SDK logic. 2023-09-28 10:49:23 +00:00
validate_test_matrix.dart Migrate several files in tools/. 2022-06-10 16:31:04 +00:00
VERSION Rename be channel to main. 2023-11-13 13:27:24 +00:00
write_dartdoc_options_file.py Update dartdoc to 1.0.0 and lock down dartdoc warnings. 2021-06-29 19:31:28 +00:00
write_revision_file.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
write_version_file.py [infra] Migrate scripts to python3 2021-04-15 10:10:20 +00:00
yaml2json.dart [repo] improve the analysis of the tools/ directory 2022-02-17 19:09:52 +00:00