From 4270b99d7571ee57bcfae72037d0a3e8e1f96a93 Mon Sep 17 00:00:00 2001 From: Leaf Petersen Date: Mon, 30 Oct 2017 19:54:26 +0000 Subject: [PATCH] Fix dynamic as bottom uses in front end and dart2js. Re-enable the dynamic as bottom hint in analysis_options.yaml and fix the code to be hint clean again. Fixes #30589 Fixes #30590 Bug: Change-Id: Idb7910b3ab1c6d931a3ead3eed885d8bd172e621 Reviewed-on: https://dart-review.googlesource.com/17062 Commit-Queue: Leaf Petersen Reviewed-by: Johnni Winther --- pkg/compiler/analysis_options.yaml | 3 - pkg/compiler/lib/src/dart2js.dart | 10 +- pkg/compiler/lib/src/helpers/track_map.dart | 2 +- .../src/js_backend/backend_serialization.dart | 8 +- .../lib/src/js_emitter/constant_ordering.dart | 4 +- .../lib/src/serialization/equivalence.dart | 36 ++--- .../lib/src/serialization/modelz.dart | 2 +- .../lib/src/serialization/serialization.dart | 6 +- pkg/compiler/tool/track_memory.dart | 2 +- pkg/front_end/analysis_options.yaml | 4 - .../lib/src/byte_store/file_byte_store.dart | 3 +- .../lib/src/fasta/kernel/body_builder.dart | 2 +- .../lib/src/multi_root_file_system.dart | 6 +- pkg/js_ast/lib/src/printer.dart | 2 +- tests/compiler/dart2js/analysis_options.yaml | 3 - .../constant_expression_evaluate_test.dart | 4 +- .../dart2js/constant_expression_test.dart | 4 +- .../compiler/dart2js/dart2js_batch2_test.dart | 2 +- .../compiler/dart2js/dart2js_batch_test.dart | 2 +- .../dart2js/equivalence/check_helpers.dart | 130 ++++++++++-------- tests/compiler/dart2js/kernel/mixin_test.dart | 14 +- .../compiler/dart2js/kernel/test_helpers.dart | 6 + tests/compiler/dart2js/launch_helper.dart | 2 +- tests/compiler/dart2js/memory_compiler.dart | 2 +- tests/compiler/dart2js/mirrors_used_test.dart | 19 ++- tests/compiler/dart2js/mock_compiler.dart | 2 +- tests/compiler/dart2js/parser_test.dart | 9 +- tests/compiler/dart2js/patch_test.dart | 2 +- .../dart2js/reexport_handled_test.dart | 3 +- tests/compiler/dart2js/resolver_test.dart | 4 +- .../serialization/model_test_helper.dart | 24 ++-- .../serialization/native_data_test.dart | 16 +-- ...ource_map_deferred_d2js_validity_test.dart | 3 +- .../dart2js/sourcemaps/diff_view.dart | 2 +- tests/compiler/dart2js/sourcemaps/save.dart | 2 +- .../dart2js/type_mask_disjoint_test.dart | 3 +- 36 files changed, 185 insertions(+), 163 deletions(-) diff --git a/pkg/compiler/analysis_options.yaml b/pkg/compiler/analysis_options.yaml index 0497ae31983..cb840905958 100644 --- a/pkg/compiler/analysis_options.yaml +++ b/pkg/compiler/analysis_options.yaml @@ -8,7 +8,4 @@ analyzer: enableSuperMixins: false errors: todo: ignore - # https://github.com/dart-lang/sdk/issues/30589 - # TODO(leafp): remove once #30589 is resolved - uses_dynamic_as_bottom: ignore deprecated_member_use: ignore diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart index 420e8210ed8..3da3f813fb0 100644 --- a/pkg/compiler/lib/src/dart2js.dart +++ b/pkg/compiler/lib/src/dart2js.dart @@ -43,14 +43,18 @@ String BUILD_ID = null; * string argument, or the arguments iterator for multiple arguments * handlers. */ -typedef void HandleOption(data); +typedef void HandleOption(Null data); class OptionHandler { final String pattern; - final HandleOption handle; + final HandleOption _handle; final bool multipleArguments; - OptionHandler(this.pattern, this.handle, {this.multipleArguments: false}); + void handle(argument) { + (_handle as dynamic)(argument); + } + + OptionHandler(this.pattern, this._handle, {this.multipleArguments: false}); } /** diff --git a/pkg/compiler/lib/src/helpers/track_map.dart b/pkg/compiler/lib/src/helpers/track_map.dart index 8a5eb6d7bc0..fff6ba61c4c 100644 --- a/pkg/compiler/lib/src/helpers/track_map.dart +++ b/pkg/compiler/lib/src/helpers/track_map.dart @@ -14,7 +14,7 @@ * is printed but only when running in verbose mode. */ class TrackMap implements Map { - final Map _map; + final Map _map; final List _counts; static final Map> _countsMap = {}; diff --git a/pkg/compiler/lib/src/js_backend/backend_serialization.dart b/pkg/compiler/lib/src/js_backend/backend_serialization.dart index a025e961e85..5d46196f746 100644 --- a/pkg/compiler/lib/src/js_backend/backend_serialization.dart +++ b/pkg/compiler/lib/src/js_backend/backend_serialization.dart @@ -231,10 +231,10 @@ class NativeBehaviorSerialization { /// Returns a list of the names of the [SpecialType]s in [types]. static List filterSpecialTypes(List types) { - return types - .where((type) => getTypeKind(type) == SPECIAL_TYPE) - .map((SpecialType type) => type.name) - .toList(); + return types.where((type) => getTypeKind(type) == SPECIAL_TYPE).map((t) { + SpecialType type = t; + return type.name; + }).toList(); } static void serializeNativeBehavior( diff --git a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart index 12db1a85e74..fe9ade5758b 100644 --- a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart +++ b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart @@ -43,14 +43,14 @@ class _ConstantOrdering return a.accept(this, b); } - static int compareNullable(int compare(a, b), a, b) { + static int compareNullable(int compare(T a, T b), T a, T b) { if (a == null && b == null) return 0; if (a == null) return -1; if (b == null) return 1; return compare(a, b); } - static int compareLists(int compare(a, b), List a, List b) { + static int compareLists(int compare(S a, T b), List a, List b) { int r = a.length.compareTo(b.length); if (r != 0) return r; for (int i = 0; i < a.length; i++) { diff --git a/pkg/compiler/lib/src/serialization/equivalence.dart b/pkg/compiler/lib/src/serialization/equivalence.dart index 22792094497..a7186b0506c 100644 --- a/pkg/compiler/lib/src/serialization/equivalence.dart +++ b/pkg/compiler/lib/src/serialization/equivalence.dart @@ -39,8 +39,8 @@ bool equality(a, b) => a == b; /// Returns `true` if the elements in [a] and [b] are pair-wise equivalent /// according to [elementEquivalence]. -bool areListsEquivalent(List a, List b, - [bool elementEquivalence(a, b) = equality]) { +bool areListsEquivalent(List a, List b, + [bool elementEquivalence(T a, T b) = equality]) { if (a.length != b.length) return false; for (int i = 0; i < a.length && i < b.length; i++) { if (!elementEquivalence(a[i], b[i])) { @@ -52,9 +52,9 @@ bool areListsEquivalent(List a, List b, /// Returns `true` if the elements in [a] and [b] are equivalent as sets using /// [elementEquivalence] to determine element equivalence. -bool areSetsEquivalent(Iterable set1, Iterable set2, - [bool elementEquivalence(a, b) = equality]) { - Set remaining = set2.toSet(); +bool areSetsEquivalent(Iterable set1, Iterable set2, + [bool elementEquivalence(E a, E b) = equality]) { + Set remaining = set2.toSet(); for (dynamic element1 in set1) { bool found = false; for (dynamic element2 in set2) { @@ -73,9 +73,9 @@ bool areSetsEquivalent(Iterable set1, Iterable set2, /// Returns `true` if the content of [map1] and [map2] is equivalent using /// [keyEquivalence] and [valueEquivalence] to determine key/value equivalence. -bool areMapsEquivalent(Map map1, Map map2, - [bool keyEquivalence(a, b) = equality, - bool valueEquivalence(a, b) = equality]) { +bool areMapsEquivalent(Map map1, Map map2, + [bool keyEquivalence(K a, K b) = equality, + bool valueEquivalence(V a, V b) = equality]) { Set remaining = map2.keys.toSet(); for (dynamic key1 in map1.keys) { bool found = false; @@ -369,9 +369,9 @@ class TestStrategy { /// An equivalence [TestStrategy] that doesn't throw on inequivalence. TestStrategy get testOnly => this; - bool test(dynamic object1, dynamic object2, String property, dynamic value1, - dynamic value2, - [bool equivalence(a, b) = equality]) { + bool test( + dynamic object1, dynamic object2, String property, T value1, T value2, + [bool equivalence(T a, T b) = equality]) { return equivalence(value1, value2); } @@ -381,16 +381,16 @@ class TestStrategy { return areListsEquivalent(list1, list2, elementEquivalence); } - bool testSets(dynamic object1, dynamic object2, String property, - Iterable set1, Iterable set2, - [bool elementEquivalence(a, b) = equality]) { + bool testSets(dynamic object1, dynamic object2, String property, + Iterable set1, Iterable set2, + [bool elementEquivalence(E a, E b) = equality]) { return areSetsEquivalent(set1, set2, elementEquivalence); } - bool testMaps( - dynamic object1, dynamic object2, String property, Map map1, Map map2, - [bool keyEquivalence(a, b) = equality, - bool valueEquivalence(a, b) = equality]) { + bool testMaps(dynamic object1, dynamic object2, String property, + Map map1, Map map2, + [bool keyEquivalence(K a, K b) = equality, + bool valueEquivalence(V a, V b) = equality]) { return areMapsEquivalent(map1, map2, keyEquivalence, valueEquivalence); } diff --git a/pkg/compiler/lib/src/serialization/modelz.dart b/pkg/compiler/lib/src/serialization/modelz.dart index c499b1e776f..773980d8cf9 100644 --- a/pkg/compiler/lib/src/serialization/modelz.dart +++ b/pkg/compiler/lib/src/serialization/modelz.dart @@ -790,7 +790,7 @@ abstract class ParametersMixin if (_functionSignature == null) { List requiredParameters = []; List optionalParameters = []; - List orderedOptionalParameters = []; + List orderedOptionalParameters = []; int requiredParameterCount = 0; int optionalParameterCount = 0; bool optionalParametersAreNamed = false; diff --git a/pkg/compiler/lib/src/serialization/serialization.dart b/pkg/compiler/lib/src/serialization/serialization.dart index ffba5c51fb0..592687ed9f4 100644 --- a/pkg/compiler/lib/src/serialization/serialization.dart +++ b/pkg/compiler/lib/src/serialization/serialization.dart @@ -382,7 +382,7 @@ abstract class AbstractDecoder { /// If no value is associated with [key], then if [isOptional] is `true`, /// and empty [List] is returned, otherwise an exception is thrown. List getElements(K key, {bool isOptional: false}) { - List list = _map[_getKeyValue(key)]; + List list = _map[_getKeyValue(key)]; if (list == null) { if (isOptional) { return const []; @@ -414,7 +414,7 @@ abstract class AbstractDecoder { /// If no value is associated with [key], then if [isOptional] is `true`, /// and empty [List] is returned, otherwise an exception is thrown. List getConstants(K key, {bool isOptional: false}) { - List list = _map[_getKeyValue(key)]; + List list = _map[_getKeyValue(key)]; if (list == null) { if (isOptional) { return const []; @@ -446,7 +446,7 @@ abstract class AbstractDecoder { /// If no value is associated with [key], then if [isOptional] is `true`, /// and empty [List] is returned, otherwise an exception is thrown. List getTypes(K key, {bool isOptional: false}) { - List list = _map[_getKeyValue(key)]; + List list = _map[_getKeyValue(key)]; if (list == null) { if (isOptional) { return const []; diff --git a/pkg/compiler/tool/track_memory.dart b/pkg/compiler/tool/track_memory.dart index 0ba0e7c382d..75d6d14128c 100644 --- a/pkg/compiler/tool/track_memory.dart +++ b/pkg/compiler/tool/track_memory.dart @@ -76,7 +76,7 @@ Future _sendMessage(String method, [Map args = const {}]) { } /// Handle all responses -_handleResponse(String s) { +void _handleResponse(Object s) { var json = JSON.decode(s); if (json['method'] != 'streamNotify') { var id = json['id']; diff --git a/pkg/front_end/analysis_options.yaml b/pkg/front_end/analysis_options.yaml index a73ac1f491d..8460b247aa6 100644 --- a/pkg/front_end/analysis_options.yaml +++ b/pkg/front_end/analysis_options.yaml @@ -16,10 +16,6 @@ analyzer: # Allow having TODOs in the code todo: ignore - # https://github.com/dart-lang/sdk/issues/30590 - # TODO(leafp): remove once #30590 is resolved - uses_dynamic_as_bottom: ignore - # Allow deprecated calls (although it would be nice to have a distinction # between internal and external deprecated calls). deprecated_member_use: ignore diff --git a/pkg/front_end/lib/src/byte_store/file_byte_store.dart b/pkg/front_end/lib/src/byte_store/file_byte_store.dart index 10769f598c0..8ce63de5022 100644 --- a/pkg/front_end/lib/src/byte_store/file_byte_store.dart +++ b/pkg/front_end/lib/src/byte_store/file_byte_store.dart @@ -91,7 +91,8 @@ class EvictingFileByteStore implements ByteStore { * This function is started in a new isolate, receives cache folder clean up * requests and evicts older files from the folder. */ - static void _cacheCleanUpFunction(SendPort initialReplyTo) { + static void _cacheCleanUpFunction(message) { + SendPort initialReplyTo = message; ReceivePort port = new ReceivePort(); initialReplyTo.send(port.sendPort); port.listen((request) async { diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart index 5b85c5a3f75..583935590dc 100644 --- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart +++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart @@ -461,7 +461,7 @@ class BodyBuilder extends ScopeListener implements BuilderHelper { _typeInferrer.inferMetadata(annotations); Field field = fields.first.target; // The first (and often only field) will not get a clone. - annotations.forEach(field.addAnnotation); + annotations.forEach((annotation) => field.addAnnotation(annotation)); for (int i = 1; i < fields.length; i++) { // We have to clone the annotations on the remaining fields. field = fields[i].target; diff --git a/pkg/front_end/lib/src/multi_root_file_system.dart b/pkg/front_end/lib/src/multi_root_file_system.dart index a8fb3c07e33..9cf5e90f7d4 100644 --- a/pkg/front_end/lib/src/multi_root_file_system.dart +++ b/pkg/front_end/lib/src/multi_root_file_system.dart @@ -79,5 +79,7 @@ class MultiRootFileSystemEntity implements FileSystemEntity { Future readAsString() async => (await delegate).readAsString(); } -_normalize(Uri uri) => - uri.path.endsWith('/') ? uri : uri.replace(path: '${uri.path}/'); +_normalize(root) { + Uri uri = root; + return uri.path.endsWith('/') ? uri : uri.replace(path: '${uri.path}/'); +} diff --git a/pkg/js_ast/lib/src/printer.dart b/pkg/js_ast/lib/src/printer.dart index 041b2dc5b8b..511bf4a4108 100644 --- a/pkg/js_ast/lib/src/printer.dart +++ b/pkg/js_ast/lib/src/printer.dart @@ -4,7 +4,7 @@ part of js_ast; -typedef String Renamer(Name); +typedef String Renamer(Name name); class JavaScriptPrintingOptions { final bool shouldCompressOutput; diff --git a/tests/compiler/dart2js/analysis_options.yaml b/tests/compiler/dart2js/analysis_options.yaml index 6b72a53102f..1bdb85889e1 100644 --- a/tests/compiler/dart2js/analysis_options.yaml +++ b/tests/compiler/dart2js/analysis_options.yaml @@ -10,9 +10,6 @@ analyzer: errors: todo: ignore - # https://github.com/dart-lang/sdk/issues/30589 - # TODO(leafp): remove once #30589 is resolved - uses_dynamic_as_bottom: ignore deprecated_member_use: ignore exclude: diff --git a/tests/compiler/dart2js/constant_expression_evaluate_test.dart b/tests/compiler/dart2js/constant_expression_evaluate_test.dart index f688e2759d9..c485f0b4dfe 100644 --- a/tests/compiler/dart2js/constant_expression_evaluate_test.dart +++ b/tests/compiler/dart2js/constant_expression_evaluate_test.dart @@ -32,7 +32,7 @@ class TestData { final String declarations; /// Tested constants. - final List constants; + final List constants; const TestData(this.name, this.declarations, this.constants); } @@ -446,7 +446,7 @@ main() { Future testData(TestData data) async { StringBuffer sb = new StringBuffer(); sb.write('${data.declarations}\n'); - Map constants = {}; + Map constants = {}; data.constants.forEach((ConstantData constantData) { String name = 'c${constants.length}'; sb.write('const $name = ${constantData.code};\n'); diff --git a/tests/compiler/dart2js/constant_expression_test.dart b/tests/compiler/dart2js/constant_expression_test.dart index f419ac3a5a1..223ba1bde78 100644 --- a/tests/compiler/dart2js/constant_expression_test.dart +++ b/tests/compiler/dart2js/constant_expression_test.dart @@ -19,7 +19,7 @@ class TestData { final String declarations; /// Tested constants. - final List constants; + final List constants; const TestData(this.declarations, this.constants); } @@ -192,7 +192,7 @@ main() { Future testData(TestData data) async { StringBuffer sb = new StringBuffer(); sb.write('${data.declarations}\n'); - Map constants = {}; + Map constants = {}; data.constants.forEach((ConstantData constantData) { String name = 'c${constants.length}'; sb.write('const $name = ${constantData.code};\n'); diff --git a/tests/compiler/dart2js/dart2js_batch2_test.dart b/tests/compiler/dart2js/dart2js_batch2_test.dart index 0fac8aa1a6d..3ff9ce431eb 100644 --- a/tests/compiler/dart2js/dart2js_batch2_test.dart +++ b/tests/compiler/dart2js/dart2js_batch2_test.dart @@ -49,7 +49,7 @@ void cleanUp() { tmpDir.deleteSync(recursive: true); } -Future launchDart2Js(_) { +Future launchDart2Js(_) { String ext = Platform.isWindows ? '.bat' : ''; String command = path.normalize(path.join( path.fromUri(Platform.script), '../../../../sdk/bin/dart2js${ext}')); diff --git a/tests/compiler/dart2js/dart2js_batch_test.dart b/tests/compiler/dart2js/dart2js_batch_test.dart index 7e33ed58685..abd2d4921bb 100644 --- a/tests/compiler/dart2js/dart2js_batch_test.dart +++ b/tests/compiler/dart2js/dart2js_batch_test.dart @@ -52,7 +52,7 @@ void cleanUp() { tmpDir.deleteSync(recursive: true); } -Future launchDart2Js(_) { +Future launchDart2Js(_) { return Process.start( // Use an absolute path because we are changing the cwd below. path.fromUri(Uri.base.resolve(Platform.executable)), diff --git a/tests/compiler/dart2js/equivalence/check_helpers.dart b/tests/compiler/dart2js/equivalence/check_helpers.dart index 1acc2a1df1b..e4d9de74181 100644 --- a/tests/compiler/dart2js/equivalence/check_helpers.dart +++ b/tests/compiler/dart2js/equivalence/check_helpers.dart @@ -90,8 +90,8 @@ class CheckStrategy extends TestStrategy { constantValueEquivalence: constantValueEquivalence); @override - bool test(var object1, var object2, String property, var value1, var value2, - [bool equivalence(a, b) = equality]) { + bool test(var object1, var object2, String property, T value1, T value2, + [bool equivalence(T a, T b) = equality]) { return check(object1, object2, property, value1, value2, equivalence); } @@ -109,17 +109,18 @@ class CheckStrategy extends TestStrategy { } @override - bool testSets( - var object1, var object2, String property, Iterable set1, Iterable set2, - [bool elementEquivalence(a, b) = equality]) { + bool testSets(var object1, var object2, String property, Iterable set1, + Iterable set2, + [bool elementEquivalence(E a, E b) = equality]) { return checkSetEquivalence( object1, object2, property, set1, set2, elementEquivalence); } @override - bool testMaps(var object1, var object2, String property, Map map1, Map map2, - [bool keyEquivalence(a, b) = equality, - bool valueEquivalence(a, b) = equality]) { + bool testMaps( + var object1, var object2, String property, Map map1, Map map2, + [bool keyEquivalence(K a, K b) = equality, + bool valueEquivalence(V a, V b) = equality]) { return checkMapEquivalence(object1, object2, property, map1, map2, keyEquivalence, valueEquivalence); } @@ -127,8 +128,8 @@ class CheckStrategy extends TestStrategy { /// Check that the values [property] of [object1] and [object2], [value1] and /// [value2] respectively, are equal and throw otherwise. -bool check(var object1, var object2, String property, var value1, var value2, - [bool equivalence(a, b) = equality, String toString(a)]) { +bool check(var object1, var object2, String property, T value1, T value2, + [bool equivalence(T a, T b) = equality, String toString(T a)]) { currentCheck = new Check( currentCheck, object1, object2, property, value1, value2, toString); if (!equivalence(value1, value2)) { @@ -142,13 +143,13 @@ bool check(var object1, var object2, String property, var value1, var value2, /// [checkEquivalence] to check the pair-wise equivalence. /// /// Uses [object1], [object2] and [property] to provide context for failures. -bool checkListEquivalence( +bool checkListEquivalence( Object object1, Object object2, String property, - Iterable list1, - Iterable list2, - void checkEquivalence(o1, o2, property, a, b)) { + Iterable list1, + Iterable list2, + void checkEquivalence(Object o1, Object o2, String property, T a, T b)) { currentCheck = new Check(currentCheck, object1, object2, property, list1, list2); for (int i = 0; i < list1.length && i < list2.length; i++) { @@ -177,9 +178,9 @@ bool checkListEquivalence( /// Elements both in [set1] and [set2] are added to [common], elements in [set1] /// but not in [set2] are added to [unfound], and the set of elements in [set2] /// but not in [set1] are returned. -Set computeSetDifference( - Iterable set1, Iterable set2, List common, List unfound, - {bool sameElement(a, b): equality, void checkElements(a, b)}) { +Set computeSetDifference( + Iterable set1, Iterable set2, List> common, List unfound, + {bool sameElement(E a, E b): equality, void checkElements(E a, E b)}) { // TODO(johnniwinther): Avoid the quadratic cost here. Some ideas: // - convert each set to a list and sort it first, then compare by walking // both lists in parallel @@ -214,12 +215,12 @@ Set computeSetDifference( /// [elementEquivalence] to compute the pair-wise equivalence. /// /// Uses [object1], [object2] and [property] to provide context for failures. -bool checkSetEquivalence(var object1, var object2, String property, - Iterable set1, Iterable set2, bool sameElement(a, b), - {void onSameElement(a, b)}) { - List common = []; - List unfound = []; - Set remaining = computeSetDifference(set1, set2, common, unfound, +bool checkSetEquivalence(var object1, var object2, String property, + Iterable set1, Iterable set2, bool sameElement(E a, E b), + {void onSameElement(E a, E b)}) { + var common = >[]; + var unfound = []; + Set remaining = computeSetDifference(set1, set2, common, unfound, sameElement: sameElement, checkElements: onSameElement); if (unfound.isNotEmpty || remaining.isNotEmpty) { String message = "Set mismatch for `$property` on\n" @@ -236,12 +237,18 @@ bool checkSetEquivalence(var object1, var object2, String property, /// [elementEquivalence] to compute the pair-wise equivalence. /// /// Uses [object1], [object2] and [property] to provide context for failures. -bool checkMapEquivalence(var object1, var object2, String property, Map map1, - Map map2, bool sameKey(a, b), bool sameValue(a, b), +bool checkMapEquivalence( + var object1, + var object2, + String property, + Map map1, + Map map2, + bool sameKey(K a, K b), + bool sameValue(V a, V b), {bool allowExtra: false}) { - List common = []; - List unfound = []; - Set extra = computeSetDifference(map1.keys, map2.keys, common, unfound, + var common = >[]; + var unfound = []; + var extra = computeSetDifference(map1.keys, map2.keys, common, unfound, sameElement: sameKey); if (unfound.isNotEmpty || (!allowExtra && extra.isNotEmpty)) { String message = @@ -266,7 +273,7 @@ bool checkElementIdentities(Object object1, Object object2, String property, Entity element1, Entity element2) { if (identical(element1, element2)) return true; return check( - object1, object2, property, element1, element2, areElementsEquivalent); + object1, object2, property, element1, element2, areEntitiesEquivalent); } /// Checks the pair-wise equivalence of the identity (but not properties) of the @@ -279,6 +286,13 @@ bool checkElementListIdentities(Object object1, Object object2, String property, object1, object2, property, list1, list2, checkElementIdentities); } +/// Checks the equivalence of [DartType]s [type1] and [type2]. +/// +/// Uses [object1], [object2] and [property] to provide context for failures. +bool checkDartTypes(Object object1, Object object2, String property, + DartType type1, DartType type2) => + checkTypes(object1, object2, property, type1, type2); + /// Checks the equivalence of [type1] and [type2]. /// /// Uses [object1], [object2] and [property] to provide context for failures. @@ -299,7 +313,7 @@ bool checkTypes(Object object1, Object object2, String property, bool checkTypeLists(Object object1, Object object2, String property, List list1, List list2) { return checkListEquivalence( - object1, object2, property, list1, list2, checkTypes); + object1, object2, property, list1, list2, checkDartTypes); } /// Checks the equivalence of [exp1] and [exp2]. @@ -355,13 +369,13 @@ bool checkConstantValueLists(Object object1, Object object2, String property, object1, object2, property, list1, list2, checkConstantValues); } -void checkLists( - List list1, List list2, String messagePrefix, bool sameElement(a, b), +void checkLists(List list1, List list2, String messagePrefix, + bool sameElement(T a, T b), {bool verbose: false, - void onSameElement(a, b), - void onDifferentElements(a, b), - void onUnfoundElement(a), - void onExtraElement(b), + void onSameElement(T a, T b), + void onDifferentElements(T a, T b), + void onUnfoundElement(T a), + void onExtraElement(T b), String elementToString(key): defaultToString}) { List common = []; List mismatch = []; @@ -429,17 +443,17 @@ void checkLists( } } -void checkSets( - Iterable set1, Iterable set2, String messagePrefix, bool sameElement(a, b), +void checkSets(Iterable set1, Iterable set2, String messagePrefix, + bool sameElement(E a, E b), {bool failOnUnfound: true, bool failOnExtra: true, bool verbose: false, - void onSameElement(a, b), - void onUnfoundElement(a), - void onExtraElement(b), - bool elementFilter(element), - elementConverter(element), - String elementToString(key): defaultToString}) { + void onSameElement(E a, E b), + void onUnfoundElement(E a), + void onExtraElement(E b), + bool elementFilter(E element), + elementConverter(E element), + String elementToString(E key): defaultToString}) { if (elementFilter != null) { set1 = set1.where(elementFilter); set2 = set2.where(elementFilter); @@ -448,9 +462,9 @@ void checkSets( set1 = set1.map(elementConverter); set2 = set2.map(elementConverter); } - List common = []; - List unfound = []; - Set remaining = computeSetDifference(set1, set2, common, unfound, + var common = >[]; + var unfound = []; + var remaining = computeSetDifference(set1, set2, common, unfound, sameElement: sameElement, checkElements: onSameElement); if (onUnfoundElement != null) { unfound.forEach(onUnfoundElement); @@ -490,25 +504,25 @@ void checkSets( String defaultToString(obj) => '$obj'; -void checkMaps(Map map1, Map map2, String messagePrefix, bool sameKey(a, b), - bool sameValue(a, b), +void checkMaps(Map map1, Map map2, String messagePrefix, + bool sameKey(K a, K b), bool sameValue(V a, V b), {bool failOnUnfound: true, bool failOnMismatch: true, - bool keyFilter(key), + bool keyFilter(K key), bool verbose: false, - String keyToString(key): defaultToString, - String valueToString(key): defaultToString}) { - List common = []; - List unfound = []; - List mismatch = []; + String keyToString(K key): defaultToString, + String valueToString(V key): defaultToString}) { + var common = >[]; + var unfound = []; + var mismatch = >[]; - Iterable keys1 = map1.keys; - Iterable keys2 = map2.keys; + Iterable keys1 = map1.keys; + Iterable keys2 = map2.keys; if (keyFilter != null) { keys1 = keys1.where(keyFilter); keys2 = keys2.where(keyFilter); } - Set remaining = computeSetDifference(keys1, keys2, common, unfound, + var remaining = computeSetDifference(keys1, keys2, common, unfound, sameElement: sameKey, checkElements: (k1, k2) { var v1 = map1[k1]; var v2 = map2[k2]; diff --git a/tests/compiler/dart2js/kernel/mixin_test.dart b/tests/compiler/dart2js/kernel/mixin_test.dart index 42f86a4e54c..0f921e76cc4 100644 --- a/tests/compiler/dart2js/kernel/mixin_test.dart +++ b/tests/compiler/dart2js/kernel/mixin_test.dart @@ -160,13 +160,13 @@ main(List args) { Expect.isNotNull(cls2, 'Missing class ${cls1.name}'); check(cls1.library, cls2.library, 'class ${cls1.name}', cls1, cls2, - equivalence.entityEquivalence); + equivalence.entityEntityEquivalence); InterfaceType thisType1 = types1.getThisType(cls1); InterfaceType thisType2 = types2.getThisType(cls2); check(cls1, cls2, 'thisType', thisType1, thisType2, - equivalence.typeEquivalence); + equivalence.typeTypeEquivalence); check(cls1, cls2, 'supertype', types1.getSupertype(cls1), - types2.getSupertype(cls2), equivalence.typeEquivalence); + types2.getSupertype(cls2), equivalence.typeTypeEquivalence); checkClasses(env1.getSuperClass(cls1), env2.getSuperClass(cls2)); List mixins1 = []; @@ -177,19 +177,19 @@ main(List args) { env2.forEachMixin(cls2, (ClassEntity mixin) { mixins2.add(types2.asInstanceOf(thisType2, mixin)); }); - checkLists( - mixins1, mixins2, '${cls1.name} mixins', equivalence.typeEquivalence); + checkLists(mixins1, mixins2, '${cls1.name} mixins', + equivalence.typeTypeEquivalence); checkLists( types1.getInterfaces(cls1).toList(), types2.getInterfaces(cls2).toList(), '${cls1.name} interfaces', - equivalence.typeEquivalence); + equivalence.typeTypeEquivalence); checkLists( types1.getSupertypes(cls1).toList(), types2.getSupertypes(cls2).toList(), '${cls1.name} supertypes', - equivalence.typeEquivalence); + equivalence.typeTypeEquivalence); if (cls1 == compiler1.frontendStrategy.commonElements.objectClass) return; diff --git a/tests/compiler/dart2js/kernel/test_helpers.dart b/tests/compiler/dart2js/kernel/test_helpers.dart index ed14dc3cdbd..e5635461297 100644 --- a/tests/compiler/dart2js/kernel/test_helpers.dart +++ b/tests/compiler/dart2js/kernel/test_helpers.dart @@ -37,6 +37,9 @@ class KernelEquivalence { constantEquivalence: constantEquivalence, constantValueEquivalence: constantValueEquivalence); + bool entityEntityEquivalence(Entity a, Entity b, {TestStrategy strategy}) => + entityEquivalence(a, b, strategy: strategy); + bool entityEquivalence(Element a, Entity b, {TestStrategy strategy}) { if (identical(a, b)) return true; if (a == null || b == null) return false; @@ -164,6 +167,9 @@ class KernelEquivalence { } } + bool typeTypeEquivalence(DartType a, DartType b, {TestStrategy strategy}) => + typeEquivalence(a, b, strategy: strategy); + bool typeEquivalence(ResolutionDartType a, DartType b, {TestStrategy strategy}) { if (identical(a, b)) return true; diff --git a/tests/compiler/dart2js/launch_helper.dart b/tests/compiler/dart2js/launch_helper.dart index 671d4121af7..4e4df858c86 100644 --- a/tests/compiler/dart2js/launch_helper.dart +++ b/tests/compiler/dart2js/launch_helper.dart @@ -20,7 +20,7 @@ List dart2JsCommand(List args) { return command; } -Future launchDart2Js(args, {bool noStdoutEncoding: false}) { +Future launchDart2Js(args, {bool noStdoutEncoding: false}) { if (noStdoutEncoding) { return Process.run(Platform.executable, dart2JsCommand(args), stdoutEncoding: null); diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart index 46ed98b7a1d..3f992baa8a9 100644 --- a/tests/compiler/dart2js/memory_compiler.dart +++ b/tests/compiler/dart2js/memory_compiler.dart @@ -238,7 +238,7 @@ class MemoryLoadedLibraries implements LoadedLibraries { } @override - void forEachLibrary(f) => copiedLibraries.values.forEach(f); + void forEachLibrary(void f(l)) => copiedLibraries.values.forEach(f); @override getLibrary(Uri uri) => copiedLibraries[uri]; diff --git a/tests/compiler/dart2js/mirrors_used_test.dart b/tests/compiler/dart2js/mirrors_used_test.dart index 5238472681f..57922bd85bc 100644 --- a/tests/compiler/dart2js/mirrors_used_test.dart +++ b/tests/compiler/dart2js/mirrors_used_test.dart @@ -6,6 +6,8 @@ /// requested elements are retained for reflection. library dart2js.test.mirrors_used_test; +import 'package:compiler/src/js/js.dart' as jsAst; + import 'package:expect/expect.dart'; import "package:async_helper/async_helper.dart"; @@ -75,17 +77,17 @@ void main() { '${generatedCode.length} > $expectedMethodCount'); // The following names should be retained: - List expectedNames = [ + List expectedNames = [ 'Foo', // The name of class Foo. r'Foo$', // The name of class Foo's constructor. - r'get$field' - ]; // The (getter) name of Foo.field. + r'get$field' // The (getter) name of Foo.field. + ].map(backend.namer.asName).toList(); // TODO(ahe): Check for the following names, currently they are not being // recorded correctly, but are being emitted. [ 'Foo_staticMethod', // The name of Foo.staticMethod. - r'instanceMethod$0' - ]; // The name of Foo.instanceMethod. + r'instanceMethod$0' // The name of Foo.instanceMethod. + ]; // We always include the names of some native classes. List nativeClasses = [ @@ -97,17 +99,14 @@ void main() { compiler.resolution.commonElements.nullClass, compiler.resolution.commonElements.listClass ]; - Iterable nativeNames = - // `backend.namer.className` returns a Name, but a String is required. - // ignore: ARGUMENT_TYPE_NOT_ASSIGNABLE + Iterable nativeNames = nativeClasses.map((c) => backend.namer.className(c)); - expectedNames = expectedNames.map(backend.namer.asName).toList(); expectedNames.addAll(nativeNames); // Mirrors only work in the full emitter. We can thus be certain that the // emitter is the full emitter. full.Emitter fullEmitter = backend.emitter.emitter; - Set recordedNames = new Set() + Set recordedNames = new Set() ..addAll(fullEmitter.recordedMangledNames) ..addAll(fullEmitter.mangledFieldNames.keys) ..addAll(fullEmitter.mangledGlobalFieldNames.keys); diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart index 43e390347db..923837000d8 100644 --- a/tests/compiler/dart2js/mock_compiler.dart +++ b/tests/compiler/dart2js/mock_compiler.dart @@ -280,7 +280,7 @@ class MockCompiler extends Compiler { } /// Create a new [MockCompiler] and apply it asynchronously to [f]. - static Future create(f(MockCompiler compiler)) { + static Future create(T f(MockCompiler compiler)) { MockCompiler compiler = new MockCompiler.internal(); return compiler.init().then((_) => f(compiler)); } diff --git a/tests/compiler/dart2js/parser_test.dart b/tests/compiler/dart2js/parser_test.dart index 4a1fcc75298..0ef19e8b5e1 100644 --- a/tests/compiler/dart2js/parser_test.dart +++ b/tests/compiler/dart2js/parser_test.dart @@ -337,7 +337,8 @@ void testMissingCloseParen() { parseMember(source, reporter: new Collector()); } - check(Collector c) { + check(exn) { + Collector c = exn; Expect.equals(OPEN_CURLY_BRACKET_TOKEN, c.token); return true; } @@ -351,7 +352,8 @@ void testMissingCloseBraceInClass() { fullParseUnit(source, reporter: new Collector()); } - check(Collector c) { + check(exn) { + Collector c = exn; Expect.equals(BAD_INPUT_TOKEN, c.token); return true; } @@ -365,7 +367,8 @@ void testUnmatchedAngleBracket() { fullParseUnit(source, reporter: new Collector()); } - check(Collector c) { + check(exn) { + Collector c = exn; Expect.equals(LT_TOKEN, c.token); return true; } diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart index ae31a290e06..2c8dbfd70f1 100644 --- a/tests/compiler/dart2js/patch_test.dart +++ b/tests/compiler/dart2js/patch_test.dart @@ -54,7 +54,7 @@ void expectHasNoBody(compiler, ElementX element) { Expect.isFalse(node.hasBody); } -Element ensure(compiler, String name, Element lookup(name), +Element ensure(compiler, String name, Element lookup(String name), {bool expectIsPatched: false, bool expectIsPatch: false, bool checkHasBody: false, diff --git a/tests/compiler/dart2js/reexport_handled_test.dart b/tests/compiler/dart2js/reexport_handled_test.dart index b153fe81e0a..c8c0ad43277 100644 --- a/tests/compiler/dart2js/reexport_handled_test.dart +++ b/tests/compiler/dart2js/reexport_handled_test.dart @@ -6,6 +6,7 @@ library reexport_handled_test; import "package:expect/expect.dart"; import "package:async_helper/async_helper.dart"; +import 'package:compiler/src/elements/elements.dart' show LibraryElement; import 'mock_compiler.dart'; final exportingLibraryUri = Uri.parse('exporting.dart'); @@ -30,7 +31,7 @@ void main() { return compiler.libraryLoader.loadLibrary(exportingLibraryUri); }).then((loadedLibraries) { compiler.processLoadedLibraries(loadedLibraries); - var exportingLibrary = loadedLibraries.rootLibrary; + LibraryElement exportingLibrary = loadedLibraries.rootLibrary; Expect.isTrue(exportingLibrary.exportsHandled); var foo = exportingLibrary.findExported('foo'); Expect.isNotNull(foo); diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart index 7249e1ba9db..24003369673 100644 --- a/tests/compiler/dart2js/resolver_test.dart +++ b/tests/compiler/dart2js/resolver_test.dart @@ -44,7 +44,7 @@ createLocals(List variables) { return new VariableDefinitions(null, Modifiers.EMPTY, definitions); } -Future testLocals(List variables) { +Future testLocals(List variables) { return MockCompiler.create((MockCompiler compiler) { ResolverVisitor visitor = compiler.resolverVisitor(); ResolutionResult result = visitor.visit(createLocals(variables)); @@ -660,7 +660,7 @@ Future testTwoInterfaces() { Future testFunctionExpression() { return MockCompiler.create((MockCompiler compiler) { - Map mapping = compiler.resolveStatement("int f() {}").map; + var mapping = compiler.resolveStatement("int f() {}").map; Expect.equals(2, mapping.length); Element element; Node node; diff --git a/tests/compiler/dart2js/serialization/model_test_helper.dart b/tests/compiler/dart2js/serialization/model_test_helper.dart index 7cfefba88ed..0944e341ff5 100644 --- a/tests/compiler/dart2js/serialization/model_test_helper.dart +++ b/tests/compiler/dart2js/serialization/model_test_helper.dart @@ -117,7 +117,7 @@ void checkBackendInfo(Compiler compilerNormal, Compiler compilerDeserialized, compilerNormal.enqueuer.resolution.processedEntities, compilerDeserialized.enqueuer.resolution.processedEntities, "Processed element mismatch", - areElementsEquivalent, onSameElement: (a, b) { + areEntitiesEquivalent, onSameElement: (a, b) { checkElements(compilerNormal, compilerDeserialized, a, b, verbose: verbose); }, verbose: verbose); Expect.equals( @@ -205,7 +205,7 @@ void checkElements( '$element1.thisFieldEntity', closureData1.thisFieldEntity, closureData2.thisFieldEntity, - areLocalsEquivalent); + areCapturedVariablesEquivalent); if (element1 is MemberElement && element2 is MemberElement) { MemberElement member1 = element1.implementation; MemberElement member2 = element2.implementation; @@ -233,7 +233,9 @@ void checkElements( checkElementOutputUnits(compiler1, compiler2, element1, element2); } -bool areLocalsEquivalent(LocalVariable a, LocalVariable b) { +bool areLocalsEquivalent(Local a, Local b) => areLocalVariablesEquivalent(a, b); + +bool areLocalVariablesEquivalent(LocalVariable a, LocalVariable b) { if (a == b) return true; if (a == null || b == null) return false; @@ -250,10 +252,10 @@ bool areCapturedVariablesEquivalent(FieldEntity a, FieldEntity b) { if (a == null || b == null) return false; if (a is ClosureFieldElement && b is ClosureFieldElement) { return areElementsEquivalent(a.closureClass, b.closureClass) && - areLocalsEquivalent(a.local, b.local); + areLocalVariablesEquivalent(a.local, b.local); } else if (a is BoxFieldElement && b is BoxFieldElement) { return areElementsEquivalent(a.variableElement, b.variableElement) && - areLocalsEquivalent(a.box, b.box); + areLocalVariablesEquivalent(a.box, b.box); } return false; } @@ -261,18 +263,18 @@ bool areCapturedVariablesEquivalent(FieldEntity a, FieldEntity b) { bool areCapturedScopesEquivalent(CapturedScope a, CapturedScope b) { if (a == b) return true; if (a == null || b == null) return false; - if (!areLocalsEquivalent(a.context, b.context)) { + if (!areLocalVariablesEquivalent(a.context, b.context)) { return false; } - if (!areLocalsEquivalent(a.thisLocal, b.thisLocal)) { + if (!areLocalVariablesEquivalent(a.thisLocal, b.thisLocal)) { return false; } - var aBoxed = {}; + var aBoxed = {}; a.forEachBoxedVariable((k, v) => aBoxed[k] = v); - var bBoxed = {}; + var bBoxed = {}; b.forEachBoxedVariable((k, v) => bBoxed[k] = v); - checkMaps(aBoxed, bBoxed, 'CapturedScope.boxedVariables', areLocalsEquivalent, - areElementsEquivalent); + checkMaps(aBoxed, bBoxed, 'CapturedScope.boxedVariables', + areLocalVariablesEquivalent, areEntitiesEquivalent); return true; } diff --git a/tests/compiler/dart2js/serialization/native_data_test.dart b/tests/compiler/dart2js/serialization/native_data_test.dart index 2271414a5ef..4d0fbb06d54 100644 --- a/tests/compiler/dart2js/serialization/native_data_test.dart +++ b/tests/compiler/dart2js/serialization/native_data_test.dart @@ -59,26 +59,26 @@ Future checkNativeData(Uri uri, {bool verbose: false}) async { NativeDataImpl nativeData2 = closedWorld2.nativeData; checkMaps(nativeData1.jsInteropLibraries, nativeData2.jsInteropLibraries, - "NativeData.jsInteropLibraryNames", areElementsEquivalent, equality, + "NativeData.jsInteropLibraryNames", areEntitiesEquivalent, equality, verbose: verbose); checkMaps(nativeData1.jsInteropClasses, nativeData2.jsInteropClasses, - "NativeData.jsInteropClassNames", areElementsEquivalent, equality, + "NativeData.jsInteropClassNames", areEntitiesEquivalent, equality, verbose: verbose); checkMaps(nativeData1.jsInteropMembers, nativeData2.jsInteropMembers, - "NativeData.jsInteropMemberNames", areElementsEquivalent, equality, + "NativeData.jsInteropMemberNames", areEntitiesEquivalent, equality, verbose: verbose); checkMaps(nativeData1.nativeMemberName, nativeData2.nativeMemberName, - "NativeData.nativeMemberName", areElementsEquivalent, equality, + "NativeData.nativeMemberName", areEntitiesEquivalent, equality, verbose: verbose); checkMaps( nativeBasicData1.nativeClassTagInfo, nativeBasicData2.nativeClassTagInfo, "NativeData.nativeClassTagInfo", - areElementsEquivalent, + areEntitiesEquivalent, equality, verbose: verbose); @@ -86,7 +86,7 @@ Future checkNativeData(Uri uri, {bool verbose: false}) async { nativeData1.nativeMethodBehavior, nativeData2.nativeMethodBehavior, "NativeData.nativeMethodBehavior", - areElementsEquivalent, + areEntitiesEquivalent, testNativeBehavior, verbose: verbose); @@ -94,7 +94,7 @@ Future checkNativeData(Uri uri, {bool verbose: false}) async { nativeData1.nativeFieldLoadBehavior, nativeData2.nativeFieldLoadBehavior, "NativeData.nativeFieldLoadBehavior", - areElementsEquivalent, + areEntitiesEquivalent, testNativeBehavior, verbose: verbose); @@ -102,7 +102,7 @@ Future checkNativeData(Uri uri, {bool verbose: false}) async { nativeData1.nativeFieldStoreBehavior, nativeData2.nativeFieldStoreBehavior, "NativeData.nativeFieldStoreBehavior", - areElementsEquivalent, + areEntitiesEquivalent, testNativeBehavior, verbose: verbose); } diff --git a/tests/compiler/dart2js/source_map_deferred_d2js_validity_test.dart b/tests/compiler/dart2js/source_map_deferred_d2js_validity_test.dart index e15471c9db9..0eb43c7bd26 100644 --- a/tests/compiler/dart2js/source_map_deferred_d2js_validity_test.dart +++ b/tests/compiler/dart2js/source_map_deferred_d2js_validity_test.dart @@ -2,7 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import 'dart:async'; import 'dart:io'; import 'package:async_helper/async_helper.dart'; @@ -17,7 +16,7 @@ void main() { String file = 'tests/compiler/dart2js/source_map_deferred_validator_test_file.dart'; print("Compiling $file"); - Future result = entry.internalMain( + var result = entry.internalMain( [file, '-o${tmpDir.path}/out.js', '--library-root=sdk']); return result.then((CompilationResult result) { CompilerImpl compiler = result.compiler; diff --git a/tests/compiler/dart2js/sourcemaps/diff_view.dart b/tests/compiler/dart2js/sourcemaps/diff_view.dart index b0b2b69773f..b6de701b306 100644 --- a/tests/compiler/dart2js/sourcemaps/diff_view.dart +++ b/tests/compiler/dart2js/sourcemaps/diff_view.dart @@ -906,7 +906,7 @@ CodeSource codeSourceFromElement(Element element) { /// Create [LineData] that colors line numbers according to the [CodeSource]s /// origin if available. -LineData getLineData(CodeSource lineAnnotation) { +LineData getLineData(Object lineAnnotation) { if (lineAnnotation != null) { return new LineData( lineClass: ClassNames.line, diff --git a/tests/compiler/dart2js/sourcemaps/save.dart b/tests/compiler/dart2js/sourcemaps/save.dart index 90324fbca59..eaa60529e54 100644 --- a/tests/compiler/dart2js/sourcemaps/save.dart +++ b/tests/compiler/dart2js/sourcemaps/save.dart @@ -46,7 +46,7 @@ SingleMapping convertFromHumanReadableSourceMap(String json) { Map inputMap = lazon.decode(json); Map urls = inputMap['sources']; List sources = new List.filled(urls.length, null); - urls.forEach((String index, String url) { + urls.forEach((Object index, Object url) { int i = int.parse(index); assert(sources[i] == null); sources[i] = url; diff --git a/tests/compiler/dart2js/type_mask_disjoint_test.dart b/tests/compiler/dart2js/type_mask_disjoint_test.dart index 2aabb3423fa..18e36f98d1c 100644 --- a/tests/compiler/dart2js/type_mask_disjoint_test.dart +++ b/tests/compiler/dart2js/type_mask_disjoint_test.dart @@ -136,7 +136,8 @@ check(String typeMaskDescriptor1, String typeMaskDescriptor2, areDisjoint: areDisjoint); } -checkUnions(List descriptors1, List descriptors2, {areDisjoint: true}) { +checkUnions(List descriptors1, List descriptors2, + {areDisjoint: true}) { print('[$descriptors1] & [$descriptors2]'); var m1 = new TypeMask.unionOf(descriptors1.map(maskOf).toList(), world); var m2 = new TypeMask.unionOf(descriptors2.map(maskOf).toList(), world);