Version 2.0.0-dev.37.0
Merge commit 'a3c352a6e4db5ebb13f55a445ba7122525fc55db' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 33c562a..2369ad0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,36 @@
+## 2.0.0-dev.37.0
+
+### Tool Changes
+
+* dart2js
+
+ * The dart2js compiler now uses the common front-end by default. This is a
+ step towards supporting Dart 2.0. At this time dart2js has no semantic
+ changes: the Dart 2.0 strong-mode semantics are not enabled, so dart2js
+ continues to support the Dart 1 type system. This change however lets us
+ start supporting new syntactic features of Dart 2.0, like optional
+ new/const. With this change you may notice:
+
+ * small code differences (~1% code size): some code is generated slightly
+ different, this is expected because the internal representation of the
+ program has small differences between the old and new front end.
+
+ * source-maps changes: with the new front-end, dart2js also is using a new
+ mechanism to generate source-map files. We don't expect big differences
+ here either, the new source-maps try to encode more data for locations
+ that are commonly used during debugging.
+
+ * some missing errors: the CFE is not complete and may not report some
+ static errors that the old front-end did. This is temporary. If you run
+ the analyzer on all your project already, you may never notice those
+ missing error messages.
+
+ * as announced earlier, this is the first version of dart2js that no longer
+ supports `dart:mirrors`.
+
+ * this is the first version of dart2js that no longer supports
+ `--package-root`, which long ago was deprecated in favor of `--packages`.
+
## 2.0.0-dev.36.0
### Core library changes
@@ -76,6 +109,9 @@
* `MapBase`: added `mapToString`.
* `LinkedHashMap` no longer implements `HashMap`
* `LinkedHashSet` no longer implements `HashSet`.
+ * Added `of` constructor to `Queue`, `ListQueue`,
+ `DoubleLinkedQueue`, `HashSet`, `LinkedHashSet`, `SplayTreeSet`,
+ `Map`, `HashMap`, `LinkedHashMap`, `SplayTreeMap`.
* `dart:convert`
@@ -115,6 +151,7 @@
* *Note*: if a class extends `IterableBase`, `ListBase`, `SetBase` or
`MapBase` (or uses the corresponding mixins) from `dart:collection`, the
new members are implemented automatically.
+ * Added `of` constructor to `List`, `Set`, `Map`.
* Renamed `double.INFINITY`, `double.NEGATIVE_INFINITY`, `double.NAN`,
`double.MAX_FINITE` and `double.MIN_POSITIVE`
to `double.infinity`, `double.negativeInfinity`, `double.nan`,
@@ -346,6 +383,9 @@
* Fix `pub global run` for packages activated from a local path that also have
relative path dependencies ([issue 1751][pub#1751]).
+* `pub build` and `pub serve` support using the common front-end in the dart2js
+ transformer.
+
[pub#1684]: https://github.com/dart-lang/pub/issues/1684
[pub#1719]: https://github.com/dart-lang/pub/issues/1719
[pub#1679]: https://github.com/dart-lang/pub/issues/1679
diff --git a/DEPS b/DEPS
index e360ee3..438d546 100644
--- a/DEPS
+++ b/DEPS
@@ -50,7 +50,7 @@
"gperftools_revision": "@02eeed29df112728564a5dde6417fa4622b57a06",
# Revisions of /third_party/* dependencies.
- "args_tag": "@0.13.7",
+ "args_tag": "@1.4.1",
"async_tag": "@2.0.6",
"barback-0.13.0_rev": "@34853",
"barback-0.14.0_rev": "@36398",
@@ -63,7 +63,7 @@
"charcode_tag": "@v1.1.1",
"chrome_rev" : "@19997",
"cli_util_tag" : "@0.1.2+1",
- "collection_tag": "@6ff408a512df30559c1a18b37cfac9fc51a4ceef",
+ "collection_tag": "@1.14.6",
"convert_tag": "@2.0.1",
"crypto_tag" : "@2.0.2+1",
"csslib_tag" : "@0.14.1",
@@ -83,7 +83,7 @@
# For more details, see https://github.com/dart-lang/sdk/issues/30164
"dart_style_tag": "@1.0.10", # Please see the note above before updating.
- "dartdoc_tag" : "@v0.17.0",
+ "dartdoc_tag" : "@v0.17.1+1",
"fixnum_tag": "@0.10.5",
"func_rev": "@25eec48146a58967d75330075ab376b3838b18a8",
"glob_tag": "@1.1.5",
@@ -92,16 +92,16 @@
"http_multi_server_tag" : "@2.0.4",
"http_parser_tag" : "@3.1.1",
"http_retry_tag": "@0.1.0",
- "http_tag" : "@0.11.3+14",
+ "http_tag" : "@0.11.3+16",
"http_throttle_tag" : "@1.0.1",
"idl_parser_rev": "@7fbe68cab90c38147dee4f48c30ad0d496c17915",
"intl_tag": "@0.15.2",
"isolate_tag": "@1.1.0",
"jinja2_rev": "@2222b31554f03e62600cd7e383376a7c187967a1",
"json_rpc_2_tag": "@2.0.6",
- "linter_tag": "@0.1.43",
+ "linter_tag": "@0.1.44",
"logging_tag": "@0.11.3+1",
- "markdown_tag": "@1.0.0",
+ "markdown_tag": "@1.1.1",
"matcher_tag": "@0.12.1+4",
"mime_tag": "@0.9.6",
"mockito_tag": "@a92db054fba18bc2d605be7670aee74b7cadc00a",
@@ -115,21 +115,21 @@
"ply_rev": "@604b32590ffad5cbb82e4afef1d305512d06ae93",
"pool_tag": "@1.3.4",
"protobuf_tag": "@0.7.1",
- "pub_rev": "@73ff0d3d9f80f60d41e3135ac44597d011abb4f3",
+ "pub_rev": "@d2755745e88b63448d0adfbf2d04af9050f45ed3",
"pub_semver_tag": "@1.3.2",
"quiver_tag": "@5aaa3f58c48608af5b027444d561270b53f15dbf",
"resource_rev":"@af5a5bf65511943398146cf146e466e5f0b95cb9",
"root_certificates_rev": "@16ef64be64c7dfdff2b9f4b910726e635ccc519e",
- "shelf_static_rev": "@3558aa35a0d2f0f35868c3fd64b258e140db0122",
+ "shelf_static_rev": "@v0.2.7",
"shelf_packages_handler_tag": "@1.0.3",
- "shelf_tag": "@0.7.1",
+ "shelf_tag": "@0.7.2",
"shelf_web_socket_tag": "@0.2.2",
"source_map_stack_trace_tag": "@1.1.4",
"source_maps-0.9.4_rev": "@38524",
"source_maps_tag": "@0.10.4",
"source_span_tag": "@1.4.0",
- "stack_trace_tag": "@1.9.0",
- "stream_channel_tag": "@1.6.2",
+ "stack_trace_tag": "@1.9.2",
+ "stream_channel_tag": "@1.6.4",
"string_scanner_tag": "@1.0.2",
"sunflower_rev": "@879b704933413414679396b129f5dfa96f7a0b1e",
"test_descriptor_tag": "@1.0.3",
diff --git a/pkg/analysis_server/test/analysis/get_hover_test.dart b/pkg/analysis_server/test/analysis/get_hover_test.dart
index 64cb212..3a74968 100644
--- a/pkg/analysis_server/test/analysis/get_hover_test.dart
+++ b/pkg/analysis_server/test/analysis/get_hover_test.dart
@@ -420,11 +420,11 @@
expect(hover.containingLibraryPath, isNull);
expect(hover.containingClassDescription, isNull);
expect(hover.dartdoc, isNull);
- expect(hover.elementDescription, 'dynamic vvv');
+ expect(hover.elementDescription, 'int vvv');
expect(hover.elementKind, 'local variable');
// types
- expect(hover.staticType, 'dynamic');
- expect(hover.propagatedType, 'int');
+ expect(hover.staticType, 'int');
+ expect(hover.propagatedType, null);
}
test_expression_variable_inMethod() async {
@@ -446,7 +446,7 @@
expect(hover.elementKind, 'local variable');
// types
expect(hover.staticType, 'num');
- expect(hover.propagatedType, 'int');
+ expect(hover.propagatedType, null);
// no parameter
expect(hover.parameter, isNull);
}
diff --git a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
index 9b0a08f..90b04f2 100644
--- a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
@@ -59,13 +59,6 @@
handleSuccessfulRequest(request);
}
- void setStrongMode(bool isSet) {
- addOptionsFile('''
-analyzer:
- strong-mode: $isSet
-''');
- }
-
@override
void setUp() {
generateSummaryFiles = true;
@@ -202,19 +195,23 @@
await waitForTasksFinished();
- // Verify strong-mode disabled.
- verifyStrongMode(enabled: false);
+ // Verify that lints are disabled.
+ expect(analysisOptions.lint, false);
// Clear errors.
filesErrors[testFile] = [];
- // Add options file with strong mode enabled.
- setStrongMode(true);
+ // Add options file with a lint enabled.
+ addOptionsFile('''
+linter:
+ rules:
+ - camel_case_types
+''');
await pumpEventQueue();
await waitForTasksFinished();
- verifyStrongMode(enabled: true);
+ verifyLintsEnabled(['camel_case_types']);
}
test_options_file_parse_error() async {
@@ -232,14 +229,18 @@
}
test_options_file_removed() async {
- setStrongMode(true);
+ addOptionsFile('''
+linter:
+ rules:
+ - camel_case_types
+''');
addTestFile(testSource);
setAnalysisRoot();
await waitForTasksFinished();
- verifyStrongMode(enabled: true);
+ verifyLintsEnabled(['camel_case_types']);
// Clear errors.
filesErrors[testFile] = [];
@@ -249,46 +250,7 @@
await pumpEventQueue();
await waitForTasksFinished();
- verifyStrongMode(enabled: false);
- }
-
- test_strong_mode_changed_off() async {
- setStrongMode(true);
-
- addTestFile(testSource);
- setAnalysisRoot();
-
- await waitForTasksFinished();
-
- verifyStrongMode(enabled: true);
-
- // Clear errors.
- filesErrors[testFile] = [];
-
- setStrongMode(false);
-
- await pumpEventQueue();
- await waitForTasksFinished();
-
- verifyStrongMode(enabled: false);
- }
-
- test_strong_mode_changed_on() async {
- setStrongMode(false);
-
- addTestFile(testSource);
- setAnalysisRoot();
-
- await waitForTasksFinished();
-
- verifyStrongMode(enabled: false);
-
- setStrongMode(true);
-
- await pumpEventQueue();
- await waitForTasksFinished();
-
- verifyStrongMode(enabled: true);
+ expect(analysisOptions.lint, false);
}
void verifyLintsEnabled(List<String> lints) {
@@ -297,21 +259,6 @@
var rules = options.lintRules.map((rule) => rule.name);
expect(rules, unorderedEquals(lints));
}
-
- verifyStrongMode({bool enabled}) {
- // Verify strong-mode enabled.
- expect(analysisOptions.strongMode, enabled);
-
- if (enabled) {
- // Should produce a type warning.
- expect(errors.map((error) => error.type),
- unorderedEquals([AnalysisErrorType.STATIC_TYPE_WARNING]));
- } else {
- // Should only produce a hint.
- expect(errors.map((error) => error.type),
- unorderedEquals([AnalysisErrorType.HINT]));
- }
- }
}
@reflectiveTest
diff --git a/pkg/analysis_server/test/analysis/notification_errors_test.dart b/pkg/analysis_server/test/analysis/notification_errors_test.dart
index bdfc83c..b22b940 100644
--- a/pkg/analysis_server/test/analysis/notification_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_errors_test.dart
@@ -188,7 +188,8 @@
createProject();
addTestFile('''
main() {
- print(UNKNOWN);
+ final int foo;
+ print(foo);
}
''');
await waitForTasksFinished();
diff --git a/pkg/analysis_server/test/completion_test.dart b/pkg/analysis_server/test/completion_test.dart
index 96fca2a..d4029b3 100644
--- a/pkg/analysis_server/test/completion_test.dart
+++ b/pkg/analysis_server/test/completion_test.dart
@@ -294,27 +294,6 @@
}
}''', <String>["1+toUpperCase", "2-getKeys"]);
- // Type propagation.
- buildTests('testCommentSnippets053', '''
-class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{getKeys(){}}
-void r() {
- var v;
- while (v is String) {
- v.!1toUpperCase;
- v.!2getKeys;
- }
-}''', <String>["1+toUpperCase", "2-getKeys"]);
-
- buildTests('testCommentSnippets054', '''
-class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{getKeys(){}}
-void r() {
- var v;
- for (; v is String; v.!1isEmpty) {
- v.!2toUpperCase;
- v.!3getKeys;
- }
-}''', <String>["1+isEmpty", "2+toUpperCase", "3-getKeys"]);
-
buildTests('testCommentSnippets055', '''
class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{getKeys(){}}
void r() {
@@ -324,25 +303,6 @@
}
}''', <String>["1+toUpperCase"]);
- // Type propagation.
- buildTests('testCommentSnippets056', '''
-class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{getKeys(){}}
-void f(var v) {
- if (v is!! String) {
- return;
- }
- v.!1toUpperCase;
-}''', <String>["1+toUpperCase"]);
-
- // Type propagation.
- buildTests('testCommentSnippets057', '''
-class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{getKeys(){}}
-void f(var v) {
- if ((v as String).!2length == 0) {
- v.!1toUpperCase;
- }
-}''', <String>["1+toUpperCase", "2+length"]);
-
buildTests(
'testCommentSnippets058',
'''
@@ -372,15 +332,6 @@
class A{m(){!1f(3);!2}}n(){!3f(3);!4}f(x)=>x*3;''',
<String>["1+f", "1+n", "2+f", "2+n", "3+f", "3+n", "4+f", "4+n"]);
- // Type propagation.
- buildTests('testCommentSnippets063', '''
-class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{getKeys(){}}
-void r(var v) {
- v.!1toUpperCase;
- assert(v is String);
- v.!2toUpperCase;
-}''', <String>["1-toUpperCase", "2+toUpperCase"]);
-
buildTests('testCommentSnippets064', '''
class Spline {
Line c;
@@ -2363,8 +2314,7 @@
// test analysis of untyped fields and top-level vars
buildTests('test035', '''class Y {final x='hi';mth() {x.!1length;}}''',
- <String>["1+length"],
- failingTests: '1');
+ <String>["1+length"]);
// TODO(scheglov) decide what to do with Type for untyped field (not
// supported by the new store)
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index 96f1aa7..8f6af83 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -116,7 +116,7 @@
// Declared variables.
//
Map<String, String> declaredVariables = <String, String>{};
- List<String> variables = args[defineVariableOption] as List<String>;
+ List<String> variables = (args[defineVariableOption] as List).cast<String>();
for (String variable in variables) {
int index = variable.indexOf('=');
if (index < 0) {
diff --git a/pkg/analyzer/lib/src/context/cache.dart b/pkg/analyzer/lib/src/context/cache.dart
index 3f7bcf7..1a86195 100644
--- a/pkg/analyzer/lib/src/context/cache.dart
+++ b/pkg/analyzer/lib/src/context/cache.dart
@@ -905,7 +905,7 @@
*/
class CacheFlushManager<T> {
final IsPriorityAnalysisTarget isPriorityAnalysisTarget;
- final ResultCachingPolicy<T> policy;
+ final ResultCachingPolicy policy;
final int maxActiveSize;
final int maxIdleSize;
@@ -934,8 +934,7 @@
*/
int maxSize;
- CacheFlushManager(
- ResultCachingPolicy<T> policy, this.isPriorityAnalysisTarget)
+ CacheFlushManager(ResultCachingPolicy policy, this.isPriorityAnalysisTarget)
: policy = policy,
maxActiveSize = policy.maxActiveSize,
maxIdleSize = policy.maxIdleSize,
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index c8f3023..bda0506 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -94,7 +94,7 @@
/**
* The version of data format, should be incremented on every format change.
*/
- static const int DATA_VERSION = 50;
+ static const int DATA_VERSION = 51;
/**
* The number of exception contexts allowed to write. Once this field is
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 3ee9fc1..ddb19d7 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1444,8 +1444,7 @@
@override
bool preserveComments = true;
- @override
- bool strongMode = false;
+ bool _strongMode = false;
/**
* A flag indicating whether strong-mode inference hints should be
@@ -1682,6 +1681,13 @@
}
@override
+ bool get strongMode => _strongMode || previewDart2;
+
+ void set strongMode(bool value) {
+ _strongMode = value;
+ }
+
+ @override
void resetToDefaults() {
declarationCasts = true;
dart2jsHint = false;
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 59e05e7..5bdb1b3 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -8397,7 +8397,9 @@
}
} else {
if (element is GenericTypeAliasElementImpl) {
- type = element.typeAfterSubstitution(null) ?? dynamicType;
+ List<DartType> typeArguments =
+ typeSystem.instantiateTypeFormalsToBounds(element.typeParameters);
+ type = element.typeAfterSubstitution(typeArguments) ?? dynamicType;
} else {
type = typeSystem.instantiateToBounds(type);
}
diff --git a/pkg/analyzer/lib/src/generated/type_system.dart b/pkg/analyzer/lib/src/generated/type_system.dart
index c0562b4..34ddfb2 100644
--- a/pkg/analyzer/lib/src/generated/type_system.dart
+++ b/pkg/analyzer/lib/src/generated/type_system.dart
@@ -309,9 +309,28 @@
DartType instantiateToBounds(DartType type,
{List<bool> hasError, Map<TypeParameterType, DartType> knownTypes}) {
List<TypeParameterElement> typeFormals = typeFormalsAsElements(type);
+ List<DartType> arguments = instantiateTypeFormalsToBounds(typeFormals,
+ hasError: hasError, knownTypes: knownTypes);
+ if (arguments == null) {
+ return type;
+ }
+
+ return instantiateType(type, arguments);
+ }
+
+ /**
+ * Given uninstantiated [typeFormals], instantiate them to their bounds.
+ * See the issue for the algorithm description.
+ *
+ * https://github.com/dart-lang/sdk/issues/27526#issuecomment-260021397
+ */
+ List<DartType> instantiateTypeFormalsToBounds(
+ List<TypeParameterElement> typeFormals,
+ {List<bool> hasError,
+ Map<TypeParameterType, DartType> knownTypes}) {
int count = typeFormals.length;
if (count == 0) {
- return type;
+ return null;
}
Set<TypeParameterType> all = new Set<TypeParameterType>();
@@ -394,7 +413,7 @@
List<DartType> orderedArguments =
typeFormals.map((p) => defaults[p.type]).toList();
- return instantiateType(type, orderedArguments);
+ return orderedArguments;
}
@override
@@ -1223,6 +1242,13 @@
}
/**
+ * Given uninstantiated [typeFormals], instantiate them to their bounds.
+ */
+ List<DartType> instantiateTypeFormalsToBounds(
+ List<TypeParameterElement> typeFormals,
+ {List<bool> hasError});
+
+ /**
* Return `true` if the [leftType] is assignable to the [rightType] (that is,
* if leftType <==> rightType).
*/
@@ -1531,6 +1557,13 @@
}
@override
+ List<DartType> instantiateTypeFormalsToBounds(
+ List<TypeParameterElement> typeFormals,
+ {List<bool> hasError}) {
+ return null;
+ }
+
+ @override
bool isAssignableTo(DartType leftType, DartType rightType,
{bool isDeclarationCast = false}) {
return leftType.isAssignableTo(rightType);
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index c8e60f3..4f2ed45 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -3266,6 +3266,9 @@
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
@override
+ String toString() => _variable.toString();
+
+ @override
void _setInferenceError(TopLevelInferenceErrorBuilder error) {
assert(!_hasTypeBeenInferred);
_inferenceError = error;
@@ -3393,6 +3396,9 @@
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
@override
+ String toString() => enclosingElement.toString();
+
+ @override
void _setInferenceError(TopLevelInferenceErrorBuilder error) {}
@override
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index 879fb63..4f0d914 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -1299,9 +1299,32 @@
return type;
} else if (element is GenericTypeAliasElementHandle) {
GenericTypeAliasElementImpl actualElement = element.actualElement;
- List<DartType> argumentTypes =
- new List.generate(numTypeArguments, getTypeArgument);
- return actualElement.typeAfterSubstitution(argumentTypes);
+ List<DartType> typeArguments;
+ if (numTypeArguments == numTypeParameters) {
+ typeArguments = _buildTypeArguments(numTypeArguments, getTypeArgument);
+ } else if (libraryResynthesizer.summaryResynthesizer.strongMode &&
+ instantiateToBoundsAllowed) {
+ if (!_isBeingInstantiatedToBounds) {
+ _isBeingInstantiatedToBounds = true;
+ _isRecursiveWhileInstantiateToBounds = false;
+ try {
+ typeArguments = libraryResynthesizer
+ .summaryResynthesizer.context.typeSystem
+ .instantiateTypeFormalsToBounds(element.typeParameters);
+ if (_isRecursiveWhileInstantiateToBounds) {
+ typeArguments = _dynamicTypeArguments;
+ }
+ } finally {
+ _isBeingInstantiatedToBounds = false;
+ }
+ } else {
+ _isRecursiveWhileInstantiateToBounds = true;
+ typeArguments = _dynamicTypeArguments;
+ }
+ } else {
+ typeArguments = _dynamicTypeArguments;
+ }
+ return actualElement.typeAfterSubstitution(typeArguments);
} else if (element is FunctionTypedElement) {
if (element is FunctionTypeAliasElementHandle) {
List<DartType> typeArguments;
diff --git a/pkg/analyzer/lib/src/summary/summarize_ast.dart b/pkg/analyzer/lib/src/summary/summarize_ast.dart
index bf9328a..ea0c328 100644
--- a/pkg/analyzer/lib/src/summary/summarize_ast.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_ast.dart
@@ -66,7 +66,7 @@
references.add(constructor);
operations.add(UnlinkedExprOperation.pushReference);
} else {
- serializeInstanceCreation(constructor, annotation.arguments);
+ serializeInstanceCreation(constructor, annotation.arguments, false);
}
}
diff --git a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
index ad72193..75a487c 100644
--- a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
@@ -185,9 +185,9 @@
*/
EntityRefBuilder serializeIdentifierSequence(Expression expr);
- void serializeInstanceCreation(
- EntityRefBuilder constructor, ArgumentList argumentList) {
- _serializeArguments(argumentList);
+ void serializeInstanceCreation(EntityRefBuilder constructor,
+ ArgumentList argumentList, bool typeArgumentsProvided) {
+ _serializeArguments(argumentList, typeArgumentsProvided);
references.add(constructor);
operations.add(UnlinkedExprOperation.invokeConstructor);
}
@@ -368,7 +368,8 @@
serializeInstanceCreation(
serializeConstructorRef(typeName.type, typeName.name,
typeName.typeArguments, expr.constructorName.name),
- expr.argumentList);
+ expr.argumentList,
+ typeName.typeArguments != null);
} else if (expr is ListLiteral) {
_serializeListLiteral(expr);
} else if (expr is MapLiteral) {
@@ -441,8 +442,9 @@
}
}
- void _serializeArguments(ArgumentList argumentList) {
- if (forConst) {
+ void _serializeArguments(
+ ArgumentList argumentList, bool typeArgumentsProvided) {
+ if (forConst || !typeArgumentsProvided) {
List<Expression> arguments = argumentList.arguments;
// Serialize the arguments.
List<String> argumentNames = <String>[];
@@ -601,7 +603,7 @@
ArgumentList argumentList = invocation.argumentList;
if (_isIdentifierSequence(methodName)) {
EntityRefBuilder ref = serializeIdentifierSequence(methodName);
- _serializeArguments(argumentList);
+ _serializeArguments(argumentList, invocation.typeArguments != null);
references.add(ref);
_serializeTypeArguments(invocation.typeArguments);
operations.add(UnlinkedExprOperation.invokeMethodRef);
@@ -609,7 +611,7 @@
if (!invocation.isCascaded) {
_serialize(target);
}
- _serializeArguments(argumentList);
+ _serializeArguments(argumentList, invocation.typeArguments != null);
strings.add(methodName.name);
_serializeTypeArguments(invocation.typeArguments);
operations.add(UnlinkedExprOperation.invokeMethod);
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index ca300a9..aa309b2 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -54,44 +54,43 @@
/**
* The [ResultCachingPolicy] for ASTs.
*/
-const ResultCachingPolicy<CompilationUnit> AST_CACHING_POLICY =
+const ResultCachingPolicy AST_CACHING_POLICY =
const SimpleResultCachingPolicy(1024 * 64, 32);
/**
* The [ResultCachingPolicy] for lists of [ConstantEvaluationTarget]s.
*/
-const ResultCachingPolicy<List<ConstantEvaluationTarget>>
- CONSTANT_EVALUATION_TARGET_LIST_POLICY =
+const ResultCachingPolicy CONSTANT_EVALUATION_TARGET_LIST_POLICY =
const SimpleResultCachingPolicy(-1, -1);
/**
* The [ResultCachingPolicy] for [ConstantEvaluationTarget]s.
*/
-const ResultCachingPolicy<ConstantEvaluationTarget>
- CONSTANT_EVALUATION_TARGET_POLICY = const SimpleResultCachingPolicy(-1, -1);
+const ResultCachingPolicy CONSTANT_EVALUATION_TARGET_POLICY =
+ const SimpleResultCachingPolicy(-1, -1);
/**
* The [ResultCachingPolicy] for [Element]s.
*/
-const ResultCachingPolicy<Element> ELEMENT_CACHING_POLICY =
+const ResultCachingPolicy ELEMENT_CACHING_POLICY =
const SimpleResultCachingPolicy(-1, -1);
/**
* The [ResultCachingPolicy] for [TOKEN_STREAM].
*/
-const ResultCachingPolicy<Token> TOKEN_STREAM_CACHING_POLICY =
+const ResultCachingPolicy TOKEN_STREAM_CACHING_POLICY =
const SimpleResultCachingPolicy(1, 1);
/**
* The [ResultCachingPolicy] for [UsedImportedElements]s.
*/
-const ResultCachingPolicy<UsedImportedElements> USED_IMPORTED_ELEMENTS_POLICY =
+const ResultCachingPolicy USED_IMPORTED_ELEMENTS_POLICY =
const SimpleResultCachingPolicy(-1, -1);
/**
* The [ResultCachingPolicy] for [UsedLocalElements]s.
*/
-const ResultCachingPolicy<UsedLocalElements> USED_LOCAL_ELEMENTS_POLICY =
+const ResultCachingPolicy USED_LOCAL_ELEMENTS_POLICY =
const SimpleResultCachingPolicy(-1, -1);
/**
diff --git a/pkg/analyzer/lib/src/task/model.dart b/pkg/analyzer/lib/src/task/model.dart
index 47de4b3..4f99b8c 100644
--- a/pkg/analyzer/lib/src/task/model.dart
+++ b/pkg/analyzer/lib/src/task/model.dart
@@ -11,7 +11,7 @@
/**
* The default [ResultCachingPolicy], results are never flushed.
*/
-const ResultCachingPolicy<Object> DEFAULT_CACHING_POLICY =
+const ResultCachingPolicy DEFAULT_CACHING_POLICY =
const SimpleResultCachingPolicy(-1, -1);
/**
@@ -25,7 +25,7 @@
* values associated with this result will remain in the cache.
*/
ListResultDescriptorImpl(String name, List<E> defaultValue,
- {ResultCachingPolicy<List<E>> cachingPolicy: DEFAULT_CACHING_POLICY})
+ {ResultCachingPolicy cachingPolicy: DEFAULT_CACHING_POLICY})
: super(name, defaultValue, cachingPolicy: cachingPolicy);
@override
@@ -59,7 +59,7 @@
/**
* The caching policy for results described by this descriptor.
*/
- final ResultCachingPolicy<V> cachingPolicy;
+ final ResultCachingPolicy cachingPolicy;
/**
* Initialize a newly created analysis result to have the given [name] and
@@ -86,7 +86,7 @@
* A simple [ResultCachingPolicy] implementation that consider all the objects
* to be of the size `1`.
*/
-class SimpleResultCachingPolicy<T> implements ResultCachingPolicy<T> {
+class SimpleResultCachingPolicy implements ResultCachingPolicy {
@override
final int maxActiveSize;
@@ -96,7 +96,7 @@
const SimpleResultCachingPolicy(this.maxActiveSize, this.maxIdleSize);
@override
- int measure(T object) => 1;
+ int measure(Object object) => 1;
}
/**
diff --git a/pkg/analyzer/lib/task/model.dart b/pkg/analyzer/lib/task/model.dart
index 9eed95d..b522c98 100644
--- a/pkg/analyzer/lib/task/model.dart
+++ b/pkg/analyzer/lib/task/model.dart
@@ -350,8 +350,7 @@
* values associated with this result will remain in the cache.
*/
factory ListResultDescriptor(String name, List<E> defaultValue,
- {ResultCachingPolicy<List<E>> cachingPolicy}) =
- ListResultDescriptorImpl<E>;
+ {ResultCachingPolicy cachingPolicy}) = ListResultDescriptorImpl<E>;
@override
ListTaskInput<E> of(AnalysisTarget target, {bool flushOnAccess: false});
@@ -434,7 +433,7 @@
*
* Clients may implement this class when implementing plugins.
*/
-abstract class ResultCachingPolicy<T> {
+abstract class ResultCachingPolicy {
/**
* Return the maximum total size of results that can be kept in the cache
* while analysis is in progress.
@@ -450,7 +449,7 @@
/**
* Return the size of the given [object].
*/
- int measure(T object);
+ int measure(Object object);
}
/**
@@ -475,12 +474,12 @@
* never evicted from the cache, and removed only when they are invalidated.
*/
factory ResultDescriptor(String name, V defaultValue,
- {ResultCachingPolicy<V> cachingPolicy}) = ResultDescriptorImpl<V>;
+ {ResultCachingPolicy cachingPolicy}) = ResultDescriptorImpl<V>;
/**
* Return the caching policy for results described by this descriptor.
*/
- ResultCachingPolicy<V> get cachingPolicy;
+ ResultCachingPolicy get cachingPolicy;
/**
* Return the default value for results described by this descriptor.
diff --git a/pkg/analyzer/test/src/context/cache_test.dart b/pkg/analyzer/test/src/context/cache_test.dart
index 295a733..06f3fd7 100644
--- a/pkg/analyzer/test/src/context/cache_test.dart
+++ b/pkg/analyzer/test/src/context/cache_test.dart
@@ -16,9 +16,9 @@
import 'package:analyzer/src/generated/utilities_collection.dart';
import 'package:analyzer/src/task/model.dart';
import 'package:analyzer/task/model.dart';
+import 'package:mockito/mockito.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
-import 'package:mockito/mockito.dart';
import '../../generated/test_support.dart';
@@ -362,8 +362,7 @@
}
test_getValue_flushResults() {
- ResultCachingPolicy<int> cachingPolicy =
- new SimpleResultCachingPolicy<int>(2, 2);
+ ResultCachingPolicy cachingPolicy = new SimpleResultCachingPolicy(2, 2);
ResultDescriptor<int> descriptor1 = new ResultDescriptor<int>(
'result1', null,
cachingPolicy: cachingPolicy);
@@ -753,8 +752,7 @@
}
test_setValue_flushResults() {
- ResultCachingPolicy<int> cachingPolicy =
- new SimpleResultCachingPolicy<int>(2, 2);
+ ResultCachingPolicy cachingPolicy = new SimpleResultCachingPolicy(2, 2);
ResultDescriptor<int> descriptor1 = new ResultDescriptor<int>(
'result1', null,
cachingPolicy: cachingPolicy);
@@ -785,8 +783,7 @@
}
test_setValue_flushResults_keepForPrioritySources() {
- ResultCachingPolicy<int> cachingPolicy =
- new SimpleResultCachingPolicy<int>(2, 2);
+ ResultCachingPolicy cachingPolicy = new SimpleResultCachingPolicy(2, 2);
ResultDescriptor<int> newResult(String name) =>
new ResultDescriptor<int>(name, null, cachingPolicy: cachingPolicy);
ResultDescriptor<int> descriptor1 = newResult('result1');
diff --git a/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart b/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
index 2669e5c..08cd463 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
@@ -68,12 +68,6 @@
@override
@failingTest
- test_instantiateToBounds_functionTypeAlias_simple() async {
- await super.test_instantiateToBounds_functionTypeAlias_simple();
- }
-
- @override
- @failingTest
test_syntheticFunctionType_genericClosure() async {
await super.test_syntheticFunctionType_genericClosure();
}
diff --git a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
index 9f18b85..952d08c 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
@@ -234,18 +234,6 @@
await super.test_import_invalidUri_metadata();
}
- @failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/30724')
- test_instantiateToBounds_boundRefersToEarlierTypeArgument() async {
- await super.test_instantiateToBounds_boundRefersToEarlierTypeArgument();
- }
-
- @failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/30724')
- test_instantiateToBounds_boundRefersToLaterTypeArgument() async {
- await super.test_instantiateToBounds_boundRefersToLaterTypeArgument();
- }
-
@override
@failingTest
test_invalid_annotation_prefixed_constructor() {
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index ab0b33b..0411275 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -6749,11 +6749,16 @@
assertUnlinkedConst(variable.initializer.bodyExpr,
isValidConst: false,
operators: [
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushLocalFunctionReference,
UnlinkedExprOperation.invokeMethodRef
],
ints: [
+ 5,
0,
0,
+ 0,
+ 2,
0
],
referenceValidators: [
@@ -6770,11 +6775,19 @@
assertUnlinkedConst(variable.initializer.bodyExpr,
isValidConst: false,
operators: [
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushLocalFunctionReference,
+ UnlinkedExprOperation.pushLocalFunctionReference,
UnlinkedExprOperation.invokeMethodRef
],
ints: [
+ 5,
0,
0,
+ 0,
+ 1,
+ 0,
+ 3,
0
],
referenceValidators: [
@@ -7046,16 +7059,24 @@
isValidConst: false,
operators: [
UnlinkedExprOperation.invokeConstructor,
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushInt,
UnlinkedExprOperation.invokeMethod,
],
ints: [
0,
0,
- 0,
- 0,
+ 1,
+ 2,
+ 3,
+ 2,
+ 1,
0
],
strings: [
+ 'b',
+ 'c',
'm'
],
referenceValidators: [
@@ -7117,11 +7138,15 @@
assertUnlinkedConst(variable.initializer.bodyExpr,
isValidConst: false,
operators: [
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushInt,
UnlinkedExprOperation.invokeMethodRef,
],
ints: [
+ 10,
+ 20,
0,
- 0,
+ 2,
0
],
strings: [],
@@ -7184,14 +7209,17 @@
assertUnlinkedConst(variable.initializer.bodyExpr,
isValidConst: false,
operators: [
+ UnlinkedExprOperation.pushReference,
UnlinkedExprOperation.invokeMethodRef
],
ints: [
0,
- 0,
+ 1,
0
],
referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, 'u',
+ expectedKind: ReferenceKind.topLevelPropertyAccessor),
(EntityRef r) => checkTypeRef(r, null, 'f',
expectedKind: ReferenceKind.topLevelFunction)
]);
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index 37f17da..50c157d 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -1293,7 +1293,6 @@
''');
}
- @failingTest
test_fuzzyArrowLegacyAssignability_GlobalInference() async {
// Test for legacy fuzzy arrow support on assignability, pending
// cleanup. https://github.com/dart-lang/sdk/issues/29630
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index 3ffa729..d9f803c 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -4361,12 +4361,6 @@
@failingTest
@override
- test_genericMethods_usesGreatestLowerBound_topLevel() async {
- await super.test_genericMethods_usesGreatestLowerBound_topLevel();
- }
-
- @failingTest
- @override
test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr2() async {
await super
.test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr2();
@@ -4378,10 +4372,4 @@
await super
.test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr2();
}
-
- @failingTest
- @override
- test_voidReturnTypeEquivalentToDynamic() async {
- await super.test_voidReturnTypeEquivalentToDynamic();
- }
}
diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart
index 52bcbb3..76bc78f 100644
--- a/pkg/analyzer_cli/lib/src/options.dart
+++ b/pkg/analyzer_cli/lib/src/options.dart
@@ -167,9 +167,10 @@
: buildAnalysisOutput = args['build-analysis-output'],
buildMode = args['build-mode'],
buildModePersistentWorker = args['persistent_worker'],
- buildSummaryInputs = args['build-summary-input'] as List<String>,
+ buildSummaryInputs =
+ (args['build-summary-input'] as List).cast<String>(),
buildSummaryUnlinkedInputs =
- args['build-summary-unlinked-input'] as List<String>,
+ (args['build-summary-unlinked-input'] as List).cast<String>(),
buildSummaryOnly = args['build-summary-only'],
buildSummaryOnlyUnlinked = args['build-summary-only-unlinked'],
buildSummaryOutput = args['build-summary-output'],
diff --git a/pkg/analyzer_cli/test/data/file_with_warning.dart b/pkg/analyzer_cli/test/data/file_with_warning.dart
index 6f21a74..97dfd3f 100644
--- a/pkg/analyzer_cli/test/data/file_with_warning.dart
+++ b/pkg/analyzer_cli/test/data/file_with_warning.dart
@@ -1,3 +1,3 @@
main() {
- undefined();
+ final String foo;
}
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index 2650724..f32dee3 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -636,15 +636,6 @@
expect(exitCode, 0);
}
- test_partFile_reversed() async {
- Driver driver = new Driver(isTesting: true);
- await driver.start([
- path.join(testDirectory, 'data/library_and_parts/part1.dart'),
- path.join(testDirectory, 'data/library_and_parts/lib.dart')
- ]);
- expect(exitCode, 0);
- }
-
test_partFile_dangling() async {
await drive('data/library_and_parts/part2.dart');
expect(exitCode, 3);
@@ -658,6 +649,15 @@
]);
expect(exitCode, 3);
}
+
+ test_partFile_reversed() async {
+ Driver driver = new Driver(isTesting: true);
+ await driver.start([
+ path.join(testDirectory, 'data/library_and_parts/part1.dart'),
+ path.join(testDirectory, 'data/library_and_parts/lib.dart')
+ ]);
+ expect(exitCode, 0);
+ }
}
@reflectiveTest
@@ -851,6 +851,43 @@
ErrorProcessor processorFor(AnalysisError error) =>
processors.firstWhere((p) => p.appliesTo(error));
+ test_analysisOptions_excludes() async {
+ await drive('data/exclude_test_project',
+ options: 'data/exclude_test_project/$optionsFileName');
+ _expectUndefinedClassErrorsWithoutExclusions(usePreviewDart2);
+ }
+
+ test_analysisOptions_excludesRelativeToAnalysisOptions_explicit() async {
+ // The exclude is relative to the project, not/ the analyzed path, and it
+ // has to then understand that.
+ await drive('data/exclude_test_project',
+ options: 'data/exclude_test_project/$optionsFileName');
+ _expectUndefinedClassErrorsWithoutExclusions(usePreviewDart2);
+ }
+
+ test_analysisOptions_excludesRelativeToAnalysisOptions_inferred() async {
+ // By passing no options, and the path `lib`, it should discover the
+ // analysis_options above lib. The exclude is relative to the project, not
+ // the analyzed path, and it has to then understand that.
+ await drive('data/exclude_test_project/lib', options: null);
+ _expectUndefinedClassErrorsWithoutExclusions(usePreviewDart2);
+ }
+
+ test_analyzeFilesInDifferentContexts() async {
+ await driveMany([
+ 'data/linter_project/test_file.dart',
+ 'data/no_lints_project/test_file.dart',
+ ], options: null);
+
+ // Should have the lint in the project with lint rules enabled.
+ expect(
+ bulletToDash(outSink),
+ contains(path.join('linter_project', 'test_file.dart') +
+ ':7:7 - camel_case_types'));
+ // Should be just one lint in total.
+ expect(outSink.toString(), contains('1 lint found.'));
+ }
+
test_basic_filters() async {
await _driveBasic();
expect(processors, hasLength(3));
@@ -947,55 +984,21 @@
expect(outSink.toString(), contains("1 error and 1 warning found."));
}
- test_analyzeFilesInDifferentContexts() async {
- await driveMany([
- 'data/linter_project/test_file.dart',
- 'data/no_lints_project/test_file.dart',
- ], options: null);
-
- // Should have the lint in the project with lint rules enabled.
- expect(
- bulletToDash(outSink),
- contains(path.join('linter_project', 'test_file.dart') +
- ':7:7 - camel_case_types'));
- // Should be just one lint in total.
- expect(outSink.toString(), contains('1 lint found.'));
- }
-
- test_analysisOptions_excludes() async {
- await drive('data/exclude_test_project',
- options: 'data/exclude_test_project/$optionsFileName');
- _expectUndefinedClassErrorsWithoutExclusions();
- }
-
- test_analysisOptions_excludesRelativeToAnalysisOptions_inferred() async {
- // By passing no options, and the path `lib`, it should discover the
- // analysis_options above lib. The exclude is relative to the project, not
- // the analyzed path, and it has to then understand that.
- await drive('data/exclude_test_project/lib', options: null);
- _expectUndefinedClassErrorsWithoutExclusions();
- }
-
- test_analysisOptions_excludesRelativeToAnalysisOptions_explicit() async {
- // The exclude is relative to the project, not/ the analyzed path, and it
- // has to then understand that.
- await drive('data/exclude_test_project',
- options: 'data/exclude_test_project/$optionsFileName');
- _expectUndefinedClassErrorsWithoutExclusions();
- }
-
- void _expectUndefinedClassErrorsWithoutExclusions() {
- expect(bulletToDash(outSink),
- contains("warning - Undefined class 'IncludedUndefinedClass'"));
- expect(bulletToDash(outSink),
- isNot(contains("warning - Undefined class 'ExcludedUndefinedClass'")));
- expect(outSink.toString(), contains("1 warning found."));
- }
-
Future<Null> _driveBasic() async {
await drive('data/options_tests_project/test_file.dart',
options: 'data/options_tests_project/$optionsFileName');
}
+
+ void _expectUndefinedClassErrorsWithoutExclusions(bool isStrong) {
+ final String issueType = isStrong ? 'error' : 'warning';
+ expect(bulletToDash(outSink),
+ contains("$issueType - Undefined class 'IncludedUndefinedClass'"));
+ expect(
+ bulletToDash(outSink),
+ isNot(
+ contains("$issueType - Undefined class 'ExcludedUndefinedClass'")));
+ expect(outSink.toString(), contains("1 $issueType found."));
+ }
}
@reflectiveTest
@@ -1011,6 +1014,20 @@
@override
@failingTest
+ test_analysisOptions_excludes() => super.test_analysisOptions_excludes();
+
+ @override
+ @failingTest
+ test_analysisOptions_excludesRelativeToAnalysisOptions_explicit() =>
+ super.test_analysisOptions_excludesRelativeToAnalysisOptions_explicit();
+
+ @override
+ @failingTest
+ test_analysisOptions_excludesRelativeToAnalysisOptions_inferred() =>
+ super.test_analysisOptions_excludesRelativeToAnalysisOptions_inferred();
+
+ @override
+ @failingTest
test_basic_filters() => super.test_basic_filters();
@override
@@ -1033,20 +1050,6 @@
@failingTest
test_withFlags_overrideFatalWarning() =>
super.test_withFlags_overrideFatalWarning();
-
- @override
- @failingTest
- test_analysisOptions_excludes() => super.test_analysisOptions_excludes();
-
- @override
- @failingTest
- test_analysisOptions_excludesRelativeToAnalysisOptions_inferred() =>
- super.test_analysisOptions_excludesRelativeToAnalysisOptions_inferred();
-
- @override
- @failingTest
- test_analysisOptions_excludesRelativeToAnalysisOptions_explicit() =>
- super.test_analysisOptions_excludesRelativeToAnalysisOptions_explicit();
}
class TestSource implements Source {
diff --git a/pkg/compiler/lib/src/commandline_options.dart b/pkg/compiler/lib/src/commandline_options.dart
index b44128c..261a3ef 100644
--- a/pkg/compiler/lib/src/commandline_options.dart
+++ b/pkg/compiler/lib/src/commandline_options.dart
@@ -35,9 +35,7 @@
static const String generateCodeWithCompileTimeErrors =
'--generate-code-with-compile-time-errors';
- /// Enable the unified front end, loading from .dill files, and compilation
- /// using the kernel representation.
- /// See [CompilerOptions.useKernel] for details.
+ /// TODO(sigmund): delete this flag.
static const String useKernel = '--use-kernel';
/// Temporary flag to revert to the old front-end once the new common
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index 27943d1..9c46934 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -139,7 +139,7 @@
bool showWarnings;
bool showHints;
bool enableColors;
- bool useKernel = false;
+ bool useKernel = true;
Uri platformBinaries = computePlatformBinariesLocation();
// List of provided options that imply that output is expected.
List<String> optionsImplyCompilation = <String>[];
@@ -287,10 +287,8 @@
passThrough('--categories=${categories.join(",")}');
}
- void setUseKernel(String argument) {
- useKernel = true;
- // TODO(sigmund): reenable hints (Issue #32111)
- showHints = false;
+ void setUseOldFrontend(String argument) {
+ useKernel = false;
passThrough(argument);
}
@@ -347,8 +345,8 @@
new OptionHandler(
'--output-type=dart|--output-type=dart-multi|--output-type=js',
setOutputType),
- new OptionHandler(Flags.useKernel, setUseKernel),
- new OptionHandler(Flags.useOldFrontend, ignoreOption),
+ new OptionHandler(Flags.useKernel, ignoreOption),
+ new OptionHandler(Flags.useOldFrontend, setUseOldFrontend),
new OptionHandler(Flags.platformBinaries, setPlatformBinaries),
new OptionHandler(Flags.noFrequencyBasedMinification, passThrough),
new OptionHandler(Flags.verbose, setVerbose),
@@ -598,6 +596,8 @@
Uri script = currentDirectory.resolve(arguments[0]);
if (useKernel) {
diagnosticHandler.autoReadFileUri = true;
+ // TODO(sigmund): reenable hints (Issue #32111)
+ diagnosticHandler.showHints = showHints = false;
}
CompilerOptions compilerOptions = new CompilerOptions.parse(
entryPoint: script,
diff --git a/pkg/compiler/lib/src/js_backend/impact_transformer.dart b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
index 3416641..c83d271 100644
--- a/pkg/compiler/lib/src/js_backend/impact_transformer.dart
+++ b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
@@ -240,7 +240,8 @@
registerImpact(_impacts.closure);
Local closure = staticUse.element;
FunctionType type = _elementEnvironment.getLocalFunctionType(closure);
- if (type.containsTypeVariables) {
+ if (type.containsTypeVariables ||
+ (_options.strongMode && !optimizeLocalSignaturesForStrongMode)) {
registerImpact(_impacts.computeSignature);
}
break;
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index ec4fc0f..e67afa3 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -27,6 +27,10 @@
bool cacheRtiDataForTesting = false;
+// TODO(johnniwinther): Remove this when local signatures are optimized for
+// Dart 2.
+const bool optimizeLocalSignaturesForStrongMode = false;
+
/// For each class, stores the possible class subtype tests that could succeed.
abstract class TypeChecks {
/// Get the set of checks required for class [element].
@@ -97,6 +101,8 @@
/// and when it is needed.
bool localFunctionNeedsSignature(Local localFunction);
+ /// Returns `true` if a dynamic call of [selector] needs to pass type
+ /// arguments.
bool selectorNeedsTypeArguments(Selector selector);
}
@@ -137,7 +143,7 @@
/// Computes the [RuntimeTypesNeed] for the data registered with this builder.
RuntimeTypesNeed computeRuntimeTypesNeed(
ResolutionWorldBuilder resolutionWorldBuilder, ClosedWorld closedWorld,
- {bool enableTypeAssertions});
+ {bool enableTypeAssertions, bool strongMode});
}
class TrivialRuntimeTypesNeedBuilder implements RuntimeTypesNeedBuilder {
@@ -155,7 +161,7 @@
@override
RuntimeTypesNeed computeRuntimeTypesNeed(
ResolutionWorldBuilder resolutionWorldBuilder, ClosedWorld closedWorld,
- {bool enableTypeAssertions}) {
+ {bool enableTypeAssertions, bool strongMode}) {
return const TrivialRuntimeTypesNeed();
}
}
@@ -197,7 +203,8 @@
/// Computes the [RuntimeTypesChecks] for the data in this builder.
RuntimeTypesChecks computeRequiredChecks(
- CodegenWorldBuilder codegenWorldBuilder);
+ CodegenWorldBuilder codegenWorldBuilder,
+ {bool strongMode});
bool get rtiChecksBuilderClosed;
}
@@ -217,7 +224,8 @@
@override
RuntimeTypesChecks computeRequiredChecks(
- CodegenWorldBuilder codegenWorldBuilder) {
+ CodegenWorldBuilder codegenWorldBuilder,
+ {bool strongMode}) {
rtiChecksBuilderClosed = true;
Map<ClassEntity, ClassUse> classUseMap = <ClassEntity, ClassUse>{};
@@ -229,7 +237,8 @@
..checkedInstance = true
..typeArgument = true
..checkedTypeArgument = true
- ..functionType = _computeFunctionType(_elementEnvironment, cls);
+ ..functionType = _computeFunctionType(_elementEnvironment, cls,
+ strongMode: strongMode);
classUseMap[cls] = classUse;
}
TypeChecks typeChecks = _substitutions._requiredChecks =
@@ -1273,7 +1282,7 @@
@override
RuntimeTypesNeed computeRuntimeTypesNeed(
ResolutionWorldBuilder resolutionWorldBuilder, ClosedWorld closedWorld,
- {bool enableTypeAssertions}) {
+ {bool enableTypeAssertions, bool strongMode}) {
TypeVariableTests typeVariableTests = new TypeVariableTests(
closedWorld.elementEnvironment,
closedWorld.commonElements,
@@ -1336,12 +1345,25 @@
return false;
}
- for (Local function
- in resolutionWorldBuilder.localFunctionsWithFreeTypeVariables) {
- if (checkFunctionType(
- _elementEnvironment.getLocalFunctionType(function))) {
+ if (strongMode) {
+ assert(!optimizeLocalSignaturesForStrongMode);
+ // TODO(johnniwinther): Optimize generation of signatures for Dart 2.
+ for (Local function in resolutionWorldBuilder.localFunctions) {
+ FunctionType functionType =
+ _elementEnvironment.getLocalFunctionType(function);
+ functionType.forEachTypeVariable((TypeVariableType typeVariable) {
+ potentiallyNeedTypeArguments(typeVariable.element.typeDeclaration);
+ });
localFunctionsNeedingSignature.add(function);
}
+ } else {
+ for (Local function
+ in resolutionWorldBuilder.localFunctionsWithFreeTypeVariables) {
+ if (checkFunctionType(
+ _elementEnvironment.getLocalFunctionType(function))) {
+ localFunctionsNeedingSignature.add(function);
+ }
+ }
}
for (FunctionEntity function
in resolutionWorldBuilder.closurizedMembersWithFreeTypeVariables) {
@@ -1526,7 +1548,8 @@
}
RuntimeTypesChecks computeRequiredChecks(
- CodegenWorldBuilder codegenWorldBuilder) {
+ CodegenWorldBuilder codegenWorldBuilder,
+ {bool strongMode}) {
TypeVariableTests typeVariableTests = new TypeVariableTests(
_elementEnvironment, _commonElements, _types, codegenWorldBuilder,
forRtiNeeds: false);
@@ -1620,8 +1643,9 @@
Set<ClassEntity> processedClasses = new Set<ClassEntity>();
void processClass(ClassEntity cls) {
- ClassFunctionType functionType =
- _computeFunctionType(_elementEnvironment, cls);
+ ClassFunctionType functionType = _computeFunctionType(
+ _elementEnvironment, cls,
+ strongMode: strongMode);
if (functionType != null) {
ClassUse classUse =
classUseMap.putIfAbsent(cls, () => new ClassUse());
@@ -1653,9 +1677,14 @@
}
}
-// TODO(johnniwinther): Handle Dart 2 semantics.
+/// Computes the function type of [cls], if any.
+///
+/// In Dart 1, any class with a `call` method has a function type, in Dart 2
+/// only closure classes have a function type.
ClassFunctionType _computeFunctionType(
- ElementEnvironment _elementEnvironment, ClassEntity cls) {
+ ElementEnvironment _elementEnvironment, ClassEntity cls,
+ {bool strongMode}) {
+ if (strongMode && !cls.isClosure) return null;
MemberEntity call =
_elementEnvironment.lookupLocalClassMember(cls, Identifiers.call);
if (call != null && call.isFunction) {
diff --git a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
index cb3ae06..003771e 100644
--- a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
+++ b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
@@ -171,7 +171,7 @@
backend.mirrorsData,
backend.rtiEncoder,
codegenWorldBuilder);
- typeTestRegistry = new TypeTestRegistry(
+ typeTestRegistry = new TypeTestRegistry(compiler.options,
codegenWorldBuilder, closedWorld, closedWorld.elementEnvironment);
});
}
diff --git a/pkg/compiler/lib/src/js_emitter/type_test_registry.dart b/pkg/compiler/lib/src/js_emitter/type_test_registry.dart
index b69beb8..6f979fd 100644
--- a/pkg/compiler/lib/src/js_emitter/type_test_registry.dart
+++ b/pkg/compiler/lib/src/js_emitter/type_test_registry.dart
@@ -14,6 +14,7 @@
RuntimeTypesChecksBuilder,
RuntimeTypesSubstitutions;
import '../js_backend/mirrors_data.dart';
+import '../options.dart';
import '../universe/world_builder.dart';
import '../world.dart' show ClosedWorld;
@@ -24,13 +25,14 @@
/// used for RTI.
Set<ClassEntity> _rtiNeededClasses;
+ final CompilerOptions _options;
final CodegenWorldBuilder _codegenWorldBuilder;
final ClosedWorld _closedWorld;
RuntimeTypesChecks _rtiChecks;
- TypeTestRegistry(
- this._codegenWorldBuilder, this._closedWorld, this._elementEnvironment);
+ TypeTestRegistry(this._options, this._codegenWorldBuilder, this._closedWorld,
+ this._elementEnvironment);
RuntimeTypesChecks get rtiChecks {
assert(
@@ -111,6 +113,7 @@
}
void computeRequiredTypeChecks(RuntimeTypesChecksBuilder rtiChecksBuilder) {
- _rtiChecks = rtiChecksBuilder.computeRequiredChecks(_codegenWorldBuilder);
+ _rtiChecks = rtiChecksBuilder.computeRequiredChecks(_codegenWorldBuilder,
+ strongMode: _options.strongMode);
}
}
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index f582b52..53b132c 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -2004,7 +2004,8 @@
classHierarchyNodes,
classSets) {
computeRtiNeed(resolutionWorldBuilder, rtiNeedBuilder,
- enableTypeAssertions: options.enableTypeAssertions);
+ enableTypeAssertions: options.enableTypeAssertions,
+ strongMode: options.strongMode);
}
@override
@@ -2686,7 +2687,7 @@
closureClassInfo.closureClassEntity,
// SignatureMethod takes no arguments.
const ParameterStructure(0, 0, const [], 0),
- getAsyncMarker(closureSourceNode));
+ AsyncMarker.SYNC);
_members.register<IndexedFunction, FunctionData>(
signatureMethod,
new SignatureFunctionData(
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index e194cbd..ec4b54c 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -336,7 +336,8 @@
outputUri: _extractUriOption(options, '--out='),
platformConfigUri:
_resolvePlatformConfigFromOptions(libraryRoot, options),
- platformBinaries: platformBinaries,
+ platformBinaries: platformBinaries ??
+ _extractUriOption(options, '--platform-binaries='),
preserveComments: _hasOption(options, Flags.preserveComments),
preserveUris: _hasOption(options, Flags.preserveUris),
resolutionInputs: resolutionInputs,
@@ -352,7 +353,7 @@
trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations),
useContentSecurityPolicy:
_hasOption(options, Flags.useContentSecurityPolicy),
- useKernel: _hasOption(options, Flags.useKernel),
+ useKernel: !_hasOption(options, Flags.useOldFrontend),
useFrequencyNamer:
!_hasOption(options, Flags.noFrequencyBasedMinification),
useMultiSourceInfo: _hasOption(options, Flags.useMultiSourceInfo),
@@ -419,7 +420,7 @@
bool trustPrimitives: false,
bool trustTypeAnnotations: false,
bool useContentSecurityPolicy: false,
- bool useKernel: false,
+ bool useKernel: true,
bool useFrequencyNamer: true,
bool useMultiSourceInfo: false,
bool useNewSourceInfo: false,
@@ -450,9 +451,7 @@
}
}
if (useKernel && platformBinaries == null) {
- throw new ArgumentError(
- "${Flags.useKernel} is only supported in combination "
- "with ${Flags.platformBinaries}");
+ throw new ArgumentError("Missing required ${Flags.platformBinaries}");
}
return new CompilerOptions._(entryPoint, libraryRoot, packageRoot,
packageConfig, packagesDiscoveryProvider, environment,
@@ -559,7 +558,7 @@
this.trustPrimitives: false,
this.trustTypeAnnotations: false,
this.useContentSecurityPolicy: false,
- this.useKernel: false,
+ this.useKernel: true,
this.useFrequencyNamer: false,
this.useMultiSourceInfo: false,
this.useNewSourceInfo: false,
diff --git a/pkg/compiler/lib/src/universe/resolution_world_builder.dart b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
index 95a24e8..160f196 100644
--- a/pkg/compiler/lib/src/universe/resolution_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
@@ -11,6 +11,11 @@
/// Used by the mirror tracking system to find all live closure instances.
void forEachLocalFunction(void f(MemberEntity member, Local localFunction));
+ /// Set of (live) local functions (closures).
+ ///
+ /// A live function is one whose enclosing member function has been enqueued.
+ Iterable<Local> get localFunctions;
+
/// Set of (live) local functions (closures) whose signatures reference type
/// variables.
///
diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart
index d1353b1..8ef7d5b 100644
--- a/pkg/compiler/lib/src/world.dart
+++ b/pkg/compiler/lib/src/world.dart
@@ -1295,7 +1295,8 @@
classHierarchyNodes,
classSets) {
computeRtiNeed(resolutionWorldBuilder, rtiNeedBuilder,
- enableTypeAssertions: options.enableTypeAssertions);
+ enableTypeAssertions: options.enableTypeAssertions,
+ strongMode: options.strongMode);
}
bool checkClass(ClassElement cls) => cls.isDeclaration;
@@ -1426,10 +1427,10 @@
void computeRtiNeed(ResolutionWorldBuilder resolutionWorldBuilder,
RuntimeTypesNeedBuilder rtiNeedBuilder,
- {bool enableTypeAssertions}) {
+ {bool enableTypeAssertions, bool strongMode}) {
_rtiNeed = rtiNeedBuilder.computeRuntimeTypesNeed(
resolutionWorldBuilder, this,
- enableTypeAssertions: enableTypeAssertions);
+ enableTypeAssertions: enableTypeAssertions, strongMode: strongMode);
}
RuntimeTypesNeed get rtiNeed => _rtiNeed;
diff --git a/pkg/compiler/tool/generate_kernel.dart b/pkg/compiler/tool/generate_kernel.dart
index b8d1434..9887aaa 100644
--- a/pkg/compiler/tool/generate_kernel.dart
+++ b/pkg/compiler/tool/generate_kernel.dart
@@ -39,7 +39,7 @@
exit(1);
}
- Uri entry = Uri.base.resolve(flags.rest.first);
+ Uri entry = Uri.base.resolve(nativeToUriPath(flags.rest.first));
var program = await kernelForProgram(entry, options);
await writeProgramToBinary(program, flags['out']);
}
@@ -53,4 +53,4 @@
String _defaultPlatform = computePlatformBinariesLocation()
.resolve('dart2js_platform.dill')
- .toString();
+ .toFilePath();
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 6739a47..3dc85f7 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -550,7 +550,7 @@
// Infer based on the sdkRoot, but only when `compileSdk` is false,
// otherwise the default intent was to compile the sdk from sources and
// not to load an sdk summary file.
- _sdkSummary = root?.resolve("vm_outline.dill");
+ _sdkSummary = root?.resolve("vm_platform.dill");
}
if (_raw.librariesSpecificationUri != null) {
diff --git a/pkg/front_end/lib/src/fasta/builder/library_builder.dart b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
index aa42f64..a252d1e 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -176,7 +176,8 @@
/// where they were omitted by the programmer and not provided by the type
/// inference. The method returns the number of distinct type variables
/// that were instantiated in this library.
- int instantiateToBound(TypeBuilder dynamicType, ClassBuilder objectClass) {
+ int instantiateToBound(TypeBuilder dynamicType, TypeBuilder bottomType,
+ ClassBuilder objectClass) {
return 0;
}
diff --git a/pkg/front_end/lib/src/fasta/constant_context.dart b/pkg/front_end/lib/src/fasta/constant_context.dart
new file mode 100644
index 0000000..a4d646a
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/constant_context.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library fasta.constant_context;
+
+enum ConstantContext {
+ /// Not in a constant context.
+ ///
+ /// This means that `Object()` and `[]` are equivalent to `new Object()` and
+ /// `[]` respectively. `new Object()` is **not** a compile-time error.
+ ///
+ /// TODO(ahe): Update the above specification and corresponding
+ /// implementation because `Object()` is a compile-time constant. See [magic
+ /// const](
+ /// ../../../../../../docs/language/informal/docs/language/informal/implicit-creation.md
+ /// ).
+ none,
+
+ /// In a context where constant expressions are required, and `const` may be
+ /// inferred.
+ ///
+ /// This means that `Object()` and `[]` are equivalent to `const Object()` and
+ /// `const []` respectively. `new Object()` is a compile-time error.
+ inferred,
+}
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index 21f523f..d351d58 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -359,6 +359,16 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeCantDetermineConstness = messageCantDetermineConstness;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageCantDetermineConstness = const MessageCode(
+ "CantDetermineConstness",
+ severity: Severity.error,
+ message:
+ r"""The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeCantInferPackagesFromManyInputs =
messageCantInferPackagesFromManyInputs;
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 44f684f..7c7babc 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -6,6 +6,8 @@
import 'dart:core' hide MapEntry;
+import '../constant_context.dart' show ConstantContext;
+
import '../fasta_codes.dart' as fasta;
import '../fasta_codes.dart' show LocatedMessage, Message, noLength, Template;
@@ -58,6 +60,12 @@
import '../type_inference/type_promotion.dart' show TypePromoter;
+import 'constness.dart' show Constness;
+
+import 'fangorn.dart' show Fangorn;
+
+import 'forest.dart' show Forest;
+
import 'frontend_accessors.dart' show buildIsNull;
import 'redirecting_factory_body.dart'
@@ -67,10 +75,6 @@
getRedirectingFactoryBody,
getRedirectionTarget;
-import 'forest.dart' show Forest;
-
-import 'fangorn.dart' show Fangorn;
-
import '../names.dart';
import 'fasta_accessors.dart';
@@ -168,7 +172,7 @@
CloneVisitor cloner;
- bool constantExpressionRequired = false;
+ ConstantContext constantContext = ConstantContext.none;
DartType currentLocalVariableType;
@@ -376,8 +380,8 @@
@override
void beginMetadata(Token token) {
debugEvent("beginMetadata");
- super.push(constantExpressionRequired);
- constantExpressionRequired = true;
+ super.push(constantContext);
+ constantContext = ConstantContext.inferred;
}
@override
@@ -408,14 +412,14 @@
false);
}
- bool savedConstantExpressionRequired = pop();
+ ConstantContext savedConstantContext = pop();
if (expression is! StaticAccessor) {
push(wrapInCompileTimeError(
toValue(expression), fasta.messageExpressionNotMetadata));
} else {
push(toValue(expression));
}
- constantExpressionRequired = savedConstantExpressionRequired;
+ constantContext = savedConstantContext;
}
}
@@ -881,15 +885,15 @@
@override
void beginCaseExpression(Token caseKeyword) {
debugEvent("beginCaseExpression");
- super.push(constantExpressionRequired);
- constantExpressionRequired = true;
+ super.push(constantContext);
+ constantContext = ConstantContext.inferred;
}
@override
void endCaseExpression(Token colon) {
debugEvent("endCaseExpression");
Expression expression = popForValue();
- constantExpressionRequired = pop();
+ constantContext = pop();
super.push(expression);
}
@@ -1036,12 +1040,12 @@
if (isGetter) {
message = warnUnresolvedGet(kernelName, charOffset,
isSuper: isSuper,
- reportWarning: !constantExpressionRequired,
+ reportWarning: constantContext == ConstantContext.none,
context: context);
} else if (isSetter) {
message = warnUnresolvedSet(kernelName, charOffset,
isSuper: isSuper,
- reportWarning: !constantExpressionRequired,
+ reportWarning: constantContext == ConstantContext.none,
context: context);
} else {
if (argMessage != null) {
@@ -1052,11 +1056,11 @@
} else {
message = warnUnresolvedMethod(kernelName, charOffset,
isSuper: isSuper,
- reportWarning: !constantExpressionRequired,
+ reportWarning: constantContext == ConstantContext.none,
context: context);
}
}
- if (constantExpressionRequired) {
+ if (constantContext != ConstantContext.none) {
// TODO(ahe): Use [error] below instead of building a compile-time error,
// should be:
// return library.loader.throwCompileConstantError(error, charOffset);
@@ -1232,9 +1236,10 @@
} else if (context.inDeclaration) {
if (context == IdentifierContext.topLevelVariableDeclaration ||
context == IdentifierContext.fieldDeclaration) {
- constantExpressionRequired = member.isConst;
+ constantContext =
+ member.isConst ? ConstantContext.inferred : ConstantContext.none;
}
- } else if (constantExpressionRequired &&
+ } else if (constantContext != ConstantContext.none &&
!context.allowedInConstantExpression) {
deprecated_addCompileTimeError(
token.charOffset, "Not a constant expression: $context");
@@ -1265,7 +1270,7 @@
Name n = new Name(name, library.library);
if (!isQualified && isInstanceContext) {
assert(builder == null);
- if (constantExpressionRequired || member.isField) {
+ if (constantContext != ConstantContext.none || member.isField) {
return new UnresolvedAccessor(this, n, token);
}
return new ThisPropertyAccessor(this, token, n, lookupInstanceMember(n),
@@ -1278,7 +1283,7 @@
return new UnresolvedAccessor(this, n, token);
}
} else if (builder.isTypeDeclaration) {
- if (constantExpressionRequired &&
+ if (constantContext != ConstantContext.none &&
builder.isTypeVariable &&
!member.isConstructor) {
deprecated_addCompileTimeError(
@@ -1290,7 +1295,7 @@
? new DeferredAccessor(this, token, prefix, accessor)
: accessor;
} else if (builder.isLocal) {
- if (constantExpressionRequired &&
+ if (constantContext != ConstantContext.none &&
!builder.isConst &&
!member.isConstructor) {
deprecated_addCompileTimeError(
@@ -1314,7 +1319,7 @@
return new VariableAccessor(this, token, builder.target);
}
} else if (builder.isInstanceMember) {
- if (constantExpressionRequired &&
+ if (constantContext != ConstantContext.none &&
!inInitializer &&
// TODO(ahe): This is a hack because Fasta sets up the scope
// "this.field" parameters according to old semantics. Under the new
@@ -1343,7 +1348,7 @@
? new DeferredAccessor(this, token, prefix, accessor)
: accessor;
} else if (builder is PrefixBuilder) {
- if (constantExpressionRequired && builder.deferred) {
+ if (constantContext != ConstantContext.none && builder.deferred) {
deprecated_addCompileTimeError(
charOffset,
"'$name' can't be used in a constant expression because it's "
@@ -1367,7 +1372,7 @@
}
StaticAccessor accessor =
new StaticAccessor.fromBuilder(this, builder, token, setter);
- if (constantExpressionRequired) {
+ if (constantContext != ConstantContext.none) {
Member readTarget = accessor.readTarget;
if (!(readTarget is Field && readTarget.isConst ||
// Static tear-offs are also compile time constants.
@@ -1574,7 +1579,7 @@
assert(currentLocalVariableModifiers != -1);
bool isConst = (currentLocalVariableModifiers & constMask) != 0;
bool isFinal = (currentLocalVariableModifiers & finalMask) != 0;
- assert(isConst == constantExpressionRequired);
+ assert(isConst == (constantContext == ConstantContext.inferred));
push(new ShadowVariableDeclaration(identifier.name, functionNestingLevel,
initializer: initializer,
type: currentLocalVariableType,
@@ -1594,7 +1599,7 @@
@override
void handleNoFieldInitializer(Token token) {
debugEvent("NoFieldInitializer");
- if (constantExpressionRequired) {
+ if (constantContext != ConstantContext.none) {
// Creating a null value to prevent the Dart VM from crashing.
push(forest.literalNull(token));
} else {
@@ -1621,15 +1626,17 @@
super.push(currentLocalVariableType ?? NullValue.Type);
currentLocalVariableType = type;
currentLocalVariableModifiers = modifiers;
- super.push(constantExpressionRequired);
- constantExpressionRequired = (modifiers & constMask) != 0;
+ super.push(constantContext);
+ constantContext = ((modifiers & constMask) != 0)
+ ? ConstantContext.inferred
+ : ConstantContext.none;
}
@override
void endVariablesDeclaration(int count, Token endToken) {
debugEvent("VariablesDeclaration");
List<VariableDeclaration> variables = popList(count);
- constantExpressionRequired = pop();
+ constantContext = pop();
currentLocalVariableType = pop();
currentLocalVariableModifiers = pop();
pop(); // Metadata.
@@ -1787,7 +1794,7 @@
push(forest.literalList(
typeArgument,
expressions,
- constKeyword != null || constantExpressionRequired,
+ constKeyword != null || constantContext == ConstantContext.inferred,
constKeyword ?? beginToken));
}
@@ -1845,7 +1852,7 @@
keyType,
valueType,
entries,
- constKeyword != null || constantExpressionRequired,
+ constKeyword != null || constantContext == ConstantContext.inferred,
constKeyword ?? beginToken));
}
@@ -1972,7 +1979,7 @@
debugEvent("AsOperator");
DartType type = pop();
Expression expression = popForValue();
- if (constantExpressionRequired) {
+ if (constantContext != ConstantContext.none) {
push(deprecated_buildCompileTimeError(
"Not a constant expression.", operator.charOffset));
} else {
@@ -1996,7 +2003,7 @@
typePromoter.handleIsCheck(isExpression, isInverted, operand.variable,
type, functionNestingLevel);
}
- if (constantExpressionRequired) {
+ if (constantContext != ConstantContext.none) {
push(deprecated_buildCompileTimeError(
"Not a constant expression.", operator.charOffset));
} else {
@@ -2036,7 +2043,7 @@
void handleThrowExpression(Token throwToken, Token endToken) {
debugEvent("ThrowExpression");
Expression expression = popForValue();
- if (constantExpressionRequired) {
+ if (constantContext != ConstantContext.none) {
push(deprecated_buildCompileTimeError(
"Not a constant expression.", throwToken.charOffset));
} else {
@@ -2141,8 +2148,8 @@
@override
void beginFormalParameters(Token token, MemberKind kind) {
- super.push(constantExpressionRequired);
- constantExpressionRequired = false;
+ super.push(constantContext);
+ constantContext = ConstantContext.none;
}
@override
@@ -2158,7 +2165,7 @@
popList(count) ?? <VariableDeclaration>[],
optional,
beginToken.charOffset);
- constantExpressionRequired = pop();
+ constantContext = pop();
push(formals);
if ((inCatchClause || functionNestingLevel != 0) &&
kind != MemberKind.GeneralizedFunctionType) {
@@ -2412,10 +2419,11 @@
@override
Expression buildStaticInvocation(Member target, Arguments arguments,
- {bool isConst: false,
+ {Constness constness: Constness.implicit,
int charOffset: -1,
Member initialTarget,
List<DartType> targetTypeArguments}) {
+ bool isConst = constness == Constness.explicitConst;
initialTarget ??= target;
List<TypeParameter> typeParameters = target.function.typeParameters;
if (target is Constructor) {
@@ -2441,7 +2449,14 @@
argMessage: argMessage);
}
if (target is Constructor) {
- if (isConst && !target.isConst) {
+ isConst =
+ isConst || constantContext != ConstantContext.none && target.isConst;
+ if (constness == Constness.implicit &&
+ target.isConst &&
+ constantContext != ConstantContext.inferred) {
+ return buildCompileTimeError(
+ fasta.messageCantDetermineConstness, charOffset, noLength);
+ } else if (isConst && !target.isConst) {
return deprecated_buildCompileTimeError(
"Not a const constructor.", charOffset);
}
@@ -2451,7 +2466,14 @@
..fileOffset = charOffset;
} else {
Procedure procedure = target;
- if (isConst && !procedure.isConst) {
+ isConst = isConst ||
+ constantContext != ConstantContext.none && procedure.isConst;
+ if (constness == Constness.implicit &&
+ procedure.isConst &&
+ constantContext != ConstantContext.inferred) {
+ return buildCompileTimeError(
+ fasta.messageCantDetermineConstness, charOffset, noLength);
+ } else if (isConst && !procedure.isConst) {
return deprecated_buildCompileTimeError(
"Not a const factory.", charOffset);
} else if (procedure.isFactory) {
@@ -2550,33 +2572,33 @@
@override
void beginNewExpression(Token token) {
debugEvent("beginNewExpression");
- super.push(constantExpressionRequired);
- if (constantExpressionRequired) {
+ super.push(constantContext);
+ if (constantContext != ConstantContext.none) {
deprecated_addCompileTimeError(
token.charOffset, "Not a constant expression.");
}
- constantExpressionRequired = false;
+ constantContext = ConstantContext.none;
}
@override
void beginConstExpression(Token token) {
debugEvent("beginConstExpression");
- super.push(constantExpressionRequired);
- constantExpressionRequired = true;
+ super.push(constantContext);
+ constantContext = ConstantContext.inferred;
}
@override
void beginConstLiteral(Token token) {
debugEvent("beginConstLiteral");
- super.push(constantExpressionRequired);
- constantExpressionRequired = true;
+ super.push(constantContext);
+ constantContext = ConstantContext.inferred;
}
@override
void endConstLiteral(Token token) {
debugEvent("endConstLiteral");
var literal = pop();
- constantExpressionRequired = pop();
+ constantContext = pop();
push(literal);
}
@@ -2606,7 +2628,7 @@
type = accessor.declaration;
}
- bool savedConstantExpressionRequired = pop();
+ ConstantContext savedConstantContext = pop();
if (type is TypeDeclarationBuilder) {
Expression expression = buildConstructorInvocation(
type,
@@ -2615,7 +2637,9 @@
name,
typeArguments,
token.charOffset,
- optional("const", token) || optional("@", token));
+ optional("const", token) || optional("@", token)
+ ? Constness.explicitConst
+ : Constness.explicitNew);
push(deferredPrefix != null
? wrapInDeferredCheck(expression, deferredPrefix, checkOffset)
: expression);
@@ -2625,7 +2649,7 @@
push(throwNoSuchMethodError(forest.literalNull(token),
debugName(getNodeName(type), name), arguments, nameToken.charOffset));
}
- constantExpressionRequired = savedConstantExpressionRequired;
+ constantContext = savedConstantContext;
}
@override
@@ -2636,7 +2660,7 @@
String name,
List<DartType> typeArguments,
int charOffset,
- bool isConst) {
+ Constness constness) {
if (arguments == null) {
return deprecated_buildCompileTimeError(
"No arguments.", nameToken.charOffset);
@@ -2705,7 +2729,7 @@
if (target is Constructor ||
(target is Procedure && target.kind == ProcedureKind.Factory)) {
return buildStaticInvocation(target, arguments,
- isConst: isConst,
+ constness: constness,
charOffset: nameToken.charOffset,
initialTarget: initialTarget,
targetTypeArguments: targetTypeArguments);
@@ -2909,7 +2933,7 @@
typeParameters: typeParameters, asyncMarker: asyncModifier)
..fileOffset = beginToken.charOffset
..fileEndOffset = token.charOffset);
- if (constantExpressionRequired) {
+ if (constantContext != ConstantContext.none) {
push(deprecated_buildCompileTimeError(
"Not a constant expression.", formals.charOffset));
} else {
@@ -3696,8 +3720,8 @@
@override
void deprecated_addCompileTimeError(int charOffset, String message,
{bool wasHandled: false}) {
- // TODO(ahe): If constantExpressionRequired is set, set it to false to
- // avoid a long list of errors.
+ // TODO(ahe): Consider setting [constantContext] to `ConstantContext.none`
+ // to avoid a long list of errors.
return library.addCompileTimeError(
fasta.templateUnspecified.withArguments(message),
charOffset,
@@ -3730,7 +3754,7 @@
addProblemErrorIfConst(message, offset, length);
}
return const InvalidType();
- } else if (constantExpressionRequired) {
+ } else if (constantContext != ConstantContext.none) {
deprecated_addCompileTimeError(
offset,
"Type variable '${type.parameter.name}' can't be used as a constant "
@@ -3766,7 +3790,7 @@
bool isImplicitCall: false,
bool isSuper: false,
Member interfaceTarget}) {
- if (constantExpressionRequired && !isConstantExpression) {
+ if (constantContext != ConstantContext.none && !isConstantExpression) {
return deprecated_buildCompileTimeError(
"Not a constant expression.", offset);
}
@@ -3838,7 +3862,7 @@
// TODO(askesc): Instead of deciding on the severity, this method should
// take two messages: one to use when a constant expression is
// required and one to use otherwise.
- if (constantExpressionRequired) {
+ if (constantContext != ConstantContext.none) {
addCompileTimeError(message, charOffset, length, context: context);
} else {
library.addProblem(message, charOffset, length, uri, context: context);
@@ -3992,7 +4016,7 @@
}
Expression handleAssignment(bool voidContext) {
- if (helper.constantExpressionRequired) {
+ if (helper.constantContext != ConstantContext.none) {
return helper.deprecated_buildCompileTimeError(
"Not a constant expression.", offsetForToken(token));
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/constness.dart b/pkg/front_end/lib/src/fasta/kernel/constness.dart
new file mode 100644
index 0000000..0da490d
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/kernel/constness.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library fasta.constness;
+
+enum Constness {
+ explicitConst,
+ explicitNew,
+ implicit,
+}
diff --git a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
index 1fb2094..fb16e2a 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
@@ -6,6 +6,8 @@
import '../../scanner/token.dart' show Token;
+import '../constant_context.dart' show ConstantContext;
+
import '../fasta_codes.dart'
show
LocatedMessage,
@@ -32,6 +34,8 @@
import 'body_builder.dart' show Identifier, noLocation;
+import 'constness.dart' show Constness;
+
import 'forest.dart' show Forest;
import 'frontend_accessors.dart' as kernel
@@ -81,7 +85,7 @@
int get functionNestingLevel;
- bool get constantExpressionRequired;
+ ConstantContext get constantContext;
Forest<Expression, Statement, Token, Arguments> get forest;
@@ -116,7 +120,7 @@
[int charOffset = -1]);
Expression buildStaticInvocation(Procedure target, Arguments arguments,
- {bool isConst, int charOffset, Member initialTarget});
+ {Constness constness, int charOffset, Member initialTarget});
Expression buildProblemExpression(
ProblemBuilder builder, int offset, int length);
@@ -158,7 +162,7 @@
String name,
List<DartType> typeArguments,
int charOffset,
- bool isConst);
+ Constness constness);
DartType validatedTypeVariableUse(
TypeParameterType type, int offset, bool nonInstanceAccessIsError);
@@ -256,7 +260,8 @@
send.arguments, offsetForToken(send.token),
isNullAware: isNullAware);
} else {
- if (helper.constantExpressionRequired && send.name != lengthName) {
+ if (helper.constantContext != ConstantContext.none &&
+ send.name != lengthName) {
helper.deprecated_addCompileTimeError(
offsetForToken(token), "Not a constant expression.");
}
@@ -877,7 +882,8 @@
String get plainNameForRead => (readTarget ?? writeTarget).name.name;
Expression doInvocation(int offset, Arguments arguments) {
- if (helper.constantExpressionRequired && !helper.isIdentical(readTarget)) {
+ if (helper.constantContext != ConstantContext.none &&
+ !helper.isIdentical(readTarget)) {
helper.deprecated_addCompileTimeError(
offset, "Not a constant expression.");
}
@@ -972,7 +978,7 @@
String get plainNameForRead => name.name;
Expression doInvocation(int offset, Arguments arguments) {
- if (helper.constantExpressionRequired) {
+ if (helper.constantContext != ConstantContext.none) {
helper.deprecated_addCompileTimeError(
offset, "Not a constant expression.");
}
@@ -1237,14 +1243,8 @@
if (send is IncompletePropertyAccessor) {
accessor = new UnresolvedAccessor(helper, name, send.token);
} else {
- return helper.buildConstructorInvocation(
- declaration,
- send.token,
- arguments,
- name.name,
- null,
- token.charOffset,
- helper.constantExpressionRequired);
+ return helper.buildConstructorInvocation(declaration, send.token,
+ arguments, name.name, null, token.charOffset, Constness.implicit);
}
} else {
Builder setter;
@@ -1311,14 +1311,16 @@
typeDeclaration.calculatedBounds ??= calculateBoundsForDeclaration(
typeDeclaration,
helperLibrary.loader.target.dynamicType,
- helperLibrary.loader.coreLibrary["Object"]);
+ helperLibrary.loader.target.bottomType,
+ helperLibrary.loader.target.objectClassBuilder);
type = typeDeclaration.buildType(
helper.library, typeDeclaration.calculatedBounds);
} else if (typeDeclaration is KernelFunctionTypeAliasBuilder) {
typeDeclaration.calculatedBounds ??= calculateBoundsForDeclaration(
typeDeclaration,
helperLibrary.loader.target.dynamicType,
- helperLibrary.loader.coreLibrary["Object"]);
+ helperLibrary.loader.target.bottomType,
+ helperLibrary.loader.target.objectClassBuilder);
type = typeDeclaration.buildType(
helper.library, typeDeclaration.calculatedBounds);
}
@@ -1372,7 +1374,7 @@
@override
Expression doInvocation(int offset, Arguments arguments) {
return helper.buildConstructorInvocation(declaration, token, arguments, "",
- null, token.charOffset, helper.constantExpressionRequired);
+ null, token.charOffset, Constness.implicit);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 25054fe..4cbda32 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -973,20 +973,27 @@
return count;
}
- int instantiateToBound(TypeBuilder dynamicType, ClassBuilder objectClass) {
+ int instantiateToBound(TypeBuilder dynamicType, TypeBuilder bottomType,
+ ClassBuilder objectClass) {
int count = 0;
for (var declarationBuilder in libraryDeclaration.members.values) {
if (declarationBuilder is KernelClassBuilder) {
if (declarationBuilder.typeVariables != null) {
declarationBuilder.calculatedBounds = calculateBounds(
- declarationBuilder.typeVariables, dynamicType, objectClass);
+ declarationBuilder.typeVariables,
+ dynamicType,
+ bottomType,
+ objectClass);
count += declarationBuilder.calculatedBounds.length;
}
} else if (declarationBuilder is KernelFunctionTypeAliasBuilder) {
if (declarationBuilder.typeVariables != null) {
declarationBuilder.calculatedBounds = calculateBounds(
- declarationBuilder.typeVariables, dynamicType, objectClass);
+ declarationBuilder.typeVariables,
+ dynamicType,
+ bottomType,
+ objectClass);
count += declarationBuilder.calculatedBounds.length;
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index c0b4ad3..388fd98 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -117,6 +117,11 @@
final TypeBuilder dynamicType = new KernelNamedTypeBuilder("dynamic", null);
+ final NamedTypeBuilder objectType =
+ new KernelNamedTypeBuilder("Object", null);
+
+ final TypeBuilder bottomType = new KernelNamedTypeBuilder("Null", null);
+
bool get strongMode => backendTarget.strongMode;
bool get disableTypeInference => backendTarget.disableTypeInference;
@@ -234,9 +239,11 @@
dynamicType.bind(loader.coreLibrary["dynamic"]);
loader.resolveParts();
loader.computeLibraryScopes();
+ objectType.bind(loader.coreLibrary["Object"]);
+ bottomType.bind(loader.coreLibrary["Null"]);
loader.resolveTypes();
if (loader.target.strongMode) {
- loader.instantiateToBound(dynamicType, objectClassBuilder);
+ loader.instantiateToBound(dynamicType, bottomType, objectClassBuilder);
}
List<SourceClassBuilder> myClasses = collectMyClasses();
loader.checkSemantics(myClasses);
@@ -421,7 +428,7 @@
ticker.logMs("Installed default constructors");
}
- KernelClassBuilder get objectClassBuilder => loader.coreLibrary["Object"];
+ KernelClassBuilder get objectClassBuilder => objectType.builder;
Class get objectClass => objectClassBuilder.cls;
diff --git a/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart b/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart
index a53c0bd..a48b328 100644
--- a/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/type_algorithms.dart
@@ -4,55 +4,142 @@
import 'kernel_builder.dart'
show
+ TypeBuilder,
TypeVariableBuilder,
+ KernelFormalParameterBuilder,
KernelTypeBuilder,
KernelNamedTypeBuilder,
KernelTypeVariableBuilder,
KernelClassBuilder,
KernelFunctionTypeAliasBuilder,
+ KernelFunctionTypeBuilder,
NamedTypeBuilder,
+ FormalParameterBuilder,
+ FunctionTypeBuilder,
TypeDeclarationBuilder;
-KernelTypeBuilder substituteRec(
+import 'package:kernel/util/graph.dart' show Graph, computeStrongComponents;
+
+KernelTypeBuilder substituteRange(
KernelTypeBuilder type,
- Map<TypeVariableBuilder, KernelTypeBuilder> substitution,
- KernelTypeBuilder dynamicType,
- int depth) {
+ Map<TypeVariableBuilder, KernelTypeBuilder> upperSubstitution,
+ Map<TypeVariableBuilder, KernelTypeBuilder> lowerSubstitution,
+ {bool isCovariant = true}) {
if (type is KernelNamedTypeBuilder) {
- if (type.builder is KernelTypeVariableBuilder &&
- substitution.containsKey(type.builder)) {
- if (depth > 0) {
- return substituteRec(
- substitution[type.builder], substitution, dynamicType, depth - 1);
+ if (type.builder is KernelTypeVariableBuilder) {
+ if (isCovariant) {
+ return upperSubstitution[type.builder] ?? type;
}
- return dynamicType;
- } else if (type.builder is KernelClassBuilder ||
- type.builder is KernelFunctionTypeAliasBuilder) {
- if (type.arguments == null || type.arguments.length == 0) {
- return type;
+ return lowerSubstitution[type.builder] ?? type;
+ }
+ if (type.arguments == null || type.arguments.length == 0) {
+ return type;
+ }
+ List<TypeBuilder> arguments;
+ for (int i = 0; i < type.arguments.length; i++) {
+ TypeBuilder substitutedArgument = substituteRange(
+ type.arguments[i], upperSubstitution, lowerSubstitution,
+ isCovariant: isCovariant);
+ if (substitutedArgument != type.arguments[i]) {
+ arguments ??= type.arguments.toList();
+ arguments[i] = substitutedArgument;
}
- List<KernelTypeBuilder> typeArguments =
- new List<KernelTypeBuilder>(type.arguments.length);
- for (int i = 0; i < typeArguments.length; i++) {
- typeArguments[i] =
- substituteRec(type.arguments[i], substitution, dynamicType, depth);
- }
- return new KernelNamedTypeBuilder(type.name, typeArguments)
+ }
+ if (arguments != null) {
+ return new KernelNamedTypeBuilder(type.name, arguments)
..bind(type.builder);
}
+ return type;
+ }
+
+ if (type is KernelFunctionTypeBuilder) {
+ List<KernelTypeVariableBuilder> variables;
+ if (type.typeVariables != null) {
+ variables =
+ new List<KernelTypeVariableBuilder>(type.typeVariables.length);
+ }
+ List<KernelFormalParameterBuilder> formals;
+ if (type.formals != null) {
+ formals = new List<KernelFormalParameterBuilder>(type.formals.length);
+ }
+ KernelTypeBuilder returnType;
+ bool changed = false;
+
+ if (type.typeVariables != null) {
+ for (int i = 0; i < variables.length; i++) {
+ KernelTypeVariableBuilder variable = type.typeVariables[i];
+ KernelTypeBuilder bound = substituteRange(
+ variable.bound, upperSubstitution, lowerSubstitution,
+ isCovariant: isCovariant);
+ if (bound != variable.bound) {
+ variables[i] = new KernelTypeVariableBuilder(
+ variable.name, variable.parent, variable.charOffset, bound);
+ changed = true;
+ } else {
+ variables[i] = variable;
+ }
+ }
+ }
+
+ if (type.formals != null) {
+ for (int i = 0; i < formals.length; i++) {
+ KernelFormalParameterBuilder formal = type.formals[i];
+ KernelTypeBuilder parameterType = substituteRange(
+ formal.type, upperSubstitution, lowerSubstitution,
+ isCovariant: !isCovariant);
+ if (parameterType != formal.type) {
+ formals[i] = new KernelFormalParameterBuilder(
+ formal.metadata,
+ formal.modifiers,
+ parameterType,
+ formal.name,
+ formal.hasThis,
+ formal.parent,
+ formal.charOffset);
+ changed = true;
+ } else {
+ formals[i] = formal;
+ }
+ }
+ }
+
+ returnType = substituteRange(
+ type.returnType, upperSubstitution, lowerSubstitution,
+ isCovariant: true);
+ if (returnType != type.returnType) {
+ changed = true;
+ }
+
+ if (changed) {
+ return new KernelFunctionTypeBuilder(returnType, variables, formals);
+ }
+
+ return type;
}
return type;
}
-List<KernelTypeBuilder> calculateBounds(
- List<TypeVariableBuilder> typeParameters,
- KernelTypeBuilder dynamicType,
- KernelClassBuilder objectClass) {
- var refinedBounds = new List<KernelTypeBuilder>(typeParameters.length);
- var substitution = new Map<TypeVariableBuilder, KernelTypeBuilder>();
+KernelTypeBuilder substitute(KernelTypeBuilder type,
+ Map<TypeVariableBuilder, KernelTypeBuilder> substitution) {
+ return substituteRange(type, substitution, substitution, isCovariant: true);
+}
- for (int i = 0; i < typeParameters.length; i++) {
- KernelTypeBuilder type = typeParameters[i].bound;
+/// Calculates bounds to be provided as type arguments in place of missing type
+/// arguments on raw types with the given type parameters.
+///
+/// See the [description]
+/// (https://github.com/dart-lang/sdk/blob/master/docs/language/informal/instantiate-to-bound.md)
+/// of the algorithm for details.
+List<KernelTypeBuilder> calculateBounds(
+ List<TypeVariableBuilder> variables,
+ KernelTypeBuilder dynamicType,
+ KernelTypeBuilder bottomType,
+ KernelClassBuilder objectClass) {
+ List<KernelTypeBuilder> bounds =
+ new List<KernelTypeBuilder>(variables.length);
+
+ for (int i = 0; i < variables.length; i++) {
+ KernelTypeBuilder type = variables[i].bound;
if (type == null ||
type is KernelNamedTypeBuilder &&
type.builder is KernelClassBuilder &&
@@ -60,27 +147,47 @@
type = dynamicType;
}
- refinedBounds[i] = type;
- substitution[typeParameters[i]] = type;
+ bounds[i] = type;
}
- // TODO(dmitryas): Replace the call to [substituteRec] with actual
- // instantiate-to-bounds algorithm.
- List<KernelTypeBuilder> result =
- new List<KernelTypeBuilder>(typeParameters.length);
- for (int i = 0; i < result.length; i++) {
- // The current bound `refinedBounds[i]` is used as a starting point for
- // [substituteRec], that is, the first substitution of a type parameter with
- // its bound is already performed, so the depth parameter is lessened by 1.
- result[i] = substituteRec(
- refinedBounds[i], substitution, dynamicType, typeParameters.length - 1);
+ TypeVariablesGraph graph = new TypeVariablesGraph(variables, bounds);
+ List<List<int>> stronglyConnected = computeStrongComponents(graph);
+ for (List<int> component in stronglyConnected) {
+ Map<TypeVariableBuilder, KernelTypeBuilder> dynamicSubstitution =
+ <TypeVariableBuilder, KernelTypeBuilder>{};
+ Map<TypeVariableBuilder, KernelTypeBuilder> nullSubstitution =
+ <TypeVariableBuilder, KernelTypeBuilder>{};
+ for (int variableIndex in component) {
+ dynamicSubstitution[variables[variableIndex]] = dynamicType;
+ nullSubstitution[variables[variableIndex]] = bottomType;
+ }
+ for (int variableIndex in component) {
+ bounds[variableIndex] = substituteRange(
+ bounds[variableIndex], dynamicSubstitution, nullSubstitution,
+ isCovariant: true);
+ }
}
- return result;
+
+ for (int i = 0; i < variables.length; i++) {
+ Map<TypeVariableBuilder, KernelTypeBuilder> substitution =
+ <TypeVariableBuilder, KernelTypeBuilder>{};
+ Map<TypeVariableBuilder, KernelTypeBuilder> nullSubstitution =
+ <TypeVariableBuilder, KernelTypeBuilder>{};
+ substitution[variables[i]] = bounds[i];
+ nullSubstitution[variables[i]] = bottomType;
+ for (int j = 0; j < variables.length; j++) {
+ bounds[j] = substituteRange(bounds[j], substitution, nullSubstitution,
+ isCovariant: true);
+ }
+ }
+
+ return bounds;
}
List<KernelTypeBuilder> calculateBoundsForDeclaration(
TypeDeclarationBuilder typeDeclarationBuilder,
KernelTypeBuilder dynamicType,
+ KernelTypeBuilder nullType,
KernelClassBuilder objectClass) {
List<TypeVariableBuilder> typeParameters;
@@ -94,18 +201,84 @@
return null;
}
- return calculateBounds(typeParameters, dynamicType, objectClass);
+ return calculateBounds(typeParameters, dynamicType, nullType, objectClass);
}
-int instantiateToBoundInPlace(NamedTypeBuilder typeBuilder,
- KernelTypeBuilder dynamicType, KernelClassBuilder objectClass) {
+int instantiateToBoundInPlace(
+ NamedTypeBuilder typeBuilder,
+ KernelTypeBuilder dynamicType,
+ KernelTypeBuilder nullType,
+ KernelClassBuilder objectClass) {
int count = 0;
if (typeBuilder.arguments == null) {
typeBuilder.arguments = calculateBoundsForDeclaration(
- typeBuilder.builder, dynamicType, objectClass);
+ typeBuilder.builder, dynamicType, nullType, objectClass);
count = typeBuilder.arguments?.length ?? 0;
}
return count;
}
+
+/// Graph of mutual dependencies of type variables from the same declaration.
+/// Type variables are represented by their indices in the corresponding
+/// declaration.
+class TypeVariablesGraph implements Graph<int> {
+ List<int> vertices;
+ List<TypeVariableBuilder> variables;
+ List<TypeBuilder> bounds;
+
+ // `edges[i]` is the list of indices of type variables that reference the type
+ // variable with the index `i` in their bounds.
+ List<List<int>> edges;
+
+ TypeVariablesGraph(this.variables, this.bounds) {
+ assert(variables.length == bounds.length);
+
+ vertices = new List<int>(variables.length);
+ Map<TypeVariableBuilder, int> variableIndices =
+ <TypeVariableBuilder, int>{};
+ edges = new List<List<int>>(variables.length);
+ for (int i = 0; i < vertices.length; i++) {
+ vertices[i] = i;
+ variableIndices[variables[i]] = i;
+ edges[i] = <int>[];
+ }
+
+ void collectReferencesFrom(int index, TypeBuilder type) {
+ if (type is NamedTypeBuilder) {
+ if (type.builder is TypeVariableBuilder &&
+ this.variables.contains(type.builder)) {
+ edges[variableIndices[type.builder]].add(index);
+ }
+ if (type.arguments != null) {
+ for (TypeBuilder argument in type.arguments) {
+ collectReferencesFrom(index, argument);
+ }
+ }
+ } else if (type is FunctionTypeBuilder) {
+ if (type.typeVariables != null) {
+ for (TypeVariableBuilder typeVariable in type.typeVariables) {
+ collectReferencesFrom(index, typeVariable.bound);
+ }
+ }
+ if (type.formals != null) {
+ for (FormalParameterBuilder parameter in type.formals) {
+ collectReferencesFrom(index, parameter.type);
+ }
+ }
+ collectReferencesFrom(index, type.returnType);
+ }
+ }
+
+ for (int i = 0; i < vertices.length; i++) {
+ collectReferencesFrom(i, bounds[i]);
+ }
+ }
+
+ /// Returns indices of type variables that depend on the type variable with
+ /// [index].
+ Iterable<int> neighborsOf(int index) {
+ return edges[index];
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 896f9f0..466f059 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -93,6 +93,8 @@
import 'type_continuation.dart'
show TypeContinuation, typeContinuationFromFormalParameterKind;
+import 'type_info.dart' show isGeneralizedFunctionType, isValidTypeReference;
+
import 'util.dart' show closeBraceTokenFor, optional;
/// An event generating parser of Dart programs. This parser expects all tokens
@@ -1466,20 +1468,6 @@
: beforeStart;
}
- bool isValidTypeReference(Token token) {
- int kind = token.kind;
- if (IDENTIFIER_TOKEN == kind) return true;
- if (KEYWORD_TOKEN == kind) {
- TokenType type = token.type;
- String value = type.lexeme;
- return type.isPseudo ||
- (type.isBuiltIn && optional('.', token.next)) ||
- (identical(value, 'dynamic')) ||
- (identical(value, 'void'));
- }
- return false;
- }
-
/// Returns `true` if [token] matches '<' type (',' type)* '>' '(', and
/// otherwise returns `false`. The final '(' is not part of the grammar
/// construct `typeArguments`, but it is required here such that type
@@ -2241,11 +2229,6 @@
!identical(value, token.stringValue);
}
- bool isGeneralizedFunctionType(Token token) {
- return optional('Function', token) &&
- (optional('<', token.next) || optional('(', token.next));
- }
-
/// Parse a type, if it is appropriate to do so.
///
/// If this method can parse a type, it will return the next (non-null) token
@@ -2880,41 +2863,40 @@
}
Token parseTypeArgumentsOpt(Token token) {
- return parseStuffOpt(
- token,
- (t) => listener.beginTypeArguments(t),
- (t) => parseType(t),
- (c, bt, et) => listener.endTypeArguments(c, bt, et),
- (t) => listener.handleNoTypeArguments(t));
- }
-
- Token parseTypeVariablesOpt(Token token) {
- return parseStuffOpt(
- token,
- (t) => listener.beginTypeVariables(t),
- (t) => parseTypeVariable(t),
- (c, bt, et) => listener.endTypeVariables(c, bt, et),
- (t) => listener.handleNoTypeVariables(t));
- }
-
- /// TODO(ahe): Clean this up.
- Token parseStuffOpt(Token token, Function beginStuff, Function stuffParser,
- Function endStuff, Function handleNoStuff) {
Token next = token.next;
if (optional('<', next)) {
BeginToken begin = next;
rewriteLtEndGroupOpt(begin);
- beginStuff(begin);
+ listener.beginTypeArguments(begin);
int count = 0;
do {
- token = stuffParser(token.next);
+ token = parseType(token.next);
++count;
} while (optional(',', token.next));
token = begin.endToken = ensureGt(token);
- endStuff(count, begin, token);
- return token;
+ listener.endTypeArguments(count, begin, token);
+ } else {
+ listener.handleNoTypeArguments(next);
}
- handleNoStuff(next);
+ return token;
+ }
+
+ Token parseTypeVariablesOpt(Token token) {
+ Token next = token.next;
+ if (optional('<', next)) {
+ BeginToken begin = next;
+ rewriteLtEndGroupOpt(begin);
+ listener.beginTypeVariables(begin);
+ int count = 0;
+ do {
+ token = parseTypeVariable(token.next);
+ ++count;
+ } while (optional(',', token.next));
+ token = begin.endToken = ensureGt(token);
+ listener.endTypeVariables(count, begin, token);
+ } else {
+ listener.handleNoTypeVariables(next);
+ }
return token;
}
diff --git a/pkg/front_end/lib/src/fasta/parser/type_info.dart b/pkg/front_end/lib/src/fasta/parser/type_info.dart
new file mode 100644
index 0000000..8a012ce
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/parser/type_info.dart
@@ -0,0 +1,354 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library fasta.parser.type_info;
+
+import '../../scanner/token.dart' show Token, TokenType;
+
+import '../scanner/token_constants.dart' show IDENTIFIER_TOKEN, KEYWORD_TOKEN;
+
+import '../util/link.dart' show Link;
+
+import 'identifier_context.dart' show IdentifierContext;
+
+import 'listener.dart' show Listener;
+
+import 'member_kind.dart' show MemberKind;
+
+import 'parser.dart' show Parser;
+
+import 'type_info_impl.dart'
+ show
+ NoTypeInfo,
+ PrefixedTypeInfo,
+ SimpleTypeArgumentsInfo,
+ SimpleTypeInfo,
+ VoidTypeInfo,
+ looksLikeName,
+ skipTypeArguments;
+
+import 'util.dart' show optional;
+
+/// [TypeInfo] provides information that has collected by [computeType]
+/// about a particular type reference.
+abstract class TypeInfo {
+ /// Call this function when it's known that the token after [token] is a type.
+ /// This function will call the appropriate event methods on the [Parser]'s
+ /// listener to handle the type.
+ Token parseType(Token token, Parser parser);
+
+ /// Call this function with the [token] before the type to obtain
+ /// the last token in the type. If there is no type, then this method
+ /// will return [token].
+ Token skipType(Token token);
+}
+
+/// [NoTypeInfo] is a specialized [TypeInfo] returned by [computeType] when
+/// there is no type information in the source.
+const TypeInfo noTypeInfo = const NoTypeInfo();
+
+/// [VoidTypeInfo] is a specialized [TypeInfo] returned by [computeType] when
+/// there is a single identifier as the type reference.
+const TypeInfo voidTypeInfo = const VoidTypeInfo();
+
+/// [SimpleTypeInfo] is a specialized [TypeInfo] returned by [computeType]
+/// when there is a single identifier as the type reference.
+const TypeInfo simpleTypeInfo = const SimpleTypeInfo();
+
+/// [PrefixedTypeInfo] is a specialized [TypeInfo] returned by [computeType]
+/// when the type reference is of the form: identifier `.` identifier.
+const TypeInfo prefixedTypeInfo = const PrefixedTypeInfo();
+
+/// [SimpleTypeArgumentsInfo] is a specialized [TypeInfo] returned by
+/// [computeType] when the type reference is of the form:
+/// identifier `<` identifier `>`.
+const TypeInfo simpleTypeArgumentsInfo = const SimpleTypeArgumentsInfo();
+
+bool isGeneralizedFunctionType(Token token) {
+ return optional('Function', token) &&
+ (optional('<', token.next) || optional('(', token.next));
+}
+
+bool isValidTypeReference(Token token) {
+ int kind = token.kind;
+ if (IDENTIFIER_TOKEN == kind) return true;
+ if (KEYWORD_TOKEN == kind) {
+ TokenType type = token.type;
+ String value = type.lexeme;
+ return type.isPseudo ||
+ (type.isBuiltIn && optional('.', token.next)) ||
+ (identical(value, 'dynamic')) ||
+ (identical(value, 'void'));
+ }
+ return false;
+}
+
+/// Called by the parser to obtain information about a possible type reference
+/// that follows [token].
+TypeInfo computeType(final Token token, bool required) {
+ Token next = token.next;
+ if (!isValidTypeReference(next)) {
+ return noTypeInfo;
+ }
+
+ if (optional('void', next)) {
+ next = next.next;
+ if (isGeneralizedFunctionType(next)) {
+ // `void` `Function` ...
+ return new ComplexTypeInfo(token).computeVoidGFT(required);
+ }
+ // `void`
+ return voidTypeInfo;
+ }
+
+ if (isGeneralizedFunctionType(next)) {
+ // `Function` ...
+ return new ComplexTypeInfo(token).computeNoTypeGFT(required);
+ }
+
+ // We've seen an identifier.
+ next = next.next;
+
+ if (optional('<', next)) {
+ if (next.endGroup != null) {
+ next = next.next;
+ // identifier `<` `void` `>` is handled by ComplexTypeInfo.
+ if (isValidTypeReference(next) && !identical('void', next.stringValue)) {
+ next = next.next;
+ if (optional('>', next)) {
+ // We've seen identifier `<` identifier `>`
+ next = next.next;
+ if (!isGeneralizedFunctionType(next)) {
+ if (required || looksLikeName(next)) {
+ // identifier `<` identifier `>` identifier
+ return simpleTypeArgumentsInfo;
+ } else {
+ // identifier `<` identifier `>` non-identifier
+ return noTypeInfo;
+ }
+ }
+ }
+ // TODO(danrubel): Consider adding a const for
+ // identifier `<` identifier `,` identifier `>`
+ // if that proves to be a common case.
+ }
+
+ // identifier `<` ... `>`
+ return new ComplexTypeInfo(token)
+ .computeSimpleWithTypeArguments(required);
+ }
+ // identifier `<`
+ return required ? simpleTypeInfo : noTypeInfo;
+ }
+
+ if (optional('.', next)) {
+ next = next.next;
+ if (isValidTypeReference(next)) {
+ next = next.next;
+ // We've seen identifier `.` identifier
+ if (!optional('<', next) && !isGeneralizedFunctionType(next)) {
+ if (required || looksLikeName(next)) {
+ // identifier `.` identifier identifier
+ return prefixedTypeInfo;
+ } else {
+ // identifier `.` identifier non-identifier
+ return noTypeInfo;
+ }
+ }
+ // identifier `.` identifier
+ return new ComplexTypeInfo(token).computePrefixedType(required);
+ }
+ // identifier `.` non-identifier
+ return required ? simpleTypeInfo : noTypeInfo;
+ }
+
+ if (isGeneralizedFunctionType(next)) {
+ // `Function`
+ return new ComplexTypeInfo(token).computeIdentifierGFT(required);
+ }
+
+ if (required || looksLikeName(next)) {
+ // identifier identifier
+ return simpleTypeInfo;
+ }
+ return noTypeInfo;
+}
+
+/// Instances of [ComplexTypeInfo] are returned by [computeType] to represent
+/// type references that cannot be represented by the constants above.
+class ComplexTypeInfo implements TypeInfo {
+ final Token start;
+ Token end;
+
+ /// Non-null if type arguments were seen during analysis.
+ Token typeArguments;
+
+ /// The tokens before the start of type variables of function types seen
+ /// during analysis. Notice that the tokens in this list might precede
+ /// either `'<'` or `'('` as not all function types have type parameters.
+ Link<Token> typeVariableStarters = const Link<Token>();
+
+ /// If the receiver represents a generalized function type then this indicates
+ /// whether it has a return type, otherwise this is `null`.
+ bool gftHasReturnType;
+
+ ComplexTypeInfo(Token beforeStart) : this.start = beforeStart.next;
+
+ @override
+ Token parseType(Token token, Parser parser) {
+ assert(identical(token.next, start));
+ Listener listener = parser.listener;
+
+ for (Link<Token> t = typeVariableStarters; t.isNotEmpty; t = t.tail) {
+ parser.parseTypeVariablesOpt(t.head);
+ listener.beginFunctionType(start);
+ }
+
+ if (gftHasReturnType == false) {
+ // A function type without return type.
+ // Push the non-existing return type first. The loop below will
+ // generate the full type.
+ noTypeInfo.parseType(token, parser);
+ } else if (optional('void', token.next)) {
+ token = voidTypeInfo.parseType(token, parser);
+ } else {
+ if (!optional('.', token.next.next)) {
+ token = parser.ensureIdentifier(token, IdentifierContext.typeReference);
+ } else {
+ token = parser.ensureIdentifier(
+ token, IdentifierContext.prefixedTypeReference);
+ token = parser.parseQualifiedRest(
+ token, IdentifierContext.typeReferenceContinuation);
+ }
+ token = parser.parseTypeArgumentsOpt(token);
+ listener.handleType(start, token.next);
+ }
+
+ for (Link<Token> t = typeVariableStarters; t.isNotEmpty; t = t.tail) {
+ token = token.next;
+ assert(optional('Function', token));
+ Token functionToken = token;
+ if (optional("<", token.next)) {
+ // Skip type parameters, they were parsed above.
+ token = token.next.endGroup;
+ }
+ token = parser.parseFormalParametersRequiredOpt(
+ token, MemberKind.GeneralizedFunctionType);
+ listener.endFunctionType(functionToken, token.next);
+ }
+
+ assert(
+ identical(token, end) || (optional('>', token) && optional('>>', end)));
+ return token;
+ }
+
+ @override
+ Token skipType(Token token) {
+ return end;
+ }
+
+ /// Given `Function` non-identifier, compute the type
+ /// and return the receiver or one of the [TypeInfo] constants.
+ TypeInfo computeNoTypeGFT(bool required) {
+ assert(optional('Function', start));
+ computeRest(start, required);
+
+ return gftHasReturnType != null
+ ? this
+ : required ? simpleTypeInfo : noTypeInfo;
+ }
+
+ /// Given void `Function` non-identifier, compute the type
+ /// and return the receiver or one of the [TypeInfo] constants.
+ TypeInfo computeVoidGFT(bool required) {
+ assert(optional('void', start));
+ assert(optional('Function', start.next));
+ computeRest(start.next, required);
+
+ return gftHasReturnType != null ? this : voidTypeInfo;
+ }
+
+ /// Given identifier `Function` non-identifier, compute the type
+ /// and return the receiver or one of the [TypeInfo] constants.
+ TypeInfo computeIdentifierGFT(bool required) {
+ assert(isValidTypeReference(start));
+ assert(optional('Function', start.next));
+ computeRest(start.next, required);
+
+ return gftHasReturnType != null ? this : simpleTypeInfo;
+ }
+
+ /// Given identifier `<` ... `>`, compute the type
+ /// and return the receiver or one of the [TypeInfo] constants.
+ TypeInfo computeSimpleWithTypeArguments(bool required) {
+ assert(isValidTypeReference(start));
+ typeArguments = start.next;
+ assert(optional('<', typeArguments));
+
+ Token token = skipTypeArguments(typeArguments);
+ if (token == null) {
+ return required ? simpleTypeInfo : noTypeInfo;
+ }
+ end = token;
+ computeRest(token.next, required);
+
+ return required || looksLikeName(end.next) || gftHasReturnType != null
+ ? this
+ : noTypeInfo;
+ }
+
+ /// Given identifier `.` identifier, compute the type
+ /// and return the receiver or one of the [TypeInfo] constants.
+ TypeInfo computePrefixedType(bool required) {
+ assert(isValidTypeReference(start));
+ Token token = start.next;
+ assert(optional('.', token));
+ token = token.next;
+ assert(isValidTypeReference(token));
+
+ end = token;
+ token = token.next;
+ if (optional('<', token)) {
+ typeArguments = token;
+ token = skipTypeArguments(token);
+ if (token == null) {
+ return required ? prefixedTypeInfo : noTypeInfo;
+ }
+ end = token;
+ token = token.next;
+ }
+ computeRest(token, required);
+
+ return required || looksLikeName(end.next) || gftHasReturnType != null
+ ? this
+ : noTypeInfo;
+ }
+
+ void computeRest(Token token, bool required) {
+ while (optional('Function', token)) {
+ Token typeVariableStart = token;
+ token = token.next;
+ if (optional('<', token)) {
+ token = token.endGroup;
+ if (token == null) {
+ break; // Not a function type.
+ }
+ assert(optional('>', token) || optional('>>', token));
+ token = token.next;
+ }
+ if (!optional('(', token)) {
+ break; // Not a function type.
+ }
+ token = token.endGroup;
+ if (token == null) {
+ break; // Not a function type.
+ }
+ assert(optional(')', token));
+ gftHasReturnType ??= typeVariableStart != start;
+ typeVariableStarters = typeVariableStarters.prepend(typeVariableStart);
+ end = token;
+ token = token.next;
+ }
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/parser/type_info_impl.dart b/pkg/front_end/lib/src/fasta/parser/type_info_impl.dart
new file mode 100644
index 0000000..58b67bc
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/parser/type_info_impl.dart
@@ -0,0 +1,161 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library fasta.parser.type_info_impl;
+
+import '../../scanner/token.dart' show Token;
+
+import 'identifier_context.dart' show IdentifierContext;
+
+import 'listener.dart' show Listener;
+
+import 'parser.dart' show Parser;
+
+import 'type_info.dart' show TypeInfo, simpleTypeInfo;
+
+import 'util.dart' show optional;
+
+/// See documentation on the [noTypeInfo] const.
+class NoTypeInfo implements TypeInfo {
+ const NoTypeInfo();
+
+ @override
+ Token parseType(Token token, Parser parser) {
+ parser.listener.handleNoType(token);
+ return token;
+ }
+
+ @override
+ Token skipType(Token token) {
+ return token;
+ }
+}
+
+/// See documentation on the [prefixedTypeInfo] const.
+class PrefixedTypeInfo implements TypeInfo {
+ const PrefixedTypeInfo();
+
+ @override
+ Token parseType(Token token, Parser parser) {
+ Token start = token = token.next;
+ assert(token.isKeywordOrIdentifier);
+ Listener listener = parser.listener;
+ listener.handleIdentifier(token, IdentifierContext.prefixedTypeReference);
+
+ Token period = token = token.next;
+ assert(optional('.', token));
+
+ token = token.next;
+ assert(token.isKeywordOrIdentifier);
+ listener.handleIdentifier(
+ token, IdentifierContext.typeReferenceContinuation);
+ listener.handleQualified(period);
+
+ listener.handleNoTypeArguments(token.next);
+ listener.handleType(start, token.next);
+ return token;
+ }
+
+ @override
+ Token skipType(Token token) {
+ return token.next.next.next;
+ }
+}
+
+/// See documentation on the [simpleTypeArgumentsInfo] const.
+class SimpleTypeArgumentsInfo implements TypeInfo {
+ const SimpleTypeArgumentsInfo();
+
+ @override
+ Token parseType(Token token, Parser parser) {
+ Token start = token = token.next;
+ assert(token.isKeywordOrIdentifier);
+ Listener listener = parser.listener;
+ listener.handleIdentifier(token, IdentifierContext.typeReference);
+
+ Token begin = token = token.next;
+ assert(optional('<', token));
+ listener.beginTypeArguments(token);
+
+ token = simpleTypeInfo.parseType(token, parser);
+
+ token = token.next;
+ assert(optional('>', token));
+ assert(begin.endGroup == token);
+ listener.endTypeArguments(1, begin, token);
+
+ listener.handleType(start, token.next);
+ return token;
+ }
+
+ @override
+ Token skipType(Token token) {
+ return token.next.next.endGroup;
+ }
+}
+
+/// See documentation on the [simpleTypeInfo] const.
+class SimpleTypeInfo implements TypeInfo {
+ const SimpleTypeInfo();
+
+ @override
+ Token parseType(Token token, Parser parser) {
+ token = token.next;
+ assert(token.isKeywordOrIdentifier);
+ Listener listener = parser.listener;
+ listener.handleIdentifier(token, IdentifierContext.typeReference);
+ listener.handleNoTypeArguments(token.next);
+ listener.handleType(token, token.next);
+ return token;
+ }
+
+ @override
+ Token skipType(Token token) {
+ return token.next;
+ }
+}
+
+/// See documentation on the [voidTypeInfo] const.
+class VoidTypeInfo implements TypeInfo {
+ const VoidTypeInfo();
+
+ @override
+ Token parseType(Token token, Parser parser) {
+ token = token.next;
+ parser.listener.handleVoidKeyword(token);
+ return token;
+ }
+
+ @override
+ Token skipType(Token token) {
+ return token.next;
+ }
+}
+
+bool looksLikeName(Token next) => next.isIdentifier || optional('this', next);
+
+Token skipTypeArguments(Token token) {
+ assert(optional('<', token));
+ Token endGroup = token.endGroup;
+
+ // The scanner sets the endGroup in situations like this: C<T && T>U;
+ // Scan the type arguments to assert there are no operators.
+ // TODO(danrubel) Fix the scanner and remove this code.
+ if (endGroup != null) {
+ token = token.next;
+ while (token != endGroup) {
+ if (token.isOperator) {
+ String value = token.stringValue;
+ if (!identical(value, '<') &&
+ !identical(value, '>') &&
+ !identical(value, '>>')) {
+ return null;
+ }
+ }
+ token = token.next;
+ }
+ }
+
+ return endGroup;
+}
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index 92cba45..d831420 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -16,6 +16,8 @@
import '../builder/builder.dart';
+import '../constant_context.dart' show ConstantContext;
+
import '../deprecated_problems.dart'
show Crash, deprecated_InputError, deprecated_inputError;
@@ -545,9 +547,12 @@
var typeInferrer = library.disableTypeInference
? typeInferenceEngine.createDisabledTypeInferrer()
: typeInferenceEngine.createLocalTypeInferrer(uri, thisType, library);
+ ConstantContext constantContext = builder.isConstructor && builder.isConst
+ ? ConstantContext.inferred
+ : ConstantContext.none;
return new BodyBuilder(library, builder, memberScope, formalParameterScope,
hierarchy, coreTypes, currentClass, isInstanceMember, uri, typeInferrer)
- ..constantExpressionRequired = builder.isConstructor && builder.isConst;
+ ..constantContext = constantContext;
}
void buildFunctionBody(
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index a8f84fd..4777289 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -815,11 +815,10 @@
} else if (count > 1) {
var last = pop();
count--;
- if (last is List) {
+ if (last is List<FormalParameterBuilder>) {
formals = new List<FormalParameterBuilder>.filled(
count + last.length, null,
growable: true);
- // ignore: ARGUMENT_TYPE_NOT_ASSIGNABLE
formals.setRange(count, formals.length, last);
} else {
formals = new List<FormalParameterBuilder>.filled(count + 1, null,
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index fcac936..fb478c7 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -358,11 +358,13 @@
ticker.logMs("Resolved $count type-variable bounds");
}
- void instantiateToBound(TypeBuilder dynamicType, ClassBuilder objectClass) {
+ void instantiateToBound(TypeBuilder dynamicType, TypeBuilder bottomType,
+ ClassBuilder objectClass) {
int count = 0;
builders.forEach((Uri uri, LibraryBuilder library) {
if (library.loader == this) {
- count += library.instantiateToBound(dynamicType, objectClass);
+ count +=
+ library.instantiateToBound(dynamicType, bottomType, objectClass);
}
});
ticker.logMs("Instantiated $count type variables to their bounds");
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 8dccab2..b43d976 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -875,9 +875,12 @@
}
desugaredGet?.dispatchCategory = callKind;
bool checkReturn = false;
- if (callKind == DispatchCategory.interface &&
- interfaceMember is Procedure) {
- checkReturn = interfaceMember.isGenericContravariant;
+ if (callKind == DispatchCategory.interface) {
+ if (interfaceMember is Procedure) {
+ checkReturn = interfaceMember.isGenericContravariant;
+ } else if (interfaceMember is Field) {
+ checkReturn = interfaceMember.isGenericContravariant;
+ }
}
var replacedExpression = desugaredGet ?? expression;
if (checkReturn) {
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index d4216e5..e93ba87 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -29,6 +29,7 @@
CannotReadPackagesFile/example: Fail
CannotReadSdkSpecification/analyzerCode: Fail
CannotReadSdkSpecification/example: Fail
+CantDetermineConstness/analyzerCode: Fail
CantInferPackagesFromManyInputs/analyzerCode: Fail
CantInferPackagesFromManyInputs/example: Fail
CantInferPackagesFromPackageUri/analyzerCode: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 403ba23..86381e1 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -2031,3 +2031,11 @@
template: "Can't invoke the type '#type' because its declaration of `.call` is not a method."
tip: "Change .call to a method or explicitly invoke .call."
severity: ERROR
+
+# TODO(ahe): Remove this message when the underlying issue is fixed.
+CantDetermineConstness:
+ template: "The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here."
+ severity: ERROR
+ expression:
+ - "Object()"
+ - "bool.fromEnvironment('fisk')"
diff --git a/pkg/front_end/test/fasta/parser/type_info_test.dart b/pkg/front_end/test/fasta/parser/type_info_test.dart
new file mode 100644
index 0000000..4efa647
--- /dev/null
+++ b/pkg/front_end/test/fasta/parser/type_info_test.dart
@@ -0,0 +1,726 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/fasta/messages.dart';
+import 'package:front_end/src/fasta/parser.dart';
+import 'package:front_end/src/fasta/parser/type_info.dart';
+import 'package:front_end/src/fasta/scanner.dart';
+import 'package:front_end/src/scanner/token.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(TokenInfoTest);
+ });
+}
+
+@reflectiveTest
+class TokenInfoTest {
+ void test_noType() {
+ TypeInfo typeInfo = noTypeInfo;
+ Token start = scanString('before ;').tokens;
+ Token expectedEnd = start;
+ expect(typeInfo.skipType(start), expectedEnd);
+
+ TypeInfoListener listener = new TypeInfoListener();
+ expect(typeInfo.parseType(start, new Parser(listener)), expectedEnd);
+ expect(listener.calls, ['handleNoType before']);
+ }
+
+ void test_voidType() {
+ TypeInfo typeInfo = voidTypeInfo;
+ Token start = scanString('before void ;').tokens;
+ Token expectedEnd = start.next;
+ expect(typeInfo.skipType(start), expectedEnd);
+
+ TypeInfoListener listener = new TypeInfoListener();
+ expect(typeInfo.parseType(start, new Parser(listener)), expectedEnd);
+ expect(listener.calls, ['handleVoidKeyword void']);
+ }
+
+ void test_prefixedTypeInfo() {
+ TypeInfo typeInfo = prefixedTypeInfo;
+ Token start = scanString('before C.a ;').tokens;
+ Token expectedEnd = start.next.next.next;
+ expect(typeInfo.skipType(start), expectedEnd);
+
+ TypeInfoListener listener = new TypeInfoListener();
+ expect(typeInfo.parseType(start, new Parser(listener)), expectedEnd);
+ expect(listener.calls, [
+ 'handleIdentifier C prefixedTypeReference',
+ 'handleIdentifier a typeReferenceContinuation',
+ 'handleQualified .',
+ 'handleNoTypeArguments ;',
+ 'handleType C ;',
+ ]);
+ }
+
+ void test_simpleTypeInfo() {
+ TypeInfo typeInfo = simpleTypeInfo;
+ Token start = scanString('before C ;').tokens;
+ Token expectedEnd = start.next;
+ expect(typeInfo.skipType(start), expectedEnd);
+
+ TypeInfoListener listener = new TypeInfoListener();
+ expect(typeInfo.parseType(start, new Parser(listener)), expectedEnd);
+ expect(listener.calls, [
+ 'handleIdentifier C typeReference',
+ 'handleNoTypeArguments ;',
+ 'handleType C ;',
+ ]);
+ }
+
+ void test_simpleTypeArgumentsInfo() {
+ TypeInfo typeInfo = simpleTypeArgumentsInfo;
+ Token start = scanString('before C<T> ;').tokens;
+ Token expectedEnd = start.next.next.next.next;
+ expect(typeInfo.skipType(start), expectedEnd);
+
+ TypeInfoListener listener = new TypeInfoListener();
+ expect(typeInfo.parseType(start, new Parser(listener)), expectedEnd);
+ expect(listener.calls, [
+ 'handleIdentifier C typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier T typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType T >',
+ 'endTypeArguments 1 < >',
+ 'handleType C ;',
+ ]);
+ }
+
+ void test_computeType_basic() {
+ expectInfo(noTypeInfo, '');
+ expectInfo(noTypeInfo, ';');
+ expectInfo(noTypeInfo, '( foo');
+ expectInfo(noTypeInfo, '< foo');
+ expectInfo(noTypeInfo, '= foo');
+ expectInfo(noTypeInfo, '* foo');
+ expectInfo(noTypeInfo, 'do foo');
+ expectInfo(noTypeInfo, 'get foo');
+ expectInfo(noTypeInfo, 'set foo');
+ expectInfo(noTypeInfo, 'operator *');
+ }
+
+ void test_computeType_gft() {
+ expectComplexInfo('Function()', expectedCalls: [
+ 'handleNoTypeVariables (',
+ 'beginFunctionType Function',
+ 'handleNoType ',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ expectComplexInfo('Function<T>()', expectedCalls: [
+ 'beginTypeVariables <',
+ 'beginTypeVariable T',
+ 'beginMetadataStar T',
+ 'endMetadataStar 0',
+ 'handleIdentifier T typeVariableDeclaration',
+ 'handleNoType T',
+ 'endTypeVariable > null',
+ 'endTypeVariables 1 < >',
+ 'beginFunctionType Function',
+ 'handleNoType ',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ expectComplexInfo('Function(int)', expectedCalls: [
+ 'handleNoTypeVariables (',
+ 'beginFunctionType Function',
+ 'handleNoType ',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'beginMetadataStar int',
+ 'endMetadataStar 0',
+ 'beginFormalParameter int MemberKind.GeneralizedFunctionType',
+ 'handleModifiers 0',
+ 'handleIdentifier int typeReference',
+ 'handleNoTypeArguments )',
+ 'handleType int )',
+ 'handleNoName )',
+ 'handleFormalParameterWithoutValue )',
+ 'beginTypeVariables null null ) FormalParameterKind.mandatory '
+ 'MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 1 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ expectComplexInfo('Function<T>(int)', expectedCalls: [
+ 'beginTypeVariables <',
+ 'beginTypeVariable T',
+ 'beginMetadataStar T',
+ 'endMetadataStar 0',
+ 'handleIdentifier T typeVariableDeclaration',
+ 'handleNoType T',
+ 'endTypeVariable > null',
+ 'endTypeVariables 1 < >',
+ 'beginFunctionType Function',
+ 'handleNoType ',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'beginMetadataStar int',
+ 'endMetadataStar 0',
+ 'beginFormalParameter int MemberKind.GeneralizedFunctionType',
+ 'handleModifiers 0',
+ 'handleIdentifier int typeReference',
+ 'handleNoTypeArguments )',
+ 'handleType int )',
+ 'handleNoName )',
+ 'handleFormalParameterWithoutValue )',
+ 'beginTypeVariables null null ) FormalParameterKind.mandatory MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 1 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ expectComplexInfo('Function(int x)');
+ expectComplexInfo('Function<T>(int x)');
+ expectComplexInfo('Function<T>(int x) Function<T>(int x)');
+ }
+
+ void test_computeType_identifier() {
+ expectInfo(noTypeInfo, 'C', required: false);
+ expectInfo(noTypeInfo, 'C;', required: false);
+ expectInfo(noTypeInfo, 'C(', required: false);
+ expectInfo(noTypeInfo, 'C<', required: false);
+ expectInfo(noTypeInfo, 'C.', required: false);
+ expectInfo(noTypeInfo, 'C=', required: false);
+ expectInfo(noTypeInfo, 'C*', required: false);
+ expectInfo(noTypeInfo, 'C do', required: false);
+
+ expectInfo(simpleTypeInfo, 'C', required: true);
+ expectInfo(simpleTypeInfo, 'C;', required: true);
+ expectInfo(simpleTypeInfo, 'C(', required: true);
+ expectInfo(simpleTypeInfo, 'C<', required: true);
+ expectInfo(simpleTypeInfo, 'C.', required: true);
+ expectInfo(simpleTypeInfo, 'C=', required: true);
+ expectInfo(simpleTypeInfo, 'C*', required: true);
+ expectInfo(simpleTypeInfo, 'C do', required: true);
+
+ expectInfo(simpleTypeInfo, 'C foo');
+ expectInfo(simpleTypeInfo, 'C get');
+ expectInfo(simpleTypeInfo, 'C set');
+ expectInfo(simpleTypeInfo, 'C operator');
+ expectInfo(simpleTypeInfo, 'C this');
+ expectInfo(simpleTypeInfo, 'C Function');
+ }
+
+ void test_computeType_identifierComplex() {
+ expectComplexInfo('C Function()');
+ expectComplexInfo('C Function<T>()');
+ expectComplexInfo('C Function(int)');
+ expectComplexInfo('C Function<T>(int)');
+ expectComplexInfo('C Function(int x)');
+ expectComplexInfo('C Function<T>(int x)');
+ expectComplexInfo('C Function<T>(int x) Function<T>(int x)');
+ expectComplexInfo('C Function(', // Scanner inserts synthetic ')'.
+ expectedCalls: [
+ 'handleNoTypeVariables (',
+ 'beginFunctionType C',
+ 'handleIdentifier C typeReference',
+ 'handleNoTypeArguments Function',
+ 'handleType C Function',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ }
+
+ void test_computeType_identifierTypeArg() {
+ expectInfo(noTypeInfo, 'C<T>', required: false);
+ expectInfo(noTypeInfo, 'C<T>;', required: false);
+ expectInfo(noTypeInfo, 'C<T>(', required: false);
+ expectInfo(noTypeInfo, 'C<T> do', required: false);
+ expectInfo(noTypeInfo, 'C<void>', required: false);
+
+ expectInfo(simpleTypeArgumentsInfo, 'C<T>', required: true);
+ expectInfo(simpleTypeArgumentsInfo, 'C<T>;', required: true);
+ expectInfo(simpleTypeArgumentsInfo, 'C<T>(', required: true);
+ expectInfo(simpleTypeArgumentsInfo, 'C<T> do', required: true);
+ expectComplexInfo('C<void>', required: true, expectedCalls: [
+ 'handleIdentifier C typeReference',
+ 'beginTypeArguments <',
+ 'handleVoidKeyword void',
+ 'endTypeArguments 1 < >',
+ 'handleType C ',
+ ]);
+
+ expectInfo(simpleTypeArgumentsInfo, 'C<T> foo');
+ expectInfo(simpleTypeArgumentsInfo, 'C<T> get');
+ expectInfo(simpleTypeArgumentsInfo, 'C<T> set');
+ expectInfo(simpleTypeArgumentsInfo, 'C<T> operator');
+ expectInfo(simpleTypeArgumentsInfo, 'C<T> Function');
+ }
+
+ void test_computeType_identifierTypeArgComplex() {
+ expectInfo(noTypeInfo, 'C<S,T>', required: false);
+ expectInfo(noTypeInfo, 'C<S<T>>', required: false);
+ expectInfo(noTypeInfo, 'C.a<T>', required: false);
+
+ expectComplexInfo('C<S,T>', required: true, expectedCalls: [
+ 'handleIdentifier C typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier S typeReference',
+ 'handleNoTypeArguments ,',
+ 'handleType S ,',
+ 'handleIdentifier T typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType T >',
+ 'endTypeArguments 2 < >',
+ 'handleType C ',
+ ]);
+ expectComplexInfo('C<S<T>>', required: true, expectedCalls: [
+ 'handleIdentifier C typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier S typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier T typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType T >',
+ 'endTypeArguments 1 < >',
+ 'handleType S >',
+ 'endTypeArguments 1 < >',
+ 'handleType C ',
+ ]);
+ expectComplexInfo('C<S,T> f', tokenAfter: 'f', expectedCalls: [
+ 'handleIdentifier C typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier S typeReference',
+ 'handleNoTypeArguments ,',
+ 'handleType S ,',
+ 'handleIdentifier T typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType T >',
+ 'endTypeArguments 2 < >',
+ 'handleType C f',
+ ]);
+ expectComplexInfo('C<S<T>> f', tokenAfter: 'f', expectedCalls: [
+ 'handleIdentifier C typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier S typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier T typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType T >',
+ 'endTypeArguments 1 < >',
+ 'handleType S >',
+ 'endTypeArguments 1 < >',
+ 'handleType C f',
+ ]);
+ }
+
+ void test_computeType_identifierTypeArgGFT() {
+ expectComplexInfo('C<T> Function(', // Scanner inserts synthetic ')'.
+ expectedCalls: [
+ 'handleNoTypeVariables (',
+ 'beginFunctionType C',
+ 'handleIdentifier C typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier T typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType T >',
+ 'endTypeArguments 1 < >',
+ 'handleType C Function',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ expectComplexInfo('C<T> Function<T>(int x) Function<T>(int x)');
+ }
+
+ void test_computeType_identifierTypeArgRecovery() {
+ // TOOD(danrubel): dynamic, do, other keywords, malformed, recovery
+ // <T>
+
+ expectInfo(noTypeInfo, 'C<>', required: false);
+ expectComplexInfo('C<>', required: true, expectedCalls: [
+ 'handleIdentifier C typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType > >',
+ 'endTypeArguments 1 < >',
+ 'handleType C ',
+ ]);
+ expectComplexInfo('C<> f', required: true, tokenAfter: 'f', expectedCalls: [
+ 'handleIdentifier C typeReference',
+ 'beginTypeArguments <',
+ 'handleIdentifier typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType > >',
+ 'endTypeArguments 1 < >',
+ 'handleType C f',
+ ]);
+
+ // Statements that should not have a type
+ expectInfo(noTypeInfo, 'C<T ; T>U;', required: false);
+ expectInfo(noTypeInfo, 'C<T && T>U;', required: false);
+ }
+
+ void test_computeType_prefixed() {
+ expectInfo(noTypeInfo, 'C.a', required: false);
+ expectInfo(noTypeInfo, 'C.a;', required: false);
+ expectInfo(noTypeInfo, 'C.a(', required: false);
+ expectInfo(noTypeInfo, 'C.a<', required: false);
+ expectInfo(noTypeInfo, 'C.a=', required: false);
+ expectInfo(noTypeInfo, 'C.a*', required: false);
+ expectInfo(noTypeInfo, 'C.a do', required: false);
+
+ expectInfo(prefixedTypeInfo, 'C.a', required: true);
+ expectInfo(prefixedTypeInfo, 'C.a;', required: true);
+ expectInfo(prefixedTypeInfo, 'C.a(', required: true);
+ expectInfo(prefixedTypeInfo, 'C.a<', required: true);
+ expectInfo(prefixedTypeInfo, 'C.a=', required: true);
+ expectInfo(prefixedTypeInfo, 'C.a*', required: true);
+ expectInfo(prefixedTypeInfo, 'C.a do', required: true);
+
+ expectInfo(prefixedTypeInfo, 'C.a foo');
+ expectInfo(prefixedTypeInfo, 'C.a get');
+ expectInfo(prefixedTypeInfo, 'C.a set');
+ expectInfo(prefixedTypeInfo, 'C.a operator');
+ expectInfo(prefixedTypeInfo, 'C.a Function');
+ }
+
+ void test_computeType_prefixedGFT() {
+ expectComplexInfo('C.a Function(', // Scanner inserts synthetic ')'.
+ expectedCalls: [
+ 'handleNoTypeVariables (',
+ 'beginFunctionType C',
+ 'handleIdentifier C prefixedTypeReference',
+ 'handleIdentifier a typeReferenceContinuation',
+ 'handleQualified .',
+ 'handleNoTypeArguments Function',
+ 'handleType C Function',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ expectComplexInfo('C.a Function<T>(int x) Function<T>(int x)');
+ }
+
+ void test_computeType_prefixedTypeArg() {
+ expectComplexInfo('C.a<T>', required: true, expectedCalls: [
+ 'handleIdentifier C prefixedTypeReference',
+ 'handleIdentifier a typeReferenceContinuation',
+ 'handleQualified .',
+ 'beginTypeArguments <',
+ 'handleIdentifier T typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType T >',
+ 'endTypeArguments 1 < >',
+ 'handleType C ',
+ ]);
+
+ expectComplexInfo('C.a<T> f', tokenAfter: 'f', expectedCalls: [
+ 'handleIdentifier C prefixedTypeReference',
+ 'handleIdentifier a typeReferenceContinuation',
+ 'handleQualified .',
+ 'beginTypeArguments <',
+ 'handleIdentifier T typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType T >',
+ 'endTypeArguments 1 < >',
+ 'handleType C f',
+ ]);
+ }
+
+ void test_computeType_prefixedTypeArgGFT() {
+ expectComplexInfo('C.a<T> Function<T>(int x) Function<T>(int x)',
+ expectedCalls: [
+ 'beginTypeVariables <',
+ 'beginTypeVariable T',
+ 'beginMetadataStar T',
+ 'endMetadataStar 0',
+ 'handleIdentifier T typeVariableDeclaration',
+ 'handleNoType T',
+ 'endTypeVariable > null',
+ 'endTypeVariables 1 < >',
+ 'beginFunctionType C',
+ 'beginTypeVariables <',
+ 'beginTypeVariable T',
+ 'beginMetadataStar T',
+ 'endMetadataStar 0',
+ 'handleIdentifier T typeVariableDeclaration',
+ 'handleNoType T',
+ 'endTypeVariable > null',
+ 'endTypeVariables 1 < >',
+ 'beginFunctionType C',
+ 'handleIdentifier C prefixedTypeReference',
+ 'handleIdentifier a typeReferenceContinuation',
+ 'handleQualified .',
+ 'beginTypeArguments <',
+ 'handleIdentifier T typeReference',
+ 'handleNoTypeArguments >',
+ 'handleType T >',
+ 'endTypeArguments 1 < >',
+ 'handleType C Function',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'beginMetadataStar int',
+ 'endMetadataStar 0',
+ 'beginFormalParameter int MemberKind.GeneralizedFunctionType',
+ 'handleModifiers 0',
+ 'handleIdentifier int typeReference',
+ 'handleNoTypeArguments x',
+ 'handleType int x',
+ 'handleIdentifier x formalParameterDeclaration',
+ 'handleFormalParameterWithoutValue )',
+ 'beginTypeVariables null null x FormalParameterKind.mandatory '
+ 'MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 1 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function Function',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'beginMetadataStar int',
+ 'endMetadataStar 0',
+ 'beginFormalParameter int MemberKind.GeneralizedFunctionType',
+ 'handleModifiers 0',
+ 'handleIdentifier int typeReference',
+ 'handleNoTypeArguments x',
+ 'handleType int x',
+ 'handleIdentifier x formalParameterDeclaration',
+ 'handleFormalParameterWithoutValue )',
+ 'beginTypeVariables null null x FormalParameterKind.mandatory '
+ 'MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 1 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ }
+
+ void test_computeType_void() {
+ expectInfo(voidTypeInfo, 'void');
+ expectInfo(voidTypeInfo, 'void;');
+ expectInfo(voidTypeInfo, 'void(');
+ expectInfo(voidTypeInfo, 'void<');
+ expectInfo(voidTypeInfo, 'void=');
+ expectInfo(voidTypeInfo, 'void*');
+ expectInfo(voidTypeInfo, 'void<T>');
+ expectInfo(voidTypeInfo, 'void do');
+ expectInfo(voidTypeInfo, 'void foo');
+ expectInfo(voidTypeInfo, 'void get');
+ expectInfo(voidTypeInfo, 'void set');
+ expectInfo(voidTypeInfo, 'void operator');
+ expectInfo(voidTypeInfo, 'void Function');
+ expectComplexInfo('void Function(', // Scanner inserts synthetic ')'.
+ expectedCalls: [
+ 'handleNoTypeVariables (',
+ 'beginFunctionType void',
+ 'handleVoidKeyword void',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ }
+
+ void test_computeType_voidComplex() {
+ expectComplexInfo('void Function()', expectedCalls: [
+ 'handleNoTypeVariables (',
+ 'beginFunctionType void',
+ 'handleVoidKeyword void',
+ 'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
+ 'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
+ 'endFunctionType Function ',
+ ]);
+ expectComplexInfo('void Function<T>()');
+ expectComplexInfo('void Function(int)');
+ expectComplexInfo('void Function<T>(int)');
+ expectComplexInfo('void Function(int x)');
+ expectComplexInfo('void Function<T>(int x)');
+ expectComplexInfo('void Function<T>(int x) Function<T>(int x)');
+ }
+}
+
+void expectInfo(expectedInfo, String source,
+ {bool required, String expectedAfter, List<String> expectedCalls}) {
+ Token start = scan(source);
+ if (required == null) {
+ compute(expectedInfo, source, start, true, expectedAfter, expectedCalls);
+ compute(expectedInfo, source, start, false, expectedAfter, expectedCalls);
+ } else {
+ compute(
+ expectedInfo, source, start, required, expectedAfter, expectedCalls);
+ }
+}
+
+void expectComplexInfo(String source,
+ {bool required, String tokenAfter, List<String> expectedCalls}) {
+ expectInfo(const isInstanceOf<ComplexTypeInfo>(), source,
+ required: required,
+ expectedAfter: tokenAfter,
+ expectedCalls: expectedCalls);
+}
+
+void compute(expectedInfo, String source, Token start, bool required,
+ String expectedAfter, List<String> expectedCalls) {
+ TypeInfo typeInfo = computeType(start, required);
+ expect(typeInfo, expectedInfo, reason: source);
+ if (typeInfo is ComplexTypeInfo) {
+ TypeInfoListener listener = new TypeInfoListener();
+ Parser parser = new Parser(listener);
+ expect(typeInfo.start, start.next, reason: source);
+ expectEnd(expectedAfter, typeInfo.skipType(start));
+ expectEnd(expectedAfter, typeInfo.parseType(start, parser));
+ if (expectedCalls != null) {
+ // TypeInfoListener listener2 = new TypeInfoListener();
+ // new Parser(listener2).parseType(start, TypeContinuation.Required);
+ // print('[');
+ // for (String call in listener2.calls) {
+ // print("'$call',");
+ // }
+ // print(']');
+
+ expect(listener.calls, expectedCalls, reason: source);
+ }
+ }
+}
+
+void expectEnd(String tokenAfter, Token end) {
+ if (tokenAfter == null) {
+ expect(end.isEof, isFalse);
+ expect(end.next.isEof, isTrue);
+ } else {
+ expect(end.next.lexeme, tokenAfter);
+ }
+}
+
+Token scan(String source) {
+ Token start = scanString(source).tokens;
+ while (start is ErrorToken) {
+ start = start.next;
+ }
+ return new SyntheticToken(TokenType.EOF, 0)..setNext(start);
+}
+
+class TypeInfoListener implements Listener {
+ List<String> calls = <String>[];
+
+ @override
+ void beginFormalParameter(Token token, MemberKind kind) {
+ calls.add('beginFormalParameter $token $kind');
+ }
+
+ @override
+ void beginFormalParameters(Token token, MemberKind kind) {
+ calls.add('beginFormalParameters $token $kind');
+ }
+
+ @override
+ void beginFunctionType(Token token) {
+ calls.add('beginFunctionType $token');
+ }
+
+ @override
+ void beginMetadataStar(Token token) {
+ calls.add('beginMetadataStar $token');
+ }
+
+ @override
+ void beginTypeArguments(Token token) {
+ calls.add('beginTypeArguments $token');
+ }
+
+ @override
+ void beginTypeVariable(Token token) {
+ calls.add('beginTypeVariable $token');
+ }
+
+ @override
+ void endFormalParameters(
+ int count, Token beginToken, Token endToken, MemberKind kind) {
+ calls.add('endFormalParameters $count $beginToken $endToken $kind');
+ }
+
+ @override
+ void beginTypeVariables(Token token) {
+ calls.add('beginTypeVariables $token');
+ }
+
+ @override
+ void endFormalParameter(Token thisKeyword, Token periodAfterThis,
+ Token nameToken, FormalParameterKind kind, MemberKind memberKind) {
+ calls.add('beginTypeVariables $thisKeyword $periodAfterThis '
+ '$nameToken $kind $memberKind');
+ }
+
+ @override
+ void endFunctionType(Token functionToken, Token endToken) {
+ calls.add('endFunctionType $functionToken $endToken');
+ }
+
+ @override
+ void endMetadataStar(int count) {
+ calls.add('endMetadataStar $count');
+ }
+
+ @override
+ void endTypeArguments(int count, Token beginToken, Token endToken) {
+ calls.add('endTypeArguments $count $beginToken $endToken');
+ }
+
+ @override
+ void endTypeVariable(Token token, Token extendsOrSuper) {
+ calls.add('endTypeVariable $token $extendsOrSuper');
+ }
+
+ @override
+ void endTypeVariables(int count, Token beginToken, Token endToken) {
+ calls.add('endTypeVariables $count $beginToken $endToken');
+ }
+
+ @override
+ void handleFormalParameterWithoutValue(Token token) {
+ calls.add('handleFormalParameterWithoutValue $token');
+ }
+
+ @override
+ void handleIdentifier(Token token, IdentifierContext context) {
+ calls.add('handleIdentifier $token $context');
+ }
+
+ @override
+ void handleModifiers(int count) {
+ calls.add('handleModifiers $count');
+ }
+
+ @override
+ void handleNoName(Token token) {
+ calls.add('handleNoName $token');
+ }
+
+ @override
+ void handleNoType(Token token) {
+ calls.add('handleNoType $token');
+ }
+
+ @override
+ void handleNoTypeArguments(Token token) {
+ calls.add('handleNoTypeArguments $token');
+ }
+
+ @override
+ void handleNoTypeVariables(Token token) {
+ calls.add('handleNoTypeVariables $token');
+ }
+
+ @override
+ void handleRecoverableError(
+ Message message, Token startToken, Token endToken) {
+ // ignored
+ }
+
+ @override
+ void handleQualified(Token token) {
+ calls.add('handleQualified $token');
+ }
+
+ @override
+ void handleType(Token beginToken, Token endToken) {
+ calls.add('handleType $beginToken $endToken');
+ }
+
+ @override
+ void handleVoidKeyword(Token token) {
+ calls.add('handleVoidKeyword $token');
+ }
+
+ noSuchMethod(Invocation invocation) {
+ throw '${invocation.memberName} should not be called.';
+ }
+}
diff --git a/pkg/front_end/test/kernel_generator_test.dart b/pkg/front_end/test/kernel_generator_test.dart
index ee8b9a0..f84b832 100644
--- a/pkg/front_end/test/kernel_generator_test.dart
+++ b/pkg/front_end/test/kernel_generator_test.dart
@@ -67,7 +67,8 @@
expect(errors, isNotEmpty);
});
- test('by default program is compiled using summaries', () async {
+ test('by default program is compiled using the full platform file',
+ () async {
var options = new CompilerOptions()
// Note: we define [librariesSpecificationUri] with a specification that
// contains broken URIs to ensure we do not attempt to lookup for
@@ -80,7 +81,7 @@
// Note: summaries created by the SDK today contain empty statements as
// method bodies.
- expect(printMember.function.body is EmptyStatement, isTrue);
+ expect(printMember.function.body is! EmptyStatement, isTrue);
});
test('compiler requires a main method', () async {
diff --git a/pkg/front_end/test/src/base/processed_options_test.dart b/pkg/front_end/test/src/base/processed_options_test.dart
index 1eb44b5..359acab 100644
--- a/pkg/front_end/test/src/base/processed_options_test.dart
+++ b/pkg/front_end/test/src/base/processed_options_test.dart
@@ -50,7 +50,7 @@
..sdkRoot = Uri.parse('org-dartlang-test:///sdk/dir/')
..compileSdk = false;
expect(new ProcessedOptions(raw).sdkSummary,
- Uri.parse('org-dartlang-test:///sdk/dir/vm_outline.dill'));
+ Uri.parse('org-dartlang-test:///sdk/dir/vm_platform.dill'));
// But it is left null when compile-sdk is true
raw = new CompilerOptions()
@@ -357,7 +357,7 @@
.entityForUri(sdkRoot)
.writeAsStringSync('\n');
fileSystem
- .entityForUri(sdkRoot.resolve('vm_outline.dill'))
+ .entityForUri(sdkRoot.resolve('vm_platform.dill'))
.writeAsStringSync('\n');
fileSystem
.entityForUri(Uri.parse('org-dartlang-test:///foo.dart'))
@@ -427,7 +427,8 @@
test_validateOptions_inferred_summary_exists() async {
var sdkRoot = Uri.parse('org-dartlang-test:///sdk/root/');
- var sdkSummary = Uri.parse('org-dartlang-test:///sdk/root/vm_outline.dill');
+ var sdkSummary =
+ Uri.parse('org-dartlang-test:///sdk/root/vm_platform.dill');
fileSystem.entityForUri(sdkRoot).writeAsStringSync('\n');
fileSystem.entityForUri(sdkSummary).writeAsStringSync('\n');
fileSystem
diff --git a/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart b/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart
new file mode 100644
index 0000000..293a967
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that all three steps of the instantiate-to-bound algorithm
+// implementation, that is, substitution of variables in strongly connected
+// components, substitution of dependencies in the acyclic remainder of the type
+// variables graph, and using simply typed bounds, work together well on the
+// same declaration.
+
+class B<X, Y> {}
+
+class C<X, Y> {}
+
+class D<X extends B<X, Y>, Y extends C<X, Y>, Z extends X Function(Y),
+ W extends num> {}
+
+main() {
+ D d;
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart.direct.expect
new file mode 100644
index 0000000..90d33dd
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart.direct.expect
@@ -0,0 +1,22 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends self::B<self::D::X, self::D::Y>, Y extends self::C<self::D::X, self::D::Y>, Z extends (self::D::Y) → self::D::X, W extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::D<dynamic, dynamic, dynamic, dynamic> d;
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart.outline.expect
new file mode 100644
index 0000000..8f375f5
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart.outline.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D<X extends self::B<self::D::X, self::D::Y>, Y extends self::C<self::D::X, self::D::Y>, Z extends (self::D::Y) → self::D::X, W extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart.strong.expect
new file mode 100644
index 0000000..e209715
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/all_steps.dart.strong.expect
@@ -0,0 +1,22 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends self::B<self::D::X, self::D::Y>, Y extends self::C<self::D::X, self::D::Y>, Z extends (self::D::Y) → self::D::X, W extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::D<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>, (core::Null) → self::B<dynamic, dynamic>, core::num> d;
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart
new file mode 100644
index 0000000..35e508d
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that contravariant occurrences of a type variable in the
+// bounds of the other type variables from the same declaration that are not
+// being transitively depended on by that variable are replaced with Null.
+
+class C<X extends num, Y extends void Function(X)> {}
+
+C c;
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart.direct.expect
new file mode 100644
index 0000000..b2e548c
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart.direct.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C<X extends core::num, Y extends (self::C::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::C<dynamic, dynamic> c;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart.outline.expect
new file mode 100644
index 0000000..79ffb56
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart.outline.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C<X extends core::num, Y extends (self::C::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field self::C<dynamic, dynamic> c;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart.strong.expect
new file mode 100644
index 0000000..7752f4e
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence.dart.strong.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C<X extends core::num, Y extends (self::C::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::C<core::num, (core::Null) → void> c;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart
new file mode 100644
index 0000000..d6aab8e
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that contravariant occurrences of a type variable in the
+// bounds of the other type variables from the same declaration that are not
+// being transitively depended on by that variable are replaced with Null, in
+// the case where the raw type is used as a type argument of a list or map
+// literal.
+
+class C<X extends num, Y extends void Function(X)> {}
+
+var lc = <C>[];
+
+var mc = <C, C>{};
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart.direct.expect
new file mode 100644
index 0000000..88dc108
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart.direct.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C<X extends core::num, Y extends (self::C::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic lc = <self::C<dynamic, dynamic>>[];
+static field dynamic mc = <self::C<dynamic, dynamic>, self::C<dynamic, dynamic>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart.outline.expect
new file mode 100644
index 0000000..4c67675
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart.outline.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C<X extends core::num, Y extends (self::C::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field dynamic lc;
+static field dynamic mc;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart.strong.expect
new file mode 100644
index 0000000..a18fd3d
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_dependence_in_literals.dart.strong.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C<X extends core::num, Y extends (self::C::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field core::List<self::C<core::num, (core::Null) → void>> lc = <self::C<core::num, (core::Null) → void>>[];
+static field core::Map<self::C<core::num, (core::Null) → void>, self::C<core::num, (core::Null) → void>> mc = <self::C<core::num, (core::Null) → void>, self::C<core::num, (core::Null) → void>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart
new file mode 100644
index 0000000..235d9f4
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that contravariant occurrences of mutually dependent type
+// variables in the bounds of all of these type variables are replaced with
+// Null.
+
+class D<X extends void Function(X, Y), Y extends void Function(X, Y)> {}
+
+D d;
+
+class E<X extends void Function(X)> {}
+
+E e;
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart.direct.expect
new file mode 100644
index 0000000..17cca3b
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart.direct.expect
@@ -0,0 +1,17 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class D<X extends (self::D::X, self::D::Y) → void, Y extends (self::D::X, self::D::Y) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends (self::E::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::D<dynamic, dynamic> d;
+static field self::E<dynamic> e;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart.outline.expect
new file mode 100644
index 0000000..fe0a77b
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart.outline.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class D<X extends (self::D::X, self::D::Y) → void, Y extends (self::D::X, self::D::Y) → void> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class E<X extends (self::E::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field self::D<dynamic, dynamic> d;
+static field self::E<dynamic> e;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart.strong.expect
new file mode 100644
index 0000000..b3fcc39
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence.dart.strong.expect
@@ -0,0 +1,17 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class D<X extends (self::D::X, self::D::Y) → void, Y extends (self::D::X, self::D::Y) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends (self::E::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::D<(core::Null, core::Null) → void, (core::Null, core::Null) → void> d;
+static field self::E<(core::Null) → void> e;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart
new file mode 100644
index 0000000..3c4aee8
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that contravariant occurrences of mutually dependent type
+// variables in the bounds of all of these type variables are replaced with
+// Null, in the case when the raw type is used as a type argument of a list or
+// map literal.
+
+class D<X extends void Function(X, Y), Y extends void Function(X, Y)> {}
+
+var ld = <D>[];
+var md = <D, D>{};
+
+class E<X extends void Function(X)> {}
+
+var le = <E>[];
+var me = <E, E>{};
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart.direct.expect
new file mode 100644
index 0000000..803b7ee
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart.direct.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class D<X extends (self::D::X, self::D::Y) → void, Y extends (self::D::X, self::D::Y) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends (self::E::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic ld = <self::D<dynamic, dynamic>>[];
+static field dynamic md = <self::D<dynamic, dynamic>, self::D<dynamic, dynamic>>{};
+static field dynamic le = <self::E<dynamic>>[];
+static field dynamic me = <self::E<dynamic>, self::E<dynamic>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart.outline.expect
new file mode 100644
index 0000000..4006f50
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart.outline.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class D<X extends (self::D::X, self::D::Y) → void, Y extends (self::D::X, self::D::Y) → void> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class E<X extends (self::E::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field dynamic ld;
+static field dynamic md;
+static field dynamic le;
+static field dynamic me;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart.strong.expect
new file mode 100644
index 0000000..1797ecd
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/contravariant_mutual_dependence_in_literals.dart.strong.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class D<X extends (self::D::X, self::D::Y) → void, Y extends (self::D::X, self::D::Y) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends (self::E::X) → void> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field core::List<self::D<(core::Null, core::Null) → void, (core::Null, core::Null) → void>> ld = <self::D<(core::Null, core::Null) → void, (core::Null, core::Null) → void>>[];
+static field core::Map<self::D<(core::Null, core::Null) → void, (core::Null, core::Null) → void>, self::D<(core::Null, core::Null) → void, (core::Null, core::Null) → void>> md = <self::D<(core::Null, core::Null) → void, (core::Null, core::Null) → void>, self::D<(core::Null, core::Null) → void, (core::Null, core::Null) → void>>{};
+static field core::List<self::E<(core::Null) → void>> le = <self::E<(core::Null) → void>>[];
+static field core::Map<self::E<(core::Null) → void>, self::E<(core::Null) → void>> me = <self::E<(core::Null) → void>, self::E<(core::Null) → void>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart
new file mode 100644
index 0000000..0bb06cd
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that covariant occurrences of a type variable in the bounds
+// of the other type variables from the same declaration that are not being
+// transitively depended on by that type variable are replaced with the bound of
+// that type variable.
+
+class A<X> {}
+
+class C<X, Y extends A<X>> {}
+
+C c;
+
+class D<X extends num, Y extends A<X>> {}
+
+D d;
+
+class E<X, Y extends X Function()> {}
+
+E e;
+
+class F<X extends num, Y extends X Function()> {}
+
+F f;
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart.direct.expect
new file mode 100644
index 0000000..2d50f0b
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart.direct.expect
@@ -0,0 +1,34 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends self::A<self::C::X>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends core::num, Y extends self::A<self::D::X>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends core::Object, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<X extends core::num, Y extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::C<dynamic, dynamic> c;
+static field self::D<dynamic, dynamic> d;
+static field self::E<dynamic, dynamic> e;
+static field self::F<dynamic, dynamic> f;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart.outline.expect
new file mode 100644
index 0000000..cca8bfd
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart.outline.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C<X extends core::Object, Y extends self::A<self::C::X>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D<X extends core::num, Y extends self::A<self::D::X>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class E<X extends core::Object, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class F<X extends core::num, Y extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field self::C<dynamic, dynamic> c;
+static field self::D<dynamic, dynamic> d;
+static field self::E<dynamic, dynamic> e;
+static field self::F<dynamic, dynamic> f;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart.strong.expect
new file mode 100644
index 0000000..dfad499
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence.dart.strong.expect
@@ -0,0 +1,34 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends self::A<self::C::X>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends core::num, Y extends self::A<self::D::X>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends core::Object, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<X extends core::num, Y extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::C<dynamic, self::A<dynamic>> c;
+static field self::D<core::num, self::A<core::num>> d;
+static field self::E<dynamic, () → dynamic> e;
+static field self::F<core::num, () → core::num> f;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart
new file mode 100644
index 0000000..86fa97d
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that covariant occurrences of a type variable in the bounds
+// of the other type variables from the same declaration that are not being
+// transitively depended on by that type variable are replaced with the bound of
+// that type variable, in case when the raw type is used as a type argument of a
+// list or a map literal.
+
+class A<X> {}
+
+class C<X, Y extends A<X>> {}
+
+var lc = <C>[];
+var mc = <C, C>{};
+
+class D<X extends num, Y extends A<X>> {}
+
+var ld = <D>[];
+var md = <D, D>{};
+
+class E<X, Y extends X Function()> {}
+
+var le = <E>[];
+var me = <E, E>{};
+
+class F<X extends num, Y extends X Function()> {}
+
+var lf = <F>[];
+var mf = <F, F>{};
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart.direct.expect
new file mode 100644
index 0000000..f3f4e88
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart.direct.expect
@@ -0,0 +1,38 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends self::A<self::C::X>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends core::num, Y extends self::A<self::D::X>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends core::Object, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<X extends core::num, Y extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic lc = <self::C<dynamic, dynamic>>[];
+static field dynamic mc = <self::C<dynamic, dynamic>, self::C<dynamic, dynamic>>{};
+static field dynamic ld = <self::D<dynamic, dynamic>>[];
+static field dynamic md = <self::D<dynamic, dynamic>, self::D<dynamic, dynamic>>{};
+static field dynamic le = <self::E<dynamic, dynamic>>[];
+static field dynamic me = <self::E<dynamic, dynamic>, self::E<dynamic, dynamic>>{};
+static field dynamic lf = <self::F<dynamic, dynamic>>[];
+static field dynamic mf = <self::F<dynamic, dynamic>, self::F<dynamic, dynamic>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart.outline.expect
new file mode 100644
index 0000000..004ef30
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart.outline.expect
@@ -0,0 +1,34 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C<X extends core::Object, Y extends self::A<self::C::X>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D<X extends core::num, Y extends self::A<self::D::X>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class E<X extends core::Object, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class F<X extends core::num, Y extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field dynamic lc;
+static field dynamic mc;
+static field dynamic ld;
+static field dynamic md;
+static field dynamic le;
+static field dynamic me;
+static field dynamic lf;
+static field dynamic mf;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart.strong.expect
new file mode 100644
index 0000000..e2ae82b
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_dependence_in_literals.dart.strong.expect
@@ -0,0 +1,38 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends self::A<self::C::X>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends core::num, Y extends self::A<self::D::X>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends core::Object, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<X extends core::num, Y extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field core::List<self::C<dynamic, self::A<dynamic>>> lc = <self::C<dynamic, self::A<dynamic>>>[];
+static field core::Map<self::C<dynamic, self::A<dynamic>>, self::C<dynamic, self::A<dynamic>>> mc = <self::C<dynamic, self::A<dynamic>>, self::C<dynamic, self::A<dynamic>>>{};
+static field core::List<self::D<core::num, self::A<core::num>>> ld = <self::D<core::num, self::A<core::num>>>[];
+static field core::Map<self::D<core::num, self::A<core::num>>, self::D<core::num, self::A<core::num>>> md = <self::D<core::num, self::A<core::num>>, self::D<core::num, self::A<core::num>>>{};
+static field core::List<self::E<dynamic, () → dynamic>> le = <self::E<dynamic, () → dynamic>>[];
+static field core::Map<self::E<dynamic, () → dynamic>, self::E<dynamic, () → dynamic>> me = <self::E<dynamic, () → dynamic>, self::E<dynamic, () → dynamic>>{};
+static field core::List<self::F<core::num, () → core::num>> lf = <self::F<core::num, () → core::num>>[];
+static field core::Map<self::F<core::num, () → core::num>, self::F<core::num, () → core::num>> mf = <self::F<core::num, () → core::num>, self::F<core::num, () → core::num>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart
new file mode 100644
index 0000000..9b4c9c6
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that covariant occurrences of mutually dependent type
+// variables in the bounds of all of these type variables are replaced with
+// `dynamic`.
+
+class B<X, Y> {}
+
+class C<X, Y> {}
+
+class D<X extends B<X, Y>, Y extends C<X, Y>> {}
+
+D d;
+
+class E<X extends B<X, Y>, Y extends X Function()> {}
+
+E e;
+
+class F<X extends X Function()> {}
+
+F f;
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart.direct.expect
new file mode 100644
index 0000000..d6cc852
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart.direct.expect
@@ -0,0 +1,33 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends self::B<self::D::X, self::D::Y>, Y extends self::C<self::D::X, self::D::Y>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends self::B<self::E::X, self::E::Y>, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<X extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::D<dynamic, dynamic> d;
+static field self::E<dynamic, dynamic> e;
+static field self::F<dynamic> f;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart.outline.expect
new file mode 100644
index 0000000..cd39a20
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart.outline.expect
@@ -0,0 +1,29 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D<X extends self::B<self::D::X, self::D::Y>, Y extends self::C<self::D::X, self::D::Y>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class E<X extends self::B<self::E::X, self::E::Y>, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class F<X extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field self::D<dynamic, dynamic> d;
+static field self::E<dynamic, dynamic> e;
+static field self::F<dynamic> f;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart.strong.expect
new file mode 100644
index 0000000..1ebe886
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence.dart.strong.expect
@@ -0,0 +1,33 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends self::B<self::D::X, self::D::Y>, Y extends self::C<self::D::X, self::D::Y>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends self::B<self::E::X, self::E::Y>, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<X extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::D<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>> d;
+static field self::E<self::B<dynamic, dynamic>, () → dynamic> e;
+static field self::F<() → dynamic> f;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart
new file mode 100644
index 0000000..29f3ee2
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that covariant occurrences of mutually dependent type
+// variables in the bounds of all of these type variables are replaced with
+// `dynamic`, in case when the raw type is used as a type argument of a list or
+// a map literal.
+
+class B<X, Y> {}
+
+class C<X, Y> {}
+
+class D<X extends B<X, Y>, Y extends C<X, Y>> {}
+
+var ld = <D>[];
+var md = <D, D>{};
+
+class E<X extends B<X, Y>, Y extends X Function()> {}
+
+var le = <E>[];
+var me = <E, E>{};
+
+class F<X extends X Function()> {}
+
+var lf = <F>[];
+var mf = <F, F>{};
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart.direct.expect
new file mode 100644
index 0000000..bc1bfe2
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart.direct.expect
@@ -0,0 +1,36 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends self::B<self::D::X, self::D::Y>, Y extends self::C<self::D::X, self::D::Y>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends self::B<self::E::X, self::E::Y>, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<X extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic ld = <self::D<dynamic, dynamic>>[];
+static field dynamic md = <self::D<dynamic, dynamic>, self::D<dynamic, dynamic>>{};
+static field dynamic le = <self::E<dynamic, dynamic>>[];
+static field dynamic me = <self::E<dynamic, dynamic>, self::E<dynamic, dynamic>>{};
+static field dynamic lf = <self::F<dynamic>>[];
+static field dynamic mf = <self::F<dynamic>, self::F<dynamic>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart.outline.expect
new file mode 100644
index 0000000..fb41cb5
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart.outline.expect
@@ -0,0 +1,32 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D<X extends self::B<self::D::X, self::D::Y>, Y extends self::C<self::D::X, self::D::Y>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class E<X extends self::B<self::E::X, self::E::Y>, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class F<X extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field dynamic ld;
+static field dynamic md;
+static field dynamic le;
+static field dynamic me;
+static field dynamic lf;
+static field dynamic mf;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart.strong.expect
new file mode 100644
index 0000000..5dd347a
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/covariant_mutual_dependence_in_literals.dart.strong.expect
@@ -0,0 +1,36 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends self::B<self::D::X, self::D::Y>, Y extends self::C<self::D::X, self::D::Y>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends self::B<self::E::X, self::E::Y>, Y extends () → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<X extends () → self::F::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field core::List<self::D<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>>> ld = <self::D<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>>>[];
+static field core::Map<self::D<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>>, self::D<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>>> md = <self::D<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>>, self::D<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>>>{};
+static field core::List<self::E<self::B<dynamic, dynamic>, () → dynamic>> le = <self::E<self::B<dynamic, dynamic>, () → dynamic>>[];
+static field core::Map<self::E<self::B<dynamic, dynamic>, () → dynamic>, self::E<self::B<dynamic, dynamic>, () → dynamic>> me = <self::E<self::B<dynamic, dynamic>, () → dynamic>, self::E<self::B<dynamic, dynamic>, () → dynamic>>{};
+static field core::List<self::F<() → dynamic>> lf = <self::F<() → dynamic>>[];
+static field core::Map<self::F<() → dynamic>, self::F<() → dynamic>> mf = <self::F<() → dynamic>, self::F<() → dynamic>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/dependence.dart b/pkg/front_end/testcases/instantiate_to_bound/dependence.dart
new file mode 100644
index 0000000..f875ed0
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/dependence.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that covariant and contravariant occurrences of the same
+// type variable in the bounds of the other type variables from the same
+// declaration that are not being transitively depended on by that variable are
+// replaced with the bound of that variable and Null respectively.
+
+class A<X> {}
+
+class C<X, Y extends X Function(X)> {}
+
+C c;
+
+class D<X extends num, Y extends X Function(X)> {}
+
+D d;
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/dependence.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/dependence.dart.direct.expect
new file mode 100644
index 0000000..50c5cd5
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/dependence.dart.direct.expect
@@ -0,0 +1,22 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends (self::C::X) → self::C::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends core::num, Y extends (self::D::X) → self::D::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::C<dynamic, dynamic> c;
+static field self::D<dynamic, dynamic> d;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/dependence.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/dependence.dart.outline.expect
new file mode 100644
index 0000000..3bfdc8a
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/dependence.dart.outline.expect
@@ -0,0 +1,20 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C<X extends core::Object, Y extends (self::C::X) → self::C::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D<X extends core::num, Y extends (self::D::X) → self::D::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field self::C<dynamic, dynamic> c;
+static field self::D<dynamic, dynamic> d;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/dependence.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/dependence.dart.strong.expect
new file mode 100644
index 0000000..5e74c50
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/dependence.dart.strong.expect
@@ -0,0 +1,22 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends (self::C::X) → self::C::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends core::num, Y extends (self::D::X) → self::D::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::C<dynamic, (core::Null) → dynamic> c;
+static field self::D<core::num, (core::Null) → core::num> d;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart b/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart
new file mode 100644
index 0000000..bbfa488
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that covariant and contravariant occurrences of the same
+// type variable in the bounds of the other type variables from the same
+// declaration that are not being transitively depended on by that variable are
+// replaced with the bound of that variable and Null respectively, in case when
+// the raw type is used as a type argument of a list or a map literal.
+
+class A<X> {}
+
+class C<X, Y extends X Function(X)> {}
+
+var lc = <C>[];
+var mc = <C, C>{};
+
+class D<X extends num, Y extends X Function(X)> {}
+
+var ld = <D>[];
+var md = <D, D>{};
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart.direct.expect
new file mode 100644
index 0000000..3d63194
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart.direct.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends (self::C::X) → self::C::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends core::num, Y extends (self::D::X) → self::D::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic lc = <self::C<dynamic, dynamic>>[];
+static field dynamic mc = <self::C<dynamic, dynamic>, self::C<dynamic, dynamic>>{};
+static field dynamic ld = <self::D<dynamic, dynamic>>[];
+static field dynamic md = <self::D<dynamic, dynamic>, self::D<dynamic, dynamic>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart.outline.expect
new file mode 100644
index 0000000..20f0f48
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart.outline.expect
@@ -0,0 +1,22 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C<X extends core::Object, Y extends (self::C::X) → self::C::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D<X extends core::num, Y extends (self::D::X) → self::D::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field dynamic lc;
+static field dynamic mc;
+static field dynamic ld;
+static field dynamic md;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart.strong.expect
new file mode 100644
index 0000000..454cf25
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/dependence_in_literals.dart.strong.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends (self::C::X) → self::C::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends core::num, Y extends (self::D::X) → self::D::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field core::List<self::C<dynamic, (core::Null) → dynamic>> lc = <self::C<dynamic, (core::Null) → dynamic>>[];
+static field core::Map<self::C<dynamic, (core::Null) → dynamic>, self::C<dynamic, (core::Null) → dynamic>> mc = <self::C<dynamic, (core::Null) → dynamic>, self::C<dynamic, (core::Null) → dynamic>>{};
+static field core::List<self::D<core::num, (core::Null) → core::num>> ld = <self::D<core::num, (core::Null) → core::num>>[];
+static field core::Map<self::D<core::num, (core::Null) → core::num>, self::D<core::num, (core::Null) → core::num>> md = <self::D<core::num, (core::Null) → core::num>, self::D<core::num, (core::Null) → core::num>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart b/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart
new file mode 100644
index 0000000..055d6dc
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that the instantiate-to-bound algorithm implementation works
+// well in cases where there are multiple distinct strongly connected components
+// of the type variable dependency graph in one declaration.
+
+class A<X> {}
+
+class B<X, Y> {}
+
+class C<X, Y> {}
+
+// Two loops.
+class D<X extends A<X>, Y extends A<Y>> {}
+
+D d;
+
+class E<W extends B<W, X>, X extends C<W, X>, Y extends B<Y, Z>,
+ Z extends C<Y, Z>> {}
+
+E e;
+
+class F<V extends num, W extends B<W, X>, X extends C<W, X>, Y extends B<W, X>,
+ Z extends C<Y, Z>> {}
+
+F f;
+
+class G<V extends num, W extends B<V, X>, X extends C<W, V>, Y extends B<W, X>,
+ Z extends C<Y, Z>> {}
+
+G g;
+
+class H<S extends A<S>, T extends B<T, U>, U extends C<T, U>, V extends A<V>,
+ W extends S, X extends T, Y extends U, Z extends V> {}
+
+H h;
+
+// A square and a triangle.
+class I<T extends U, U extends Y, V extends Function(W), W extends Function(X),
+ X extends Function(V), Y extends Z, Z extends T> {}
+
+I i;
+
+// A triangle and a "bowtie."
+class J<
+ S extends T Function(U),
+ T extends U Function(S),
+ U extends S Function(T),
+ V extends W,
+ W extends X,
+ X extends Y Function(V),
+ Y extends Z,
+ Z extends X> {}
+
+J j;
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart.direct.expect
new file mode 100644
index 0000000..9ecef65
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart.direct.expect
@@ -0,0 +1,62 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends self::A<self::D::X>, Y extends self::A<self::D::Y>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<W extends self::B<self::E::W, self::E::X>, X extends self::C<self::E::W, self::E::X>, Y extends self::B<self::E::Y, self::E::Z>, Z extends self::C<self::E::Y, self::E::Z>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<V extends core::num, W extends self::B<self::F::W, self::F::X>, X extends self::C<self::F::W, self::F::X>, Y extends self::B<self::F::W, self::F::X>, Z extends self::C<self::F::Y, self::F::Z>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class G<V extends core::num, W extends self::B<self::G::V, self::G::X>, X extends self::C<self::G::W, self::G::V>, Y extends self::B<self::G::W, self::G::X>, Z extends self::C<self::G::Y, self::G::Z>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class H<S extends self::A<self::H::S>, T extends self::B<self::H::T, self::H::U>, U extends self::C<self::H::T, self::H::U>, V extends self::A<self::H::V>, W extends self::H::S, X extends self::H::T, Y extends self::H::U, Z extends self::H::V> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class I<T extends self::I::U, U extends self::I::Y, V extends (self::I::W) → dynamic, W extends (self::I::X) → dynamic, X extends (self::I::V) → dynamic, Y extends self::I::Z, Z extends self::I::T> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class J<S extends (self::J::U) → self::J::T, T extends (self::J::S) → self::J::U, U extends (self::J::T) → self::J::S, V extends self::J::W, W extends self::J::X, X extends (self::J::V) → self::J::Y, Y extends self::J::Z, Z extends self::J::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::D<dynamic, dynamic> d;
+static field self::E<dynamic, dynamic, dynamic, dynamic> e;
+static field self::F<dynamic, dynamic, dynamic, dynamic, dynamic> f;
+static field self::G<dynamic, dynamic, dynamic, dynamic, dynamic> g;
+static field self::H<dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic> h;
+static field self::I<dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic> i;
+static field self::J<dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic> j;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart.outline.expect
new file mode 100644
index 0000000..64dbcc8
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart.outline.expect
@@ -0,0 +1,53 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D<X extends self::A<self::D::X>, Y extends self::A<self::D::Y>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class E<W extends self::B<self::E::W, self::E::X>, X extends self::C<self::E::W, self::E::X>, Y extends self::B<self::E::Y, self::E::Z>, Z extends self::C<self::E::Y, self::E::Z>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class F<V extends core::num, W extends self::B<self::F::W, self::F::X>, X extends self::C<self::F::W, self::F::X>, Y extends self::B<self::F::W, self::F::X>, Z extends self::C<self::F::Y, self::F::Z>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class G<V extends core::num, W extends self::B<self::G::V, self::G::X>, X extends self::C<self::G::W, self::G::V>, Y extends self::B<self::G::W, self::G::X>, Z extends self::C<self::G::Y, self::G::Z>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class H<S extends self::A<self::H::S>, T extends self::B<self::H::T, self::H::U>, U extends self::C<self::H::T, self::H::U>, V extends self::A<self::H::V>, W extends self::H::S, X extends self::H::T, Y extends self::H::U, Z extends self::H::V> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class I<T extends self::I::U, U extends self::I::Y, V extends (self::I::W) → dynamic, W extends (self::I::X) → dynamic, X extends (self::I::V) → dynamic, Y extends self::I::Z, Z extends self::I::T> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class J<S extends (self::J::U) → self::J::T, T extends (self::J::S) → self::J::U, U extends (self::J::T) → self::J::S, V extends self::J::W, W extends self::J::X, X extends (self::J::V) → self::J::Y, Y extends self::J::Z, Z extends self::J::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field self::D<dynamic, dynamic> d;
+static field self::E<dynamic, dynamic, dynamic, dynamic> e;
+static field self::F<dynamic, dynamic, dynamic, dynamic, dynamic> f;
+static field self::G<dynamic, dynamic, dynamic, dynamic, dynamic> g;
+static field self::H<dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic> h;
+static field self::I<dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic> i;
+static field self::J<dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic> j;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart.strong.expect
new file mode 100644
index 0000000..b890460
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/multiple_strongly_connected.dart.strong.expect
@@ -0,0 +1,62 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D<X extends self::A<self::D::X>, Y extends self::A<self::D::Y>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<W extends self::B<self::E::W, self::E::X>, X extends self::C<self::E::W, self::E::X>, Y extends self::B<self::E::Y, self::E::Z>, Z extends self::C<self::E::Y, self::E::Z>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class F<V extends core::num, W extends self::B<self::F::W, self::F::X>, X extends self::C<self::F::W, self::F::X>, Y extends self::B<self::F::W, self::F::X>, Z extends self::C<self::F::Y, self::F::Z>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class G<V extends core::num, W extends self::B<self::G::V, self::G::X>, X extends self::C<self::G::W, self::G::V>, Y extends self::B<self::G::W, self::G::X>, Z extends self::C<self::G::Y, self::G::Z>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class H<S extends self::A<self::H::S>, T extends self::B<self::H::T, self::H::U>, U extends self::C<self::H::T, self::H::U>, V extends self::A<self::H::V>, W extends self::H::S, X extends self::H::T, Y extends self::H::U, Z extends self::H::V> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class I<T extends self::I::U, U extends self::I::Y, V extends (self::I::W) → dynamic, W extends (self::I::X) → dynamic, X extends (self::I::V) → dynamic, Y extends self::I::Z, Z extends self::I::T> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class J<S extends (self::J::U) → self::J::T, T extends (self::J::S) → self::J::U, U extends (self::J::T) → self::J::S, V extends self::J::W, W extends self::J::X, X extends (self::J::V) → self::J::Y, Y extends self::J::Z, Z extends self::J::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::D<self::A<dynamic>, self::A<dynamic>> d;
+static field self::E<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>, self::B<dynamic, dynamic>, self::C<dynamic, dynamic>> e;
+static field self::F<core::num, self::B<dynamic, dynamic>, self::C<dynamic, dynamic>, self::B<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>>, self::C<self::B<self::B<dynamic, dynamic>, self::C<dynamic, dynamic>>, dynamic>> f;
+static field self::G<core::num, self::B<core::num, dynamic>, self::C<dynamic, core::num>, self::B<self::B<core::num, dynamic>, self::C<dynamic, core::num>>, self::C<self::B<self::B<core::num, dynamic>, self::C<dynamic, core::num>>, dynamic>> g;
+static field self::H<self::A<dynamic>, self::B<dynamic, dynamic>, self::C<dynamic, dynamic>, self::A<dynamic>, self::A<dynamic>, self::B<dynamic, dynamic>, self::C<dynamic, dynamic>, self::A<dynamic>> h;
+static field self::I<dynamic, dynamic, (core::Null) → dynamic, (core::Null) → dynamic, (core::Null) → dynamic, dynamic, dynamic> i;
+static field self::J<(core::Null) → dynamic, (core::Null) → dynamic, (core::Null) → dynamic, dynamic, dynamic, (core::Null) → dynamic, dynamic, dynamic> j;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart
new file mode 100644
index 0000000..5cb6e71
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that covariant and contravariant occurrences of the same
+// type variable from the set of mutually dependent type variables in the bounds
+// of all of these type variables are replaced with `dynamic` and Null
+// respectively.
+
+class B<X, Y> {}
+
+class C1<X extends X Function(Y), Y extends X Function(Y)> {}
+
+C1 c1;
+
+class C2<X extends X Function(Y), Y extends Y Function(X)> {}
+
+C2 c2;
+
+class C3<X extends X Function(X, Y), Y extends X Function(X, Y)> {}
+
+C3 c3;
+
+class C4<X extends X Function(X, Y), Y extends Y Function(X, Y)> {}
+
+C4 c4;
+
+class D1<X extends B<X, Y>, Y extends X Function(Y)> {}
+
+D1 d1;
+
+class D2<X extends B<X, Y>, Y extends Y Function(X)> {}
+
+D2 d2;
+
+class D3<X extends B<X, Y>, Y extends X Function(X, Y)> {}
+
+D3 d3;
+
+class D4<X extends B<X, Y>, Y extends Y Function(X, Y)> {}
+
+D4 d4;
+
+class E<X extends X Function(X)> {}
+
+E e;
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart.direct.expect
new file mode 100644
index 0000000..74147c8
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart.direct.expect
@@ -0,0 +1,64 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C1<X extends (self::C1::Y) → self::C1::X, Y extends (self::C1::Y) → self::C1::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C2<X extends (self::C2::Y) → self::C2::X, Y extends (self::C2::X) → self::C2::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C3<X extends (self::C3::X, self::C3::Y) → self::C3::X, Y extends (self::C3::X, self::C3::Y) → self::C3::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C4<X extends (self::C4::X, self::C4::Y) → self::C4::X, Y extends (self::C4::X, self::C4::Y) → self::C4::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D1<X extends self::B<self::D1::X, self::D1::Y>, Y extends (self::D1::Y) → self::D1::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D2<X extends self::B<self::D2::X, self::D2::Y>, Y extends (self::D2::X) → self::D2::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D3<X extends self::B<self::D3::X, self::D3::Y>, Y extends (self::D3::X, self::D3::Y) → self::D3::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D4<X extends self::B<self::D4::X, self::D4::Y>, Y extends (self::D4::X, self::D4::Y) → self::D4::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends (self::E::X) → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::C1<dynamic, dynamic> c1;
+static field self::C2<dynamic, dynamic> c2;
+static field self::C3<dynamic, dynamic> c3;
+static field self::C4<dynamic, dynamic> c4;
+static field self::D1<dynamic, dynamic> d1;
+static field self::D2<dynamic, dynamic> d2;
+static field self::D3<dynamic, dynamic> d3;
+static field self::D4<dynamic, dynamic> d4;
+static field self::E<dynamic> e;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart.outline.expect
new file mode 100644
index 0000000..9ba0b7d
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart.outline.expect
@@ -0,0 +1,55 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C1<X extends (self::C1::Y) → self::C1::X, Y extends (self::C1::Y) → self::C1::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C2<X extends (self::C2::Y) → self::C2::X, Y extends (self::C2::X) → self::C2::Y> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C3<X extends (self::C3::X, self::C3::Y) → self::C3::X, Y extends (self::C3::X, self::C3::Y) → self::C3::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C4<X extends (self::C4::X, self::C4::Y) → self::C4::X, Y extends (self::C4::X, self::C4::Y) → self::C4::Y> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D1<X extends self::B<self::D1::X, self::D1::Y>, Y extends (self::D1::Y) → self::D1::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D2<X extends self::B<self::D2::X, self::D2::Y>, Y extends (self::D2::X) → self::D2::Y> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D3<X extends self::B<self::D3::X, self::D3::Y>, Y extends (self::D3::X, self::D3::Y) → self::D3::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D4<X extends self::B<self::D4::X, self::D4::Y>, Y extends (self::D4::X, self::D4::Y) → self::D4::Y> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class E<X extends (self::E::X) → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field self::C1<dynamic, dynamic> c1;
+static field self::C2<dynamic, dynamic> c2;
+static field self::C3<dynamic, dynamic> c3;
+static field self::C4<dynamic, dynamic> c4;
+static field self::D1<dynamic, dynamic> d1;
+static field self::D2<dynamic, dynamic> d2;
+static field self::D3<dynamic, dynamic> d3;
+static field self::D4<dynamic, dynamic> d4;
+static field self::E<dynamic> e;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart.strong.expect
new file mode 100644
index 0000000..77802e7
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence.dart.strong.expect
@@ -0,0 +1,64 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C1<X extends (self::C1::Y) → self::C1::X, Y extends (self::C1::Y) → self::C1::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C2<X extends (self::C2::Y) → self::C2::X, Y extends (self::C2::X) → self::C2::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C3<X extends (self::C3::X, self::C3::Y) → self::C3::X, Y extends (self::C3::X, self::C3::Y) → self::C3::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C4<X extends (self::C4::X, self::C4::Y) → self::C4::X, Y extends (self::C4::X, self::C4::Y) → self::C4::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D1<X extends self::B<self::D1::X, self::D1::Y>, Y extends (self::D1::Y) → self::D1::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D2<X extends self::B<self::D2::X, self::D2::Y>, Y extends (self::D2::X) → self::D2::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D3<X extends self::B<self::D3::X, self::D3::Y>, Y extends (self::D3::X, self::D3::Y) → self::D3::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D4<X extends self::B<self::D4::X, self::D4::Y>, Y extends (self::D4::X, self::D4::Y) → self::D4::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends (self::E::X) → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::C1<(core::Null) → dynamic, (core::Null) → dynamic> c1;
+static field self::C2<(core::Null) → dynamic, (core::Null) → dynamic> c2;
+static field self::C3<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic> c3;
+static field self::C4<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic> c4;
+static field self::D1<self::B<dynamic, dynamic>, (core::Null) → dynamic> d1;
+static field self::D2<self::B<dynamic, dynamic>, (core::Null) → dynamic> d2;
+static field self::D3<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic> d3;
+static field self::D4<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic> d4;
+static field self::E<(core::Null) → dynamic> e;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart
new file mode 100644
index 0000000..097cba9
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart
@@ -0,0 +1,58 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that covariant and contravariant occurrences of the same
+// type variable from the set of mutually dependent type variables in the bounds
+// of all of these type variables are replaced with `dynamic` and Null
+// respectively, in case when the raw type is used as a type argument of a list
+// or a map literal.
+
+class B<X, Y> {}
+
+class C1<X extends X Function(Y), Y extends X Function(Y)> {}
+
+var lc1 = <C1>[];
+var mc1 = <C1, C1>{};
+
+class C2<X extends X Function(Y), Y extends Y Function(X)> {}
+
+var lc2 = <C2>[];
+var mc2 = <C2, C2>{};
+
+class C3<X extends X Function(X, Y), Y extends X Function(X, Y)> {}
+
+var lc3 = <C3>[];
+var mc3 = <C3, C3>{};
+
+class C4<X extends X Function(X, Y), Y extends Y Function(X, Y)> {}
+
+var lc4 = <C4>[];
+var mc4 = <C4, C4>{};
+
+class D1<X extends B<X, Y>, Y extends X Function(Y)> {}
+
+var ld1 = <D1>[];
+var md1 = <D1, D1>{};
+
+class D2<X extends B<X, Y>, Y extends Y Function(X)> {}
+
+var ld2 = <D2>[];
+var md2 = <D2, D2>{};
+
+class D3<X extends B<X, Y>, Y extends X Function(X, Y)> {}
+
+var ld3 = <D3>[];
+var md3 = <D3, D3>{};
+
+class D4<X extends B<X, Y>, Y extends Y Function(X, Y)> {}
+
+var ld4 = <D4>[];
+var md4 = <D4, D4>{};
+
+class E<X extends X Function(X)> {}
+
+var le = <E>[];
+var me = <E, E>{};
+
+main() {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart.direct.expect
new file mode 100644
index 0000000..ec1fdc4
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart.direct.expect
@@ -0,0 +1,73 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C1<X extends (self::C1::Y) → self::C1::X, Y extends (self::C1::Y) → self::C1::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C2<X extends (self::C2::Y) → self::C2::X, Y extends (self::C2::X) → self::C2::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C3<X extends (self::C3::X, self::C3::Y) → self::C3::X, Y extends (self::C3::X, self::C3::Y) → self::C3::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C4<X extends (self::C4::X, self::C4::Y) → self::C4::X, Y extends (self::C4::X, self::C4::Y) → self::C4::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D1<X extends self::B<self::D1::X, self::D1::Y>, Y extends (self::D1::Y) → self::D1::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D2<X extends self::B<self::D2::X, self::D2::Y>, Y extends (self::D2::X) → self::D2::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D3<X extends self::B<self::D3::X, self::D3::Y>, Y extends (self::D3::X, self::D3::Y) → self::D3::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D4<X extends self::B<self::D4::X, self::D4::Y>, Y extends (self::D4::X, self::D4::Y) → self::D4::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends (self::E::X) → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic lc1 = <self::C1<dynamic, dynamic>>[];
+static field dynamic mc1 = <self::C1<dynamic, dynamic>, self::C1<dynamic, dynamic>>{};
+static field dynamic lc2 = <self::C2<dynamic, dynamic>>[];
+static field dynamic mc2 = <self::C2<dynamic, dynamic>, self::C2<dynamic, dynamic>>{};
+static field dynamic lc3 = <self::C3<dynamic, dynamic>>[];
+static field dynamic mc3 = <self::C3<dynamic, dynamic>, self::C3<dynamic, dynamic>>{};
+static field dynamic lc4 = <self::C4<dynamic, dynamic>>[];
+static field dynamic mc4 = <self::C4<dynamic, dynamic>, self::C4<dynamic, dynamic>>{};
+static field dynamic ld1 = <self::D1<dynamic, dynamic>>[];
+static field dynamic md1 = <self::D1<dynamic, dynamic>, self::D1<dynamic, dynamic>>{};
+static field dynamic ld2 = <self::D2<dynamic, dynamic>>[];
+static field dynamic md2 = <self::D2<dynamic, dynamic>, self::D2<dynamic, dynamic>>{};
+static field dynamic ld3 = <self::D3<dynamic, dynamic>>[];
+static field dynamic md3 = <self::D3<dynamic, dynamic>, self::D3<dynamic, dynamic>>{};
+static field dynamic ld4 = <self::D4<dynamic, dynamic>>[];
+static field dynamic md4 = <self::D4<dynamic, dynamic>, self::D4<dynamic, dynamic>>{};
+static field dynamic le = <self::E<dynamic>>[];
+static field dynamic me = <self::E<dynamic>, self::E<dynamic>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart.outline.expect
new file mode 100644
index 0000000..c1a07b1
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart.outline.expect
@@ -0,0 +1,64 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C1<X extends (self::C1::Y) → self::C1::X, Y extends (self::C1::Y) → self::C1::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C2<X extends (self::C2::Y) → self::C2::X, Y extends (self::C2::X) → self::C2::Y> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C3<X extends (self::C3::X, self::C3::Y) → self::C3::X, Y extends (self::C3::X, self::C3::Y) → self::C3::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C4<X extends (self::C4::X, self::C4::Y) → self::C4::X, Y extends (self::C4::X, self::C4::Y) → self::C4::Y> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D1<X extends self::B<self::D1::X, self::D1::Y>, Y extends (self::D1::Y) → self::D1::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D2<X extends self::B<self::D2::X, self::D2::Y>, Y extends (self::D2::X) → self::D2::Y> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D3<X extends self::B<self::D3::X, self::D3::Y>, Y extends (self::D3::X, self::D3::Y) → self::D3::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class D4<X extends self::B<self::D4::X, self::D4::Y>, Y extends (self::D4::X, self::D4::Y) → self::D4::Y> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class E<X extends (self::E::X) → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field dynamic lc1;
+static field dynamic mc1;
+static field dynamic lc2;
+static field dynamic mc2;
+static field dynamic lc3;
+static field dynamic mc3;
+static field dynamic lc4;
+static field dynamic mc4;
+static field dynamic ld1;
+static field dynamic md1;
+static field dynamic ld2;
+static field dynamic md2;
+static field dynamic ld3;
+static field dynamic md3;
+static field dynamic ld4;
+static field dynamic md4;
+static field dynamic le;
+static field dynamic me;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart.strong.expect
new file mode 100644
index 0000000..8a37dd2
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/mutual_dependence_in_literals.dart.strong.expect
@@ -0,0 +1,73 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C1<X extends (self::C1::Y) → self::C1::X, Y extends (self::C1::Y) → self::C1::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C2<X extends (self::C2::Y) → self::C2::X, Y extends (self::C2::X) → self::C2::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C3<X extends (self::C3::X, self::C3::Y) → self::C3::X, Y extends (self::C3::X, self::C3::Y) → self::C3::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C4<X extends (self::C4::X, self::C4::Y) → self::C4::X, Y extends (self::C4::X, self::C4::Y) → self::C4::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D1<X extends self::B<self::D1::X, self::D1::Y>, Y extends (self::D1::Y) → self::D1::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D2<X extends self::B<self::D2::X, self::D2::Y>, Y extends (self::D2::X) → self::D2::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D3<X extends self::B<self::D3::X, self::D3::Y>, Y extends (self::D3::X, self::D3::Y) → self::D3::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class D4<X extends self::B<self::D4::X, self::D4::Y>, Y extends (self::D4::X, self::D4::Y) → self::D4::Y> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class E<X extends (self::E::X) → self::E::X> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field core::List<self::C1<(core::Null) → dynamic, (core::Null) → dynamic>> lc1 = <self::C1<(core::Null) → dynamic, (core::Null) → dynamic>>[];
+static field core::Map<self::C1<(core::Null) → dynamic, (core::Null) → dynamic>, self::C1<(core::Null) → dynamic, (core::Null) → dynamic>> mc1 = <self::C1<(core::Null) → dynamic, (core::Null) → dynamic>, self::C1<(core::Null) → dynamic, (core::Null) → dynamic>>{};
+static field core::List<self::C2<(core::Null) → dynamic, (core::Null) → dynamic>> lc2 = <self::C2<(core::Null) → dynamic, (core::Null) → dynamic>>[];
+static field core::Map<self::C2<(core::Null) → dynamic, (core::Null) → dynamic>, self::C2<(core::Null) → dynamic, (core::Null) → dynamic>> mc2 = <self::C2<(core::Null) → dynamic, (core::Null) → dynamic>, self::C2<(core::Null) → dynamic, (core::Null) → dynamic>>{};
+static field core::List<self::C3<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>> lc3 = <self::C3<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>>[];
+static field core::Map<self::C3<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>, self::C3<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>> mc3 = <self::C3<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>, self::C3<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>>{};
+static field core::List<self::C4<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>> lc4 = <self::C4<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>>[];
+static field core::Map<self::C4<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>, self::C4<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>> mc4 = <self::C4<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>, self::C4<(core::Null, core::Null) → dynamic, (core::Null, core::Null) → dynamic>>{};
+static field core::List<self::D1<self::B<dynamic, dynamic>, (core::Null) → dynamic>> ld1 = <self::D1<self::B<dynamic, dynamic>, (core::Null) → dynamic>>[];
+static field core::Map<self::D1<self::B<dynamic, dynamic>, (core::Null) → dynamic>, self::D1<self::B<dynamic, dynamic>, (core::Null) → dynamic>> md1 = <self::D1<self::B<dynamic, dynamic>, (core::Null) → dynamic>, self::D1<self::B<dynamic, dynamic>, (core::Null) → dynamic>>{};
+static field core::List<self::D2<self::B<dynamic, dynamic>, (core::Null) → dynamic>> ld2 = <self::D2<self::B<dynamic, dynamic>, (core::Null) → dynamic>>[];
+static field core::Map<self::D2<self::B<dynamic, dynamic>, (core::Null) → dynamic>, self::D2<self::B<dynamic, dynamic>, (core::Null) → dynamic>> md2 = <self::D2<self::B<dynamic, dynamic>, (core::Null) → dynamic>, self::D2<self::B<dynamic, dynamic>, (core::Null) → dynamic>>{};
+static field core::List<self::D3<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>> ld3 = <self::D3<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>>[];
+static field core::Map<self::D3<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>, self::D3<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>> md3 = <self::D3<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>, self::D3<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>>{};
+static field core::List<self::D4<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>> ld4 = <self::D4<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>>[];
+static field core::Map<self::D4<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>, self::D4<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>> md4 = <self::D4<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>, self::D4<self::B<dynamic, dynamic>, (core::Null, core::Null) → dynamic>>{};
+static field core::List<self::E<(core::Null) → dynamic>> le = <self::E<(core::Null) → dynamic>>[];
+static field core::Map<self::E<(core::Null) → dynamic>, self::E<(core::Null) → dynamic>> me = <self::E<(core::Null) → dynamic>, self::E<(core::Null) → dynamic>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/magic_const.dart b/pkg/front_end/testcases/magic_const.dart
new file mode 100644
index 0000000..276245e
--- /dev/null
+++ b/pkg/front_end/testcases/magic_const.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Test that we produce a compile-time error when magic constness would
+/// otherwise apply.
+// TODO(ahe): Update this test when we implement magic constness correctly.
+
+class Constant {
+ const Constant();
+}
+
+class NotConstant {}
+
+foo({a: Constant(), b: Constant(), c: []}) {}
+
+test() {
+ const NotConstant();
+ Constant();
+ const x = Constant();
+ bool.fromEnvironment("fisk");
+ const b = bool.fromEnvironment("fisk");
+}
+
+main() {
+ // Don't invoke [test] as it throws a compile-time due to `const NotConstant()`.
+}
diff --git a/pkg/front_end/testcases/magic_const.dart.direct.expect b/pkg/front_end/testcases/magic_const.dart.direct.expect
new file mode 100644
index 0000000..f5152ff
--- /dev/null
+++ b/pkg/front_end/testcases/magic_const.dart.direct.expect
@@ -0,0 +1,33 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Constant extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class NotConstant extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method foo({dynamic a = invalid-expression "pkg/front_end/testcases/magic_const.dart:15:9: Error: The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here.
+foo({a: Constant(), b: Constant(), c: []}) {}
+ ^", dynamic b = invalid-expression "pkg/front_end/testcases/magic_const.dart:15:24: Error: The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here.
+foo({a: Constant(), b: Constant(), c: []}) {}
+ ^", dynamic c = <dynamic>[]}) → dynamic {}
+static method test() → dynamic {
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Not a const constructor.
+ const NotConstant();
+ ^";
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:19:3: Error: The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here.
+ Constant();
+ ^";
+ const dynamic x = const self::Constant::•();
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:21:8: Error: The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here.
+ bool.fromEnvironment(\"fisk\");
+ ^";
+ const dynamic b = const core::bool::fromEnvironment("fisk");
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/magic_const.dart.outline.expect b/pkg/front_end/testcases/magic_const.dart.outline.expect
new file mode 100644
index 0000000..8e343a1
--- /dev/null
+++ b/pkg/front_end/testcases/magic_const.dart.outline.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Constant extends core::Object {
+ const constructor •() → void
+ ;
+}
+class NotConstant extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static method foo({dynamic a, dynamic b, dynamic c}) → dynamic
+ ;
+static method test() → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/magic_const.dart.strong.expect b/pkg/front_end/testcases/magic_const.dart.strong.expect
new file mode 100644
index 0000000..6648bbe
--- /dev/null
+++ b/pkg/front_end/testcases/magic_const.dart.strong.expect
@@ -0,0 +1,33 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Constant extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class NotConstant extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method foo({dynamic a = invalid-expression "pkg/front_end/testcases/magic_const.dart:15:9: Error: The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here.
+foo({a: Constant(), b: Constant(), c: []}) {}
+ ^", dynamic b = invalid-expression "pkg/front_end/testcases/magic_const.dart:15:24: Error: The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here.
+foo({a: Constant(), b: Constant(), c: []}) {}
+ ^", dynamic c = <dynamic>[]}) → dynamic {}
+static method test() → dynamic {
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:18:9: Error: Not a const constructor.
+ const NotConstant();
+ ^";
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:19:3: Error: The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here.
+ Constant();
+ ^";
+ const self::Constant x = const self::Constant::•();
+ invalid-expression "pkg/front_end/testcases/magic_const.dart:21:8: Error: The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to infer 'const' or 'new' here.
+ bool.fromEnvironment(\"fisk\");
+ ^";
+ const core::bool b = const core::bool::fromEnvironment("fisk");
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_field.dart b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart
new file mode 100644
index 0000000..73392ad
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=checks*/
+library test;
+
+typedef void F<T>(T x);
+
+class C<T> {
+ F<T> /*@genericContravariant=true*/ y;
+ void f() {
+ var x = this. /*@callKind=this*/ y;
+ }
+}
+
+void g(C<num> c) {
+ var x = c. /*@checkReturn=(num) -> void*/ y;
+}
+
+void main() {}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.direct.expect b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.direct.expect
new file mode 100644
index 0000000..cd8a1ec
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.direct.expect
@@ -0,0 +1,18 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+typedef F<T extends core::Object> = (T) → void;
+class C<T extends core::Object> extends core::Object {
+ field (self::C::T) → void y = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method f() → void {
+ dynamic x = this.{self::C::y};
+ }
+}
+static method g(self::C<core::num> c) → void {
+ dynamic x = c.y;
+}
+static method main() → void {}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.outline.expect b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.outline.expect
new file mode 100644
index 0000000..27f223b
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.outline.expect
@@ -0,0 +1,16 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+typedef F<T extends core::Object> = (T) → void;
+class C<T extends core::Object> extends core::Object {
+ field (self::C::T) → void y;
+ synthetic constructor •() → void
+ ;
+ method f() → void
+ ;
+}
+static method g(self::C<core::num> c) → void
+ ;
+static method main() → void
+ ;
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.strong.expect
new file mode 100644
index 0000000..c2e5212
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.strong.expect
@@ -0,0 +1,18 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+typedef F<T extends core::Object> = (T) → void;
+class C<T extends core::Object> extends core::Object {
+ generic-contravariant field (self::C::T) → void y = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method f() → void {
+ (self::C::T) → void x = this.{self::C::y};
+ }
+}
+static method g(self::C<core::num> c) → void {
+ (core::num) → void x = c.{self::C::y} as{TypeError} (core::num) → void;
+}
+static method main() → void {}
diff --git a/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect b/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect
index 636512b..b48746b 100644
--- a/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect
+++ b/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect
@@ -434,6 +434,7 @@
class MapEntry<K extends self::Object, V extends self::Object> extends self::Object {
final field self::MapEntry::K key;
final field self::MapEntry::V value;
+ method toString() → self::String;
}
class Null extends self::Object {
external get hashCode() → self::int;
diff --git a/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect b/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect
index 3844c72..ebd2c9b 100644
--- a/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect
+++ b/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect
@@ -370,6 +370,7 @@
- class MapEntry
- key
- value
+ - toString
- class Null
- hashCode
- toString
diff --git a/pkg/kernel/lib/type_algebra.dart b/pkg/kernel/lib/type_algebra.dart
index fc325fd..ad6017b 100644
--- a/pkg/kernel/lib/type_algebra.dart
+++ b/pkg/kernel/lib/type_algebra.dart
@@ -5,6 +5,8 @@
import 'ast.dart';
+import 'util/graph.dart';
+
/// Returns a type where all occurrences of the given type parameters have been
/// replaced with the corresponding types.
///
@@ -66,31 +68,95 @@
return substitutor.isInfinite ? null : result;
}
+/// Calculates bounds to be provided as type arguments in place of missing type
+/// arguments on raw types with the given type parameters.
+///
+/// See the [description]
+/// (https://github.com/dart-lang/sdk/blob/master/docs/language/informal/instantiate-to-bound.md)
+/// of the algorithm for details.
List<DartType> calculateBounds(
List<TypeParameter> typeParameters, Class object) {
- var refinedBounds = new List<DartType>(typeParameters.length);
- var substitution = <TypeParameter, DartType>{};
- var substitutionToDynamic = <TypeParameter, DartType>{};
-
+ List<DartType> bounds = new List<DartType>(typeParameters.length);
for (int i = 0; i < typeParameters.length; i++) {
DartType type = typeParameters[i].bound;
if (type == null || type is InterfaceType && type.classNode == object) {
type = const DynamicType();
}
- refinedBounds[i] = type;
- substitution[typeParameters[i]] = type;
- substitutionToDynamic[typeParameters[i]] = const DynamicType();
+ bounds[i] = type;
}
- var result = new List<DartType>(typeParameters.length);
- for (int i = 0; i < result.length; i++) {
- result[i] = substituteDeep(refinedBounds[i], substitution);
- if (result[i] == null) {
- result[i] = substitute(refinedBounds[i], substitutionToDynamic);
+ _TypeVariableGraph graph = new _TypeVariableGraph(typeParameters, bounds);
+ List<List<int>> stronglyConnected = computeStrongComponents(graph);
+ for (List<int> component in stronglyConnected) {
+ Map<TypeParameter, DartType> dynamicSubstitution =
+ <TypeParameter, DartType>{};
+ Map<TypeParameter, DartType> nullSubstitution = <TypeParameter, DartType>{};
+ for (int typeParameterIndex in component) {
+ dynamicSubstitution[typeParameters[typeParameterIndex]] =
+ const DynamicType();
+ nullSubstitution[typeParameters[typeParameterIndex]] = const BottomType();
+ }
+ _TopSubstitutor substitutor = new _TopSubstitutor(
+ Substitution.fromUpperAndLowerBounds(
+ dynamicSubstitution, nullSubstitution),
+ false);
+ for (int typeParameterIndex in component) {
+ bounds[typeParameterIndex] =
+ substitutor.visit(bounds[typeParameterIndex]);
}
}
- return result;
+
+ for (int i = 0; i < typeParameters.length; i++) {
+ Map<TypeParameter, DartType> substitution = <TypeParameter, DartType>{};
+ Map<TypeParameter, DartType> nullSubstitution = <TypeParameter, DartType>{};
+ substitution[typeParameters[i]] = bounds[i];
+ nullSubstitution[typeParameters[i]] = const BottomType();
+ _TopSubstitutor substitutor = new _TopSubstitutor(
+ Substitution.fromUpperAndLowerBounds(substitution, nullSubstitution),
+ false);
+ for (int j = 0; j < typeParameters.length; j++) {
+ bounds[j] = substitutor.visit(bounds[j]);
+ }
+ }
+
+ return bounds;
+}
+
+class _TypeVariableGraph extends Graph<int> {
+ List<int> vertices;
+ List<TypeParameter> typeParameters;
+ List<DartType> bounds;
+
+ // `edges[i]` is the list of indices of type variables that reference the type
+ // variable with the index `i` in their bounds.
+ List<List<int>> edges;
+
+ _TypeVariableGraph(this.typeParameters, this.bounds) {
+ assert(typeParameters.length == bounds.length);
+
+ vertices = new List<int>(typeParameters.length);
+ Map<TypeParameter, int> typeParameterIndices = <TypeParameter, int>{};
+ edges = new List<List<int>>(typeParameters.length);
+ for (int i = 0; i < vertices.length; i++) {
+ vertices[i] = i;
+ typeParameterIndices[typeParameters[i]] = i;
+ edges[i] = <int>[];
+ }
+
+ for (int i = 0; i < vertices.length; i++) {
+ _OccurrenceCollectorVisitor collector =
+ new _OccurrenceCollectorVisitor(typeParameters.toSet());
+ collector.visit(bounds[i]);
+ for (TypeParameter typeParameter in collector.occurred) {
+ edges[typeParameterIndices[typeParameter]].add(i);
+ }
+ }
+ }
+
+ Iterable<int> neighborsOf(int index) {
+ return edges[index];
+ }
}
DartType instantiateToBounds(DartType type, Class object) {
@@ -777,3 +843,52 @@
return node.bound.accept(this);
}
}
+
+class _OccurrenceCollectorVisitor extends DartTypeVisitor {
+ final Set<TypeParameter> typeParameters;
+ Set<TypeParameter> occurred = new Set<TypeParameter>();
+
+ _OccurrenceCollectorVisitor(this.typeParameters);
+
+ visit(DartType node) => node.accept(this);
+
+ visitNamedType(NamedType node) {
+ node.type.accept(this);
+ }
+
+ visitInvalidType(InvalidType node);
+ visitDynamicType(DynamicType node);
+ visitVoidType(VoidType node);
+ visitVectorType(VectorType node);
+
+ visitInterfaceType(InterfaceType node) {
+ for (DartType argument in node.typeArguments) {
+ argument.accept(this);
+ }
+ }
+
+ visitTypedefType(TypedefType node) {
+ for (DartType argument in node.typeArguments) {
+ argument.accept(this);
+ }
+ }
+
+ visitFunctionType(FunctionType node) {
+ for (TypeParameter typeParameter in node.typeParameters) {
+ typeParameter.bound.accept(this);
+ }
+ for (DartType parameter in node.positionalParameters) {
+ parameter.accept(this);
+ }
+ for (NamedType namedParameter in node.namedParameters) {
+ namedParameter.type.accept(this);
+ }
+ node.returnType.accept(this);
+ }
+
+ visitTypeParameterType(TypeParameterType node) {
+ if (typeParameters.contains(node.parameter)) {
+ occurred.add(node.parameter);
+ }
+ }
+}
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 647c7e5..4ec3c11 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -173,6 +173,11 @@
crypto/test/sha1_test: Slow, Pass
crypto/test/sha256_test: Slow, Pass
+[ $compiler == dart2js && $browser && $fast_startup && $fasta ]
+analysis_server_client/test/analysis_server_client_test: RuntimeError
+js_ast/test/printer_callback_test: RuntimeError
+js_ast/test/string_escape_test: RuntimeError
+
[ $compiler == dart2js && $checked ]
crypto/test/base64_test: Slow, Pass
@@ -214,7 +219,6 @@
analyzer/test/src/task/strong/front_end_inference_test: Pass, Slow
[ $runtime == vm && $use_sdk ]
-compiler/tool/generate_kernel_test*: Skip # Issue 31899
kernel/test/metadata_test: Skip # Issue 31900
# Timeout. These tests do not run efficiently on our simulator or low-end
diff --git a/runtime/lib/map_patch.dart b/runtime/lib/map_patch.dart
index 3e71459..0e41c85 100644
--- a/runtime/lib/map_patch.dart
+++ b/runtime/lib/map_patch.dart
@@ -22,7 +22,7 @@
@patch
factory Map.unmodifiable(Map other) {
- return new UnmodifiableMapView<K, V>(new Map.from(other));
+ return new UnmodifiableMapView<K, V>(new Map<K, V>.from(other));
}
@patch
diff --git a/runtime/tests/vm/dart/regress32508_test.dart b/runtime/tests/vm/dart/regress32508_test.dart
new file mode 100644
index 0000000..37319c2
--- /dev/null
+++ b/runtime/tests/vm/dart/regress32508_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for dartbug.com/32508: check that type test which takes
+// a value of a guarded _Closure field is performed correctly.
+
+// VMOptions=--optimization_counter_threshold=10 --no-background-compilation
+
+import "package:expect/expect.dart";
+
+typedef R MyFunc<R, T1, T2>(T1 arg1, T2 arg2);
+
+class X {
+ Function _foo = (x) {};
+
+ bool bar() {
+ if (_foo is MyFunc<dynamic, dynamic, dynamic>) {
+ Expect.fail('Boom!');
+ }
+ return true;
+ }
+}
+
+main() {
+ for (var i = 0; i < 100; i++) {
+ Expect.isTrue(new X().bar());
+ }
+}
diff --git a/runtime/vm/compiler/assembler/assembler_arm.cc b/runtime/vm/compiler/assembler/assembler_arm.cc
index 14b68c0..2d7bfca 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm.cc
@@ -1533,32 +1533,24 @@
}
// Preserves object and value registers.
-void Assembler::StoreIntoObjectFilterNoSmi(Register object,
- Register value,
- Label* no_update) {
- COMPILE_ASSERT((kNewObjectAlignmentOffset == kWordSize) &&
- (kOldObjectAlignmentOffset == 0));
-
- // Write-barrier triggers if the value is in the new space (has bit set) and
- // the object is in the old space (has bit cleared).
- // To check that, we compute value & ~object and skip the write barrier
- // if the bit is not set. We can't destroy the object.
- bic(IP, value, Operand(object));
- tst(IP, Operand(kNewObjectAlignmentOffset));
- b(no_update, EQ);
-}
-
-// Preserves object and value registers.
void Assembler::StoreIntoObjectFilter(Register object,
Register value,
- Label* no_update) {
+ Label* label,
+ CanBeSmi value_can_be_smi,
+ BarrierFilterMode how_to_jump) {
+ COMPILE_ASSERT((kNewObjectAlignmentOffset == kWordSize) &&
+ (kOldObjectAlignmentOffset == 0));
// For the value we are only interested in the new/old bit and the tag bit.
// And the new bit with the tag bit. The resulting bit will be 0 for a Smi.
- and_(IP, value, Operand(value, LSL, kObjectAlignmentLog2 - 1));
- // And the result with the negated space bit of the object.
- bic(IP, IP, Operand(object));
+ if (value_can_be_smi == kValueCanBeSmi) {
+ and_(IP, value, Operand(value, LSL, kObjectAlignmentLog2 - 1));
+ // And the result with the negated space bit of the object.
+ bic(IP, IP, Operand(object));
+ } else {
+ bic(IP, value, Operand(object));
+ }
tst(IP, Operand(kNewObjectAlignmentOffset));
- b(no_update, EQ);
+ b(label, how_to_jump == kJumpToNoUpdate ? EQ : NE);
}
Register UseRegister(Register reg, RegList* used) {
@@ -1583,15 +1575,11 @@
void Assembler::StoreIntoObject(Register object,
const Address& dest,
Register value,
- bool can_value_be_smi) {
+ CanBeSmi can_be_smi) {
ASSERT(object != value);
str(value, dest);
Label done;
- if (can_value_be_smi) {
- StoreIntoObjectFilter(object, value, &done);
- } else {
- StoreIntoObjectFilterNoSmi(object, value, &done);
- }
+ StoreIntoObjectFilter(object, value, &done, can_be_smi, kJumpToNoUpdate);
// A store buffer update is required.
RegList regs = (1 << CODE_REG) | (1 << LR);
if (value != R0) {
@@ -1611,7 +1599,7 @@
void Assembler::StoreIntoObjectOffset(Register object,
int32_t offset,
Register value,
- bool can_value_be_smi) {
+ CanBeSmi can_value_be_smi) {
int32_t ignored = 0;
if (Address::CanHoldStoreOffset(kWord, offset - kHeapObjectTag, &ignored)) {
StoreIntoObject(object, FieldAddress(object, offset), value,
@@ -1628,7 +1616,7 @@
str(value, dest);
#if defined(DEBUG)
Label done;
- StoreIntoObjectFilter(object, value, &done);
+ StoreIntoObjectFilter(object, value, &done, kValueCanBeSmi, kJumpToNoUpdate);
Stop("Store buffer update is required");
Bind(&done);
#endif // defined(DEBUG)
@@ -1694,8 +1682,10 @@
str(value_even, Address(begin, -2 * kWordSize), HI);
#if defined(DEBUG)
Label done;
- StoreIntoObjectFilter(object, value_even, &done);
- StoreIntoObjectFilter(object, value_odd, &done);
+ StoreIntoObjectFilter(object, value_even, &done, kValueCanBeSmi,
+ kJumpToNoUpdate);
+ StoreIntoObjectFilter(object, value_odd, &done, kValueCanBeSmi,
+ kJumpToNoUpdate);
Stop("Store buffer update is required");
Bind(&done);
#endif // defined(DEBUG)
@@ -1720,8 +1710,10 @@
}
#if defined(DEBUG)
Label done;
- StoreIntoObjectFilter(object, value_even, &done);
- StoreIntoObjectFilter(object, value_odd, &done);
+ StoreIntoObjectFilter(object, value_even, &done, kValueCanBeSmi,
+ kJumpToNoUpdate);
+ StoreIntoObjectFilter(object, value_odd, &done, kValueCanBeSmi,
+ kJumpToNoUpdate);
Stop("Store buffer update is required");
Bind(&done);
#endif // defined(DEBUG)
diff --git a/runtime/vm/compiler/assembler/assembler_arm.h b/runtime/vm/compiler/assembler/assembler_arm.h
index b13d839..b4f890a 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.h
+++ b/runtime/vm/compiler/assembler/assembler_arm.h
@@ -772,14 +772,19 @@
void PushObject(const Object& object);
void CompareObject(Register rn, const Object& object);
+ enum CanBeSmi {
+ kValueIsNotSmi,
+ kValueCanBeSmi,
+ };
+
void StoreIntoObject(Register object, // Object we are storing into.
const Address& dest, // Where we are storing into.
Register value, // Value we are storing.
- bool can_value_be_smi = true);
+ CanBeSmi can_value_be_smi = kValueCanBeSmi);
void StoreIntoObjectOffset(Register object,
int32_t offset,
Register value,
- bool can_value_be_smi = true);
+ CanBeSmi can_value_be_smi = kValueCanBeSmi);
void StoreIntoObjectNoBarrier(Register object,
const Address& dest,
@@ -1227,12 +1232,21 @@
int32_t EncodeTstOffset(int32_t offset, int32_t inst);
int32_t DecodeTstOffset(int32_t inst);
- void StoreIntoObjectFilter(Register object, Register value, Label* no_update);
+ enum BarrierFilterMode {
+ // Filter falls through into the barrier update code. Target label
+ // is a "after-store" label.
+ kJumpToNoUpdate,
- // Shorter filtering sequence that assumes that value is not a smi.
- void StoreIntoObjectFilterNoSmi(Register object,
- Register value,
- Label* no_update);
+ // Filter falls through to the "after-store" code. Target label
+ // is barrier update code label.
+ kJumpToBarrier,
+ };
+
+ void StoreIntoObjectFilter(Register object,
+ Register value,
+ Label* label,
+ CanBeSmi can_be_smi,
+ BarrierFilterMode barrier_filter_mode);
DISALLOW_ALLOCATION();
DISALLOW_COPY_AND_ASSIGN(Assembler);
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.cc b/runtime/vm/compiler/assembler/assembler_arm64.cc
index 6eba840..e28333f 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64.cc
@@ -898,59 +898,56 @@
vmuls(vd, vd, VTMP);
}
-// Store into object.
// Preserves object and value registers.
-void Assembler::StoreIntoObjectFilterNoSmi(Register object,
- Register value,
- Label* no_update) {
+void Assembler::StoreIntoObjectFilter(Register object,
+ Register value,
+ Label* label,
+ CanBeSmi value_can_be_smi,
+ BarrierFilterMode how_to_jump) {
COMPILE_ASSERT((kNewObjectAlignmentOffset == kWordSize) &&
(kOldObjectAlignmentOffset == 0));
// Write-barrier triggers if the value is in the new space (has bit set) and
// the object is in the old space (has bit cleared).
- // To check that, we compute value & ~object and skip the write barrier
- // if the bit is not set. We can't destroy the object.
- bic(TMP, value, Operand(object));
- tbz(no_update, TMP, kNewObjectBitPosition);
-}
-
-// Preserves object and value registers.
-void Assembler::StoreIntoObjectFilter(Register object,
- Register value,
- Label* no_update) {
- // For the value we are only interested in the new/old bit and the tag bit.
- // And the new bit with the tag bit. The resulting bit will be 0 for a Smi.
- and_(TMP, value, Operand(value, LSL, kNewObjectBitPosition));
- // And the result with the negated space bit of the object.
- bic(TMP, TMP, Operand(object));
- tbz(no_update, TMP, kNewObjectBitPosition);
+ if (value_can_be_smi == kValueIsNotSmi) {
+ // To check that, we compute value & ~object and skip the write barrier
+ // if the bit is not set. We can't destroy the object.
+ bic(TMP, value, Operand(object));
+ } else {
+ // For the value we are only interested in the new/old bit and the tag bit.
+ // And the new bit with the tag bit. The resulting bit will be 0 for a Smi.
+ and_(TMP, value, Operand(value, LSL, kNewObjectBitPosition));
+ // And the result with the negated space bit of the object.
+ bic(TMP, TMP, Operand(object));
+ }
+ if (how_to_jump == kJumpToNoUpdate) {
+ tbz(label, TMP, kNewObjectBitPosition);
+ } else {
+ tbnz(label, TMP, kNewObjectBitPosition);
+ }
}
void Assembler::StoreIntoObjectOffset(Register object,
int32_t offset,
Register value,
- bool can_value_be_smi) {
+ CanBeSmi value_can_be_smi) {
if (Address::CanHoldOffset(offset - kHeapObjectTag)) {
StoreIntoObject(object, FieldAddress(object, offset), value,
- can_value_be_smi);
+ value_can_be_smi);
} else {
AddImmediate(TMP, object, offset - kHeapObjectTag);
- StoreIntoObject(object, Address(TMP), value, can_value_be_smi);
+ StoreIntoObject(object, Address(TMP), value, value_can_be_smi);
}
}
void Assembler::StoreIntoObject(Register object,
const Address& dest,
Register value,
- bool can_value_be_smi) {
+ CanBeSmi can_be_smi) {
ASSERT(object != value);
str(value, dest);
Label done;
- if (can_value_be_smi) {
- StoreIntoObjectFilter(object, value, &done);
- } else {
- StoreIntoObjectFilterNoSmi(object, value, &done);
- }
+ StoreIntoObjectFilter(object, value, &done, kValueCanBeSmi, kJumpToNoUpdate);
// A store buffer update is required.
if (value != R0) {
// Preserve R0.
@@ -977,7 +974,7 @@
str(value, dest);
#if defined(DEBUG)
Label done;
- StoreIntoObjectFilter(object, value, &done);
+ StoreIntoObjectFilter(object, value, &done, kValueCanBeSmi, kJumpToNoUpdate);
Stop("Store buffer update is required");
Bind(&done);
#endif // defined(DEBUG)
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.h b/runtime/vm/compiler/assembler/assembler_arm64.h
index b26fd9b..cfe69b9 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.h
+++ b/runtime/vm/compiler/assembler/assembler_arm64.h
@@ -1439,15 +1439,20 @@
StoreQToOffset(src, base, offset - kHeapObjectTag);
}
+ enum CanBeSmi {
+ kValueIsNotSmi,
+ kValueCanBeSmi,
+ };
+
// Storing into an object.
void StoreIntoObject(Register object,
const Address& dest,
Register value,
- bool can_value_be_smi = true);
+ CanBeSmi can_value_be_smi = kValueCanBeSmi);
void StoreIntoObjectOffset(Register object,
int32_t offset,
Register value,
- bool can_value_be_smi = true);
+ CanBeSmi can_value_be_smi = kValueCanBeSmi);
void StoreIntoObjectNoBarrier(Register object,
const Address& dest,
Register value);
@@ -1841,9 +1846,11 @@
ASSERT(Utils::IsInt(16, imm) && ((imm & 0x3) == 0));
ASSERT((rt != CSP) && (rt != R31));
const Register crt = ConcreteRegister(rt);
- const int32_t encoding = op | (static_cast<int32_t>(bit_number) << 19) |
- (static_cast<int32_t>(crt) << kRtShift) |
- encoded_offset;
+ int32_t bit_number_low = bit_number & 0x1f;
+ int32_t bit_number_hi = (bit_number & 0x20) >> 5;
+ const int32_t encoding =
+ op | (bit_number_low << 19) | (bit_number_hi << 31) |
+ (static_cast<int32_t>(crt) << kRtShift) | encoded_offset;
Emit(encoding);
}
@@ -2204,12 +2211,21 @@
Emit(encoding);
}
- void StoreIntoObjectFilter(Register object, Register value, Label* no_update);
+ enum BarrierFilterMode {
+ // Filter falls through into the barrier update code. Target label
+ // is a "after-store" label.
+ kJumpToNoUpdate,
- // Shorter filtering sequence that assumes that value is not a smi.
- void StoreIntoObjectFilterNoSmi(Register object,
- Register value,
- Label* no_update);
+ // Filter falls through to the "after-store" code. Target label
+ // is barrier update code label.
+ kJumpToBarrier,
+ };
+
+ void StoreIntoObjectFilter(Register object,
+ Register value,
+ Label* label,
+ CanBeSmi can_be_smi,
+ BarrierFilterMode barrier_filter_mode);
DISALLOW_ALLOCATION();
DISALLOW_COPY_AND_ASSIGN(Assembler);
diff --git a/runtime/vm/compiler/assembler/assembler_arm64_test.cc b/runtime/vm/compiler/assembler/assembler_arm64_test.cc
index fbfb286..a41fad24 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64_test.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64_test.cc
@@ -1008,15 +1008,22 @@
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
}
+static const int64_t kBits5And35 = (1 << 5) | (1ll << 35);
+
ASSEMBLER_TEST_GENERATE(TstBranchIfZero, assembler) {
- Label l;
+ Label l, l2;
__ movz(R0, Immediate(42), 0);
- __ movz(R1, Immediate((0 << 5) | 1), 0);
+ __ LoadImmediate(R1, ~kBits5And35);
__ tbz(&l, R1, 5);
__ movz(R0, Immediate(0), 0);
__ Bind(&l);
+
+ __ tbz(&l2, R1, 35);
+ __ movz(R0, Immediate(0), 0);
+ __ Bind(&l2);
+
__ ret();
}
@@ -1029,7 +1036,7 @@
Label l;
__ movz(R0, Immediate(0), 0);
- __ movz(R1, Immediate((1 << 5) | 1), 0);
+ __ LoadImmediate(R1, kBits5And35);
__ tbz(&l, R1, 5);
__ movz(R0, Immediate(42), 0);
@@ -1043,14 +1050,19 @@
}
ASSEMBLER_TEST_GENERATE(TstBranchIfNotZero, assembler) {
- Label l;
+ Label l, l2;
__ movz(R0, Immediate(42), 0);
- __ movz(R1, Immediate((1 << 5) | 1), 0);
+ __ LoadImmediate(R1, kBits5And35);
__ tbnz(&l, R1, 5);
__ movz(R0, Immediate(0), 0);
__ Bind(&l);
+
+ __ tbnz(&l2, R1, 35);
+ __ movz(R0, Immediate(0), 0);
+ __ Bind(&l2);
+
__ ret();
}
@@ -1063,7 +1075,7 @@
Label l;
__ movz(R0, Immediate(0), 0);
- __ movz(R1, Immediate((0 << 5) | 1), 0);
+ __ LoadImmediate(R1, ~kBits5And35);
__ tbnz(&l, R1, 5);
__ movz(R0, Immediate(42), 0);
@@ -1080,7 +1092,7 @@
Label l;
__ movz(R0, Immediate(42), 0);
- __ movz(R1, Immediate((0 << 5) | 1), 0);
+ __ LoadImmediate(R1, ~kBits5And35);
__ tbz(&l, R1, 5);
@@ -1103,7 +1115,7 @@
Label l;
__ movz(R0, Immediate(42), 0);
- __ movz(R1, Immediate((1 << 5) | 1), 0);
+ __ LoadImmediate(R1, kBits5And35);
__ tbnz(&l, R1, 5);
diff --git a/runtime/vm/compiler/assembler/assembler_dbc.h b/runtime/vm/compiler/assembler/assembler_dbc.h
index 29e6d3a..45bdb9e 100644
--- a/runtime/vm/compiler/assembler/assembler_dbc.h
+++ b/runtime/vm/compiler/assembler/assembler_dbc.h
@@ -80,7 +80,12 @@
static bool IsSafe(const Object& value) { return true; }
static bool IsSafeSmi(const Object& value) { return false; }
-// Bytecodes.
+ enum CanBeSmi {
+ kValueIsNotSmi,
+ kValueCanBeSmi,
+ };
+
+ // Bytecodes.
#define DECLARE_EMIT(Name, Signature, Fmt0, Fmt1, Fmt2) \
void Name(PARAMS_##Signature);
diff --git a/runtime/vm/compiler/assembler/assembler_ia32.cc b/runtime/vm/compiler/assembler/assembler_ia32.cc
index 363261f..035c00b 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32.cc
+++ b/runtime/vm/compiler/assembler/assembler_ia32.cc
@@ -1834,50 +1834,45 @@
}
// Destroys the value register.
-void Assembler::StoreIntoObjectFilterNoSmi(Register object,
- Register value,
- Label* no_update) {
- COMPILE_ASSERT((kNewObjectAlignmentOffset == kWordSize) &&
- (kOldObjectAlignmentOffset == 0));
-
- // Write-barrier triggers if the value is in the new space (has bit set) and
- // the object is in the old space (has bit cleared).
- // To check that we could compute value & ~object and skip the write barrier
- // if the bit is not set. However we can't destroy the object.
- // However to preserve the object we compute negated expression
- // ~value | object instead and skip the write barrier if the bit is set.
- notl(value);
- orl(value, object);
- testl(value, Immediate(kNewObjectAlignmentOffset));
- j(NOT_ZERO, no_update, Assembler::kNearJump);
-}
-
-// Destroys the value register.
void Assembler::StoreIntoObjectFilter(Register object,
Register value,
- Label* no_update) {
- ASSERT(kNewObjectAlignmentOffset == 4);
- ASSERT(kHeapObjectTag == 1);
- // Detect value being ...101 and object being ...001.
- andl(value, Immediate(7));
- leal(value, Address(value, object, TIMES_2, 9));
- testl(value, Immediate(0xf));
- j(NOT_ZERO, no_update, Assembler::kNearJump);
+ Label* label,
+ CanBeSmi can_be_smi,
+ BarrierFilterMode how_to_jump) {
+ if (can_be_smi == kValueIsNotSmi) {
+ COMPILE_ASSERT((kNewObjectAlignmentOffset == kWordSize) &&
+ (kOldObjectAlignmentOffset == 0));
+ // Write-barrier triggers if the value is in the new space (has bit set) and
+ // the object is in the old space (has bit cleared).
+ // To check that we could compute value & ~object and skip the write barrier
+ // if the bit is not set. However we can't destroy the object.
+ // However to preserve the object we compute negated expression
+ // ~value | object instead and skip the write barrier if the bit is set.
+ notl(value);
+ orl(value, object);
+ testl(value, Immediate(kNewObjectAlignmentOffset));
+ } else {
+ ASSERT(kNewObjectAlignmentOffset == 4);
+ ASSERT(kHeapObjectTag == 1);
+ // Detect value being ...101 and object being ...001.
+ andl(value, Immediate(7));
+ leal(value, Address(value, object, TIMES_2, 9));
+ testl(value, Immediate(0xf));
+ }
+ Condition condition = how_to_jump == kJumpToNoUpdate ? NOT_ZERO : ZERO;
+ bool distance = how_to_jump == kJumpToNoUpdate ? kNearJump : kFarJump;
+ j(condition, label, distance);
}
// Destroys the value register.
void Assembler::StoreIntoObject(Register object,
const Address& dest,
Register value,
- bool can_value_be_smi) {
+ CanBeSmi can_be_smi) {
ASSERT(object != value);
movl(dest, value);
Label done;
- if (can_value_be_smi) {
- StoreIntoObjectFilter(object, value, &done);
- } else {
- StoreIntoObjectFilterNoSmi(object, value, &done);
- }
+ StoreIntoObjectFilter(object, value, &done, can_be_smi, kJumpToNoUpdate);
// A store buffer update is required.
if (value != EDX) {
pushl(EDX); // Preserve EDX.
@@ -1899,7 +1894,7 @@
#if defined(DEBUG)
Label done;
pushl(value);
- StoreIntoObjectFilter(object, value, &done);
+ StoreIntoObjectFilter(object, value, &done, kValueCanBeSmi, kJumpToNoUpdate);
Stop("Store buffer update is required");
Bind(&done);
popl(value);
diff --git a/runtime/vm/compiler/assembler/assembler_ia32.h b/runtime/vm/compiler/assembler/assembler_ia32.h
index 0164bab..704550e7 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32.h
+++ b/runtime/vm/compiler/assembler/assembler_ia32.h
@@ -595,10 +595,15 @@
void CompareObject(Register reg, const Object& object);
void LoadDoubleConstant(XmmRegister dst, double value);
+ enum CanBeSmi {
+ kValueIsNotSmi,
+ kValueCanBeSmi,
+ };
+
void StoreIntoObject(Register object, // Object we are storing into.
const Address& dest, // Where we are storing into.
Register value, // Value we are storing.
- bool can_value_be_smi = true);
+ CanBeSmi can_value_be_smi = kValueCanBeSmi);
void StoreIntoObjectNoBarrier(Register object,
const Address& dest,
@@ -893,12 +898,22 @@
void EmitGenericShift(int rm, Register reg, const Immediate& imm);
void EmitGenericShift(int rm, const Operand& operand, Register shifter);
- void StoreIntoObjectFilter(Register object, Register value, Label* no_update);
+ enum BarrierFilterMode {
+ // Filter falls through into the barrier update code. Target label
+ // is a "after-store" label.
+ kJumpToNoUpdate,
- // Shorter filtering sequence that assumes that value is not a smi.
- void StoreIntoObjectFilterNoSmi(Register object,
- Register value,
- Label* no_update);
+ // Filter falls through to the "after-store" code. Target label
+ // is barrier update code label.
+ kJumpToBarrier,
+ };
+
+ void StoreIntoObjectFilter(Register object,
+ Register value,
+ Label* label,
+ CanBeSmi can_be_smi,
+ BarrierFilterMode barrier_filter_mode);
+
void UnverifiedStoreOldObject(const Address& dest, const Object& value);
int32_t jit_cookie();
diff --git a/runtime/vm/compiler/assembler/assembler_x64.cc b/runtime/vm/compiler/assembler/assembler_x64.cc
index b13e48a..72bbf42 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.cc
+++ b/runtime/vm/compiler/assembler/assembler_x64.cc
@@ -1207,49 +1207,44 @@
}
// Destroys the value register.
-void Assembler::StoreIntoObjectFilterNoSmi(Register object,
- Register value,
- Label* no_update) {
+void Assembler::StoreIntoObjectFilter(Register object,
+ Register value,
+ Label* label,
+ CanBeSmi can_be_smi,
+ BarrierFilterMode how_to_jump) {
COMPILE_ASSERT((kNewObjectAlignmentOffset == kWordSize) &&
(kOldObjectAlignmentOffset == 0));
- // Write-barrier triggers if the value is in the new space (has bit set) and
- // the object is in the old space (has bit cleared).
- // To check that we could compute value & ~object and skip the write barrier
- // if the bit is not set. However we can't destroy the object.
- // However to preserve the object we compute negated expression
- // ~value | object instead and skip the write barrier if the bit is set.
- notl(value);
- orl(value, object);
- testl(value, Immediate(kNewObjectAlignmentOffset));
- j(NOT_ZERO, no_update, Assembler::kNearJump);
-}
-
-// Destroys the value register.
-void Assembler::StoreIntoObjectFilter(Register object,
- Register value,
- Label* no_update) {
- ASSERT(kNewObjectAlignmentOffset == 8);
- ASSERT(kHeapObjectTag == 1);
- // Detect value being ...1001 and object being ...0001.
- andl(value, Immediate(0xf));
- leal(value, Address(value, object, TIMES_2, 0x15));
- testl(value, Immediate(0x1f));
- j(NOT_ZERO, no_update, Assembler::kNearJump);
+ if (can_be_smi == kValueIsNotSmi) {
+ // Write-barrier triggers if the value is in the new space (has bit set) and
+ // the object is in the old space (has bit cleared).
+ // To check that we could compute value & ~object and skip the write barrier
+ // if the bit is not set. However we can't destroy the object.
+ // However to preserve the object we compute negated expression
+ // ~value | object instead and skip the write barrier if the bit is set.
+ notl(value);
+ orl(value, object);
+ testl(value, Immediate(kNewObjectAlignmentOffset));
+ } else {
+ ASSERT(kHeapObjectTag == 1);
+ // Detect value being ...1001 and object being ...0001.
+ andl(value, Immediate(0xf));
+ leal(value, Address(value, object, TIMES_2, 0x15));
+ testl(value, Immediate(0x1f));
+ }
+ Condition condition = how_to_jump == kJumpToNoUpdate ? NOT_ZERO : ZERO;
+ bool distance = how_to_jump == kJumpToNoUpdate ? kNearJump : kFarJump;
+ j(condition, label, distance);
}
void Assembler::StoreIntoObject(Register object,
const Address& dest,
Register value,
- bool can_value_be_smi) {
+ CanBeSmi can_be_smi) {
ASSERT(object != value);
movq(dest, value);
Label done;
- if (can_value_be_smi) {
- StoreIntoObjectFilter(object, value, &done);
- } else {
- StoreIntoObjectFilterNoSmi(object, value, &done);
- }
+ StoreIntoObjectFilter(object, value, &done, can_be_smi, kJumpToNoUpdate);
// A store buffer update is required.
if (value != RDX) pushq(RDX);
if (object != RDX) {
@@ -1272,7 +1267,7 @@
#if defined(DEBUG)
Label done;
pushq(value);
- StoreIntoObjectFilter(object, value, &done);
+ StoreIntoObjectFilter(object, value, &done, kValueCanBeSmi, kJumpToNoUpdate);
Stop("Store buffer update is required");
Bind(&done);
popq(value);
diff --git a/runtime/vm/compiler/assembler/assembler_x64.h b/runtime/vm/compiler/assembler/assembler_x64.h
index 116ff36..83a80ff 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.h
+++ b/runtime/vm/compiler/assembler/assembler_x64.h
@@ -704,11 +704,16 @@
void PushObject(const Object& object);
void CompareObject(Register reg, const Object& object);
+ enum CanBeSmi {
+ kValueIsNotSmi,
+ kValueCanBeSmi,
+ };
+
// Destroys value.
void StoreIntoObject(Register object, // Object we are storing into.
const Address& dest, // Where we are storing into.
Register value, // Value we are storing.
- bool can_value_be_smi = true);
+ CanBeSmi can_be_smi = kValueCanBeSmi);
void StoreIntoObjectNoBarrier(Register object,
const Address& dest,
@@ -1037,12 +1042,22 @@
void EmitGenericShift(bool wide, int rm, Register reg, const Immediate& imm);
void EmitGenericShift(bool wide, int rm, Register operand, Register shifter);
- void StoreIntoObjectFilter(Register object, Register value, Label* no_update);
+ enum BarrierFilterMode {
+ // Filter falls through into the barrier update code. Target label
+ // is a "after-store" label.
+ kJumpToNoUpdate,
- // Shorter filtering sequence that assumes that value is not a smi.
- void StoreIntoObjectFilterNoSmi(Register object,
- Register value,
- Label* no_update);
+ // Filter falls through to the "after-store" code. Target label
+ // is barrier update code label.
+ kJumpToBarrier,
+ };
+
+ void StoreIntoObjectFilter(Register object,
+ Register value,
+ Label* label,
+ CanBeSmi can_be_smi,
+ BarrierFilterMode barrier_filter_mode);
+
// Unaware of write barrier (use StoreInto* methods for storing to objects).
void MoveImmediate(const Address& dst, const Immediate& imm);
diff --git a/runtime/vm/compiler/assembler/disassembler_arm64.cc b/runtime/vm/compiler/assembler/disassembler_arm64.cc
index ad102433..2fb2b93 100644
--- a/runtime/vm/compiler/assembler/disassembler_arm64.cc
+++ b/runtime/vm/compiler/assembler/disassembler_arm64.cc
@@ -358,7 +358,7 @@
return 6;
} else {
ASSERT(STRING_STARTS_WITH(format, "bitpos"));
- int bitpos = instr->Bits(19, 4) | (instr->Bit(31) << 5);
+ int bitpos = instr->Bits(19, 5) | (instr->Bit(31) << 5);
buffer_pos_ +=
Utils::SNPrint(current_position_in_buffer(),
remaining_size_in_buffer(), "#%d", bitpos);
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 94b1d80..44a6a4e 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -4050,11 +4050,12 @@
private:
friend class JitCallSpecializer; // For ASSERT(initialization_).
- bool CanValueBeSmi() const {
+ Assembler::CanBeSmi CanValueBeSmi() const {
const intptr_t cid = value()->Type()->ToNullableCid();
// Write barrier is skipped for nullable and non-nullable smis.
ASSERT(cid != kSmiCid);
- return (cid == kDynamicCid);
+ return cid == kDynamicCid ? Assembler::kValueCanBeSmi
+ : Assembler::kValueIsNotSmi;
}
const Field& field_;
@@ -4191,11 +4192,12 @@
PRINT_OPERANDS_TO_SUPPORT
private:
- bool CanValueBeSmi() const {
+ Assembler::CanBeSmi CanValueBeSmi() const {
const intptr_t cid = value()->Type()->ToNullableCid();
// Write barrier is skipped for nullable and non-nullable smis.
ASSERT(cid != kSmiCid);
- return (cid == kDynamicCid);
+ return cid == kDynamicCid ? Assembler::kValueCanBeSmi
+ : Assembler::kValueIsNotSmi;
}
const Field& field_;
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 0cbd93e..546542a 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -2770,7 +2770,6 @@
case kConstStaticInvocation:
EvaluateStaticInvocation();
break;
- case kConstructorInvocation:
case kConstConstructorInvocation:
EvaluateConstructorInvocationInternal();
break;
@@ -2795,11 +2794,9 @@
case kAsExpression:
EvaluateAsExpression();
break;
- case kListLiteral:
case kConstListLiteral:
EvaluateListLiteralInternal();
break;
- case kMapLiteral:
case kConstMapLiteral:
EvaluateMapLiteralInternal();
break;
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 7702bac..ad7d534 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -16805,7 +16805,18 @@
space);
}
// In strong mode, subtyping rules of callable instances are restricted.
- if (!isolate->strong()) {
+ if (isolate->strong()) {
+ // [this] is not a function type.
+ // If [other] is a function type, then [this] can't be a subtype of
+ // [other], according to Dart 2 subtyping rules.
+ // This check is needed to avoid falling through to class-based type
+ // tests, which yield incorrect result if [this] = _Closure class,
+ // and [other] is a function type, because class of a function type is
+ // also _Closure.
+ if (other.IsFunctionType()) {
+ return false;
+ }
+ } else {
// Check if type S has a call() method of function type T.
const Function& call_function =
Function::Handle(zone, type_cls.LookupCallFunctionForTypeTest());
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index 9ff89ee..5e691ac 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -31,8 +31,7 @@
DEFINE_FLAG(bool, trace_profiled_isolates, false, "Trace profiled isolates.");
-#if defined(HOST_OS_ANDROID) || defined(TARGET_ARCH_ARM64) || \
- defined(TARGET_ARCH_ARM)
+#if defined(TARGET_ARCH_ARM_6) || defined(TARGET_ARCH_ARM_5TE)
DEFINE_FLAG(int,
profile_period,
10000,
diff --git a/runtime/vm/simulator_arm64.cc b/runtime/vm/simulator_arm64.cc
index eece8ad..c115b7c 100644
--- a/runtime/vm/simulator_arm64.cc
+++ b/runtime/vm/simulator_arm64.cc
@@ -1700,19 +1700,19 @@
void Simulator::DecodeTestAndBranch(Instr* instr) {
const int op = instr->Bit(24);
- const int bitpos = instr->Bits(19, 4) | (instr->Bit(31) << 5);
+ const int bitpos = instr->Bits(19, 5) | (instr->Bit(31) << 5);
const int64_t imm14 = instr->SImm14Field();
const int64_t dest = get_pc() + (imm14 << 2);
const Register rt = instr->RtField();
const int64_t rt_val = get_register(rt, R31IsZR);
if (op == 0) {
// Format(instr, "tbz'sf 'rt, 'bitpos, 'dest14");
- if ((rt_val & (1 << bitpos)) == 0) {
+ if ((rt_val & (1ll << bitpos)) == 0) {
set_pc(dest);
}
} else {
// Format(instr, "tbnz'sf 'rt, 'bitpos, 'dest14");
- if ((rt_val & (1 << bitpos)) != 0) {
+ if ((rt_val & (1ll << bitpos)) != 0) {
set_pc(dest);
}
}
diff --git a/sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart b/sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart
index 3cd22d2..341ce90 100644
--- a/sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart
+++ b/sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart
@@ -299,7 +299,7 @@
return -1;
}
- String toString() => Maps.mapToString(this);
+ String toString() => MapBase.mapToString(this);
LinkedHashMapCell _getTableCell(var table, var key) {
return JS('var', '#[#]', table, key);
diff --git a/sdk/lib/collection/hash_map.dart b/sdk/lib/collection/hash_map.dart
index 8050607..08289f8 100644
--- a/sdk/lib/collection/hash_map.dart
+++ b/sdk/lib/collection/hash_map.dart
@@ -100,6 +100,9 @@
/**
* Creates a [HashMap] that contains all key/value pairs of [other].
+ *
+ * The keys must all be instances of [K] and the values of [V].
+ * The [other] map itself can have any type.
*/
factory HashMap.from(Map other) {
Map<K, V> result = new HashMap<K, V>();
@@ -110,6 +113,11 @@
}
/**
+ * Creates a [HashMap] that contains all key/value pairs of [other].
+ */
+ factory HashMap.of(Map<K, V> other) => new HashMap<K, V>()..addAll(other);
+
+ /**
* Creates a [HashMap] where the keys and values are computed from the
* [iterable].
*
diff --git a/sdk/lib/collection/hash_set.dart b/sdk/lib/collection/hash_set.dart
index e77d31c..b652da3 100644
--- a/sdk/lib/collection/hash_set.dart
+++ b/sdk/lib/collection/hash_set.dart
@@ -129,13 +129,14 @@
* two entries that are equal, but not identical, then the first one is
* the one in the resulting set.
*
- * All the [elements] should be assignable to [E].
+ * All the [elements] should be instances of [E].
* The `elements` iterable itself may have any element type, so this
* constructor can be used to down-cast a `Set`, for example as:
- *
- * Set<SuperType> superSet = ...;
- * Set<SubType> subSet =
- * new HashSet<SubType>.from(superSet.where((e) => e is SubType));
+ * ```dart
+ * Set<SuperType> superSet = ...;
+ * Set<SubType> subSet =
+ * new HashSet<SubType>.from(superSet.whereType<SubType>());
+ * ```
*/
factory HashSet.from(Iterable elements) {
HashSet<E> result = new HashSet<E>();
@@ -146,6 +147,17 @@
}
/**
+ * Create a hash set containing all [elements].
+ *
+ * Creates a hash set as by `new HashSet<E>()` and adds all given [elements]
+ * to the set. The elements are added in order. If [elements] contains
+ * two entries that are equal, but not identical, then the first one is
+ * the one in the resulting set.
+ */
+ factory HashSet.of(Iterable<E> elements) =>
+ new HashSet<E>()..addAll(elements);
+
+ /**
* Provides an iterator that iterates over the elements of this set.
*
* The order of iteration is unspecified,
diff --git a/sdk/lib/collection/linked_hash_map.dart b/sdk/lib/collection/linked_hash_map.dart
index 7e075fc..76029c3 100644
--- a/sdk/lib/collection/linked_hash_map.dart
+++ b/sdk/lib/collection/linked_hash_map.dart
@@ -87,6 +87,9 @@
/**
* Creates a [LinkedHashMap] that contains all key value pairs of [other].
+ *
+ * The keys must all be instances of [K] and the values to [V].
+ * The [other] map itself can have any type.
*/
factory LinkedHashMap.from(Map other) {
LinkedHashMap<K, V> result = new LinkedHashMap<K, V>();
@@ -97,6 +100,12 @@
}
/**
+ * Creates a [LinkedHashMap] that contains all key value pairs of [other].
+ */
+ factory LinkedHashMap.of(Map<K, V> other) =>
+ new LinkedHashMap<K, V>()..addAll(other);
+
+ /**
* Creates a [LinkedHashMap] where the keys and values are computed from the
* [iterable].
*
diff --git a/sdk/lib/collection/linked_hash_set.dart b/sdk/lib/collection/linked_hash_set.dart
index 672f58b..2fff2ec 100644
--- a/sdk/lib/collection/linked_hash_set.dart
+++ b/sdk/lib/collection/linked_hash_set.dart
@@ -95,7 +95,7 @@
* Creates a linked hash set as by `new LinkedHashSet<E>()` and adds each
* element of `elements` to this set in the order they are iterated.
*
- * All the [elements] should be assignable to [E].
+ * All the [elements] should be instances of [E].
* The `elements` iterable itself may have any element type,
* so this constructor can be used to down-cast a `Set`, for example as:
*
@@ -112,6 +112,15 @@
}
/**
+ * Create a linked hash set from [elements].
+ *
+ * Creates a linked hash set as by `new LinkedHashSet<E>()` and adds each
+ * element of `elements` to this set in the order they are iterated.
+ */
+ factory LinkedHashSet.of(Iterable<E> elements) =>
+ new LinkedHashSet<E>()..addAll(elements);
+
+ /**
* Executes a function on each element of the set.
*
* The elements are iterated in insertion order.
diff --git a/sdk/lib/collection/queue.dart b/sdk/lib/collection/queue.dart
index b27c5c5..48136e6 100644
--- a/sdk/lib/collection/queue.dart
+++ b/sdk/lib/collection/queue.dart
@@ -28,10 +28,27 @@
*
* The element order in the queue is as if the elements were added using
* [addLast] in the order provided by [elements.iterator].
+ *
+ * All the [elements] should be instances of [E].
+ * The `elements` iterable itself may have any element type, so this
+ * constructor can be used to down-cast a `Queue`, for example as:
+ * ```dart
+ * Queue<SuperType> superQueue = ...;
+ * Queue<SubType> subQueue =
+ * new Queue<SubType>.from(superSet.whereType<SubType>());
+ * ```
*/
factory Queue.from(Iterable elements) = ListQueue<E>.from;
/**
+ * Creates a queue from [elements].
+ *
+ * The element order in the queue is as if the elements were added using
+ * [addLast] in the order provided by [elements.iterator].
+ */
+ factory Queue.of(Iterable<E> elements) = ListQueue<E>.of;
+
+ /**
* Adapts [source] to be a `Queue<T>`.
*
* Any time the queue would produce an element that is not a [T],
@@ -312,6 +329,15 @@
*
* The element order in the queue is as if the elements were added using
* [addLast] in the order provided by [elements.iterator].
+ *
+ * All the [elements] should be instances of [E].
+ * The `elements` iterable itself may have any element type, so this
+ * constructor can be used to down-cast a `Queue`, for example as:
+ * ```dart
+ * Queue<SuperType> superQueue = ...;
+ * Queue<SubType> subQueue =
+ * new DoubleLinkedQueue<SubType>.from(superQueue.whereType<SubType>());
+ * ```
*/
factory DoubleLinkedQueue.from(Iterable elements) {
Queue<E> list = new DoubleLinkedQueue<E>();
@@ -321,6 +347,15 @@
return list;
}
+ /**
+ * Creates a double-linked queue from [elements].
+ *
+ * The element order in the queue is as if the elements were added using
+ * [addLast] in the order provided by [elements.iterator].
+ */
+ factory DoubleLinkedQueue.of(Iterable<E> elements) =>
+ new DoubleLinkedQueue<E>()..addAll(elements);
+
Queue<R> cast<R>() {
Queue<Object> self = this;
return self is Queue<R> ? self : Queue.castFrom<E, R>(this);
@@ -579,7 +614,14 @@
* The elements are added to the queue, as by [addLast], in the order given by
* `elements.iterator`.
*
- * All `elements` should be assignable to [E].
+ * All the [elements] should be instances of [E].
+ * The `elements` iterable itself may have any element type, so this
+ * constructor can be used to down-cast a `Queue`, for example as:
+ * ```dart
+ * Queue<SuperType> superQueue = ...;
+ * Queue<SubType> subQueue =
+ * new ListQueue<SubType>.from(superQueue.whereType<SubType>());
+ * ```
*/
factory ListQueue.from(Iterable elements) {
if (elements is List) {
@@ -604,6 +646,15 @@
}
}
+ /**
+ * Create a `ListQueue` from [elements].
+ *
+ * The elements are added to the queue, as by [addLast], in the order given by
+ * `elements.iterator`.
+ */
+ factory ListQueue.of(Iterable<E> elements) =>
+ new ListQueue<E>()..addAll(elements);
+
// Iterable interface.
Queue<R> cast<R>() {
diff --git a/sdk/lib/collection/splay_tree.dart b/sdk/lib/collection/splay_tree.dart
index 3022df2..99234f3 100644
--- a/sdk/lib/collection/splay_tree.dart
+++ b/sdk/lib/collection/splay_tree.dart
@@ -295,6 +295,9 @@
/**
* Creates a [SplayTreeMap] that contains all key/value pairs of [other].
+ *
+ * The keys must all be instances of [K] and the values of [V].
+ * The [other] map itself can have any type.
*/
factory SplayTreeMap.from(Map other,
[int compare(K key1, K key2), bool isValidKey(potentialKey)]) {
@@ -306,6 +309,13 @@
}
/**
+ * Creates a [SplayTreeMap] that contains all key/value pairs of [other].
+ */
+ factory SplayTreeMap.of(Map<K, V> other,
+ [int compare(K key1, K key2), bool isValidKey(potentialKey)]) =>
+ new SplayTreeMap<K, V>(compare, isValidKey)..addAll(other);
+
+ /**
* Creates a [SplayTreeMap] where the keys and values are computed from the
* [iterable].
*
@@ -721,7 +731,15 @@
*
* The set works as if created by `new SplayTreeSet<E>(compare, isValidKey)`.
*
- * All the [elements] should be valid as arguments to the [compare] function.
+ * All the [elements] should be instances of [E] and valid arguments to
+ * [compare].
+ * The `elements` iterable itself may have any element type, so this
+ * constructor can be used to down-cast a `Set`, for example as:
+ * ```dart
+ * Set<SuperType> superSet = ...;
+ * Set<SubType> subSet =
+ * new SplayTreeSet<SubType>.from(superSet.whereType<SubType>());
+ * ```
*/
factory SplayTreeSet.from(Iterable elements,
[int compare(E key1, E key2), bool isValidKey(potentialKey)]) {
@@ -733,6 +751,17 @@
return result;
}
+ /**
+ * Creates a [SplayTreeSet] from [elements].
+ *
+ * The set works as if created by `new SplayTreeSet<E>(compare, isValidKey)`.
+ *
+ * All the [elements] should be valid as arguments to the [compare] function.
+ */
+ factory SplayTreeSet.of(Iterable<E> elements,
+ [int compare(E key1, E key2), bool isValidKey(potentialKey)]) =>
+ new SplayTreeSet(compare, isValidKey)..addAll(elements);
+
Set<T> _newSet<T>() =>
new SplayTreeSet<T>((T a, T b) => _comparator(a as E, b as E), _validKey);
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 77e40e0..8df6ca5 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -114,12 +114,32 @@
*
* The [Iterator] of [elements] provides the order of the elements.
*
- * This constructor returns a growable list when [growable] is true;
+ * All the [elements] should be instances of [E].
+ * The `elements` iterable itself may have any element type, so this
+ * constructor can be used to down-cast a `List`, for example as:
+ * ```dart
+ * List<SuperType> superList = ...;
+ * List<SubType> subList =
+ * new List<SubType>.from(superList.whereType<SubType>());
+ * ```
+ *
+ * This constructor creates a growable list when [growable] is true;
* otherwise, it returns a fixed-length list.
*/
external factory List.from(Iterable elements, {bool growable: true});
/**
+ * Creates a list from [elements].
+ *
+ * The [Iterator] of [elements] provides the order of the elements.
+ *
+ * This constructor creates a growable list when [growable] is true;
+ * otherwise, it returns a fixed-length list.
+ */
+ factory List.of(Iterable<E> elements, {bool growable: true}) =>
+ new List<E>.from(elements, growable: growable);
+
+ /**
* Generates a list of values.
*
* Creates a list with [length] positions and fills it with values created by
diff --git a/sdk/lib/core/map.dart b/sdk/lib/core/map.dart
index 9e9741a..ae6857a 100644
--- a/sdk/lib/core/map.dart
+++ b/sdk/lib/core/map.dart
@@ -45,7 +45,7 @@
* Creates a [LinkedHashMap] instance that contains all key/value pairs of
* [other].
*
- * The keys must all be assignable to [K] and the values to [V].
+ * The keys must all be instances of [K] and the values of [V].
* The [other] map itself can have any type.
*
* A `LinkedHashMap` requires the keys to implement compatible
@@ -55,9 +55,18 @@
factory Map.from(Map other) = LinkedHashMap<K, V>.from;
/**
+ * Creates a [LinkedHashMap] with the same keys and values as [other].
+ *
+ * A `LinkedHashMap` requires the keys to implement compatible
+ * `operator==` and `hashCode`, and it allows `null` as a key.
+ * It iterates in key insertion order.
+ */
+ factory Map.of(Map<K, V> other) = LinkedHashMap<K, V>.of;
+
+ /**
* Creates an unmodifiable hash based map containing the entries of [other].
*
- * The keys must all be assignable to [K] and the values to [V].
+ * The keys must all be instances of [K] and the values of [V].
* The [other] map itself can have any type.
*
* The map requires the keys to implement compatible
@@ -399,4 +408,6 @@
const factory MapEntry(K key, V value) = MapEntry<K, V>._;
const MapEntry._(this.key, this.value);
+
+ String toString() => "MapEntry($key: $value)";
}
diff --git a/sdk/lib/core/set.dart b/sdk/lib/core/set.dart
index e58ea10..8d95d2d 100644
--- a/sdk/lib/core/set.dart
+++ b/sdk/lib/core/set.dart
@@ -61,7 +61,7 @@
/**
* Creates a [Set] that contains all [elements].
*
- * All the [elements] should be assignable to [E].
+ * All the [elements] should be instances of [E].
* The `elements` iterable itself can have any type,
* so this constructor can be used to down-cast a `Set`, for example as:
*
@@ -79,6 +79,18 @@
factory Set.from(Iterable elements) = LinkedHashSet<E>.from;
/**
+ * Creates a [Set] from [elements].
+ *
+ * The created [Set] is a [LinkedHashSet]. As such, it considers elements that
+ * are equal (using [==]) to be indistinguishable, and requires them to
+ * have a compatible [Object.hashCode] implementation.
+ *
+ * The set is equivalent to one created by
+ * `new LinkedHashSet<E>.of(elements)`.
+ */
+ factory Set.of(Iterable<E> elements) = LinkedHashSet<E>.of;
+
+ /**
* Adapts [source] to be a `Set<T>`.
*
* If [newSet] is provided, it is used to create the new sets returned
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 1d1faa0..9944d46 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -725,7 +725,7 @@
LayoutTests/fast/forms/input-appearance-elementFromPoint_t01: RuntimeError # Please triage this failure
LayoutTests/fast/forms/input-hit-test-border_t01: Pass, RuntimeError # Please triage this failure
LayoutTests/fast/forms/input-inputmode_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/forms/input-width-height-attributes-without-renderer-loaded-image_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/forms/input-width-height-attributes-without-renderer-loaded-image_t01: Pass, RuntimeError # Please triage this failure
LayoutTests/fast/forms/listbox-selection-2_t01: RuntimeError # Please triage this failure
LayoutTests/fast/forms/menulist-disabled-selected-option_t01: RuntimeError # Please triage this failure
LayoutTests/fast/forms/menulist-selection-reset_t01: RuntimeError # Please triage this failure
@@ -1498,8 +1498,8 @@
LayoutTests/fast/canvas/webgl/attrib-location-length-limits_t01: RuntimeError # Please triage this failure
LayoutTests/fast/canvas/webgl/attrib-location-length-limits_t01: Pass, RuntimeError # Issue 29634
LayoutTests/fast/canvas/webgl/bad-arguments-test_t01: Pass, RuntimeError # Issue 29634
-LayoutTests/fast/canvas/webgl/buffer-bind-test_t01: RuntimeError # Please triage this failure
LayoutTests/fast/canvas/webgl/buffer-bind-test_t01: Pass, RuntimeError # Issue 29634
+LayoutTests/fast/canvas/webgl/buffer-bind-test_t01: RuntimeError # Please triage this failure
LayoutTests/fast/canvas/webgl/buffer-data-array-buffer_t01: RuntimeError # Please triage this failure
LayoutTests/fast/canvas/webgl/canvas-2d-webgl-texture_t01: RuntimeError # Please triage this failure
LayoutTests/fast/canvas/webgl/canvas-2d-webgl-texture_t01: Pass, RuntimeError # Issue 29634
@@ -3701,6 +3701,10 @@
[ $compiler == dart2js && $runtime == ff && !$checked ]
LayoutTests/fast/xpath/invalid-resolver_t01: RuntimeError # Please triage this failure
+[ $compiler == dart2js && $runtime == ff && $fasta ]
+LibTest/html/Window/requestFileSystem_A01_t01: Crash
+LibTest/html/Window/requestFileSystem_A01_t02: Crash
+
[ $compiler == dart2js && $runtime == ie11 ]
Language/Expressions/Conditional/type_t04: Skip # Times out. Please triage this failure
Language/Expressions/Identifier_Reference/evaluation_function_t02: Skip # Times out. Please triage this failure
@@ -6479,8 +6483,8 @@
LibTest/html/IFrameElement/getClientRects_A01_t02: RuntimeError # Please triage this failure
LibTest/html/IFrameElement/getNamespacedAttributes_A01_t01: RuntimeError # Please triage this failure
LibTest/html/IFrameElement/innerHtml_A01_t01: RuntimeError # Please triage this failure
-LibTest/html/IFrameElement/isContentEditable_A01_t01: RuntimeError # Please triage this failure
LibTest/html/IFrameElement/isContentEditable_A01_t01: RuntimeError, Pass # Fails 19 out of 20.
+LibTest/html/IFrameElement/isContentEditable_A01_t01: RuntimeError # Please triage this failure
LibTest/html/IFrameElement/leftView_A01_t01: RuntimeError # Please triage this failure
LibTest/html/IFrameElement/marginEdge_A01_t01: RuntimeError # Please triage this failure
LibTest/html/IFrameElement/offsetTo_A01_t01: RuntimeError # Please triage this failure
@@ -6918,6 +6922,16 @@
LibTest/core/Uri/Uri_A06_t03: Slow, Pass # Please triage this failure
LibTest/math/Point/operator_mult_A02_t01: RuntimeError # Issue 1533
+[ $compiler == dart2js && $checked && $fast_startup && $fasta && $minified ]
+Language/Libraries_and_Scripts/Imports/deferred_import_t02: RuntimeError
+
+[ $compiler == dart2js && $checked && $fasta && $host_checked ]
+Language/Classes/Constructors/Factories/function_type_t02: RuntimeError
+Language/Expressions/Instance_Creation/New/redirecting_factory_constructor_t02: RuntimeError
+Language/Generics/malformed_t02: Crash
+Language/Libraries_and_Scripts/Imports/deferred_import_t02: RuntimeError
+LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01: RuntimeError
+
[ $compiler == dart2js && !$checked && $enable_asserts ]
Language/Statements/Assert/execution_t01: SkipByDesign # Unspec'd feature.
Language/Statements/Assert/execution_t02: SkipByDesign # Unspec'd feature.
@@ -7015,7 +7029,6 @@
Language/Expressions/Constants/exception_t02: MissingCompileTimeError
Language/Expressions/Constants/logical_expression_t04: MissingCompileTimeError
Language/Expressions/Function_Invocation/Unqualified_Invocation/instance_context_invocation_t04: Crash
-Language/Expressions/Identifier_Reference/evaluation_variable_or_parameter_t02: RuntimeError
Language/Expressions/Instance_Creation/Const/exception_t01: MissingCompileTimeError
Language/Expressions/Maps/syntax_t08: Crash
Language/Expressions/Method_Invocation/Ordinary_Invocation/evaluation_t08: RuntimeError
@@ -7218,6 +7231,19 @@
LibTest/html/Window/requestFileSystem_A01_t02: Crash
LibTest/html/Window/requestFileSystem_A02_t01: Crash
+[ $compiler == dart2js && $fasta && $minified ]
+Language/Expressions/Assignment/expression_assignment_failed_t01: RuntimeError
+Language/Expressions/Assignment/expression_assignment_failed_t02: RuntimeError
+Language/Expressions/Assignment/expression_assignment_value_t02: RuntimeError
+Language/Expressions/Assignment/indexed_expression_t04: RuntimeError
+Language/Expressions/Function_Invocation/Function_Expression_Invocation/property_extraction_t02: RuntimeError
+Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t02: RuntimeError
+Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t03: RuntimeError
+LibTest/core/Invocation/memberName_A01_t01: RuntimeError
+
+[ $compiler == dart2js && $fasta && !$minified ]
+Language/Expressions/Identifier_Reference/evaluation_variable_or_parameter_t02: RuntimeError
+
[ $compiler == dart2js && !$fasta ]
Language/Classes/Constructors/Generative_Constructors/execution_t03: RuntimeError # https://github.com/dart-lang/sdk/issues/29596
Language/Classes/Getters/static_getter_t02: CompileTimeError # Should be fixed with unified frontend. Issue 24534
diff --git a/tests/compiler/dart2js/all_native_test.dart b/tests/compiler/dart2js/all_native_test.dart
index 3d1d5fd..e1f236c 100644
--- a/tests/compiler/dart2js/all_native_test.dart
+++ b/tests/compiler/dart2js/all_native_test.dart
@@ -10,9 +10,9 @@
main() {
asyncTest(() async {
print('--test from ast---------------------------------------------------');
- await test([]);
+ await test([Flags.useOldFrontend]);
print('--test from kernel------------------------------------------------');
- await test([Flags.useKernel]);
+ await test([]);
});
}
diff --git a/tests/compiler/dart2js/codegen/expect_annotations2_test.dart b/tests/compiler/dart2js/codegen/expect_annotations2_test.dart
index 3dea0f3..81d8a0a 100644
--- a/tests/compiler/dart2js/codegen/expect_annotations2_test.dart
+++ b/tests/compiler/dart2js/codegen/expect_annotations2_test.dart
@@ -42,7 +42,7 @@
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
// Simply check that the constants of the small functions are still in the
// output, and that we don't see the result of constant folding.
String jsOutput = collector.getOutput('', OutputType.js);
diff --git a/tests/compiler/dart2js/codegen/expect_annotations_test.dart b/tests/compiler/dart2js/codegen/expect_annotations_test.dart
index d4cacfa..89619b6 100644
--- a/tests/compiler/dart2js/codegen/expect_annotations_test.dart
+++ b/tests/compiler/dart2js/codegen/expect_annotations_test.dart
@@ -60,7 +60,7 @@
runTest({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
Expect.isFalse(compiler.compilationFailed, 'Unsuccessful compilation');
diff --git a/tests/compiler/dart2js/codegen/gvn_dynamic_field_get_test.dart b/tests/compiler/dart2js/codegen/gvn_dynamic_field_get_test.dart
index 7d03a19..f9381f8 100644
--- a/tests/compiler/dart2js/codegen/gvn_dynamic_field_get_test.dart
+++ b/tests/compiler/dart2js/codegen/gvn_dynamic_field_get_test.dart
@@ -34,7 +34,7 @@
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': TEST},
outputProvider: outputCollector,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
ClosedWorldBase closedWorld =
compiler.resolutionWorldBuilder.closedWorldForTesting;
diff --git a/tests/compiler/dart2js/codegen/is_function_test.dart b/tests/compiler/dart2js/codegen/is_function_test.dart
index d594a90..9f1676d 100644
--- a/tests/compiler/dart2js/codegen/is_function_test.dart
+++ b/tests/compiler/dart2js/codegen/is_function_test.dart
@@ -20,8 +20,8 @@
main() {
runTest({bool useKernel}) async {
List<String> options = [Flags.enableCheckedMode];
- if (useKernel) {
- options.add(Flags.useKernel);
+ if (!useKernel) {
+ options.add(Flags.useOldFrontend);
}
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': SOURCE}, options: options);
diff --git a/tests/compiler/dart2js/codegen/number_output_test.dart b/tests/compiler/dart2js/codegen/number_output_test.dart
index e755932..07e7126 100644
--- a/tests/compiler/dart2js/codegen/number_output_test.dart
+++ b/tests/compiler/dart2js/codegen/number_output_test.dart
@@ -23,8 +23,8 @@
Future test({bool useKernel, bool minify}) async {
OutputCollector collector = new OutputCollector();
List<String> options = <String>[];
- if (useKernel) {
- options.add(Flags.useKernel);
+ if (!useKernel) {
+ options.add(Flags.useOldFrontend);
}
if (minify) {
options.add(Flags.minify);
diff --git a/tests/compiler/dart2js/codegen/trust_type_annotations2_test.dart b/tests/compiler/dart2js/codegen/trust_type_annotations2_test.dart
index 40e7651..ba65ade 100644
--- a/tests/compiler/dart2js/codegen/trust_type_annotations2_test.dart
+++ b/tests/compiler/dart2js/codegen/trust_type_annotations2_test.dart
@@ -27,8 +27,8 @@
main() {
runTest({bool useKernel}) async {
var options = [Flags.trustTypeAnnotations];
- if (useKernel) {
- options.add(Flags.useKernel);
+ if (!useKernel) {
+ options.add(Flags.useOldFrontend);
}
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, options: options);
diff --git a/tests/compiler/dart2js/codegen/trust_type_annotations_test.dart b/tests/compiler/dart2js/codegen/trust_type_annotations_test.dart
index 1f09909..ff423ac 100644
--- a/tests/compiler/dart2js/codegen/trust_type_annotations_test.dart
+++ b/tests/compiler/dart2js/codegen/trust_type_annotations_test.dart
@@ -52,8 +52,8 @@
void main() {
runTest({bool useKernel}) async {
var options = [Flags.trustTypeAnnotations];
- if (useKernel) {
- options.add(Flags.useKernel);
+ if (!useKernel) {
+ options.add(Flags.useOldFrontend);
}
var result = await runCompiler(
memorySourceFiles: {'main.dart': TEST}, options: options);
diff --git a/tests/compiler/dart2js/codegen/unused_empty_map_test.dart b/tests/compiler/dart2js/codegen/unused_empty_map_test.dart
index 0b52c0c..db577be 100644
--- a/tests/compiler/dart2js/codegen/unused_empty_map_test.dart
+++ b/tests/compiler/dart2js/codegen/unused_empty_map_test.dart
@@ -27,7 +27,7 @@
await runCompiler(
memorySourceFiles: TEST_SOURCE,
outputProvider: collector,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
String generated = collector.getOutput('', OutputType.js);
Expect.isFalse(generated.contains(HASHMAP_EMPTY_CONSTRUCTOR));
}
diff --git a/tests/compiler/dart2js/codegen/use_checks_test.dart b/tests/compiler/dart2js/codegen/use_checks_test.dart
index 7647e8f..283e81c 100644
--- a/tests/compiler/dart2js/codegen/use_checks_test.dart
+++ b/tests/compiler/dart2js/codegen/use_checks_test.dart
@@ -26,7 +26,7 @@
main() {
runTest({bool useKernel}) async {
var options = [Flags.enableCheckedMode];
- if (useKernel) options.add(Flags.useKernel);
+ if (!useKernel) options.add(Flags.useOldFrontend);
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, options: options);
var compiler = result.compiler;
diff --git a/tests/compiler/dart2js/codegen/use_strict_test.dart b/tests/compiler/dart2js/codegen/use_strict_test.dart
index b11d254..fe3cd70 100644
--- a/tests/compiler/dart2js/codegen/use_strict_test.dart
+++ b/tests/compiler/dart2js/codegen/use_strict_test.dart
@@ -53,7 +53,7 @@
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
String jsOutput = collector.getOutput('', OutputType.js);
// Skip comments.
diff --git a/tests/compiler/dart2js/codegen/value_range3_test.dart b/tests/compiler/dart2js/codegen/value_range3_test.dart
index 9296662..899f5f3 100644
--- a/tests/compiler/dart2js/codegen/value_range3_test.dart
+++ b/tests/compiler/dart2js/codegen/value_range3_test.dart
@@ -27,7 +27,7 @@
runTest({bool useKernel}) async {
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
var compiler = result.compiler;
var element =
compiler.backendClosedWorldForTesting.elementEnvironment.mainFunction;
diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart
index 05f79fd..dfd7721 100644
--- a/tests/compiler/dart2js/compiler_helper.dart
+++ b/tests/compiler/dart2js/compiler_helper.dart
@@ -75,8 +75,8 @@
if (trustJSInteropTypeAnnotations) {
options.add(Flags.trustJSInteropTypeAnnotations);
}
- if (useKernel) {
- options.add(Flags.useKernel);
+ if (!useKernel) {
+ options.add(Flags.useOldFrontend);
}
if (disableInlining) {
options.add(Flags.disableInlining);
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index 39af62a..6fd332e 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -1,7 +1,6 @@
# Copyright (c) 2012, 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.
-
analyze_dart_test: Slow, Pass
analyze_test: Slow, Pass
async_await_syntax_test: Pass # DON'T CHANGE THIS LINE -- Don't mark these tests as failing. Instead, fix the errors/warnings that they report or update the whitelist in the test-files to temporarily allow digression.
@@ -12,6 +11,8 @@
codegen/simple_function_subtype_test: Fail # simple_function_subtype_test is temporarily(?) disabled due to new method for building function type tests.
deferred_loading/deferred_loading_test: Slow, Pass
equivalence/id_equivalence_test: Pass, Slow
+generate_code_with_compile_time_errors_test: RuntimeError # not supported yet with the new FE.
+in_user_code_test: RuntimeError # analyze-only with CFE is not complete (Issues 32512, 32513)
inference/inference0_test: Slow, Pass
inference/inference1_test: Slow, Pass
inference/simple_inferrer_const_closure2_test: Fail # Issue 16507
@@ -30,13 +31,11 @@
mirrors/library_imports_shown_test: Fail
no_such_method_enabled_test: Pass, Slow
old_frontend/check_elements_invariants_test: Skip # Times out even with Slow marker. Slow due to inlining in the CPS backend
-old_frontend/check_elements_invariants_test: Skip # Times out even with Slow marker. Slow due to inlining in the CPS backend
-old_frontend/compile_with_empty_libraries_test: Fail # Issue 24223
old_frontend/compile_with_empty_libraries_test: Fail # Issue 24223
old_frontend/patch_test/bug: RuntimeError # Issue 21132
old_frontend/resolver_test: RuntimeError # Test must be updated given new parser recovery
packages/*: Skip # Skip packages folder
-quarantined/http_test: Pass, Slow
+quarantined/http_test: RuntimeError # not supported with CFE, consider deleting.
rti/rti_emission_test: Pass, Slow
rti/rti_need_test: Pass, Slow
serialization/analysis1_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
@@ -59,6 +58,8 @@
serialization/model_1_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/native_data_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/reserialization_test: Slow, RuntimeError # Issue 32149
+show_package_warnings_test: RuntimeError # missing errors from the FE
+sourcemaps/pub_build_validity_test: Pass, RuntimeError # Investigate: passes locally, but only fails in bots.
sourcemaps/source_mapping_invokes_test: Pass, Slow
sourcemaps/source_mapping_operators_test: Pass, Slow
sourcemaps/source_mapping_test: Pass, Slow
@@ -88,8 +89,8 @@
dart2js_batch2_test: Pass, RuntimeError # Issue 29021
[ $checked ]
-codegen/value_range_test: Pass, Slow
codegen/value_range_kernel_test: Pass, Slow
+codegen/value_range_test: Pass, Slow
end_to_end/exit_code_test: Pass, Slow
jsinterop/declaration_test: Slow, Pass
jsinterop/interop_anonymous_unreachable_test: Pass, Slow
diff --git a/tests/compiler/dart2js/deferred/closures_test.dart b/tests/compiler/dart2js/deferred/closures_test.dart
index 30279cc..9e97701 100644
--- a/tests/compiler/dart2js/deferred/closures_test.dart
+++ b/tests/compiler/dart2js/deferred/closures_test.dart
@@ -23,7 +23,7 @@
runTest({bool useKernel}) async {
OutputCollector collector = new OutputCollector();
- var options = useKernel ? [Flags.useKernel] : [];
+ var options = useKernel ? [] : [Flags.useOldFrontend];
await runCompiler(
memorySourceFiles: sources, outputProvider: collector, options: options);
String mainOutput = collector.getOutput("", OutputType.js);
diff --git a/tests/compiler/dart2js/deferred/custom_element_test.dart b/tests/compiler/dart2js/deferred/custom_element_test.dart
index 385e3c1..b47edfa 100644
--- a/tests/compiler/dart2js/deferred/custom_element_test.dart
+++ b/tests/compiler/dart2js/deferred/custom_element_test.dart
@@ -24,7 +24,7 @@
runTest({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
var outputUnitForEntity = compiler.backend.outputUnitData.outputUnitForEntity;
diff --git a/tests/compiler/dart2js/deferred/dont_inline_deferred_constants_test.dart b/tests/compiler/dart2js/deferred/dont_inline_deferred_constants_test.dart
index 97822e1..23d692f 100644
--- a/tests/compiler/dart2js/deferred/dont_inline_deferred_constants_test.dart
+++ b/tests/compiler/dart2js/deferred/dont_inline_deferred_constants_test.dart
@@ -19,7 +19,7 @@
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
var elementEnvironment = closedWorld.elementEnvironment;
diff --git a/tests/compiler/dart2js/deferred/dont_inline_deferred_globals_test.dart b/tests/compiler/dart2js/deferred/dont_inline_deferred_globals_test.dart
index af56ad9..558f585 100644
--- a/tests/compiler/dart2js/deferred/dont_inline_deferred_globals_test.dart
+++ b/tests/compiler/dart2js/deferred/dont_inline_deferred_globals_test.dart
@@ -19,7 +19,7 @@
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
var elementEnvironment = closedWorld.elementEnvironment;
diff --git a/tests/compiler/dart2js/deferred/emit_type_checks_test.dart b/tests/compiler/dart2js/deferred/emit_type_checks_test.dart
index e1aedd5b..370fc30 100644
--- a/tests/compiler/dart2js/deferred/emit_type_checks_test.dart
+++ b/tests/compiler/dart2js/deferred/emit_type_checks_test.dart
@@ -20,7 +20,7 @@
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
String mainOutput = collector.getOutput('', OutputType.js);
String deferredOutput = collector.getOutput('out_1', OutputType.jsPart);
diff --git a/tests/compiler/dart2js/deferred/follow_constant_dependencies_test.dart b/tests/compiler/dart2js/deferred/follow_constant_dependencies_test.dart
index 1be380f..6944dff 100644
--- a/tests/compiler/dart2js/deferred/follow_constant_dependencies_test.dart
+++ b/tests/compiler/dart2js/deferred/follow_constant_dependencies_test.dart
@@ -15,7 +15,7 @@
runTest({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
var outputUnitForConstant =
compiler.backend.outputUnitData.outputUnitForConstant;
diff --git a/tests/compiler/dart2js/deferred/follow_implicit_super_regression_test.dart b/tests/compiler/dart2js/deferred/follow_implicit_super_regression_test.dart
index 93ca8bc..b83812e 100644
--- a/tests/compiler/dart2js/deferred/follow_implicit_super_regression_test.dart
+++ b/tests/compiler/dart2js/deferred/follow_implicit_super_regression_test.dart
@@ -13,7 +13,7 @@
runTest({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
dart2js.Compiler compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
var elementEnvironment = closedWorld.elementEnvironment;
diff --git a/tests/compiler/dart2js/deferred/inline_restrictions_test.dart b/tests/compiler/dart2js/deferred/inline_restrictions_test.dart
index 12585ca..a296c65e 100644
--- a/tests/compiler/dart2js/deferred/inline_restrictions_test.dart
+++ b/tests/compiler/dart2js/deferred/inline_restrictions_test.dart
@@ -17,20 +17,16 @@
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES, outputProvider: collector);
Compiler compiler = result.compiler;
-
- lookupLibrary(name) {
- return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
- }
-
+ var env = compiler.backendClosedWorldForTesting.elementEnvironment;
var outputUnitForEntity =
compiler.backend.outputUnitData.outputUnitForEntity;
-
+ lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic lib1 = lookupLibrary("memory:lib1.dart");
- var inlineMeAway = lib1.find("inlineMeAway");
+ var inlineMeAway = env.lookupLibraryMember(lib1, "inlineMeAway");
var ou_lib1 = outputUnitForEntity(inlineMeAway);
dynamic lib3 = lookupLibrary("memory:lib3.dart");
- var sameContextInline = lib3.find("sameContextInline");
+ var sameContextInline = env.lookupLibraryMember(lib3, "sameContextInline");
var ou_lib3 = outputUnitForEntity(sameContextInline);
// Test that we actually got different output units.
@@ -42,23 +38,25 @@
String lib3Output =
collector.getOutput("out_${ou_lib3.name}", OutputType.jsPart);
- RegExp re1 = new RegExp(r"inlined as empty");
- RegExp re2 = new RegExp(r"inlined from main");
- RegExp re3 = new RegExp(r"inlined from lib1");
- RegExp re4 = new RegExp(r"inline same context");
-
// Test that inlineMeAway was inlined and its argument thus dropped.
- Expect.isFalse(re1.hasMatch(mainOutput));
+ //
+ // TODO(sigmund): reenable, this commented test changed after porting
+ // deferred loading to the new common frontend.
+ // RegExp re1 = new RegExp(r"inlined as empty");
+ // Expect.isFalse(re1.hasMatch(mainOutput));
// Test that inlineFromMain was inlined and thus the string moved to lib1.
+ RegExp re2 = new RegExp(r"inlined from main");
Expect.isFalse(re2.hasMatch(mainOutput));
Expect.isTrue(re2.hasMatch(lib1Output));
// Test that inlineFromLib1 was not inlined into main.
+ RegExp re3 = new RegExp(r"inlined from lib1");
Expect.isFalse(re3.hasMatch(mainOutput));
Expect.isTrue(re3.hasMatch(lib1Output));
// Test that inlineSameContext was inlined into lib1.
+ RegExp re4 = new RegExp(r"inline same context");
Expect.isFalse(re4.hasMatch(lib3Output));
Expect.isTrue(re4.hasMatch(lib1Output));
});
diff --git a/tests/compiler/dart2js/deferred/load_graph_segmentation2_test.dart b/tests/compiler/dart2js/deferred/load_graph_segmentation2_test.dart
index 8043235..c73eb2e 100644
--- a/tests/compiler/dart2js/deferred/load_graph_segmentation2_test.dart
+++ b/tests/compiler/dart2js/deferred/load_graph_segmentation2_test.dart
@@ -18,11 +18,11 @@
Compiler compiler = result.compiler;
var outputUnitForEntity =
compiler.backend.outputUnitData.outputUnitForEntity;
+ var env = compiler.backendClosedWorldForTesting.elementEnvironment;
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
- dynamic lib =
- compiler.libraryLoader.lookupLibrary(Uri.parse("memory:lib.dart"));
- var f1 = lib.find("f1");
- var f2 = lib.find("f2");
+ dynamic lib = env.lookupLibrary(Uri.parse("memory:lib.dart"));
+ var f1 = env.lookupLibraryMember(lib, "f1");
+ var f2 = env.lookupLibraryMember(lib, "f2");
Expect.notEquals(mainOutputUnit, outputUnitForEntity(f1));
Expect.equals(mainOutputUnit, outputUnitForEntity(f2));
});
diff --git a/tests/compiler/dart2js/deferred/load_graph_segmentation_test.dart b/tests/compiler/dart2js/deferred/load_graph_segmentation_test.dart
index 028be89..8135ce0 100644
--- a/tests/compiler/dart2js/deferred/load_graph_segmentation_test.dart
+++ b/tests/compiler/dart2js/deferred/load_graph_segmentation_test.dart
@@ -18,11 +18,9 @@
await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
Compiler compiler = result.compiler;
- lookupLibrary(name) {
- return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
- }
-
- var main = compiler.frontendStrategy.elementEnvironment.mainFunction;
+ var env = compiler.backendClosedWorldForTesting.elementEnvironment;
+ lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
+ var main = env.mainFunction;
Expect.isNotNull(main, "Could not find 'main'");
var outputUnitForEntity =
@@ -33,14 +31,14 @@
var classes = backend.emitter.neededClasses;
var inputElement = classes.where((e) => e.name == 'InputElement').single;
dynamic lib1 = lookupLibrary("memory:lib1.dart");
- var foo1 = lib1.find("foo1");
+ var foo1 = env.lookupLibraryMember(lib1, "foo1");
dynamic lib2 = lookupLibrary("memory:lib2.dart");
- var foo2 = lib2.find("foo2");
+ var foo2 = env.lookupLibraryMember(lib2, "foo2");
dynamic lib3 = lookupLibrary("memory:lib3.dart");
- var foo3 = lib3.find("foo3");
+ var foo3 = env.lookupLibraryMember(lib3, "foo3");
dynamic lib4 = lookupLibrary("memory:lib4.dart");
- var bar1 = lib4.find("bar1");
- var bar2 = lib4.find("bar2");
+ var bar1 = env.lookupLibraryMember(lib4, "bar1");
+ var bar2 = env.lookupLibraryMember(lib4, "bar2");
OutputUnit ou_lib1 = outputUnitForEntity(foo1);
OutputUnit ou_lib2 = outputUnitForEntity(foo2);
diff --git a/tests/compiler/dart2js/deferred/not_in_main_test.dart b/tests/compiler/dart2js/deferred/not_in_main_test.dart
index b495e9a..4a13b29 100644
--- a/tests/compiler/dart2js/deferred/not_in_main_test.dart
+++ b/tests/compiler/dart2js/deferred/not_in_main_test.dart
@@ -20,19 +20,15 @@
asyncTest(() async {
CompilationResult result = await runCompiler(memorySourceFiles: TEST1);
Compiler compiler = result.compiler;
-
- lookupLibrary(name) {
- return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
- }
-
var outputUnitForEntity =
compiler.backend.outputUnitData.outputUnitForEntity;
-
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
+ var env = compiler.backendClosedWorldForTesting.elementEnvironment;
+ lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic lib1 = lookupLibrary("memory:lib1.dart");
dynamic lib2 = lookupLibrary("memory:lib2.dart");
- lib1.find("foo1");
- var foo2 = lib2.find("foo2");
+ env.lookupLibraryMember(lib1, "foo1");
+ var foo2 = env.lookupLibraryMember(lib2, "foo2");
Expect.notEquals(mainOutputUnit, outputUnitForEntity(foo2));
});
@@ -42,17 +38,14 @@
asyncTest(() async {
CompilationResult result = await runCompiler(memorySourceFiles: TEST2);
Compiler compiler = result.compiler;
-
- lookupLibrary(name) {
- return compiler.libraryLoader.lookupLibrary(Uri.parse(name));
- }
-
var outputUnitForEntity =
compiler.backend.outputUnitData.outputUnitForEntity;
var mainOutputUnit = compiler.backend.outputUnitData.mainOutputUnit;
+ var env = compiler.backendClosedWorldForTesting.elementEnvironment;
+ lookupLibrary(name) => env.lookupLibrary(Uri.parse(name));
dynamic shared = lookupLibrary("memory:shared.dart");
- var a = shared.find("A");
+ var a = env.lookupLibraryMember(shared, "A");
Expect.equals(mainOutputUnit, outputUnitForEntity(a));
});
@@ -75,10 +68,8 @@
import 'lib2.dart' deferred as lib2;
-const def = const DeferredLibrary('lib2');
-
void foo1() {
- lib1.loadLibrary().then((_) => lib2.foo2());
+ lib2.loadLibrary().then((_) => lib2.foo2());
}
""",
"lib2.dart": """
diff --git a/tests/compiler/dart2js/deferred/unneeded_part_js_test.dart b/tests/compiler/dart2js/deferred/unneeded_part_js_test.dart
index 2ef6af6..2ad4c00 100644
--- a/tests/compiler/dart2js/deferred/unneeded_part_js_test.dart
+++ b/tests/compiler/dart2js/deferred/unneeded_part_js_test.dart
@@ -17,7 +17,7 @@
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: diagnostics,
outputProvider: output,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isFalse(diagnostics.hasRegularMessages);
Expect.isFalse(output.hasExtraOutput);
Expect.isTrue(result.isSuccess);
diff --git a/tests/compiler/dart2js/dill_loader_test.dart b/tests/compiler/dart2js/dill_loader_test.dart
index 148dca3..56ac318 100644
--- a/tests/compiler/dart2js/dill_loader_test.dart
+++ b/tests/compiler/dart2js/dill_loader_test.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'memory_compiler.dart';
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common_elements.dart';
import 'package:compiler/src/diagnostics/spannable.dart' show Spannable;
import 'package:compiler/src/elements/entities.dart'
@@ -58,8 +57,7 @@
entryPoint: entryPoint,
memorySourceFiles: {'main.dill': kernelBinary},
diagnosticHandler: diagnostics,
- outputProvider: output,
- options: [Flags.useKernel]);
+ outputProvider: output);
await compiler.setupSdk();
await compiler.libraryLoader.loadLibrary(entryPoint);
diff --git a/tests/compiler/dart2js/dump_info_test.dart b/tests/compiler/dart2js/dump_info_test.dart
index f628019..cf1399b 100644
--- a/tests/compiler/dart2js/dump_info_test.dart
+++ b/tests/compiler/dart2js/dump_info_test.dart
@@ -99,8 +99,8 @@
jsonTest(String program, JsonTaking testFn, {bool useKernel}) async {
var options = ['--out=out.js', Flags.dumpInfo];
- if (useKernel) {
- options.add(Flags.useKernel);
+ if (!useKernel) {
+ options.add(Flags.useOldFrontend);
}
var result = await runCompiler(
memorySourceFiles: {'main.dart': program}, options: options);
diff --git a/tests/compiler/dart2js/end_to_end/async_compiler_input_provider_test.dart b/tests/compiler/dart2js/end_to_end/async_compiler_input_provider_test.dart
index ba08d5c..8349c81 100644
--- a/tests/compiler/dart2js/end_to_end/async_compiler_input_provider_test.dart
+++ b/tests/compiler/dart2js/end_to_end/async_compiler_input_provider_test.dart
@@ -28,11 +28,15 @@
"""
};
-Future<String> provideInput(Uri uri) {
- var source = SOURCES[uri.path];
+Future provideInput(Uri uri) {
+ dynamic source = SOURCES[uri.path];
if (source == null) {
// Not one of our source files, so assume it's a built-in.
- source = new File(uri.toFilePath()).readAsStringSync();
+ if (uri.path.endsWith('.dill')) {
+ source = new File(uri.toFilePath()).readAsBytesSync();
+ } else {
+ source = new File(uri.toFilePath()).readAsStringSync();
+ }
}
// Deliver the input asynchronously.
@@ -45,9 +49,14 @@
// Find the path to sdk/ in the repo relative to this script.
Uri libraryRoot = Uri.base.resolve('sdk/');
Uri packageRoot = Uri.base.resolve('packages/');
-
- asyncTest(() => compiler.compile(entrypoint, libraryRoot, packageRoot,
- provideInput, handleDiagnostic, []).then((code) {
+ var platformDir = Uri.parse(Platform.resolvedExecutable).resolve('.');
+ asyncTest(() => compiler.compile(
+ entrypoint,
+ libraryRoot,
+ packageRoot,
+ provideInput,
+ handleDiagnostic,
+ ['--platform-binaries=${platformDir}']).then((code) {
Expect.isNotNull(code);
}));
}
diff --git a/tests/compiler/dart2js/end_to_end/command_line_test.dart b/tests/compiler/dart2js/end_to_end/command_line_test.dart
index a45172b..88a7650 100644
--- a/tests/compiler/dart2js/end_to_end/command_line_test.dart
+++ b/tests/compiler/dart2js/end_to_end/command_line_test.dart
@@ -19,18 +19,29 @@
asyncTest(() async {
await test([], exitCode: 1);
await test(['foo.dart']);
- await test([Flags.useKernel], exitCode: 1);
- await test([Flags.useKernel, 'foo.dart']);
- await test([Flags.resolveOnly, 'foo.dart'],
+ await test([Flags.useOldFrontend], exitCode: 1);
+ await test([Flags.useOldFrontend, 'foo.dart']);
+ await test([Flags.useOldFrontend, Flags.resolveOnly, 'foo.dart'],
resolveOnly: true, resolutionOutput: Uri.base.resolve('out.data'));
- await test(['--resolution-input=bar.dart', 'foo.dart'],
+ await test(
+ [Flags.useOldFrontend, '--resolution-input=bar.dart', 'foo.dart'],
resolutionInputs: [Uri.base.resolve('bar.dart')]);
- await test([Flags.resolveOnly, '--resolution-input=bar.dart', 'foo.dart'],
+ await test(
+ [
+ Flags.useOldFrontend,
+ Flags.resolveOnly,
+ '--resolution-input=bar.dart',
+ 'foo.dart'
+ ],
resolveOnly: true,
resolutionOutput: Uri.base.resolve('out.data'),
resolutionInputs: [Uri.base.resolve('bar.dart')]);
- await test([Flags.resolveOnly, '--resolution-input=out.data', 'foo.dart'],
- exitCode: 1);
+ await test([
+ Flags.useOldFrontend,
+ Flags.resolveOnly,
+ '--resolution-input=out.data',
+ 'foo.dart'
+ ], exitCode: 1);
});
}
diff --git a/tests/compiler/dart2js/end_to_end/exit_code_test.dart b/tests/compiler/dart2js/end_to_end/exit_code_test.dart
index cd70154..a6549af 100644
--- a/tests/compiler/dart2js/end_to_end/exit_code_test.dart
+++ b/tests/compiler/dart2js/end_to_end/exit_code_test.dart
@@ -241,6 +241,8 @@
entry.compileFunc = compile;
List<String> args = new List<String>.from(options)
+ // TODO(sigmund): convert to support the new CFE
+ ..add("--use-old-frontend")
..add("--library-root=${Uri.base.resolve('sdk/')}")
..add("tests/compiler/dart2js/end_to_end/data/exit_code_helper.dart");
Future result = entry.internalMain(args);
diff --git a/tests/compiler/dart2js/end_to_end/library_env_test.dart b/tests/compiler/dart2js/end_to_end/library_env_test.dart
index f6496d2..1fcdb15 100644
--- a/tests/compiler/dart2js/end_to_end/library_env_test.dart
+++ b/tests/compiler/dart2js/end_to_end/library_env_test.dart
@@ -6,6 +6,7 @@
/// environment variable set.
import 'dart:async';
+import 'dart:io';
import '../memory_source_file_helper.dart';
@@ -59,6 +60,8 @@
return new Binary(uri, clientPlatform.codeUnits);
} else if (uri.toString().endsWith("dart_server.platform")) {
return new Binary(uri, serverPlatform.codeUnits);
+ } else if (uri.path.endsWith(".dill")) {
+ return new Binary(uri, new File.fromUri(uri).readAsBytesSync());
} else {
throw "should not be needed $uri";
}
@@ -73,6 +76,8 @@
}
}
+final platformDir = Uri.parse(Platform.resolvedExecutable).resolve('.');
+
class CustomCompiler extends CompilerImpl {
CustomCompiler(options, environment)
: super(
@@ -81,7 +86,7 @@
const DummyCompilerDiagnostics(),
new CompilerOptions.parse(
libraryRoot: Uri.base.resolve("sdk/"),
- options: options,
+ options: ['--platform-binaries=$platformDir']..addAll(options),
environment: environment));
}
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
index 253b3da..09b47fa 100644
--- a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
+++ b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
@@ -519,7 +519,7 @@
CompiledData compiledData1 = await computeData(
entryPoint, memorySourceFiles, computeFromAst,
computeClassData: computeClassDataFromAst,
- options: testOptions,
+ options: [Flags.useOldFrontend]..addAll(testOptions),
verbose: verbose,
forUserLibrariesOnly: forUserLibrariesOnly,
globalIds: annotations.globalData.keys);
@@ -536,7 +536,7 @@
CompiledData compiledData2 = await computeData(
entryPoint, memorySourceFiles, computeFromKernel,
computeClassData: computeClassDataFromKernel,
- options: [Flags.useKernel]..addAll(testOptions),
+ options: testOptions,
verbose: verbose,
forUserLibrariesOnly: forUserLibrariesOnly,
globalIds: annotations.globalData.keys);
@@ -762,7 +762,7 @@
print('--from ast----------------------------------------------------------');
CompiledData data1 = await computeData(
entryPoint, memorySourceFiles, computeAstData,
- options: options,
+ options: [Flags.useOldFrontend]..addAll(options),
forUserLibrariesOnly: forUserLibrariesOnly,
skipUnprocessedMembers: skipUnprocessedMembers,
skipFailedCompilations: skipFailedCompilations);
@@ -770,7 +770,7 @@
print('--from kernel-------------------------------------------------------');
CompiledData data2 = await computeData(
entryPoint, memorySourceFiles, computeIrData,
- options: [Flags.useKernel]..addAll(options),
+ options: options,
forUserLibrariesOnly: forUserLibrariesOnly,
skipUnprocessedMembers: skipUnprocessedMembers,
skipFailedCompilations: skipFailedCompilations);
diff --git a/tests/compiler/dart2js/equivalence/show_helper.dart b/tests/compiler/dart2js/equivalence/show_helper.dart
index 6a60e11..9bdae9a 100644
--- a/tests/compiler/dart2js/equivalence/show_helper.dart
+++ b/tests/compiler/dart2js/equivalence/show_helper.dart
@@ -47,8 +47,8 @@
}
options = new List<String>.from(options);
- if (useKernel) {
- options.add(Flags.useKernel);
+ if (!useKernel) {
+ options.add(Flags.useOldFrontend);
}
if (strongMode) {
options.add(Flags.strongMode);
diff --git a/tests/compiler/dart2js/generate_code_with_compile_time_errors_test.dart b/tests/compiler/dart2js/generate_code_with_compile_time_errors_test.dart
index 8654db5..321b440 100644
--- a/tests/compiler/dart2js/generate_code_with_compile_time_errors_test.dart
+++ b/tests/compiler/dart2js/generate_code_with_compile_time_errors_test.dart
@@ -17,7 +17,7 @@
const MEMORY_SOURCE_FILES = const {
'main.dart': '''
foo() {
- const list = [];
+ const [ new List() ];
}
main() {
diff --git a/tests/compiler/dart2js/generic_methods/generic_method_test.dart b/tests/compiler/dart2js/generic_methods/generic_method_test.dart
index 4138e44..1574ab9 100644
--- a/tests/compiler/dart2js/generic_methods/generic_method_test.dart
+++ b/tests/compiler/dart2js/generic_methods/generic_method_test.dart
@@ -177,7 +177,6 @@
Compiler compiler = await runWithD8(memorySourceFiles: {
'main.dart': SOURCE
}, options: [
- Flags.useKernel,
Flags.strongMode,
Flags.disableRtiOptimization,
], expectedOutput: OUTPUT, printJs: args.contains('-v'));
diff --git a/tests/compiler/dart2js/generic_methods/world_test.dart b/tests/compiler/dart2js/generic_methods/world_test.dart
index 37b2244..4dbea81 100644
--- a/tests/compiler/dart2js/generic_methods/world_test.dart
+++ b/tests/compiler/dart2js/generic_methods/world_test.dart
@@ -86,8 +86,7 @@
main() {
asyncTest(() async {
CompilationResult result = await runCompiler(
- memorySourceFiles: {'main.dart': code},
- options: [Flags.useKernel, Flags.strongMode]);
+ memorySourceFiles: {'main.dart': code}, options: [Flags.strongMode]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
CodegenWorldBuilder worldBuilder = compiler.codegenWorldBuilder;
diff --git a/tests/compiler/dart2js/in_user_code_test.dart b/tests/compiler/dart2js/in_user_code_test.dart
index 1f926c6..bc75652 100644
--- a/tests/compiler/dart2js/in_user_code_test.dart
+++ b/tests/compiler/dart2js/in_user_code_test.dart
@@ -38,14 +38,19 @@
'pkg/sup/boz.dart': """
library sup.boz;
""",
+ '.packages': """
+sub:pkg/sub/
+sup:pkg/sup/
+"""
};
Future test(List<Uri> entryPoints, Map<String, bool> expectedResults) async {
+ print("Test: $entryPoints");
CompilationResult result = await runCompiler(
entryPoints: entryPoints,
memorySourceFiles: SOURCE,
options: [Flags.analyzeOnly, Flags.analyzeAll],
- packageRoot: Uri.parse('memory:pkg/'));
+ packageConfig: Uri.parse('memory:.packages'));
Compiler compiler = result.compiler;
expectedResults.forEach((String uri, bool expectedResult) {
dynamic element = compiler.libraryLoader.lookupLibrary(Uri.parse(uri));
@@ -77,8 +82,10 @@
'dart:core': false,
'dart:async': false
});
- await test(
- [Uri.parse('dart:async')], {'dart:core': true, 'dart:async': true});
+ // TODO(sigmund): compiler with CFE doesn't work when given sdk libraries as
+ // entrypoints (Issue XYZ).
+ //await test(
+ // [Uri.parse('dart:async')], {'dart:core': true, 'dart:async': true});
await test([
Uri.parse('package:sub/bar.dart')
], {
@@ -96,14 +103,14 @@
'package:sup/boz.dart': true,
'dart:core': false
});
- await test([
- Uri.parse('dart:async'),
- Uri.parse('package:sub/bar.dart')
- ], {
- 'package:sub/bar.dart': true,
- 'package:sub/baz.dart': true,
- 'package:sup/boz.dart': false,
- 'dart:core': true,
- 'dart:async': true
- });
+ //await test([
+ // Uri.parse('dart:async'),
+ // Uri.parse('package:sub/bar.dart')
+ //], {
+ // 'package:sub/bar.dart': true,
+ // 'package:sub/baz.dart': true,
+ // 'package:sup/boz.dart': false,
+ // 'dart:core': true,
+ // 'dart:async': true
+ //});
}
diff --git a/tests/compiler/dart2js/inference/list_tracer_test.dart b/tests/compiler/dart2js/inference/list_tracer_test.dart
index 613f8a3..6182436 100644
--- a/tests/compiler/dart2js/inference/list_tracer_test.dart
+++ b/tests/compiler/dart2js/inference/list_tracer_test.dart
@@ -213,7 +213,7 @@
String source = generateTest(allocation);
var result = await runCompiler(
memorySourceFiles: {'main.dart': source},
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
var compiler = result.compiler;
var typesInferrer = compiler.globalInference.typesInferrerInternal;
diff --git a/tests/compiler/dart2js/inference/map_tracer_test.dart b/tests/compiler/dart2js/inference/map_tracer_test.dart
index 0c1e02b..a2be02a 100644
--- a/tests/compiler/dart2js/inference/map_tracer_test.dart
+++ b/tests/compiler/dart2js/inference/map_tracer_test.dart
@@ -234,7 +234,7 @@
String source = generateTest(allocation);
var result = await runCompiler(
memorySourceFiles: {'main.dart': source},
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
TypeMask keyType, valueType;
diff --git a/tests/compiler/dart2js/inference/type_combination_test.dart b/tests/compiler/dart2js/inference/type_combination_test.dart
index c79b188..8a05664 100644
--- a/tests/compiler/dart2js/inference/type_combination_test.dart
+++ b/tests/compiler/dart2js/inference/type_combination_test.dart
@@ -761,7 +761,7 @@
}
'''
},
- options: useKernel ? [Flags.useKernel] : [],
+ options: useKernel ? [] : [Flags.useOldFrontend],
beforeRun: (compiler) => compiler.stopAfterTypeInference = true);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
diff --git a/tests/compiler/dart2js/inference/type_mask_disjoint_test.dart b/tests/compiler/dart2js/inference/type_mask_disjoint_test.dart
index f67dd0a..f9d8e70 100644
--- a/tests/compiler/dart2js/inference/type_mask_disjoint_test.dart
+++ b/tests/compiler/dart2js/inference/type_mask_disjoint_test.dart
@@ -43,7 +43,7 @@
runTests({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': CODE},
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
ClosedWorld world = compiler.backendClosedWorldForTesting;
diff --git a/tests/compiler/dart2js/inference/type_mask_test.dart b/tests/compiler/dart2js/inference/type_mask_test.dart
index fc668d0..dd77a78 100644
--- a/tests/compiler/dart2js/inference/type_mask_test.dart
+++ b/tests/compiler/dart2js/inference/type_mask_test.dart
@@ -26,7 +26,7 @@
runTests({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': CODE},
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
diff --git a/tests/compiler/dart2js/inlining/meta_annotations2_test.dart b/tests/compiler/dart2js/inlining/meta_annotations2_test.dart
index 2797238..64769bc 100644
--- a/tests/compiler/dart2js/inlining/meta_annotations2_test.dart
+++ b/tests/compiler/dart2js/inlining/meta_annotations2_test.dart
@@ -44,7 +44,7 @@
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
// Simply check that the constants of the small functions are still in the
// output, and that we don't see the result of constant folding.
String jsOutput = collector.getOutput('', OutputType.js);
diff --git a/tests/compiler/dart2js/inlining/meta_annotations3_test.dart b/tests/compiler/dart2js/inlining/meta_annotations3_test.dart
index 37d1b76..47109f3 100644
--- a/tests/compiler/dart2js/inlining/meta_annotations3_test.dart
+++ b/tests/compiler/dart2js/inlining/meta_annotations3_test.dart
@@ -56,7 +56,7 @@
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
outputProvider: collector,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
String jsOutput = collector.getOutput('', OutputType.js);
void has(String text) {
diff --git a/tests/compiler/dart2js/inlining/meta_annotations_test.dart b/tests/compiler/dart2js/inlining/meta_annotations_test.dart
index 2eaee34..256c28c 100644
--- a/tests/compiler/dart2js/inlining/meta_annotations_test.dart
+++ b/tests/compiler/dart2js/inlining/meta_annotations_test.dart
@@ -37,7 +37,7 @@
runTests({bool useKernel}) async {
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
ClosedWorld closedWorld =
compiler.resolutionWorldBuilder.closedWorldForTesting;
diff --git a/tests/compiler/dart2js/js/js_constant_test.dart b/tests/compiler/dart2js/js/js_constant_test.dart
index b9754d3..22eeedf 100644
--- a/tests/compiler/dart2js/js/js_constant_test.dart
+++ b/tests/compiler/dart2js/js/js_constant_test.dart
@@ -28,7 +28,7 @@
var result = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: {main: test},
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
var compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
diff --git a/tests/compiler/dart2js/js/js_spec_optimization_test.dart b/tests/compiler/dart2js/js/js_spec_optimization_test.dart
index 9cd6a88..3608519 100644
--- a/tests/compiler/dart2js/js/js_spec_optimization_test.dart
+++ b/tests/compiler/dart2js/js/js_spec_optimization_test.dart
@@ -95,7 +95,7 @@
var result = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: {main: test},
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
var compiler = result.compiler;
var closedWorld = compiler.backendClosedWorldForTesting;
diff --git a/tests/compiler/dart2js/jsinterop/declaration_test.dart b/tests/compiler/dart2js/jsinterop/declaration_test.dart
index 45e2e05..31ad8d3 100644
--- a/tests/compiler/dart2js/jsinterop/declaration_test.dart
+++ b/tests/compiler/dart2js/jsinterop/declaration_test.dart
@@ -449,9 +449,10 @@
DiagnosticCollector collector = new DiagnosticCollector();
List<String> options = <String>[];
if (useKernel) {
- options.add(Flags.useKernel);
// TODO(redemption): Enable inlining.
options.add(Flags.disableInlining);
+ } else {
+ options.add(Flags.useOldFrontend);
}
print('--useKernel=${useKernel}--------------------------------------------');
await runCompiler(
diff --git a/tests/compiler/dart2js/kernel/closed_world2_test.dart b/tests/compiler/dart2js/kernel/closed_world2_test.dart
index b6828d0..fe9b70d 100644
--- a/tests/compiler/dart2js/kernel/closed_world2_test.dart
+++ b/tests/compiler/dart2js/kernel/closed_world2_test.dart
@@ -198,7 +198,11 @@
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
diagnosticHandler: collector,
- options: [Flags.analyzeOnly, Flags.enableAssertMessage],
+ options: [
+ Flags.useOldFrontend,
+ Flags.analyzeOnly,
+ Flags.enableAssertMessage
+ ],
beforeRun: (compiler) {
compiler.impactCacheDeleter.retainCachesForTesting = true;
});
diff --git a/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart b/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart
index 4f65d62..5dc6689 100644
--- a/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart
+++ b/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart
@@ -115,7 +115,11 @@
CompilationResult result = await runCompiler(
entryPoint: entryPoint,
diagnosticHandler: collector,
- options: [Flags.analyzeOnly, Flags.enableAssertMessage],
+ options: [
+ Flags.useOldFrontend,
+ Flags.analyzeOnly,
+ Flags.enableAssertMessage
+ ],
beforeRun: (compiler) {
compiler.impactCacheDeleter.retainCachesForTesting = true;
});
diff --git a/tests/compiler/dart2js/kernel/compiler_helper.dart b/tests/compiler/dart2js/kernel/compiler_helper.dart
index 903758a..a11907e 100644
--- a/tests/compiler/dart2js/kernel/compiler_helper.dart
+++ b/tests/compiler/dart2js/kernel/compiler_helper.dart
@@ -37,7 +37,11 @@
CompilationResult result1 = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
- options: [Flags.analyzeAll, Flags.enableAssertMessage],
+ options: [
+ Flags.useOldFrontend,
+ Flags.analyzeAll,
+ Flags.enableAssertMessage
+ ],
beforeRun: (compiler) {
compiler.impactCacheDeleter.retainCachesForTesting = true;
});
@@ -49,7 +53,7 @@
CompilationResult result2 = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
- options: [Flags.analyzeOnly, Flags.enableAssertMessage, Flags.useKernel],
+ options: [Flags.analyzeOnly, Flags.enableAssertMessage],
beforeRun: (compiler) {
compiler.impactCacheDeleter.retainCachesForTesting = true;
});
@@ -139,7 +143,7 @@
CompilationResult result = await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
- options: [Flags.useKernel]..addAll(options),
+ options: options,
diagnosticHandler: diagnosticHandler,
outputProvider: compilerOutput,
beforeRun: (compiler) {
diff --git a/tests/compiler/dart2js/kernel/helper.dart b/tests/compiler/dart2js/kernel/helper.dart
index e395eaf4..b8e6ae9 100644
--- a/tests/compiler/dart2js/kernel/helper.dart
+++ b/tests/compiler/dart2js/kernel/helper.dart
@@ -25,7 +25,7 @@
Flags.disableInlining,
];
if (disableTypeInference) options.add(Flags.disableTypeInference);
- if (useKernel) options.add(Flags.useKernel);
+ if (!useKernel) options.add(Flags.useOldFrontend);
options.addAll(extraOptions);
if (lookup is String && lookup != 'main' && !code.contains('main')) {
diff --git a/tests/compiler/dart2js/kernel/mixin_test.dart b/tests/compiler/dart2js/kernel/mixin_test.dart
index 888c275..62e4dfa 100644
--- a/tests/compiler/dart2js/kernel/mixin_test.dart
+++ b/tests/compiler/dart2js/kernel/mixin_test.dart
@@ -115,8 +115,9 @@
print(
'---- compiler from ast -----------------------------------------------');
- var result =
- await runCompiler(entryPoint: entryPoint, options: [Flags.analyzeOnly]);
+ var result = await runCompiler(
+ entryPoint: entryPoint,
+ options: [Flags.analyzeOnly, Flags.useOldFrontend]);
Compiler compiler1 = result.compiler;
Compiler compiler2 = await compileWithDill(
diff --git a/tests/compiler/dart2js/kernel/run_from_dill_test.dart b/tests/compiler/dart2js/kernel/run_from_dill_test.dart
index 6012caf..da6d490 100644
--- a/tests/compiler/dart2js/kernel/run_from_dill_test.dart
+++ b/tests/compiler/dart2js/kernel/run_from_dill_test.dart
@@ -102,7 +102,7 @@
await runWithD8(
entryPoint: entryPoint,
memorySourceFiles: memorySourceFiles,
- options: [Flags.useKernel, Flags.enableAssertMessage],
+ options: [Flags.enableAssertMessage],
expectedOutput: OUTPUT);
return ResultKind.success;
diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart
index 98c0651..70b26c0 100644
--- a/tests/compiler/dart2js/memory_compiler.dart
+++ b/tests/compiler/dart2js/memory_compiler.dart
@@ -144,7 +144,7 @@
PackagesDiscoveryProvider packagesDiscoveryProvider}) {
Uri libraryRoot = Uri.base.resolve('sdk/');
Uri platformBinaries;
- if (options.contains(Flags.useKernel)) {
+ if (!options.contains(Flags.useOldFrontend)) {
platformBinaries = computePlatformBinariesLocation();
}
@@ -293,7 +293,5 @@
}
main() {
- runCompiler(
- memorySourceFiles: {'main.dart': 'main() {}'},
- options: [Flags.useKernel]);
+ runCompiler(memorySourceFiles: {'main.dart': 'main() {}'});
}
diff --git a/tests/compiler/dart2js/mirrors/array_tracing_mirror_test.dart b/tests/compiler/dart2js/mirrors/array_tracing_mirror_test.dart
index 7e3cec6..bb819cb 100644
--- a/tests/compiler/dart2js/mirrors/array_tracing_mirror_test.dart
+++ b/tests/compiler/dart2js/mirrors/array_tracing_mirror_test.dart
@@ -6,7 +6,8 @@
// affect optimizations done on arrays.
import 'package:expect/expect.dart';
-import "package:async_helper/async_helper.dart";
+import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart';
const MEMORY_SOURCE_FILES = const {
@@ -32,7 +33,9 @@
main() {
asyncTest(() async {
- var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
+ var result = await runCompiler(
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ options: [Flags.useOldFrontend]);
var compiler = result.compiler;
var element = compiler.frontendStrategy.elementEnvironment.mainFunction;
var code = compiler.backend.getGeneratedCode(element);
diff --git a/tests/compiler/dart2js/mirrors/deferred_mirrors_test.dart b/tests/compiler/dart2js/mirrors/deferred_mirrors_test.dart
index 40a6746..bfff8f1 100644
--- a/tests/compiler/dart2js/mirrors/deferred_mirrors_test.dart
+++ b/tests/compiler/dart2js/mirrors/deferred_mirrors_test.dart
@@ -9,12 +9,14 @@
import 'dart:async';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart';
Future runTest(String mainScript, test) async {
CompilationResult result = await runCompiler(
entryPoint: Uri.parse(mainScript),
- memorySourceFiles: MEMORY_SOURCE_FILES);
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ options: [Flags.useOldFrontend]);
test(result.compiler);
}
diff --git a/tests/compiler/dart2js/mirrors/import_mirrors_test.dart b/tests/compiler/dart2js/mirrors/import_mirrors_test.dart
index 6ab3053..5a2017f 100644
--- a/tests/compiler/dart2js/mirrors/import_mirrors_test.dart
+++ b/tests/compiler/dart2js/mirrors/import_mirrors_test.dart
@@ -10,6 +10,7 @@
import 'dart:async';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/diagnostics/messages.dart'
show MessageKind, MessageTemplate;
import '../memory_compiler.dart';
@@ -309,7 +310,7 @@
expectedPaths = [expectedPaths];
}
var collector = new DiagnosticCollector();
- var options = [];
+ var options = [Flags.useOldFrontend];
if (verbose) {
options.add('--verbose');
}
diff --git a/tests/compiler/dart2js/mirrors/mirror_final_field_inferrer2_test.dart b/tests/compiler/dart2js/mirrors/mirror_final_field_inferrer2_test.dart
index 092657c..2126ac9 100644
--- a/tests/compiler/dart2js/mirrors/mirror_final_field_inferrer2_test.dart
+++ b/tests/compiler/dart2js/mirrors/mirror_final_field_inferrer2_test.dart
@@ -6,6 +6,7 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
+import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart' show runCompiler;
import '../compiler_helper.dart' show findElement;
import '../inference/type_mask_test_helper.dart';
@@ -25,7 +26,9 @@
void main() {
asyncTest(() async {
- var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
+ var result = await runCompiler(
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ options: [Flags.useOldFrontend]);
var compiler = result.compiler;
var element = findElement(compiler, 'field');
var typesInferrer = compiler.globalInference.typesInferrerInternal;
diff --git a/tests/compiler/dart2js/mirrors/mirror_final_field_inferrer_test.dart b/tests/compiler/dart2js/mirrors/mirror_final_field_inferrer_test.dart
index 6b2af55..8583e11 100644
--- a/tests/compiler/dart2js/mirrors/mirror_final_field_inferrer_test.dart
+++ b/tests/compiler/dart2js/mirrors/mirror_final_field_inferrer_test.dart
@@ -6,6 +6,7 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
+import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart' show runCompiler;
import '../compiler_helper.dart' show findElement;
import '../inference/type_mask_test_helper.dart';
@@ -25,7 +26,9 @@
void main() {
asyncTest(() async {
- var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
+ var result = await runCompiler(
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ options: [Flags.useOldFrontend]);
var compiler = result.compiler;
var element = findElement(compiler, 'field');
var typesInferrer = compiler.globalInference.typesInferrerInternal;
diff --git a/tests/compiler/dart2js/mirrors/mirror_private_name_inheritance_test.dart b/tests/compiler/dart2js/mirrors/mirror_private_name_inheritance_test.dart
index b017527..830b3b7 100644
--- a/tests/compiler/dart2js/mirrors/mirror_private_name_inheritance_test.dart
+++ b/tests/compiler/dart2js/mirrors/mirror_private_name_inheritance_test.dart
@@ -6,6 +6,7 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
+import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart' show runCompiler;
import '../compiler_helper.dart' show findElement;
@@ -38,7 +39,9 @@
void main() {
asyncTest(() async {
- var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
+ var result = await runCompiler(
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ options: [Flags.useOldFrontend]);
var compiler = result.compiler;
dynamic superclass =
diff --git a/tests/compiler/dart2js/mirrors/mirror_tree_shaking_test.dart b/tests/compiler/dart2js/mirrors/mirror_tree_shaking_test.dart
index a430c36..0afce8b 100644
--- a/tests/compiler/dart2js/mirrors/mirror_tree_shaking_test.dart
+++ b/tests/compiler/dart2js/mirrors/mirror_tree_shaking_test.dart
@@ -5,6 +5,7 @@
// Test that tree-shaking hasn't been turned off.
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend;
import 'package:compiler/src/js_backend/mirrors_analysis.dart';
@@ -15,7 +16,9 @@
DiagnosticCollector collector = new DiagnosticCollector();
asyncTest(() async {
CompilationResult result = await runCompiler(
- memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ diagnosticHandler: collector,
+ options: [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
JavaScriptBackend backend = compiler.backend;
Expect.isTrue(collector.errors.isEmpty);
diff --git a/tests/compiler/dart2js/mirrors/mirrors_used_test.dart b/tests/compiler/dart2js/mirrors/mirrors_used_test.dart
index aef17ca..377ddff 100644
--- a/tests/compiler/dart2js/mirrors/mirrors_used_test.dart
+++ b/tests/compiler/dart2js/mirrors/mirrors_used_test.dart
@@ -14,6 +14,7 @@
import '../memory_compiler.dart' show runCompiler;
import 'package:compiler/src/apiimpl.dart' show CompilerImpl;
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/constants/values.dart'
show ConstantValue, TypeConstantValue;
@@ -54,7 +55,7 @@
var result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: new LegacyCompilerDiagnostics(expectOnlyVerboseInfo),
- options: ['--enable-experimental-mirrors']);
+ options: ['--enable-experimental-mirrors', Flags.useOldFrontend]);
CompilerImpl compiler = result.compiler;
JavaScriptBackend backend = compiler.backend;
print('');
diff --git a/tests/compiler/dart2js/mirrors/preserve_uris_test.dart b/tests/compiler/dart2js/mirrors/preserve_uris_test.dart
index 8429c81..6ecc464 100644
--- a/tests/compiler/dart2js/mirrors/preserve_uris_test.dart
+++ b/tests/compiler/dart2js/mirrors/preserve_uris_test.dart
@@ -5,6 +5,7 @@
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/compiler_new.dart';
+import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart' show runCompiler, OutputCollector;
const MEMORY_SOURCE_FILES = const <String, String>{
@@ -40,7 +41,7 @@
runTest(bool preserveUris) async {
OutputCollector collector = new OutputCollector();
- var options = ["--minify"];
+ var options = ["--minify", Flags.useOldFrontend];
if (preserveUris) options.add("--preserve-uris");
await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
diff --git a/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart b/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart
index 4c79125..9bff47f 100644
--- a/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart
+++ b/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart
@@ -599,7 +599,7 @@
print(
'--test ast----------------------------------------------------------');
await runTest(
- [Flags.analyzeAll],
+ [Flags.useOldFrontend, Flags.analyzeAll],
(Compiler compiler, FieldEntity field) => new AstEvaluationEnvironment(
compiler,
constantRequired: field.isConst));
@@ -607,8 +607,7 @@
if (!skipKernelList.contains(data.name)) {
print(
'--test kernel-------------------------------------------------------');
- await runTest([Flags.useKernel, Flags.analyzeOnly],
- (Compiler compiler, FieldEntity field) {
+ await runTest([Flags.analyzeOnly], (Compiler compiler, FieldEntity field) {
KernelFrontEndStrategy frontendStrategy = compiler.frontendStrategy;
KernelToElementMap elementMap = frontendStrategy.elementMap;
return new KernelEvaluationEnvironment(elementMap, null, field,
diff --git a/tests/compiler/dart2js/model/constant_expression_test.dart b/tests/compiler/dart2js/model/constant_expression_test.dart
index c115dae..44a1406 100644
--- a/tests/compiler/dart2js/model/constant_expression_test.dart
+++ b/tests/compiler/dart2js/model/constant_expression_test.dart
@@ -9,8 +9,8 @@
import 'package:expect/expect.dart';
import 'package:compiler/src/constants/expressions.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/compile_time_constants.dart';
-import 'package:compiler/src/elements/elements.dart';
+import 'package:compiler/src/kernel/element_map_impl.dart';
+import 'package:compiler/src/elements/entities.dart';
import '../memory_compiler.dart';
import 'constant_expression_evaluate_test.dart' show MemoryEnvironment;
@@ -56,7 +56,8 @@
const ConstantData('"foo"', ConstantExpressionKind.STRING),
const ConstantData('1 + 2', ConstantExpressionKind.BINARY),
const ConstantData('1 == 2', ConstantExpressionKind.BINARY),
- const ConstantData('1 != 2', ConstantExpressionKind.BINARY),
+ // TODO(sigmund): reenable (Issue 32511)
+ // const ConstantData('1 != 2', ConstantExpressionKind.BINARY),
const ConstantData('1 ?? 2', ConstantExpressionKind.BINARY),
const ConstantData('-(1)', ConstantExpressionKind.UNARY, text: '-1'),
const ConstantData('"foo".length', ConstantExpressionKind.STRING_LENGTH),
@@ -154,34 +155,35 @@
const ConstantData(
'const A<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
type: 'A<int>', fields: const {'field(A#field1)': '87'}),
- const ConstantData('const B()', ConstantExpressionKind.CONSTRUCTED,
- type: 'A<B<dynamic>>',
- fields: const {
- 'field(A#field1)': '42',
- }),
- const ConstantData('const B<int>()', ConstantExpressionKind.CONSTRUCTED,
- type: 'A<B<int>>',
- fields: const {
- 'field(A#field1)': '42',
- }),
- const ConstantData(
- 'const B<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
- type: 'A<B<int>>',
- fields: const {
- 'field(A#field1)': '87',
- }),
- const ConstantData(
- 'const C<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
- type: 'A<B<double>>',
- fields: const {
- 'field(A#field1)': '87',
- }),
- const ConstantData(
- 'const B<int>.named()', ConstantExpressionKind.CONSTRUCTED,
- type: 'A<int>',
- fields: const {
- 'field(A#field1)': '42',
- }),
+ // TODO(sigmund): reenable (Issue 32511)
+ //const ConstantData('const B()', ConstantExpressionKind.CONSTRUCTED,
+ // type: 'A<B<dynamic>>',
+ // fields: const {
+ // 'field(A#field1)': '42',
+ // }),
+ //const ConstantData('const B<int>()', ConstantExpressionKind.CONSTRUCTED,
+ // type: 'A<B<int>>',
+ // fields: const {
+ // 'field(A#field1)': '42',
+ // }),
+ //const ConstantData(
+ // 'const B<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
+ // type: 'A<B<int>>',
+ // fields: const {
+ // 'field(A#field1)': '87',
+ // }),
+ //const ConstantData(
+ // 'const C<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
+ // type: 'A<B<double>>',
+ // fields: const {
+ // 'field(A#field1)': '87',
+ // }),
+ //const ConstantData(
+ // 'const B<int>.named()', ConstantExpressionKind.CONSTRUCTED,
+ // type: 'A<int>',
+ // fields: const {
+ // 'field(A#field1)': '42',
+ // }),
]),
];
@@ -203,12 +205,17 @@
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': source}, options: ['--analyze-all']);
Compiler compiler = result.compiler;
- MemoryEnvironment environment =
- new MemoryEnvironment(new AstEvaluationEnvironment(compiler));
- dynamic library = compiler.frontendStrategy.elementEnvironment.mainLibrary;
+ var elementEnvironment = compiler.frontendStrategy.elementEnvironment;
+
+ MemoryEnvironment environment = new MemoryEnvironment(
+ new KernelEvaluationEnvironment(
+ (compiler.frontendStrategy as dynamic).elementMap,
+ compiler.environment,
+ null));
+ dynamic library = elementEnvironment.mainLibrary;
constants.forEach((String name, ConstantData data) {
- FieldElement field = library.localLookup(name);
- dynamic constant = field.constant;
+ FieldEntity field = elementEnvironment.lookupLibraryMember(library, name);
+ dynamic constant = elementEnvironment.getFieldConstant(field);
Expect.equals(
data.kind,
constant.kind,
@@ -237,6 +244,8 @@
"`${constant.toDartText()}`, expected '${data.fields.length}'.");
instanceFields.forEach((field, expression) {
String name = '$field';
+ Expect.isTrue(name.startsWith('k:'));
+ name = name.substring(2).replaceAll('.', "#");
String expression = instanceFields[field].toDartText();
String expected = data.fields[name];
Expect.equals(
diff --git a/tests/compiler/dart2js/no_such_method_enabled_test.dart b/tests/compiler/dart2js/no_such_method_enabled_test.dart
index 74c1826..68ff7c5 100644
--- a/tests/compiler/dart2js/no_such_method_enabled_test.dart
+++ b/tests/compiler/dart2js/no_such_method_enabled_test.dart
@@ -212,7 +212,7 @@
print(test.code);
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': test.code},
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Compiler compiler = result.compiler;
checkTest(compiler, test);
}
diff --git a/tests/compiler/dart2js/old_frontend/analyze_all_test.dart b/tests/compiler/dart2js/old_frontend/analyze_all_test.dart
index b6daf1c..4936c1c 100644
--- a/tests/compiler/dart2js/old_frontend/analyze_all_test.dart
+++ b/tests/compiler/dart2js/old_frontend/analyze_all_test.dart
@@ -34,7 +34,7 @@
{bool analyzeAll, bool expectSuccess}) async {
DiagnosticCollector collector = new DiagnosticCollector();
- List<String> options = [];
+ List<String> options = [Flags.useOldFrontend];
if (analyzeAll) {
options.add(Flags.analyzeAll);
} else {
diff --git a/tests/compiler/dart2js/old_frontend/analyze_dart2js_helpers_test.dart b/tests/compiler/dart2js/old_frontend/analyze_dart2js_helpers_test.dart
index 9375f46..7ff112a 100644
--- a/tests/compiler/dart2js/old_frontend/analyze_dart2js_helpers_test.dart
+++ b/tests/compiler/dart2js/old_frontend/analyze_dart2js_helpers_test.dart
@@ -31,6 +31,7 @@
bool verbose = arguments.contains('-v');
List<String> options = <String>[
+ Flags.useOldFrontend,
Flags.analyzeOnly,
Flags.analyzeMain,
'--categories=Client,Server'
diff --git a/tests/compiler/dart2js/old_frontend/analyze_helper.dart b/tests/compiler/dart2js/old_frontend/analyze_helper.dart
index e11223e..851e1e3 100644
--- a/tests/compiler/dart2js/old_frontend/analyze_helper.dart
+++ b/tests/compiler/dart2js/old_frontend/analyze_helper.dart
@@ -232,6 +232,7 @@
var provider = new CompilerSourceFileProvider();
var handler = new CollectingDiagnosticHandler(whiteList, skipList, provider);
options = <String>[
+ Flags.useOldFrontend,
Flags.analyzeOnly,
'--categories=Client,Server',
Flags.showPackageWarnings
diff --git a/tests/compiler/dart2js/old_frontend/analyze_only_test.dart b/tests/compiler/dart2js/old_frontend/analyze_only_test.dart
index 9b88dc9..efe3c52 100644
--- a/tests/compiler/dart2js/old_frontend/analyze_only_test.dart
+++ b/tests/compiler/dart2js/old_frontend/analyze_only_test.dart
@@ -40,6 +40,7 @@
}
}
+ options = [Flags.useOldFrontend]..addAll(options);
print('-----------------------------------------------');
print('main source:\n$main');
print('options: $options\n');
diff --git a/tests/compiler/dart2js/old_frontend/bad_loop_test.dart b/tests/compiler/dart2js/old_frontend/bad_loop_test.dart
index 889cecd..8148664 100644
--- a/tests/compiler/dart2js/old_frontend/bad_loop_test.dart
+++ b/tests/compiler/dart2js/old_frontend/bad_loop_test.dart
@@ -35,7 +35,10 @@
provider,
new LegacyCompilerOutput(),
new LegacyCompilerDiagnostics(diagnosticHandler),
- new CompilerOptions(libraryRoot: libraryRoot, packageRoot: packageRoot));
+ new CompilerOptions(
+ libraryRoot: libraryRoot,
+ useKernel: false,
+ packageRoot: packageRoot));
asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
Expect.isTrue(compiler.compilationFailed);
Expect.equals(5, errorCount);
diff --git a/tests/compiler/dart2js/old_frontend/benign_error_test.dart b/tests/compiler/dart2js/old_frontend/benign_error_test.dart
index 9fd009f..a94a5aa 100644
--- a/tests/compiler/dart2js/old_frontend/benign_error_test.dart
+++ b/tests/compiler/dart2js/old_frontend/benign_error_test.dart
@@ -7,6 +7,7 @@
import '../memory_compiler.dart';
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/messages.dart';
import 'package:compiler/src/js_backend/js_backend.dart';
@@ -28,7 +29,9 @@
}
DiagnosticCollector collector = new DiagnosticCollector();
CompilationResult result = await runCompiler(
- memorySourceFiles: example, diagnosticHandler: collector);
+ memorySourceFiles: example,
+ diagnosticHandler: collector,
+ options: [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Expect
.isTrue(collector.errors.any((message) => message.messageKind == kind));
diff --git a/tests/compiler/dart2js/old_frontend/categories_test.dart b/tests/compiler/dart2js/old_frontend/categories_test.dart
index d1b8eaa..6b4317c 100644
--- a/tests/compiler/dart2js/old_frontend/categories_test.dart
+++ b/tests/compiler/dart2js/old_frontend/categories_test.dart
@@ -4,6 +4,7 @@
import "package:expect/expect.dart";
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import "../memory_compiler.dart";
@@ -11,7 +12,7 @@
var collector = new DiagnosticCollector();
await runCompiler(
memorySourceFiles: {"main.dart": source},
- options: ["--categories=$categories"],
+ options: ["--categories=$categories", Flags.useOldFrontend],
diagnosticHandler: collector);
Expect.equals(expectedErrors, collector.errors.length);
Expect.equals(0, collector.warnings.length);
diff --git a/tests/compiler/dart2js/old_frontend/check_elements_invariants_test.dart b/tests/compiler/dart2js/old_frontend/check_elements_invariants_test.dart
index 3d0bea5..f394e6d 100644
--- a/tests/compiler/dart2js/old_frontend/check_elements_invariants_test.dart
+++ b/tests/compiler/dart2js/old_frontend/check_elements_invariants_test.dart
@@ -5,6 +5,7 @@
import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/apiimpl.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/elements/entities.dart' show ClassEntity;
import 'package:compiler/src/resolution/class_members.dart'
@@ -14,7 +15,8 @@
const String DART2JS_SOURCE = 'pkg/compiler/lib/src/dart2js.dart';
const List<String> DART2JS_OPTIONS = const <String>[
'--categories=Client,Server',
- '--disable-type-inference'
+ '--disable-type-inference',
+ Flags.useOldFrontend
];
Iterable<ClassEntity> computeLiveClasses(CompilerImpl compiler) {
diff --git a/tests/compiler/dart2js/old_frontend/combinator_hint_test.dart b/tests/compiler/dart2js/old_frontend/combinator_hint_test.dart
index 30f9535..3ff105c 100644
--- a/tests/compiler/dart2js/old_frontend/combinator_hint_test.dart
+++ b/tests/compiler/dart2js/old_frontend/combinator_hint_test.dart
@@ -44,7 +44,7 @@
print('==================================================================');
print('test: $entryPoint showPackageWarnings=$showPackageWarnings '
'suppressHints=$suppressHints');
- var options = [Flags.analyzeOnly];
+ var options = [Flags.analyzeOnly, Flags.useOldFrontend];
if (showPackageWarnings) {
options.add(Flags.showPackageWarnings);
}
diff --git a/tests/compiler/dart2js/old_frontend/diagnose_ambiguous_test.dart b/tests/compiler/dart2js/old_frontend/diagnose_ambiguous_test.dart
index 53538ed..6e8708b 100644
--- a/tests/compiler/dart2js/old_frontend/diagnose_ambiguous_test.dart
+++ b/tests/compiler/dart2js/old_frontend/diagnose_ambiguous_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/compiler_new.dart' show Diagnostic;
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@@ -13,7 +14,7 @@
CompilationResult result = await runCompiler(
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: collector,
- options: ['--analyze-all']);
+ options: ['--analyze-all', Flags.useOldFrontend]);
List<String> diagnostics = <String>[];
collector.messages.forEach((CollectedMessage message) {
diff --git a/tests/compiler/dart2js/old_frontend/duplicate_library_test.dart b/tests/compiler/dart2js/old_frontend/duplicate_library_test.dart
index 0f10f25..ea030a3 100644
--- a/tests/compiler/dart2js/old_frontend/duplicate_library_test.dart
+++ b/tests/compiler/dart2js/old_frontend/duplicate_library_test.dart
@@ -30,7 +30,7 @@
memorySourceFiles: source,
diagnosticHandler: collector,
showDiagnostics: true,
- options: [Flags.analyzeOnly, Flags.analyzeAll],
+ options: [Flags.analyzeOnly, Flags.analyzeAll, Flags.useOldFrontend],
packageRoot: Uri.parse('memory:pkg/'));
Expect.isTrue(collector.errors.isEmpty);
diff --git a/tests/compiler/dart2js/old_frontend/error_token_test.dart b/tests/compiler/dart2js/old_frontend/error_token_test.dart
index 7cdd28f..fb0854e 100644
--- a/tests/compiler/dart2js/old_frontend/error_token_test.dart
+++ b/tests/compiler/dart2js/old_frontend/error_token_test.dart
@@ -8,6 +8,7 @@
import 'dart:async';
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import "package:compiler/src/diagnostics/messages.dart";
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@@ -20,7 +21,8 @@
entryPoint: Uri.parse('memory:main.dart'),
memorySourceFiles: {'main.dart': code},
diagnosticHandler: diagnostics,
- outputProvider: output);
+ outputProvider: output,
+ options: [Flags.useOldFrontend]);
Expect.equals(error != null ? 1 : 0, diagnostics.errors.length);
if (error != null)
diff --git a/tests/compiler/dart2js/old_frontend/frontend_checker.dart b/tests/compiler/dart2js/old_frontend/frontend_checker.dart
index 7699405..7fc1552 100644
--- a/tests/compiler/dart2js/old_frontend/frontend_checker.dart
+++ b/tests/compiler/dart2js/old_frontend/frontend_checker.dart
@@ -48,7 +48,8 @@
entryPoint: Uri.parse('memory:$testFileName'),
memorySourceFiles: {testFileName: testSources[testName]},
diagnosticHandler: collector,
- options: [Flags.analyzeOnly]..addAll(options),
+ options: [Flags.analyzeOnly, Flags.useOldFrontend]
+ ..addAll(options),
showDiagnostics: verbose,
cachedCompiler: cachedCompiler);
var compiler = result.compiler;
diff --git a/tests/compiler/dart2js/old_frontend/generic_method_type_usage_test.dart b/tests/compiler/dart2js/old_frontend/generic_method_type_usage_test.dart
index 1e34c9a..7d352c0 100644
--- a/tests/compiler/dart2js/old_frontend/generic_method_type_usage_test.dart
+++ b/tests/compiler/dart2js/old_frontend/generic_method_type_usage_test.dart
@@ -14,6 +14,7 @@
import 'dart:async';
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import "package:compiler/src/diagnostics/messages.dart";
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@@ -90,7 +91,7 @@
OutputCollector output = new OutputCollector();
await runCompiler(
entryPoint: main,
- options: const <String>["--generic-method-syntax"],
+ options: const <String>["--generic-method-syntax", Flags.useOldFrontend],
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: diagnostics,
outputProvider: output);
diff --git a/tests/compiler/dart2js/old_frontend/import_test.dart b/tests/compiler/dart2js/old_frontend/import_test.dart
index de6daee..59f5362 100644
--- a/tests/compiler/dart2js/old_frontend/import_test.dart
+++ b/tests/compiler/dart2js/old_frontend/import_test.dart
@@ -8,6 +8,7 @@
library dart2js.test.import;
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/diagnostics/messages.dart';
import '../memory_compiler.dart';
@@ -45,7 +46,8 @@
await runCompiler(
entryPoint: Uri.parse('memory:part.dart'),
memorySourceFiles: MEMORY_SOURCE_FILES,
- diagnosticHandler: collector);
+ diagnosticHandler: collector,
+ options: [Flags.useOldFrontend]);
collector.checkMessages([const Expected.error(MessageKind.MAIN_HAS_PART_OF)]);
}
@@ -55,7 +57,8 @@
await runCompiler(
entryPoint: Uri.parse('memory:lib.dart'),
memorySourceFiles: MEMORY_SOURCE_FILES,
- diagnosticHandler: collector);
+ diagnosticHandler: collector,
+ options: [Flags.useOldFrontend]);
collector.checkMessages([
const Expected.error(MessageKind.IMPORT_PART_OF),
@@ -66,7 +69,9 @@
testMissingImports() async {
var collector = new DiagnosticCollector();
await runCompiler(
- memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ diagnosticHandler: collector,
+ options: [Flags.useOldFrontend]);
collector.checkMessages([
const Expected.error(MessageKind.READ_URI_ERROR),
@@ -81,7 +86,8 @@
var collector = new DiagnosticCollector();
await runCompiler(
entryPoint: Uri.parse('memory:missing.dart'),
- diagnosticHandler: collector);
+ diagnosticHandler: collector,
+ options: [Flags.useOldFrontend]);
collector.checkMessages([const Expected.error(MessageKind.READ_SELF_ERROR)]);
}
diff --git a/tests/compiler/dart2js/old_frontend/library_resolution_test.dart b/tests/compiler/dart2js/old_frontend/library_resolution_test.dart
index 34742a3..a698aba 100644
--- a/tests/compiler/dart2js/old_frontend/library_resolution_test.dart
+++ b/tests/compiler/dart2js/old_frontend/library_resolution_test.dart
@@ -38,7 +38,9 @@
const NullCompilerOutput(),
handler,
new CompilerOptions(
- libraryRoot: libraryRoot, packageConfig: packageConfig));
+ libraryRoot: libraryRoot,
+ useKernel: false,
+ packageConfig: packageConfig));
}
main() async {
diff --git a/tests/compiler/dart2js/old_frontend/malformed_uri_test.dart b/tests/compiler/dart2js/old_frontend/malformed_uri_test.dart
index a3b52ea..d5affd7 100644
--- a/tests/compiler/dart2js/old_frontend/malformed_uri_test.dart
+++ b/tests/compiler/dart2js/old_frontend/malformed_uri_test.dart
@@ -9,6 +9,7 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
+import 'package:compiler/src/commandline_options.dart';
import '../memory_compiler.dart';
const MEMORY_SOURCE_FILES = const {
@@ -23,7 +24,9 @@
asyncTest(() async {
var collector = new DiagnosticCollector();
await runCompiler(
- memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector);
+ memorySourceFiles: MEMORY_SOURCE_FILES,
+ diagnosticHandler: collector,
+ options: [Flags.useOldFrontend]);
Expect.equals(1, collector.errors.length);
});
}
diff --git a/tests/compiler/dart2js/old_frontend/members_test.dart b/tests/compiler/dart2js/old_frontend/members_test.dart
index f0f03cb..2ca4b90 100644
--- a/tests/compiler/dart2js/old_frontend/members_test.dart
+++ b/tests/compiler/dart2js/old_frontend/members_test.dart
@@ -7,6 +7,7 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
import '../type_test_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/elements/resolution_types.dart';
import "package:compiler/src/elements/elements.dart"
show ClassElement, MemberSignature;
@@ -187,7 +188,9 @@
class C<S> extends B<S> {}
class D extends C<int> {}
class E extends D {}
- """, compileMode: CompileMode.memory).then((env) {
+ """,
+ options: [Flags.useOldFrontend],
+ compileMode: CompileMode.memory).then((env) {
ResolutionInterfaceType bool_ = env['bool'];
ResolutionInterfaceType String_ = env['String'];
ResolutionInterfaceType int_ = env['int'];
@@ -445,7 +448,7 @@
num method4();
}
abstract class D implements A, B, C {}
- """).then((env) {
+ """, options: [Flags.useOldFrontend]).then((env) {
ResolutionDynamicType dynamic_ = env['dynamic'];
ResolutionVoidType void_ = env['void'];
ResolutionInterfaceType num_ = env['num'];
@@ -614,7 +617,7 @@
method2(a);
}
abstract class C extends A implements B {}
- """).then((env) {
+ """, options: [Flags.useOldFrontend]).then((env) {
ResolutionDynamicType dynamic_ = env['dynamic'];
ResolutionInterfaceType A = env['A'];
@@ -665,7 +668,7 @@
method3(S a) {}
}
abstract class C<U, V> extends Object with A<U> implements B<V> {}
- """).then((env) {
+ """, options: [Flags.useOldFrontend]).then((env) {
ResolutionDynamicType dynamic_ = env['dynamic'];
ClassElement A = env.getElement('A');
@@ -734,7 +737,7 @@
abstract class B implements A {
}
abstract class C extends Object with B {}
- """).then((env) {
+ """, options: [Flags.useOldFrontend]).then((env) {
ResolutionDynamicType dynamic_ = env['dynamic'];
ResolutionInterfaceType A = env['A'];
diff --git a/tests/compiler/dart2js/old_frontend/message_kind_helper.dart b/tests/compiler/dart2js/old_frontend/message_kind_helper.dart
index 0703acd..f869e39 100644
--- a/tests/compiler/dart2js/old_frontend/message_kind_helper.dart
+++ b/tests/compiler/dart2js/old_frontend/message_kind_helper.dart
@@ -69,8 +69,11 @@
Compiler compiler = compilerFor(
memorySourceFiles: example,
diagnosticHandler: collector,
- options: [Flags.analyzeOnly, Flags.enableExperimentalMirrors]
- ..addAll(template.options),
+ options: [
+ Flags.analyzeOnly,
+ Flags.enableExperimentalMirrors,
+ Flags.useOldFrontend
+ ]..addAll(template.options),
cachedCompiler: cachedCompiler);
return compiler.run(Uri.parse('memory:main.dart')).then((_) {
diff --git a/tests/compiler/dart2js/old_frontend/message_span_test.dart b/tests/compiler/dart2js/old_frontend/message_span_test.dart
index 9fff9b5..35009d7 100644
--- a/tests/compiler/dart2js/old_frontend/message_span_test.dart
+++ b/tests/compiler/dart2js/old_frontend/message_span_test.dart
@@ -146,7 +146,7 @@
DiagnosticCollector collector = new DiagnosticCollector();
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': test.code},
- options: [Flags.analyzeOnly],
+ options: [Flags.analyzeOnly, Flags.useOldFrontend],
diagnosticHandler: collector,
cachedCompiler: cachedCompiler);
cachedCompiler = result.compiler;
diff --git a/tests/compiler/dart2js/old_frontend/method_type_variable_test.dart b/tests/compiler/dart2js/old_frontend/method_type_variable_test.dart
index b0c0d4e..00a037a 100644
--- a/tests/compiler/dart2js/old_frontend/method_type_variable_test.dart
+++ b/tests/compiler/dart2js/old_frontend/method_type_variable_test.dart
@@ -1,4 +1,5 @@
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/diagnostics/messages.dart';
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@@ -10,7 +11,9 @@
print(code);
DiagnosticCollector collector = new DiagnosticCollector();
await runCompiler(
- memorySourceFiles: {'main.dart': code}, diagnosticHandler: collector);
+ memorySourceFiles: {'main.dart': code},
+ diagnosticHandler: collector,
+ options: [Flags.useOldFrontend]);
Expect.equals(0, collector.errors.length, "Unexpected errors.");
Expect.listEquals(
expectedWarnings,
diff --git a/tests/compiler/dart2js/old_frontend/minimal_resolution_test.dart b/tests/compiler/dart2js/old_frontend/minimal_resolution_test.dart
index 5cebcf2..c266e93 100644
--- a/tests/compiler/dart2js/old_frontend/minimal_resolution_test.dart
+++ b/tests/compiler/dart2js/old_frontend/minimal_resolution_test.dart
@@ -5,6 +5,7 @@
// Test that elements are not needlessly required by dart2js.
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common/names.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/elements/elements.dart';
@@ -36,7 +37,8 @@
analyze(String code,
{bool proxyConstantComputed: false, bool deprecatedClass: false}) async {
CompilationResult result = await runCompiler(
- memorySourceFiles: {'main.dart': code}, options: ['--analyze-only']);
+ memorySourceFiles: {'main.dart': code},
+ options: ['--analyze-only', Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
Expect.equals(
diff --git a/tests/compiler/dart2js/old_frontend/missing_file_test.dart b/tests/compiler/dart2js/old_frontend/missing_file_test.dart
index 92c4891..5fdbb8a 100644
--- a/tests/compiler/dart2js/old_frontend/missing_file_test.dart
+++ b/tests/compiler/dart2js/old_frontend/missing_file_test.dart
@@ -8,6 +8,7 @@
import 'dart:async';
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import "package:compiler/src/diagnostics/messages.dart";
import 'package:expect/expect.dart';
import '../memory_compiler.dart';
@@ -36,7 +37,8 @@
entryPoint: main,
memorySourceFiles: MEMORY_SOURCE_FILES,
diagnosticHandler: diagnostics,
- outputProvider: output);
+ outputProvider: output,
+ options: [Flags.useOldFrontend]);
Expect.isFalse(output.hasExtraOutput);
Expect.equals(error != null ? 1 : 0, diagnostics.errors.length);
diff --git a/tests/compiler/dart2js/old_frontend/mock_compiler.dart b/tests/compiler/dart2js/old_frontend/mock_compiler.dart
index 94ea07a..1ecfdfe 100644
--- a/tests/compiler/dart2js/old_frontend/mock_compiler.dart
+++ b/tests/compiler/dart2js/old_frontend/mock_compiler.dart
@@ -93,6 +93,7 @@
options: new CompilerOptions(
entryPoint: new Uri(scheme: 'mock'),
libraryRoot: Uri.parse('placeholder_library_root_for_mock/'),
+ useKernel: false,
enableTypeAssertions: enableTypeAssertions,
enableUserAssertions: enableUserAssertions,
disableInlining: disableInlining,
diff --git a/tests/compiler/dart2js/old_frontend/package_root_test.dart b/tests/compiler/dart2js/old_frontend/package_root_test.dart
index 2e60fc9..793d17f 100644
--- a/tests/compiler/dart2js/old_frontend/package_root_test.dart
+++ b/tests/compiler/dart2js/old_frontend/package_root_test.dart
@@ -10,6 +10,7 @@
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/compiler.dart' show PackagesDiscoveryProvider;
import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
import 'package:package_config/packages.dart';
@@ -41,7 +42,8 @@
diagnosticHandler: collector,
packageRoot: packageRoot,
packageConfig: packageConfig,
- packagesDiscoveryProvider: packagesDiscoveryProvider);
+ packagesDiscoveryProvider: packagesDiscoveryProvider,
+ options: [Flags.useOldFrontend]);
Expect.equals(
1, collector.errors.length, "Unexpected errors: ${collector.errors}");
Expect.equals(expectedMessageKind, collector.errors.first.message.kind,
diff --git a/tests/compiler/dart2js/old_frontend/related_types.dart b/tests/compiler/dart2js/old_frontend/related_types.dart
index 9a64e22..26f9607 100644
--- a/tests/compiler/dart2js/old_frontend/related_types.dart
+++ b/tests/compiler/dart2js/old_frontend/related_types.dart
@@ -25,7 +25,11 @@
Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.last));
CompilationResult result = await runCompiler(
entryPoint: entryPoint,
- options: [Flags.analyzeOnly, '--categories=Client,Server']);
+ options: [
+ Flags.analyzeOnly,
+ '--categories=Client,Server',
+ Flags.useOldFrontend
+ ]);
if (result.isSuccess) {
checkRelatedTypes(result.compiler);
}
diff --git a/tests/compiler/dart2js/old_frontend/related_types_test.dart b/tests/compiler/dart2js/old_frontend/related_types_test.dart
index dda4a76..963afa2 100644
--- a/tests/compiler/dart2js/old_frontend/related_types_test.dart
+++ b/tests/compiler/dart2js/old_frontend/related_types_test.dart
@@ -263,7 +263,7 @@
DiagnosticCollector collector = new DiagnosticCollector();
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': CODE},
- options: [Flags.analyzeOnly, Flags.analyzeMain],
+ options: [Flags.analyzeOnly, Flags.analyzeMain, Flags.useOldFrontend],
diagnosticHandler: collector);
Expect.isFalse(
collector.hasRegularMessages, "Unexpected analysis messages.");
diff --git a/tests/compiler/dart2js/old_frontend/semantic_visitor_test.dart b/tests/compiler/dart2js/old_frontend/semantic_visitor_test.dart
index f72ea16..3ce95aa 100644
--- a/tests/compiler/dart2js/old_frontend/semantic_visitor_test.dart
+++ b/tests/compiler/dart2js/old_frontend/semantic_visitor_test.dart
@@ -295,7 +295,7 @@
CompilationResult result = await runCompiler(
memorySourceFiles: sourceFiles,
- options: [Flags.analyzeAll, Flags.analyzeOnly]);
+ options: [Flags.analyzeAll, Flags.analyzeOnly, Flags.useOldFrontend]);
Compiler compiler = result.compiler;
testMap.forEach((String filename, Test test) {
LibraryElement library =
diff --git a/tests/compiler/dart2js/old_frontend/space_test.dart b/tests/compiler/dart2js/old_frontend/space_test.dart
index 0f01fab..8ffc6471 100644
--- a/tests/compiler/dart2js/old_frontend/space_test.dart
+++ b/tests/compiler/dart2js/old_frontend/space_test.dart
@@ -15,6 +15,7 @@
return dart2js.main([
"--library-root=${libraryRoot.toFilePath()}",
Flags.analyzeOnly,
+ Flags.useOldFrontend,
"file with spaces.dart"
]);
}
diff --git a/tests/compiler/dart2js/old_frontend/warnings_checker.dart b/tests/compiler/dart2js/old_frontend/warnings_checker.dart
index b974781..2bb7c4e 100644
--- a/tests/compiler/dart2js/old_frontend/warnings_checker.dart
+++ b/tests/compiler/dart2js/old_frontend/warnings_checker.dart
@@ -43,7 +43,7 @@
await runCompiler(
entryPoint: uri,
diagnosticHandler: collector,
- options: [Flags.analyzeOnly],
+ options: [Flags.analyzeOnly, Flags.useOldFrontend],
showDiagnostics: verbose);
Map<String, List<int>> statusMap = tests[test];
// Line numbers with known unexpected warnings.
diff --git a/tests/compiler/dart2js/output_type_test.dart b/tests/compiler/dart2js/output_type_test.dart
index 0e07a75..34c18a1 100644
--- a/tests/compiler/dart2js/output_type_test.dart
+++ b/tests/compiler/dart2js/output_type_test.dart
@@ -40,8 +40,8 @@
{List<String> groupOutputs: const <String>[], bool useKernel}) async {
List<String> options = new List<String>.from(arguments)
..add("--library-root=${Uri.base.resolve('sdk/')}");
- if (useKernel) {
- options.add(Flags.useKernel);
+ if (!useKernel) {
+ options.add(Flags.useOldFrontend);
}
print('--------------------------------------------------------------------');
print('dart2js ${options.join(' ')}');
diff --git a/tests/compiler/dart2js/rti/backend_type_helper_test.dart b/tests/compiler/dart2js/rti/backend_type_helper_test.dart
index 6d47050..9c72330 100644
--- a/tests/compiler/dart2js/rti/backend_type_helper_test.dart
+++ b/tests/compiler/dart2js/rti/backend_type_helper_test.dart
@@ -18,7 +18,7 @@
runTest({bool useKernel}) async {
CompilationResult result = await runCompiler(
entryPoint: Platform.script.resolve('data/subtype_named_args.dart'),
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
diff --git a/tests/compiler/dart2js/rti/data/call_typed.dart b/tests/compiler/dart2js/rti/data/call_typed.dart
new file mode 100644
index 0000000..edab1dd
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/call_typed.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+class A {
+ call(int i) {}
+}
+
+@noInline
+test(o) => o is Function(int);
+
+main() {
+ Expect.isTrue(test(new A()));
+ Expect.isFalse(test(null));
+}
diff --git a/tests/compiler/dart2js/rti/data/call_typed_generic.dart b/tests/compiler/dart2js/rti/data/call_typed_generic.dart
new file mode 100644
index 0000000..494b90c
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/call_typed_generic.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+/*class: A:needsArgs*/
+class A<T> {
+ /*element: A.call:needsSignature*/
+ call(T t) {}
+}
+
+@noInline
+test(o) => o is Function(int);
+
+main() {
+ Expect.isTrue(test(new A<int>()));
+ Expect.isFalse(test(new A<String>()));
+}
diff --git a/tests/compiler/dart2js/rti/data/call_typed_generic_strong.dart b/tests/compiler/dart2js/rti/data/call_typed_generic_strong.dart
new file mode 100644
index 0000000..ef0e3cb
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/call_typed_generic_strong.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+/*class: A:needsArgs*/
+class A<T> {
+ /*element: A.call:needsSignature*/
+ call(T t) {}
+}
+
+@noInline
+test(o) => o is Function(int);
+
+main() {
+ Expect.isFalse(test(new A<int>()));
+ Expect.isFalse(test(new A<String>()));
+}
diff --git a/tests/compiler/dart2js/rti/data/call_typed_strong.dart b/tests/compiler/dart2js/rti/data/call_typed_strong.dart
new file mode 100644
index 0000000..9731508
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/call_typed_strong.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+class A {
+ call(int i) {}
+}
+
+@noInline
+test(o) => o is Function(int);
+
+main() {
+ Expect.isFalse(test(new A()));
+ Expect.isFalse(test(null));
+}
diff --git a/tests/compiler/dart2js/rti/data/closure_generic_unneeded_strong.dart b/tests/compiler/dart2js/rti/data/closure_generic_unneeded_strong.dart
new file mode 100644
index 0000000..b3b1ef3
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/closure_generic_unneeded_strong.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+/*class: A:needsArgs*/
+class A<T> {
+ @NoInline()
+ m() {
+ return /*needsSignature*/ (T t, String s) {};
+ }
+}
+
+@NoInline()
+test(o) => o is void Function(int);
+
+main() {
+ test(new A<int>().m());
+}
diff --git a/tests/compiler/dart2js/rti/data/closure_unneeded_strong.dart b/tests/compiler/dart2js/rti/data/closure_unneeded_strong.dart
new file mode 100644
index 0000000..34d26df
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/closure_unneeded_strong.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+/*class: A:*/
+class A<T> {
+ @NoInline()
+ m() {
+ return /*needsSignature*/ (int i, String s) {};
+ }
+}
+
+@NoInline()
+test(o) => o is void Function(int);
+
+main() {
+ test(new A<int>().m());
+}
diff --git a/tests/compiler/dart2js/rti/data/generic_class_is2.dart b/tests/compiler/dart2js/rti/data/generic_class_is2.dart
index 2cfc7ac..508466d 100644
--- a/tests/compiler/dart2js/rti/data/generic_class_is2.dart
+++ b/tests/compiler/dart2js/rti/data/generic_class_is2.dart
@@ -8,7 +8,6 @@
/*class: A:implicit=[List<A<C2>>,List<A<C>>]*/
class A<T> {}
-/*kernel.class: A1:implicit=[A1]*/
class A1 implements A<C1> {}
/*class: B:direct,explicit=[B.T],needsArgs*/
diff --git a/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart b/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart
index 34c9ecd..1f6c15e 100644
--- a/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart
+++ b/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart
@@ -8,8 +8,7 @@
/*class: B:deps=[method],explicit=[B<A>],needsArgs*/
class B<T> {}
-/*ast.element: method:*/
-/*kernel.element: method:needsArgs*/
+/*element: method:*/
method<T>() => new B<T>();
main() {
diff --git a/tests/compiler/dart2js/rti/data/generic_method_instantiate_strong.dart b/tests/compiler/dart2js/rti/data/generic_method_instantiate_strong.dart
new file mode 100644
index 0000000..8364623
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/generic_method_instantiate_strong.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*class: A:explicit=[B<A>]*/
+class A {}
+
+/*class: B:deps=[method],explicit=[B<A>],needsArgs*/
+class B<T> {}
+
+/*element: method:needsArgs*/
+method<T>() => new B<T>();
+
+main() {
+ method<A>() is B<A>;
+}
diff --git a/tests/compiler/dart2js/rti/data/generic_method_is.dart b/tests/compiler/dart2js/rti/data/generic_method_is.dart
index dd26b9e..4adc872 100644
--- a/tests/compiler/dart2js/rti/data/generic_method_is.dart
+++ b/tests/compiler/dart2js/rti/data/generic_method_is.dart
@@ -2,8 +2,7 @@
// 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.
-/*ast.element: method:direct,explicit=[method.T]*/
-/*kernel.element: method:direct,explicit=[method.T],needsArgs*/
+/*element: method:direct,explicit=[method.T]*/
method<T>(T t) => t is T;
main() {
diff --git a/tests/compiler/dart2js/rti/data/generic_method_is2_strong.dart b/tests/compiler/dart2js/rti/data/generic_method_is2_strong.dart
new file mode 100644
index 0000000..2ed28c3
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/generic_method_is2_strong.dart
@@ -0,0 +1,95 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*class: A1:implicit=[A1]*/
+class A1 {}
+
+class A2 {}
+
+/*class: B1:implicit=[B1]*/
+class B1 {}
+
+class B2 {}
+
+/*class: C1:implicit=[C1]*/
+class C1 {}
+
+class C2 {}
+
+/*class: C3:implicit=[C3]*/
+class C3 {}
+
+/*class: D1:implicit=[D1]*/
+class D1 {}
+
+class D2 {}
+
+/*class: E1:implicit=[E1]*/
+class E1 {}
+
+class E2 {}
+
+/*class: F1:implicit=[F1]*/
+class F1 {}
+
+class F2 {}
+
+/*class: F3:implicit=[F3]*/
+class F3 {}
+
+/*element: topLevelMethod1:direct,explicit=[topLevelMethod1.T],needsArgs,selectors=[Selector(call, call, arity=2, named=[a1], types=1)]*/
+// Calls to this imply a check of the passed type arguments.
+bool topLevelMethod1<T>(T t, {a1}) => t is T;
+
+// Calls to this does _not_ imply a check of the passed type arguments.
+T topLevelMethod2<T>(T t, {a2}) => t;
+
+class Class {
+ /*element: Class.instanceMethod1:direct,explicit=[instanceMethod1.S],needsArgs,selectors=[Selector(call, call, arity=2, named=[b1], types=1),Selector(call, instanceMethod1, arity=2, named=[b1], types=1)]*/
+ // Calls to this imply a check of the passed type arguments.
+ bool instanceMethod1<S>(S s, {b1}) => s is S;
+
+ // Calls to this does _not_ imply a check of the passed type arguments.
+ S instanceMethod2<S>(S s, {b2}) => s;
+}
+
+main() {
+ // Calls to this imply a check of the passed type arguments.
+ /*direct,explicit=[localFunction1.U],needsArgs,selectors=[Selector(call, call, arity=2, named=[c1], types=1)]*/
+ bool localFunction1<U>(U u, {c1}) => u is U;
+
+ // Calls to this does _not_ imply a check of the passed type arguments.
+ U localFunction2<U>(U u, {c2}) => u;
+
+ // Calls to this does _not_ imply a check of the passed type arguments. A
+ // call to the .call function on this will, though, since it has the same
+ // signature as [localFunction1] which needs its type arguments.
+ localFunction3<U>(U u, {c1}) => u;
+
+ var c = new Class();
+
+ var local1 = localFunction1;
+ var local2 = localFunction2;
+ var local3 = localFunction3;
+ var staticTearOff1 = topLevelMethod1;
+ var staticTearOff2 = topLevelMethod2;
+ var instanceTearOff1 = c.instanceMethod1;
+ var instanceTearOff2 = c.instanceMethod2;
+
+ topLevelMethod1<A1>(new A1(), a1: 0);
+ topLevelMethod2<A2>(new A2(), a2: 0);
+ c.instanceMethod1<B1>(new B1(), b1: 0);
+ c.instanceMethod2<B2>(new B2(), b2: 0);
+ localFunction1<C1>(new C1(), c1: 0);
+ localFunction2<C2>(new C2(), c2: 0);
+ localFunction3<C3>(new C3(), c1: 0);
+
+ staticTearOff1<D1>(new D1(), a1: 0);
+ staticTearOff2<D2>(new D2(), a2: 0);
+ instanceTearOff1<E1>(new E1(), b1: 0);
+ instanceTearOff2<E2>(new E2(), b2: 0);
+ local1<F1>(new F1(), c1: 0);
+ local2<F2>(new F2(), c2: 0);
+ local3<F3>(new F3(), c1: 0);
+}
diff --git a/tests/compiler/dart2js/rti/data/generic_method_is_strong.dart b/tests/compiler/dart2js/rti/data/generic_method_is_strong.dart
index 2ed28c3..dea3540 100644
--- a/tests/compiler/dart2js/rti/data/generic_method_is_strong.dart
+++ b/tests/compiler/dart2js/rti/data/generic_method_is_strong.dart
@@ -2,94 +2,9 @@
// 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.
-/*class: A1:implicit=[A1]*/
-class A1 {}
-
-class A2 {}
-
-/*class: B1:implicit=[B1]*/
-class B1 {}
-
-class B2 {}
-
-/*class: C1:implicit=[C1]*/
-class C1 {}
-
-class C2 {}
-
-/*class: C3:implicit=[C3]*/
-class C3 {}
-
-/*class: D1:implicit=[D1]*/
-class D1 {}
-
-class D2 {}
-
-/*class: E1:implicit=[E1]*/
-class E1 {}
-
-class E2 {}
-
-/*class: F1:implicit=[F1]*/
-class F1 {}
-
-class F2 {}
-
-/*class: F3:implicit=[F3]*/
-class F3 {}
-
-/*element: topLevelMethod1:direct,explicit=[topLevelMethod1.T],needsArgs,selectors=[Selector(call, call, arity=2, named=[a1], types=1)]*/
-// Calls to this imply a check of the passed type arguments.
-bool topLevelMethod1<T>(T t, {a1}) => t is T;
-
-// Calls to this does _not_ imply a check of the passed type arguments.
-T topLevelMethod2<T>(T t, {a2}) => t;
-
-class Class {
- /*element: Class.instanceMethod1:direct,explicit=[instanceMethod1.S],needsArgs,selectors=[Selector(call, call, arity=2, named=[b1], types=1),Selector(call, instanceMethod1, arity=2, named=[b1], types=1)]*/
- // Calls to this imply a check of the passed type arguments.
- bool instanceMethod1<S>(S s, {b1}) => s is S;
-
- // Calls to this does _not_ imply a check of the passed type arguments.
- S instanceMethod2<S>(S s, {b2}) => s;
-}
+/*element: method:direct,explicit=[method.T],needsArgs*/
+method<T>(T t) => t is T;
main() {
- // Calls to this imply a check of the passed type arguments.
- /*direct,explicit=[localFunction1.U],needsArgs,selectors=[Selector(call, call, arity=2, named=[c1], types=1)]*/
- bool localFunction1<U>(U u, {c1}) => u is U;
-
- // Calls to this does _not_ imply a check of the passed type arguments.
- U localFunction2<U>(U u, {c2}) => u;
-
- // Calls to this does _not_ imply a check of the passed type arguments. A
- // call to the .call function on this will, though, since it has the same
- // signature as [localFunction1] which needs its type arguments.
- localFunction3<U>(U u, {c1}) => u;
-
- var c = new Class();
-
- var local1 = localFunction1;
- var local2 = localFunction2;
- var local3 = localFunction3;
- var staticTearOff1 = topLevelMethod1;
- var staticTearOff2 = topLevelMethod2;
- var instanceTearOff1 = c.instanceMethod1;
- var instanceTearOff2 = c.instanceMethod2;
-
- topLevelMethod1<A1>(new A1(), a1: 0);
- topLevelMethod2<A2>(new A2(), a2: 0);
- c.instanceMethod1<B1>(new B1(), b1: 0);
- c.instanceMethod2<B2>(new B2(), b2: 0);
- localFunction1<C1>(new C1(), c1: 0);
- localFunction2<C2>(new C2(), c2: 0);
- localFunction3<C3>(new C3(), c1: 0);
-
- staticTearOff1<D1>(new D1(), a1: 0);
- staticTearOff2<D2>(new D2(), a2: 0);
- instanceTearOff1<E1>(new E1(), b1: 0);
- instanceTearOff2<E2>(new E2(), b2: 0);
- local1<F1>(new F1(), c1: 0);
- local2<F2>(new F2(), c2: 0);
- local3<F3>(new F3(), c1: 0);
+ method<int>(0);
}
diff --git a/tests/compiler/dart2js/rti/data/list_to_set.dart b/tests/compiler/dart2js/rti/data/list_to_set.dart
index 611e7df..f858a43 100644
--- a/tests/compiler/dart2js/rti/data/list_to_set.dart
+++ b/tests/compiler/dart2js/rti/data/list_to_set.dart
@@ -3,9 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
/*ast.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin,SubListIterable],explicit=[List],implicit=[List.E],indirect,needsArgs*/
-/*kernel.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin,makeListFixedLength],explicit=[List,List.E,List<JSArray.E>,List<makeListFixedLength.T>],implicit=[List.E],indirect,needsArgs*/
+/*kernel.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin],explicit=[List],implicit=[List.E],indirect,needsArgs*/
/*ast.class: global#JSArray:deps=[List],explicit=[JSArray],implicit=[JSArray.E],indirect,needsArgs*/
-/*kernel.class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[JSArray,List<JSArray.E>],implicit=[JSArray.E],indirect,needsArgs*/
+/*kernel.class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[JSArray],implicit=[JSArray.E],indirect,needsArgs*/
main() {
var c = new Class<int>();
diff --git a/tests/compiler/dart2js/rti/data/list_to_set_strong.dart b/tests/compiler/dart2js/rti/data/list_to_set_strong.dart
new file mode 100644
index 0000000..da4535a
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/list_to_set_strong.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin,makeListFixedLength],explicit=[List,List.E,List<JSArray.E>,List<makeListFixedLength.T>],implicit=[List.E],indirect,needsArgs*/
+/*class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[JSArray,List<JSArray.E>],implicit=[JSArray.E],indirect,needsArgs*/
+
+main() {
+ var c = new Class<int>();
+ var list = c.m();
+ var set = list.toSet();
+ set is Set<String>;
+}
+
+/*class: Class:implicit=[Class.T],indirect,needsArgs*/
+class Class<T> {
+ m() {
+ return <T>[];
+ }
+}
diff --git a/tests/compiler/dart2js/rti/data/map_literal.dart b/tests/compiler/dart2js/rti/data/map_literal.dart
index 0ca8b19..1643414 100644
--- a/tests/compiler/dart2js/rti/data/map_literal.dart
+++ b/tests/compiler/dart2js/rti/data/map_literal.dart
@@ -2,14 +2,10 @@
// 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.
-/*ast.class: global#Map:*/
-/*kernel.class: global#Map:indirect,needsArgs*/
-/*ast.class: global#LinkedHashMap:deps=[Map]*/
-/*kernel.class: global#LinkedHashMap:deps=[Map],explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],indirect,needsArgs*/
-/*ast.class: global#JsLinkedHashMap:deps=[LinkedHashMap]*/
-/*kernel.class: global#JsLinkedHashMap:deps=[LinkedHashMap],direct,explicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],implicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],needsArgs*/
-/*ast.class: global#double:explicit=[double]*/
-/*kernel.class: global#double:explicit=[double],implicit=[double]*/
+/*class: global#Map:*/
+/*class: global#LinkedHashMap:deps=[Map]*/
+/*class: global#JsLinkedHashMap:deps=[LinkedHashMap]*/
+/*class: global#double:explicit=[double]*/
/*class: global#JSDouble:*/
main() {
diff --git a/tests/compiler/dart2js/rti/data/map_literal_strong.dart b/tests/compiler/dart2js/rti/data/map_literal_strong.dart
new file mode 100644
index 0000000..c4d4b4c
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/map_literal_strong.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*class: global#Map:indirect,needsArgs*/
+/*class: global#LinkedHashMap:deps=[Map],explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],indirect,needsArgs*/
+/*class: global#JsLinkedHashMap:deps=[LinkedHashMap],direct,explicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],implicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],needsArgs*/
+/*class: global#double:explicit=[double],implicit=[double]*/
+/*class: global#JSDouble:*/
+
+main() {
+ <int, double>{}[0] = 0.5;
+}
diff --git a/tests/compiler/dart2js/rti/data/map_to_set.dart b/tests/compiler/dart2js/rti/data/map_to_set.dart
index a0c6503..4cfda0e 100644
--- a/tests/compiler/dart2js/rti/data/map_to_set.dart
+++ b/tests/compiler/dart2js/rti/data/map_to_set.dart
@@ -2,14 +2,10 @@
// 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.
-/*ast.class: global#Map:deps=[Class],needsArgs*/
-/*kernel.class: global#Map:deps=[Class],indirect,needsArgs*/
-/*ast.class: global#LinkedHashMap:deps=[Map],needsArgs*/
-/*kernel.class: global#LinkedHashMap:deps=[Map],explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],indirect,needsArgs*/
-/*ast.class: global#JsLinkedHashMap:deps=[LinkedHashMap],implicit=[JsLinkedHashMap.K],needsArgs*/
-/*kernel.class: global#JsLinkedHashMap:deps=[LinkedHashMap],explicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],implicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],indirect,needsArgs*/
-/*ast.class: global#double:explicit=[double]*/
-/*kernel.class: global#double:explicit=[double],implicit=[double]*/
+/*class: global#Map:deps=[Class],needsArgs*/
+/*class: global#LinkedHashMap:deps=[Map],needsArgs*/
+/*class: global#JsLinkedHashMap:deps=[LinkedHashMap],implicit=[JsLinkedHashMap.K],needsArgs*/
+/*class: global#double:explicit=[double]*/
/*class: global#JSDouble:*/
main() {
@@ -19,8 +15,7 @@
set is Set<String>;
}
-/*ast.class: Class:needsArgs*/
-/*kernel.class: Class:implicit=[Class.S,Class.T],indirect,needsArgs*/
+/*class: Class:needsArgs*/
class Class<T, S> {
m() {
return <T, S>{};
diff --git a/tests/compiler/dart2js/rti/data/map_to_set_strong.dart b/tests/compiler/dart2js/rti/data/map_to_set_strong.dart
new file mode 100644
index 0000000..a111643
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/map_to_set_strong.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*class: global#Map:deps=[Class],indirect,needsArgs*/
+/*class: global#LinkedHashMap:deps=[Map],explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],indirect,needsArgs*/
+/*class: global#JsLinkedHashMap:deps=[LinkedHashMap],explicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],implicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],indirect,needsArgs*/
+/*class: global#double:explicit=[double],implicit=[double]*/
+/*class: global#JSDouble:*/
+
+main() {
+ var c = new Class<double, int>();
+ var map = c.m();
+ var set = map.keys.toSet();
+ set is Set<String>;
+}
+
+/*ast.class: Class:needsArgs*/
+/*kernel.class: Class:implicit=[Class.S,Class.T],indirect,needsArgs*/
+class Class<T, S> {
+ m() {
+ return <T, S>{};
+ }
+}
diff --git a/tests/compiler/dart2js/rti/data/tear_off.dart b/tests/compiler/dart2js/rti/data/tear_off.dart
index 6aec20e..421d480 100644
--- a/tests/compiler/dart2js/rti/data/tear_off.dart
+++ b/tests/compiler/dart2js/rti/data/tear_off.dart
@@ -2,10 +2,10 @@
// 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.
-/*class: A:needsArgs*/
+/*class: A:*/
class A<T> {
- /*element: A.m:needsSignature*/
- void m(T t) {}
+ /*element: A.m:*/
+ void m(String t) {}
/*element: A.f:*/
void f(int t) {}
diff --git a/tests/compiler/dart2js/rti/data/tear_off_generic.dart b/tests/compiler/dart2js/rti/data/tear_off_generic.dart
new file mode 100644
index 0000000..6aec20e
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/tear_off_generic.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*class: A:needsArgs*/
+class A<T> {
+ /*element: A.m:needsSignature*/
+ void m(T t) {}
+
+ /*element: A.f:*/
+ void f(int t) {}
+}
+
+main() {
+ new A<int>().m is void Function(int);
+ new A<int>().f is void Function(int);
+}
diff --git a/tests/compiler/dart2js/rti/data/tear_off_generic_strong.dart b/tests/compiler/dart2js/rti/data/tear_off_generic_strong.dart
new file mode 100644
index 0000000..6aec20e
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/tear_off_generic_strong.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*class: A:needsArgs*/
+class A<T> {
+ /*element: A.m:needsSignature*/
+ void m(T t) {}
+
+ /*element: A.f:*/
+ void f(int t) {}
+}
+
+main() {
+ new A<int>().m is void Function(int);
+ new A<int>().f is void Function(int);
+}
diff --git a/tests/compiler/dart2js/rti/data/tear_off_strong.dart b/tests/compiler/dart2js/rti/data/tear_off_strong.dart
new file mode 100644
index 0000000..421d480
--- /dev/null
+++ b/tests/compiler/dart2js/rti/data/tear_off_strong.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*class: A:*/
+class A<T> {
+ /*element: A.m:*/
+ void m(String t) {}
+
+ /*element: A.f:*/
+ void f(int t) {}
+}
+
+main() {
+ new A<int>().m is void Function(int);
+ new A<int>().f is void Function(int);
+}
diff --git a/tests/compiler/dart2js/rti/disable_rti_test.dart b/tests/compiler/dart2js/rti/disable_rti_test.dart
index ab733d8..67b3e3d 100644
--- a/tests/compiler/dart2js/rti/disable_rti_test.dart
+++ b/tests/compiler/dart2js/rti/disable_rti_test.dart
@@ -60,7 +60,7 @@
CompilationResult result = await runCompiler(
memorySourceFiles: {'main.dart': code},
options: [Flags.disableRtiOptimization, Flags.disableInlining]
- ..addAll(useKernel ? [Flags.useKernel] : []));
+ ..addAll(useKernel ? [] : [Flags.useOldFrontend]));
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
diff --git a/tests/compiler/dart2js/rti/emission/call_typed.dart b/tests/compiler/dart2js/rti/emission/call_typed.dart
new file mode 100644
index 0000000..6cb2e55
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/call_typed.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+/*class: A:checks=[],functionType,instance*/
+class A {
+ call(int i) {}
+}
+
+@noInline
+test(o) => o is Function(int);
+
+main() {
+ Expect.isTrue(test(new A()));
+ Expect.isFalse(test(null));
+}
diff --git a/tests/compiler/dart2js/rti/emission/call_typed_generic.dart b/tests/compiler/dart2js/rti/emission/call_typed_generic.dart
new file mode 100644
index 0000000..b4173d9
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/call_typed_generic.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+/*class: A:checks=[$signature],instance*/
+class A<T> {
+ call(T t) {}
+}
+
+@noInline
+test(o) => o is Function(int);
+
+main() {
+ Expect.isTrue(test(new A<int>()));
+ Expect.isFalse(test(new A<String>()));
+}
diff --git a/tests/compiler/dart2js/rti/emission/call_typed_generic_strong.dart b/tests/compiler/dart2js/rti/emission/call_typed_generic_strong.dart
new file mode 100644
index 0000000..ff62703
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/call_typed_generic_strong.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+/*class: A:checks=[],instance*/
+class A<T> {
+ call(T t) {}
+}
+
+@noInline
+test(o) => o is Function(int);
+
+main() {
+ Expect.isFalse(test(new A<int>()));
+ Expect.isFalse(test(new A<String>()));
+}
diff --git a/tests/compiler/dart2js/rti/emission/call_typed_strong.dart b/tests/compiler/dart2js/rti/emission/call_typed_strong.dart
new file mode 100644
index 0000000..3f70832
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/call_typed_strong.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+/*class: A:checks=[],instance*/
+class A {
+ call(int i) {}
+}
+
+@noInline
+test(o) => o is Function(int);
+
+main() {
+ Expect.isFalse(test(new A()));
+ Expect.isFalse(test(null));
+}
diff --git a/tests/compiler/dart2js/rti/factory_call_test.dart b/tests/compiler/dart2js/rti/factory_call_test.dart
index ed72d73..d3632ae 100644
--- a/tests/compiler/dart2js/rti/factory_call_test.dart
+++ b/tests/compiler/dart2js/rti/factory_call_test.dart
@@ -40,8 +40,7 @@
main() {
asyncTest(() async {
CompilationResult result = await runCompiler(
- memorySourceFiles: {'main.dart': code},
- options: [Flags.strongMode, Flags.useKernel]);
+ memorySourceFiles: {'main.dart': code}, options: [Flags.strongMode]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
diff --git a/tests/compiler/dart2js/rti/instance_call_test.dart b/tests/compiler/dart2js/rti/instance_call_test.dart
index b96d841..3523924 100644
--- a/tests/compiler/dart2js/rti/instance_call_test.dart
+++ b/tests/compiler/dart2js/rti/instance_call_test.dart
@@ -99,8 +99,7 @@
main() {
asyncTest(() async {
CompilationResult result = await runCompiler(
- memorySourceFiles: {'main.dart': code},
- options: [Flags.strongMode, Flags.useKernel]);
+ memorySourceFiles: {'main.dart': code}, options: [Flags.strongMode]);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
diff --git a/tests/compiler/dart2js/rti/rti_need_test.dart b/tests/compiler/dart2js/rti/rti_need_test.dart
index 8b902b0..5f30dc5 100644
--- a/tests/compiler/dart2js/rti/rti_need_test.dart
+++ b/tests/compiler/dart2js/rti/rti_need_test.dart
@@ -5,7 +5,6 @@
import 'dart:io';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/closure.dart';
-import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/common_elements.dart';
import 'package:compiler/src/compiler.dart';
@@ -35,15 +34,7 @@
dataDir, computeAstRtiMemberNeed, computeKernelRtiMemberNeed,
computeClassDataFromAst: computeAstRtiClassNeed,
computeClassDataFromKernel: computeKernelRtiClassNeed,
- args: args,
- options: [
- Flags.strongMode
- ],
- skipForKernel: [
- // TODO(johnniwinther): Fix this. It triggers a crash in the ssa
- // builder.
- 'generic_creation.dart',
- ]);
+ args: args);
});
}
diff --git a/tests/compiler/dart2js/serialization/analysis_test_helper.dart b/tests/compiler/dart2js/serialization/analysis_test_helper.dart
index 64c7c52..8c48c7c 100644
--- a/tests/compiler/dart2js/serialization/analysis_test_helper.dart
+++ b/tests/compiler/dart2js/serialization/analysis_test_helper.dart
@@ -51,7 +51,7 @@
entryPoint: entryPoint,
resolutionInputs: resolutionInputs,
memorySourceFiles: sourceFiles,
- options: [Flags.analyzeOnly],
+ options: [Flags.analyzeOnly, Flags.useOldFrontend],
diagnosticHandler: diagnosticCollector);
if (test != null) {
Expect.equals(test.expectedErrorCount, diagnosticCollector.errors.length,
diff --git a/tests/compiler/dart2js/serialization/compilation_test_helper.dart b/tests/compiler/dart2js/serialization/compilation_test_helper.dart
index 05f76b2..f1d22dd 100644
--- a/tests/compiler/dart2js/serialization/compilation_test_helper.dart
+++ b/tests/compiler/dart2js/serialization/compilation_test_helper.dart
@@ -51,7 +51,7 @@
String title = '${id}${testDescription}';
OutputCollector outputCollector = new OutputCollector();
await measure(title, 'compile', () async {
- List<String> options = [];
+ List<String> options = [Flags.useOldFrontend];
if (test != null && test.checkedMode) {
options.add(Flags.enableCheckedMode);
}
diff --git a/tests/compiler/dart2js/serialization/duplicate_library_test.dart b/tests/compiler/dart2js/serialization/duplicate_library_test.dart
index 854cc0a..7f8eceb 100644
--- a/tests/compiler/dart2js/serialization/duplicate_library_test.dart
+++ b/tests/compiler/dart2js/serialization/duplicate_library_test.dart
@@ -27,7 +27,7 @@
memorySourceFiles: sourceFiles,
resolutionInputs: resolutionInputs,
diagnosticHandler: collector,
- options: [Flags.analyzeAll]);
+ options: [Flags.analyzeAll, Flags.useOldFrontend]);
Expect.isTrue(collector.errors.isNotEmpty,
"Expected duplicate serialized library errors.");
});
diff --git a/tests/compiler/dart2js/serialization/equivalence_test.dart b/tests/compiler/dart2js/serialization/equivalence_test.dart
index 8aa3f25..027df4e 100644
--- a/tests/compiler/dart2js/serialization/equivalence_test.dart
+++ b/tests/compiler/dart2js/serialization/equivalence_test.dart
@@ -92,7 +92,11 @@
CompilationResult result = await runCompiler(
memorySourceFiles: sourceFiles,
entryPoint: entryPoint,
- options: [Flags.analyzeAll, Flags.genericMethodSyntax]);
+ options: [
+ Flags.analyzeAll,
+ Flags.genericMethodSyntax,
+ Flags.useOldFrontend
+ ]);
Compiler compiler = result.compiler;
testSerialization(compiler.libraryLoader.libraries, compiler.reporter,
compiler.resolution, compiler.libraryLoader,
diff --git a/tests/compiler/dart2js/serialization/helper.dart b/tests/compiler/dart2js/serialization/helper.dart
index 0a1f80a..4770141 100644
--- a/tests/compiler/dart2js/serialization/helper.dart
+++ b/tests/compiler/dart2js/serialization/helper.dart
@@ -162,7 +162,7 @@
}
OutputCollector outputCollector = new OutputCollector();
Compiler compiler = compilerFor(
- options: [Flags.resolveOnly],
+ options: [Flags.resolveOnly, Flags.useOldFrontend],
memorySourceFiles: memorySourceFiles,
resolutionInputs: resolutionInputs,
outputProvider: outputCollector);
@@ -243,7 +243,7 @@
entryPoint: test.sourceFiles.isEmpty ? uriList.first : null,
memorySourceFiles: sourceFiles,
resolutionInputs: serializedData.toUris(),
- options: [Flags.resolveOnly],
+ options: [Flags.resolveOnly, Flags.useOldFrontend],
outputProvider: outputCollector);
compiler.librariesToAnalyzeWhenRun = uriList;
await compiler.run(null);
diff --git a/tests/compiler/dart2js/serialization/model_test_helper.dart b/tests/compiler/dart2js/serialization/model_test_helper.dart
index 8a6a807..976b565 100644
--- a/tests/compiler/dart2js/serialization/model_test_helper.dart
+++ b/tests/compiler/dart2js/serialization/model_test_helper.dart
@@ -68,7 +68,8 @@
String title = '${id}${testDescription}';
Compiler compilerNormal = await measure(title, 'compile normal', () async {
Compiler compilerNormal = compilerFor(
- memorySourceFiles: sourceFiles, options: [Flags.analyzeOnly]);
+ memorySourceFiles: sourceFiles,
+ options: [Flags.analyzeOnly, Flags.useOldFrontend]);
compilerNormal.impactCacheDeleter.retainCachesForTesting = true;
await compilerNormal.run(entryPoint);
ElementEnvironment elementEnvironment =
@@ -82,7 +83,7 @@
Compiler compilerDeserialized = compilerFor(
memorySourceFiles: sourceFiles,
resolutionInputs: resolutionInputs,
- options: [Flags.analyzeOnly]);
+ options: [Flags.analyzeOnly, Flags.useOldFrontend]);
compilerDeserialized.impactCacheDeleter.retainCachesForTesting = true;
await compilerDeserialized.run(entryPoint);
ElementEnvironment elementEnvironment =
diff --git a/tests/compiler/dart2js/serialization/resolved_ast_test.dart b/tests/compiler/dart2js/serialization/resolved_ast_test.dart
index 5c7b3a1..7561f73 100644
--- a/tests/compiler/dart2js/serialization/resolved_ast_test.dart
+++ b/tests/compiler/dart2js/serialization/resolved_ast_test.dart
@@ -35,15 +35,16 @@
Future check(SerializedData serializedData, Uri entryPoint,
[Map<String, String> sourceFiles = const <String, String>{}]) async {
- Compiler compilerNormal =
- compilerFor(memorySourceFiles: sourceFiles, options: [Flags.analyzeAll]);
+ Compiler compilerNormal = compilerFor(
+ memorySourceFiles: sourceFiles,
+ options: [Flags.analyzeAll, Flags.useOldFrontend]);
compilerNormal.impactCacheDeleter.retainCachesForTesting = true;
await compilerNormal.run(entryPoint);
Compiler compilerDeserialized = compilerFor(
memorySourceFiles: serializedData.toMemorySourceFiles(sourceFiles),
resolutionInputs: serializedData.toUris(),
- options: [Flags.analyzeAll]);
+ options: [Flags.analyzeAll, Flags.useOldFrontend]);
compilerDeserialized.impactCacheDeleter.retainCachesForTesting = true;
await compilerDeserialized.run(entryPoint);
diff --git a/tests/compiler/dart2js/show_package_warnings_test.dart b/tests/compiler/dart2js/show_package_warnings_test.dart
index f4e06b9..5182eef 100644
--- a/tests/compiler/dart2js/show_package_warnings_test.dart
+++ b/tests/compiler/dart2js/show_package_warnings_test.dart
@@ -65,6 +65,11 @@
m(null);
pkg2.m(null);
}
+""",
+ '.packages': """
+pkg_error1:pkg/pkg_error1/
+pkg_error2:pkg/pkg_error2/
+pkg_noerror:pkg/pkg_noerror/
"""
};
@@ -90,7 +95,7 @@
entryPoint: entryPoint,
memorySourceFiles: SOURCE,
options: options,
- packageRoot: Uri.parse('memory:pkg/'),
+ packageConfig: Uri.parse('memory:.packages'),
diagnosticHandler: collector);
Expect.equals(
0, collector.errors.length, 'Unexpected errors: ${collector.errors}');
diff --git a/tests/compiler/dart2js/sourcemaps/d2js_validity_test.dart b/tests/compiler/dart2js/sourcemaps/d2js_validity_test.dart
index 006c594..53e0c75 100644
--- a/tests/compiler/dart2js/sourcemaps/d2js_validity_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/d2js_validity_test.dart
@@ -17,8 +17,12 @@
'tests/compiler/dart2js/sourcemaps/test_files/validator_test_file.dart';
asyncTest(() => createTempDir().then((Directory tmpDir) {
print('Compiling $mainFile');
- Future<CompilationResult> result = entry.internalMain(
- [mainFile, '-o${tmpDir.path}/out.js', '--library-root=sdk']);
+ Future<CompilationResult> result = entry.internalMain([
+ mainFile,
+ '-o${tmpDir.path}/out.js',
+ '--library-root=sdk',
+ '--use-old-frontend'
+ ]);
return result.then((CompilationResult result) {
CompilerImpl compiler = result.compiler;
Uri uri = new Uri.file('${tmpDir.path}/out.js',
diff --git a/tests/compiler/dart2js/sourcemaps/deferred_d2js_validity_test.dart b/tests/compiler/dart2js/sourcemaps/deferred_d2js_validity_test.dart
index 8d1ff28..ac03ca1 100644
--- a/tests/compiler/dart2js/sourcemaps/deferred_d2js_validity_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/deferred_d2js_validity_test.dart
@@ -16,8 +16,12 @@
String file = 'tests/compiler/dart2js/sourcemaps/test_files/'
'deferred_validator_test_file.dart';
print("Compiling $file");
- var result = entry.internalMain(
- [file, '-o${tmpDir.path}/out.js', '--library-root=sdk']);
+ var result = entry.internalMain([
+ file,
+ '-o${tmpDir.path}/out.js',
+ '--library-root=sdk',
+ '--use-old-frontend'
+ ]);
return result.then((CompilationResult result) {
CompilerImpl compiler = result.compiler;
Uri mainUri = new Uri.file('${tmpDir.path}/out.js',
diff --git a/tests/compiler/dart2js/sourcemaps/mapping_test.dart b/tests/compiler/dart2js/sourcemaps/mapping_test.dart
index 5a84b3f..ffc05ca 100644
--- a/tests/compiler/dart2js/sourcemaps/mapping_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/mapping_test.dart
@@ -7,7 +7,6 @@
import 'package:async_helper/async_helper.dart';
import 'package:compiler/compiler_new.dart';
-import 'package:compiler/src/commandline_options.dart';
import 'package:expect/expect.dart';
import 'package:source_maps/source_maps.dart';
import 'package:sourcemap_testing/src/annotated_code_helper.dart';
@@ -21,7 +20,7 @@
''',
'''
@{main}main() {
- @{+main}throw '';
+ @{main}throw '';
@{main}}
''',
'''
@@ -49,22 +48,11 @@
Test(this.annotatedCode, this.code, this.expectedLocations);
}
-Test processTestCode(String code, {bool useNewSourceInfo}) {
+Test processTestCode(String code) {
List<SourceLocation> expectedLocations = <SourceLocation>[];
AnnotatedCode annotatedCode = new AnnotatedCode.fromText(code);
for (Annotation annotation in annotatedCode.annotations) {
- String methodName;
- if (annotation.text.startsWith('-')) {
- // Expect only in old source maps
- if (useNewSourceInfo) continue;
- methodName = annotation.text.substring(1);
- } else if (annotation.text.startsWith('+')) {
- // Expect only in new source maps
- if (!useNewSourceInfo) continue;
- methodName = annotation.text.substring(1);
- } else {
- methodName = annotation.text;
- }
+ String methodName = annotation.text;
expectedLocations.add(
new SourceLocation(methodName, annotation.lineNo, annotation.columnNo));
}
@@ -87,7 +75,7 @@
int index = int.parse(arg, onError: (_) => null);
if (index != null) {
indices ??= <int>[];
- if (index < 0 || index >= TESTS.length * 2) {
+ if (index < 0 || index >= TESTS.length) {
print('Index $index out of bounds: [0;${TESTS.length - 1}]');
} else {
indices.add(index);
@@ -96,36 +84,22 @@
}
}
if (indices == null) {
- indices = new List<int>.generate(TESTS.length * 2, (i) => i);
+ indices = new List<int>.generate(TESTS.length, (i) => i);
}
asyncTest(() async {
for (int index in indices) {
- bool useNewSourceInfo = index % 2 == 1;
- await runTest(
- index,
- processTestCode(TESTS[index ~/ 2],
- useNewSourceInfo: useNewSourceInfo),
- printJs: printJs,
- writeJs: writeJs,
- verbose: verbose,
- useNewSourceInfo: useNewSourceInfo);
+ await runTest(index, processTestCode(TESTS[index]),
+ printJs: printJs, writeJs: writeJs, verbose: verbose);
}
});
}
Future runTest(int index, Test test,
- {bool printJs: false,
- bool writeJs,
- bool verbose: false,
- bool useNewSourceInfo: false}) async {
+ {bool printJs: false, bool writeJs, bool verbose: false}) async {
print("--$index------------------------------------------------------------");
- print("Compiling dart2js ${useNewSourceInfo ? Flags.useNewSourceInfo : ''}\n"
- "${test.annotatedCode}");
+ print("Compiling dart2js\n ${test.annotatedCode}");
OutputCollector collector = new OutputCollector();
List<String> options = <String>['--out=out.js', '--source-map=out.js.map'];
- if (useNewSourceInfo) {
- options.add(Flags.useNewSourceInfo);
- }
CompilationResult compilationResult = await runCompiler(
entryPoint: Uri.parse('memory:main.dart'),
memorySourceFiles: {'main.dart': test.code},
diff --git a/tests/compiler/dart2js/sourcemaps/multi_source_info_test.dart b/tests/compiler/dart2js/sourcemaps/multi_source_info_test.dart
index 1627c85..a1c654c 100644
--- a/tests/compiler/dart2js/sourcemaps/multi_source_info_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/multi_source_info_test.dart
@@ -11,17 +11,23 @@
main() {
asyncTest(() async {
- String oldMap = (await compile([])).getOutput('', OutputType.sourceMap);
- String newMap = (await compile([Flags.useNewSourceInfo]))
+ String oldMap = (await compile([Flags.useOldFrontend]))
.getOutput('', OutputType.sourceMap);
- OutputCollector multiCollector1 = await compile([Flags.useMultiSourceInfo]);
+ String newMap =
+ (await compile([Flags.useOldFrontend, Flags.useNewSourceInfo]))
+ .getOutput('', OutputType.sourceMap);
+ OutputCollector multiCollector1 =
+ await compile([Flags.useOldFrontend, Flags.useMultiSourceInfo]);
String multiMap1a = multiCollector1.getOutput('', OutputType.sourceMap);
String multiMap1b =
multiCollector1.getOutput('out.js', OutputType.sourceMap);
Expect.equals(oldMap, multiMap1a);
Expect.equals(newMap, multiMap1b);
- OutputCollector multiCollector2 =
- await compile([Flags.useMultiSourceInfo, Flags.useNewSourceInfo]);
+ OutputCollector multiCollector2 = await compile([
+ Flags.useOldFrontend,
+ Flags.useMultiSourceInfo,
+ Flags.useNewSourceInfo
+ ]);
String multiMap2a = multiCollector2.getOutput('', OutputType.sourceMap);
String multiMap2b =
multiCollector2.getOutput('out.js', OutputType.sourceMap);
diff --git a/tests/compiler/dart2js/sourcemaps/name_test.dart b/tests/compiler/dart2js/sourcemaps/name_test.dart
index d49387e..4855843 100644
--- a/tests/compiler/dart2js/sourcemaps/name_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/name_test.dart
@@ -7,7 +7,7 @@
import 'package:async_helper/async_helper.dart';
import 'package:expect/expect.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/elements/elements.dart';
+import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/io/source_information.dart';
import '../memory_compiler.dart';
@@ -71,7 +71,7 @@
}
''';
-check(Element element, String expectedName) {
+check(Entity element, String expectedName) {
String name = computeElementNameForSourceMaps(element);
Expect.equals(expectedName, name,
"Unexpected name '$name' for $element, expected '$expectedName'.");
@@ -82,19 +82,23 @@
CompilationResult result =
await runCompiler(memorySourceFiles: {'main.dart': SOURCE});
Compiler compiler = result.compiler;
- LibraryElement mainApp =
- compiler.frontendStrategy.elementEnvironment.mainLibrary;
+ var env = compiler.backendClosedWorldForTesting.elementEnvironment;
+ LibraryEntity mainApp = env.mainLibrary;
- Element lookup(String name) {
- Element element;
+ Entity lookup(String name) {
+ Entity element;
int dotPosition = name.indexOf('.');
if (dotPosition != -1) {
String clsName = name.substring(0, dotPosition);
- ClassElement cls = mainApp.find(clsName);
+ ClassEntity cls = env.lookupClass(mainApp, clsName);
Expect.isNotNull(cls, "Class '$clsName' not found.");
- element = cls.localLookup(name.substring(dotPosition + 1));
+ var subname = name.substring(dotPosition + 1);
+ element = env.lookupLocalClassMember(cls, subname) ??
+ env.lookupConstructor(cls, subname);
+ } else if (name.substring(0, 1) == name.substring(0, 1).toUpperCase()) {
+ element = env.lookupClass(mainApp, name);
} else {
- element = mainApp.find(name);
+ element = env.lookupLibraryMember(mainApp, name);
}
Expect.isNotNull(element, "Element '$name' not found.");
return element;
@@ -107,51 +111,50 @@
}
dynamic element = lookup(lookupName);
check(element, expectedName);
- if (element.isConstructor) {
- var constructorBody =
- element.enclosingClass.lookupConstructorBody(element.name);
- Expect.isNotNull(
- element, "Constructor body '${element.name}' not found.");
- check(constructorBody, expectedName);
+ if (element is ConstructorEntity) {
+ env.forEachConstructorBody(element.enclosingClass, (body) {
+ if (body.name != element.name) return;
+ Expect.isNotNull(
+ body, "Constructor body '${element.name}' not found.");
+ check(body, expectedName);
+ });
}
if (expectedClosureNames != null) {
int index = 0;
- for (var closure in element.nestedClosures) {
+ env.forEachNestedClosure(element, (closure) {
String expectedName = expectedClosureNames[index];
check(closure, expectedName);
- check(closure.expression, expectedName);
check(closure.enclosingClass, expectedName);
index++;
- }
+ });
}
}
checkName('toplevelField');
checkName('toplevelMethod');
- checkName('toplevelAnonymous', ['toplevelAnonymous.<anonymous function>']);
- checkName('toplevelLocal', ['toplevelLocal.localMethod']);
+ // TODO(johnniwinther): improve closure names.
+ checkName('toplevelAnonymous', ['toplevelAnonymous_closure']);
+ checkName('toplevelLocal', ['toplevelLocal_localMethod']);
checkName('Class');
checkName('main');
checkName('Class.staticField');
checkName('Class.staticMethod');
- checkName('Class.staticAnonymous',
- ['Class.staticAnonymous.<anonymous function>']);
- checkName('Class.staticLocal', ['Class.staticLocal.localMethod']);
+ checkName('Class.staticAnonymous', ['Class_staticAnonymous_closure']);
+ checkName('Class.staticLocal', ['Class_staticLocal_localMethod']);
- checkName('Class', ['Class.<anonymous function>'], 'Class.');
- checkName('Class.named', ['Class.named.localMethod']);
+ checkName('Class', ['Class_closure'], 'Class.');
+ checkName('Class.named', ['Class\$named_localMethod']);
checkName('Class.instanceField');
checkName('Class.instanceMethod');
- checkName('Class.instanceAnonymous',
- ['Class.instanceAnonymous.<anonymous function>']);
- checkName('Class.instanceLocal', ['Class.instanceLocal.localMethod']);
+ checkName('Class.instanceAnonymous', ['Class_instanceAnonymous_closure']);
+ checkName('Class.instanceLocal', ['Class_instanceLocal_localMethod']);
checkName('Class.instanceNestedLocal', [
- 'Class.instanceNestedLocal.localMethod',
- 'Class.instanceNestedLocal.localMethod.<anonymous function>',
- 'Class.instanceNestedLocal.localMethod.nestedLocalMethod'
+ 'Class_instanceNestedLocal_localMethod',
+ 'Class_instanceNestedLocal_localMethod_closure',
+ 'Class_instanceNestedLocal_localMethod_nestedLocalMethod'
]);
});
}
diff --git a/tests/compiler/dart2js/sourcemaps/pub_build_validity_test.dart b/tests/compiler/dart2js/sourcemaps/pub_build_validity_test.dart
index 8804cdb..6783b33 100644
--- a/tests/compiler/dart2js/sourcemaps/pub_build_validity_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/pub_build_validity_test.dart
@@ -19,8 +19,9 @@
print("Copying '${sunflowerDir.path}' to '${tmpDir.path}'.");
copyDirectory(sunflowerDir, tmpDir);
String ext = Platform.isWindows ? '.bat' : '';
- String command = path.normalize(path.join(
- path.fromUri(Platform.script), '../../../../../sdk/bin/pub${ext}'));
+ String command = path.fromUri(Uri
+ .parse(Platform.resolvedExecutable)
+ .resolve('dart-sdk/bin/pub${ext}'));
String file = path.join(tmpDir.path, 'build/web/sunflower.dart.js');
// sunflower/pubspec.yaml only depends on package:browser for Dartium, we
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
index 76ed3de..bf86d5d 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
@@ -82,8 +82,8 @@
Flags.useNewSourceInfo,
input,
]..addAll(options);
- if (config == kernelMarker) {
- arguments.add(Flags.useKernel);
+ if (config == astMarker) {
+ arguments.add(Flags.useOldFrontend);
}
print("Compiling dart2js ${arguments.join(' ')}");
CompilationResult compilationResult = await entry.internalMain(arguments);
diff --git a/tests/compiler/dart2js/sourcemaps/stepping_test.dart b/tests/compiler/dart2js/sourcemaps/stepping_test.dart
index a0bf75e..4738bbc 100644
--- a/tests/compiler/dart2js/sourcemaps/stepping_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/stepping_test.dart
@@ -75,9 +75,8 @@
inputFile,
Flags.disableInlining,
];
- if (config == kernelMarker) {
- arguments.add(Flags.useKernel);
- } else {
+ if (config == astMarker) {
+ arguments.add(Flags.useOldFrontend);
arguments.add(Flags.useNewSourceInfo);
}
CompilationResult compilationResult = await entry.internalMain(arguments);
diff --git a/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart b/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart
index f1c2423..781b46b 100644
--- a/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart
+++ b/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart
@@ -133,11 +133,12 @@
const Map<String, List<String>> TEST_CONFIGURATIONS = const {
'ast': const [
'--use-new-source-info',
+ '--use-old-frontend',
],
- 'kernel': const [
- Flags.useKernel,
+ 'kernel': const [],
+ 'old': const [
+ '--use-old-frontend',
],
- 'old': const [],
};
final Map<String, Uri> TEST_FILES = _computeTestFiles();
diff --git a/tests/compiler/dart2js/type_test_helper.dart b/tests/compiler/dart2js/type_test_helper.dart
index e4f6b26..f515c66 100644
--- a/tests/compiler/dart2js/type_test_helper.dart
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -105,8 +105,9 @@
memorySourceFiles: {'main.dart': source},
diagnosticHandler: collector,
options: stopAfterTypeInference
- ? options
- : ([Flags.analyzeAll, Flags.analyzeOnly]..addAll(options)),
+ ? ([Flags.useOldFrontend]..addAll(options))
+ : ([Flags.useOldFrontend, Flags.analyzeAll, Flags.analyzeOnly]
+ ..addAll(options)),
beforeRun: (compiler) {
compiler.stopAfterTypeInference = stopAfterTypeInference;
});
diff --git a/tests/compiler/dart2js/uri_retention_test.dart b/tests/compiler/dart2js/uri_retention_test.dart
index dc7d70f..43bd12b 100644
--- a/tests/compiler/dart2js/uri_retention_test.dart
+++ b/tests/compiler/dart2js/uri_retention_test.dart
@@ -17,7 +17,7 @@
var options = [];
if (minify) options.add(Flags.minify);
if (preserveUri) options.add(Flags.preserveUris);
- if (useKernel) options.add(Flags.useKernel);
+ if (!useKernel) options.add(Flags.useOldFrontend);
OutputCollector outputCollector = new OutputCollector();
await runCompiler(
memorySourceFiles: sources,
diff --git a/tests/compiler/dart2js/user_crash_test.dart b/tests/compiler/dart2js/user_crash_test.dart
index 8d46c4b..250f4cb 100644
--- a/tests/compiler/dart2js/user_crash_test.dart
+++ b/tests/compiler/dart2js/user_crash_test.dart
@@ -100,7 +100,7 @@
memorySourceFiles: memorySourceFiles,
diagnosticHandler: diagnostics,
packagesDiscoveryProvider: packagesDiscoveryProvider,
- options: useKernel ? [Flags.useKernel] : []);
+ options: useKernel ? [] : [Flags.useOldFrontend]);
} catch (e) {
result.exceptions.add(e);
}
diff --git a/tests/compiler/dart2js/zero_termination_test.dart b/tests/compiler/dart2js/zero_termination_test.dart
index f2c11cd..4a49e8c 100644
--- a/tests/compiler/dart2js/zero_termination_test.dart
+++ b/tests/compiler/dart2js/zero_termination_test.dart
@@ -65,7 +65,7 @@
String inFilePath =
pathOfData.resolve('data/one_line_dart_program.dart').path;
List<String> args = [inFilePath, "--out=" + outFilePath];
- if (useKernel) args.add(Flags.useKernel);
+ if (!useKernel) args.add(Flags.useOldFrontend);
await cleanup();
check(await launchDart2Js(args, noStdoutEncoding: true));
@@ -76,7 +76,7 @@
int port = server.port;
String inFilePath = "http://127.0.0.1:$port/data/one_line_dart_program.dart";
List<String> args = [inFilePath, "--out=" + outFilePath];
- if (useKernel) args.add(Flags.useKernel);
+ if (!useKernel) args.add(Flags.useOldFrontend);
server.listen(handleRequest);
try {
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 0eded1d..b011ab8 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -13,9 +13,6 @@
statements_test: Fail
typed_locals_test: Pass, Fail
-[ $compiler == dart2js && !$checked ]
-closure_signature_unneeded_test: RuntimeError # Too eager signature generation.
-
[ $compiler != dart2js ]
dummy_compiler_test: SkipByDesign # Issue 30773. Test should be migrated as a unit test of dart2js, is only intended to test self-hosting.
@@ -91,6 +88,9 @@
mirrors_used_warning_test/minif: Crash
mirrors_used_warning_test/none: Crash
+[ $compiler == dart2js && !$checked ]
+closure_signature_unneeded_test: RuntimeError # Too eager signature generation.
+
[ $compiler == dart2js && $csp ]
deferred_custom_loader_test: SkipByDesign # Issue 25683
deferred_fail_and_retry_test: SkipByDesign # Uses eval to simulate failed loading.
@@ -198,7 +198,7 @@
string_interpolation_test: Fail # CRLF handling clarified, see Issue 23562
[ $compiler == dart2js && !$host_checked ]
-dummy_compiler_test: Slow, Pass
+dummy_compiler_test: RuntimeError, Slow # Issue 32439. self-hosting doesn't work with CFE yet.
[ $compiler == dart2js && $minified ]
code_motion_exception_test: Skip # Requires unminified operator names.
diff --git a/tests/corelib_2/collection_from_test.dart b/tests/corelib_2/collection_from_test.dart
index 057d4e2..bc7dc7a 100644
--- a/tests/corelib_2/collection_from_test.dart
+++ b/tests/corelib_2/collection_from_test.dart
@@ -5,40 +5,89 @@
library collection.from.test;
import "package:expect/expect.dart";
-import 'dart:collection' show Queue;
+import 'dart:collection';
-class CollectionFromTest {
- static testMain() {
- var set = new Set<int>();
- set.add(1);
- set.add(2);
- set.add(4);
- check(set, new List<int>.from(set));
- check(set, new List.from(set));
- check(set, new Queue<int>.from(set));
- check(set, new Queue.from(set));
- check(set, new Set<int>.from(set));
- check(set, new Set.from(set));
- }
+main() {
+ for (Iterable<num> elements in [
+ new Set<num>(),
+ <num>[],
+ const <num>[],
+ const <num, int>{}.keys,
+ const <int, num>{}.values,
+ new Iterable<num>.generate(0),
+ new Set<num>()..add(1)..add(2)..add(4),
+ <num>[1, 2, 4],
+ new Iterable<num>.generate(3, (i) => [1, 2, 4][i]),
+ const <num>[1, 2, 4],
+ const <num, int>{1: 0, 2: 0, 4: 0}.keys,
+ const <int, num>{1: 1, 2: 2, 4: 4}.values,
+ ]) {
+ int elementCount = elements.length;
+ check(elements, new List<num>.from(elements));
+ check(elements, new List<int>.from(elements));
+ check(elements, new List<Object>.from(elements));
+ check(elements, new List<num>.from(elements, growable: true));
+ check(elements, new List<int>.from(elements, growable: true));
+ check(elements, new List<Object>.from(elements, growable: true));
+ check(elements, new List<num>.from(elements, growable: false));
+ check(elements, new List<int>.from(elements, growable: false));
+ check(elements, new List<Object>.from(elements, growable: false));
+ check(elements, new Queue<num>.from(elements));
+ check(elements, new Queue<int>.from(elements));
+ check(elements, new Queue<Object>.from(elements));
+ check(elements, new ListQueue<num>.from(elements));
+ check(elements, new ListQueue<int>.from(elements));
+ check(elements, new ListQueue<Object>.from(elements));
+ check(elements, new DoubleLinkedQueue<num>.from(elements));
+ check(elements, new DoubleLinkedQueue<int>.from(elements));
+ check(elements, new DoubleLinkedQueue<Object>.from(elements));
+ check(elements, new Set<num>.from(elements));
+ check(elements, new Set<int>.from(elements));
+ check(elements, new Set<Object>.from(elements));
+ check(elements, new HashSet<num>.from(elements));
+ check(elements, new HashSet<int>.from(elements));
+ check(elements, new HashSet<Object>.from(elements));
+ check(elements, new LinkedHashSet<num>.from(elements));
+ check(elements, new LinkedHashSet<int>.from(elements));
+ check(elements, new LinkedHashSet<Object>.from(elements));
+ check(elements, new SplayTreeSet<num>.from(elements));
+ check(elements, new SplayTreeSet<int>.from(elements));
+ check(elements, new SplayTreeSet<Object>.from(elements));
+ // Sanity check that elements didn't change.
+ Expect.equals(elementCount, elements.length);
- static check(Iterable initial, Iterable other) {
- Expect.equals(3, initial.length);
- Expect.equals(initial.length, other.length);
-
- int initialSum = 0;
- int otherSum = 0;
-
- initial.forEach((e) {
- initialSum += e;
- });
- other.forEach((e) {
- otherSum += e;
- });
- Expect.equals(4 + 2 + 1, otherSum);
- Expect.equals(otherSum, initialSum);
+ // Lists may be growable or not growable.
+ {
+ var list = new List<num>.from(elements, growable: true);
+ Expect.equals(elementCount, list.length);
+ list.add(42);
+ Expect.equals(elementCount + 1, list.length);
+ }
+ {
+ var list = new List<num>.from(elements);
+ Expect.equals(elementCount, list.length);
+ list.add(42);
+ Expect.equals(elementCount + 1, list.length);
+ }
+ {
+ var list = new List<num>.from(elements, growable: false);
+ Expect.equals(elementCount, list.length);
+ Expect.throwsUnsupportedError(() {
+ list.add(42);
+ });
+ Expect.equals(elementCount, list.length);
+ }
}
}
-main() {
- CollectionFromTest.testMain();
+void check(Iterable<num> initial, Iterable other) {
+ Expect.equals(initial.length, other.length);
+
+ for (var element in other) {
+ initial.contains(element);
+ }
+
+ for (var element in initial) {
+ other.contains(element);
+ }
}
diff --git a/tests/corelib_2/collection_of_test.dart b/tests/corelib_2/collection_of_test.dart
new file mode 100644
index 0000000..d93c7e4
--- /dev/null
+++ b/tests/corelib_2/collection_of_test.dart
@@ -0,0 +1,84 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library collection.from.test;
+
+import "package:expect/expect.dart";
+import 'dart:collection';
+
+main() {
+ for (Iterable<num> elements in [
+ new Set<num>(),
+ <num>[],
+ const <num>[],
+ const <num, int>{}.keys,
+ const <int, num>{}.values,
+ new Iterable<num>.generate(0),
+ new Set<num>()..add(1)..add(2)..add(4),
+ <num>[1, 2, 4],
+ new Iterable<num>.generate(3, (i) => [1, 2, 4][i]),
+ const <num>[1, 2, 4],
+ const <num, int>{1: 0, 2: 0, 4: 0}.keys,
+ const <int, num>{1: 1, 2: 2, 4: 4}.values,
+ ]) {
+ String sourceType = elements.runtimeType.toString();
+ check(sourceType, elements, new List<num>.of(elements));
+ Expect.throwsTypeError(() => new List<int>.of(elements));
+ check(sourceType, elements, new List<Object>.of(elements));
+ check(sourceType, elements, new Queue<num>.of(elements));
+ Expect.throwsTypeError(() => new Queue<int>.of(elements));
+ check(sourceType, elements, new Queue<Object>.of(elements));
+ check(sourceType, elements, new ListQueue<num>.of(elements));
+ Expect.throwsTypeError(() => new ListQueue<int>.of(elements));
+ check(sourceType, elements, new ListQueue<Object>.of(elements));
+ check(sourceType, elements, new DoubleLinkedQueue<num>.of(elements));
+ Expect.throwsTypeError(() => new DoubleLinkedQueue<int>.of(elements));
+ check(sourceType, elements, new DoubleLinkedQueue<Object>.of(elements));
+ check(sourceType, elements, new Set<num>.of(elements));
+ Expect.throwsTypeError(() => new Set<int>.of(elements));
+ check(sourceType, elements, new Set<Object>.of(elements));
+ check(sourceType, elements, new HashSet<num>.of(elements));
+ Expect.throwsTypeError(() => new HashSet<int>.of(elements));
+ check(sourceType, elements, new HashSet<Object>.of(elements));
+ check(sourceType, elements, new LinkedHashSet<num>.of(elements));
+ Expect.throwsTypeError(() => new LinkedHashSet<int>.of(elements));
+ check(sourceType, elements, new LinkedHashSet<Object>.of(elements));
+ check(sourceType, elements, new SplayTreeSet<num>.of(elements));
+ Expect.throwsTypeError(() => new SplayTreeSet<int>.of(elements));
+ check(sourceType, elements, new SplayTreeSet<Object>.of(elements));
+
+ // Inference applies to the `of` constructor, unlike the `from` constructor.
+ Expect.isTrue(new List.of(elements) is Iterable<num>);
+ Expect.isTrue(new Queue.of(elements) is Iterable<num>);
+ Expect.isTrue(new ListQueue.of(elements) is Iterable<num>);
+ Expect.isTrue(new DoubleLinkedQueue.of(elements) is Iterable<num>);
+ Expect.isTrue(new Set.of(elements) is Iterable<num>);
+ Expect.isTrue(new HashSet.of(elements) is Iterable<num>);
+ Expect.isTrue(new LinkedHashSet.of(elements) is Iterable<num>);
+ Expect.isTrue(new SplayTreeSet.of(elements) is Iterable<num>);
+
+ Expect.isTrue(new List.of(elements) is! Iterable<int>);
+ Expect.isTrue(new Queue.of(elements) is! Iterable<int>);
+ Expect.isTrue(new ListQueue.of(elements) is! Iterable<int>);
+ Expect.isTrue(new DoubleLinkedQueue.of(elements) is! Iterable<int>);
+ Expect.isTrue(new Set.of(elements) is! Iterable<int>);
+ Expect.isTrue(new HashSet.of(elements) is! Iterable<int>);
+ Expect.isTrue(new LinkedHashSet.of(elements) is! Iterable<int>);
+ Expect.isTrue(new SplayTreeSet.of(elements) is! Iterable<int>);
+ }
+}
+
+void check(String sourceType, Iterable<num> source, Iterable target) {
+ String targetType = target.runtimeType.toString();
+ String name = "$sourceType->$targetType";
+ Expect.equals(source.length, target.length, "$name.length");
+
+ for (var element in target) {
+ Expect.isTrue(source.contains(element), "$name:$element in source");
+ }
+
+ for (var element in source) {
+ Expect.isTrue(target.contains(element), "$name:$element in target");
+ }
+}
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index 0602e04..2e60e22 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -1,7 +1,6 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
-
iterable_where_type_test: RuntimeError # Disabled. Issue 32463
[ $compiler == dart2analyzer ]
@@ -146,6 +145,10 @@
[ $compiler == dart2js && $runtime != none ]
regexp/pcre_test: Pass, Slow # Issue 21593
+[ $compiler == dart2js && $runtime != none && !$strong ]
+collection_of_test: RuntimeError # Strong mode test
+map_of_test: RuntimeError # Strong mode test
+
[ $compiler == dart2js && $runtime == safari ]
regexp/lookahead_test: RuntimeError
regexp/no-extensions_test: RuntimeError
@@ -203,6 +206,7 @@
[ $compiler == dart2js && $fasta ]
int_from_environment_test: Pass # Issue 31762
int_parse_radix_test/none: Pass # Issue 31762
+map_entry_test: RuntimeError
[ $compiler == dart2js && $fasta && $host_checked && $strong ]
apply3_test: RuntimeError
@@ -323,6 +327,9 @@
[ $compiler == dart2js && !$fasta ]
*: SkipByDesign
+[ $compiler == dart2js && $strong ]
+collection_of_test: RuntimeError
+
[ $compiler != dart2js && $compiler != dartdevc && $compiler != dartdevk && $compiler != dartk && $compiler != dartkp && $compiler != fasta ]
iterable_element_at_test/static: MissingCompileTimeError
@@ -524,6 +531,9 @@
symbol_test/none: RuntimeError # Issue 29921
typed_data_with_limited_ints_test: Skip # dartdevc doesn't know about --limit-ints-to-64-bits
+[ $runtime == vm && !$strong ]
+collection_of_test: RuntimeError
+
[ !$checked && !$strong ]
core_runtime_types_static_test: MissingCompileTimeError
splay_tree_test/01: MissingCompileTimeError
diff --git a/tests/corelib_2/map_entry_test.dart b/tests/corelib_2/map_entry_test.dart
new file mode 100644
index 0000000..59c1cc9
--- /dev/null
+++ b/tests/corelib_2/map_entry_test.dart
@@ -0,0 +1,62 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import 'dart:collection';
+import 'dart:convert' show json;
+
+var baseMap = const {"x": 0, "y": 1};
+
+void main() {
+ var entry = new MapEntry<int, int>(1, 2);
+ Expect.isTrue(entry is MapEntry<int, int>);
+ Expect.isTrue(entry is! MapEntry<String, String>);
+ Expect.isTrue(entry is! MapEntry<Null, Null>);
+ Expect.equals(1, entry.key);
+ Expect.equals(2, entry.value);
+ Expect.equals("MapEntry(1: 2)", "$entry");
+ dynamic dynEntry = entry;
+ Expect.throwsNoSuchMethodError(() {
+ dynEntry.key = 0;
+ }, "key not settable");
+ Expect.throwsNoSuchMethodError(() {
+ dynEntry.value = 0;
+ }, "value not settable");
+
+ checkEntries(baseMap, baseMap);
+ checkEntries(baseMap, new Map<String, Object>.unmodifiable(baseMap));
+ checkMap({"x": 0, "y": 1});
+ checkMap(new Map<String, Object>.from(baseMap));
+ checkMap(new HashMap<String, Object>.from(baseMap));
+ checkMap(new LinkedHashMap<String, Object>.from(baseMap));
+ checkMap(new SplayTreeMap<String, Object>.from(baseMap));
+ checkMap(json.decode('{"x":0,"y":1}'));
+}
+
+void checkMap(Map<String, Object> map) {
+ checkEntries(baseMap, map);
+ map.addEntries([new MapEntry<String, Object>("z", 2)]);
+ checkEntries({"x": 0, "y": 1, "z": 2}, map);
+ map.addEntries(<MapEntry<String, Object>>[
+ new MapEntry("y", 11),
+ new MapEntry("v", 3),
+ new MapEntry("w", 4)
+ ]);
+ checkEntries({"v": 3, "w": 4, "x": 0, "y": 11, "z": 2}, map);
+
+ var valueMap = map.map<int, String>((key, value) => new MapEntry(value, key));
+ checkEntries({0: "x", 2: "z", 3: "v", 4: "w", 11: "y"}, valueMap);
+}
+
+void checkEntries(Map expected, Map map) {
+ int byKey(MapEntry e1, MapEntry e2) => e1.key.compareTo(e2.key);
+ Expect.equals(expected.length, map.entries.length);
+ var sorted = map.entries.toList()..sort(byKey);
+ Expect.equals(expected.length, sorted.length);
+ var expectedEntries = expected.entries.toList();
+ for (int i = 0; i < sorted.length; i++) {
+ Expect.equals(expectedEntries[i].key, sorted[i].key);
+ Expect.equals(expectedEntries[i].value, sorted[i].value);
+ }
+}
diff --git a/tests/corelib_2/map_of_test.dart b/tests/corelib_2/map_of_test.dart
new file mode 100644
index 0000000..4761b61
--- /dev/null
+++ b/tests/corelib_2/map_of_test.dart
@@ -0,0 +1,66 @@
+// Copyright (c) 2011, 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.
+
+library map.from.test;
+
+import "package:expect/expect.dart";
+import 'dart:collection';
+
+main() {
+ for (Map<num, num> map in [
+ <num, num>{},
+ const <num, num>{},
+ new HashMap<num, num>(),
+ new LinkedHashMap<num, num>(),
+ new SplayTreeMap<num, num>(),
+ <num, num>{1: 11, 2: 12, 4: 14},
+ const <num, num>{1: 11, 2: 12, 4: 14},
+ new Map<num, num>()
+ ..[1] = 11
+ ..[2] = 12
+ ..[3] = 13,
+ new HashMap<num, num>()
+ ..[1] = 11
+ ..[2] = 12
+ ..[3] = 13,
+ new LinkedHashMap<num, num>()
+ ..[1] = 11
+ ..[2] = 12
+ ..[3] = 13,
+ new SplayTreeMap<num, num>()
+ ..[1] = 11
+ ..[2] = 12
+ ..[3] = 13,
+ ]) {
+ expectThrows(void operation()) {
+ // Allow CastError as well as TypeError. Dart2js creates a CastError
+ // here for some reason, and it's not wront.
+ Expect.throws(operation, (e) => e is TypeError || e is CastError);
+ }
+
+ var sourceType = map.runtimeType.toString();
+ check(sourceType, map, new Map<Object, Object>.of(map));
+ check(sourceType, map, new Map<num, num>.of(map));
+ expectThrows(() => new Map<int, int>.of(map));
+ check(sourceType, map, new HashMap<Object, Object>.of(map));
+ check(sourceType, map, new HashMap<num, num>.of(map));
+ expectThrows(() => new HashMap<int, int>.of(map));
+ check(sourceType, map, new LinkedHashMap<Object, Object>.of(map));
+ check(sourceType, map, new LinkedHashMap<num, num>.of(map));
+ expectThrows(() => new LinkedHashMap<int, int>.of(map));
+ check(sourceType, map, new SplayTreeMap<Object, Object>.of(map));
+ check(sourceType, map, new SplayTreeMap<num, num>.of(map));
+ expectThrows(() => new SplayTreeMap<int, int>.of(map));
+ }
+}
+
+check(String sourceType, Map<num, num> expect, Map actual) {
+ var targetType = actual.runtimeType.toString();
+ var name = "$sourceType->$targetType";
+ Expect.equals(expect.length, actual.length, "$name.length");
+ for (var key in expect.keys) {
+ Expect.isTrue(actual.containsKey(key), "$name?[$key]");
+ Expect.equals(expect[key], actual[key], "$name[$key]");
+ }
+}
diff --git a/tests/html/html.status b/tests/html/html.status
index cf32f19..bd9c707 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -363,6 +363,10 @@
xhr_test: RuntimeError
xsltprocessor_test: RuntimeError
+[ $compiler == dart2js && $runtime == d8 && $fasta && $minified ]
+fontface_loaded_test: RuntimeError
+streams_test: RuntimeError
+
[ $compiler == dart2js && $runtime == drt && !$checked ]
audiocontext_test/functional: Pass, Fail
@@ -481,19 +485,14 @@
mirrors_js_typed_interop_test: SkipByDesign
postmessage_structured_test: SkipByDesign
+[ $compiler == dart2js && !$csp && $fast_startup && $fasta ]
+websql_test/Database/Database: RuntimeError
+
[ $compiler == dart2js && $fast_startup ]
-custom/constructor_calls_created_synchronously_test: Fail # mirrors not supported
-custom/js_custom_test: Fail # mirrors not supported
custom/mirrors_2_test: Fail # mirrors not supported
custom/mirrors_test: Fail # mirrors not supported
mirrors_js_typed_interop_test: Fail # mirrors not supported
-[ $compiler == dart2js && $fast_startup && $fasta ]
-js_typed_interop_default_arg_test/none: RuntimeError
-js_typed_interop_test/object literal: RuntimeError
-js_typed_interop_test/static_method_call: RuntimeError
-js_util_test/hasProperty: RuntimeError
-
[ $compiler == dart2js && $fasta ]
custom/mirrors_2_test: RuntimeError
custom/mirrors_test: RuntimeError
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index d22d01b..1727004 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -86,6 +86,13 @@
cross_isolate_message_test: Skip # Issue 12627
message_test: Skip # Issue 12627
+[ $compiler == dart2js && $browser && !$csp && $fast_startup && $fasta ]
+browser/package_resolve_browser_hook2_test: RuntimeError
+browser/package_resolve_browser_test: RuntimeError
+
+[ $compiler == dart2js && $browser && $fast_startup && $fasta ]
+browser/package_resolve_browser_hook_test: RuntimeError
+
[ $compiler == dart2js && !$browser && $fast_startup ]
isolate_current_test: Fail # please triage
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 3099dae..b2a238a 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -38,6 +38,15 @@
[ $compiler == dart2js && $runtime == ff ]
round_test: Pass, Fail, OK # Fixed in ff 35. Common JavaScript engine Math.round bug.
+[ $compiler == dart2js && $runtime == ff && $fasta ]
+conditional_import_string_test: RuntimeError
+conditional_import_test: RuntimeError
+config_import_corelib_test: RuntimeError
+library_env_test/has_io_support: RuntimeError
+
+[ $compiler == dart2js && $runtime != ff && $fasta ]
+stacktrace_test: RuntimeError # Issue 12698
+
[ $compiler == dart2js && $runtime == jsshell && !$fasta ]
async_star_no_cancel2_test: RuntimeError # Need triage
async_star_no_cancel_test: RuntimeError # Need triage
@@ -61,6 +70,11 @@
conditional_import_string_test: Fail # Issue 30615
conditional_import_test: Fail # Issue 30615
+[ $compiler == dart2js && $browser && !$csp && $fast_startup && $fasta ]
+async_await_test: RuntimeError
+async_star_pause_test: RuntimeError
+async_star_test: RuntimeError
+
[ $compiler == dart2js && $browser && !$fasta ]
config_import_test: Fail # Test flag is not passed to the compiler.
library_env_test/has_io_support: RuntimeError # Issue 27398
@@ -71,12 +85,8 @@
assertion_initializer_test: RuntimeError
assign_static_type_test/01: Fail
assign_static_type_test/02: MissingCompileTimeError
-async_await_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
async_return_types_test/nestedFuture: Fail # Issue 26429
async_return_types_test/wrongTypeParameter: Fail # Issue 26429
-async_star_pause_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-async_star_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-await_for_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
cha_deopt1_test: RuntimeError
cha_deopt2_test: RuntimeError
cha_deopt3_test: RuntimeError
@@ -162,112 +172,8 @@
factory_redirection_test/12: Fail
factory_redirection_test/13: Fail
factory_redirection_test/14: Fail
-function_type/function_type0_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type10_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type11_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type12_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type13_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type14_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type15_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type16_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type17_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type18_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type19_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type1_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type20_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type21_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type22_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type23_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type24_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type25_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type26_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type27_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type28_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type29_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type2_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type30_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type31_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type32_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type33_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type34_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type35_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type36_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type37_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type38_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type39_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type3_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type40_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type41_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type42_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type43_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type44_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type45_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type46_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type47_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type48_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type49_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type4_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type50_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type51_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type52_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type53_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type54_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type55_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type56_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type57_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type58_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type59_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type5_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type60_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type61_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type62_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type63_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type64_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type65_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type66_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type67_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type68_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type69_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type6_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type70_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type71_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type72_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type73_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type74_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type75_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type76_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type77_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type78_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type79_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type7_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type80_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type81_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type82_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type83_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type84_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type85_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type86_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type87_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type88_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type89_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type8_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type90_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type91_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type92_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type93_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type94_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type95_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type96_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type97_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type98_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type99_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-function_type/function_type9_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
generalized_void_syntax_test: RuntimeError
-generic_function_typedef2_test/04: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-generic_function_typedef_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
generic_functions_test: RuntimeError
-generic_local_functions_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
-generic_methods_generic_function_parameter_test: Crash # NoSuchMethodError: The getter 'parent' was called on null.
generic_methods_test: RuntimeError
internal_library_test/02: Crash # NoSuchMethodError: Class 'DillLibraryBuilder' has no instance getter 'mixinApplicationClasses'.
list_literal1_test/01: MissingCompileTimeError
@@ -306,6 +212,10 @@
type_variable_bounds_test/02: Fail # Issue 12702
type_variable_scope_test/03: Crash # Internal Error: Unexpected type variable in static context.
+[ $compiler == dart2js && $checked && $fasta && $host_checked ]
+generic_functions_test: Crash
+generic_methods_test: Crash
+
[ $compiler == dart2js && $checked && !$fasta ]
async_return_types_test/nestedFuture: Fail # Issue 26429
async_return_types_test/wrongTypeParameter: Fail # Issue 26429
@@ -350,42 +260,20 @@
[ $compiler == dart2js && !$checked && $fasta ]
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
+[ $compiler == dart2js && !$checked && $fasta && $minified ]
+f_bounded_quantification5_test: RuntimeError
+
[ $compiler == dart2js && !$checked && !$fasta && $minified ]
f_bounded_quantification5_test: Fail, OK # Issue 12605
[ $compiler == dart2js && $fast_startup && $fasta ]
-arithmetic_canonicalization_test: RuntimeError
-assertion_initializer_const_error2_test/none: CompileTimeError
-canonical_const3_test: CompileTimeError
constructor_redirect1_negative_test: Crash # Stack Overflow
constructor_redirect2_negative_test: Crash # Stack Overflow
-constructor_redirect2_test/01: MissingCompileTimeError
cyclic_constructor_test/01: Crash # Stack Overflow
-deferred_constraints_constants_test/default_argument2: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
deferred_constraints_constants_test/none: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
deferred_constraints_constants_test/reference_after_load: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
-deferred_constraints_type_annotation_test/as_operation: RuntimeError
-deferred_constraints_type_annotation_test/catch_check: RuntimeError
-deferred_constraints_type_annotation_test/is_check: RuntimeError
-deferred_load_constants_test/none: RuntimeError
-generic_field_mixin4_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in () for j:constructor(C3.).
-generic_field_mixin5_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in () for j:constructor(C3.).
-generic_field_mixin_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in () for j:constructor(C3.).
-generic_local_functions_test: Crash # Unsupported operation: Unsupported type parameter type node Y.
internal_library_test/02: Crash # NoSuchMethodError: Class 'DillLibraryBuilder' has no instance getter 'mixinApplicationClasses'.
-mixin_issue10216_2_test: RuntimeError
-mixin_mixin4_test: RuntimeError
-mixin_mixin5_test: RuntimeError
-mixin_mixin6_test: RuntimeError
-mixin_mixin7_test: RuntimeError
-mixin_mixin_bound2_test: RuntimeError
-mixin_mixin_bound_test: RuntimeError
-mixin_mixin_test: RuntimeError
-null_test/02: MissingCompileTimeError
-null_test/03: MissingCompileTimeError
-redirecting_factory_long_test: RuntimeError
stacktrace_demangle_ctors_test: RuntimeError
-stacktrace_test: RuntimeError
super_call4_test: Crash # NoSuchMethodError: The getter 'thisLocal' was called on null.
[ $compiler == dart2js && $fast_startup && !$fasta ]
@@ -458,7 +346,7 @@
constructor3_test: RuntimeError
constructor5_test: RuntimeError
constructor6_test: RuntimeError
-constructor_call_as_function_test/01: MissingRuntimeError
+constructor_call_as_function_test/01: CompileTimeError # Issue 32517
constructor_named_arguments_test/none: RuntimeError
constructor_redirect1_negative_test: Crash # Issue 30856
constructor_redirect2_negative_test: Crash # Issue 30856
@@ -679,7 +567,6 @@
stacktrace_rethrow_error_test/none: RuntimeError
stacktrace_rethrow_error_test/withtraceparameter: RuntimeError
stacktrace_rethrow_nonerror_test: RuntimeError
-stacktrace_test: RuntimeError # Issue 12698
static_getter_no_setter1_test/01: RuntimeError
static_getter_no_setter2_test/01: RuntimeError
static_getter_no_setter3_test/01: RuntimeError
@@ -739,7 +626,6 @@
[ $compiler == dart2js && $fasta && $minified ]
deferred_load_library_wrong_args_test/01: Crash # NoSuchMethodError: The getter 'closureClassEntity' was called on null.
deferred_redirecting_factory_test: Crash # NoSuchMethodError: The getter 'closureClassEntity' was called on null.
-f_bounded_quantification5_test: RuntimeError
internal_library_test/02: Crash # NoSuchMethodError: Class 'DillLibraryBuilder' has no instance getter 'mixinApplicationClasses'.
stacktrace_rethrow_error_test/none: RuntimeError # Issue 12698
stacktrace_rethrow_error_test/withtraceparameter: RuntimeError # Issue 12698
diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status
index a7c5a89..0c2222c 100644
--- a/tests/language/language_kernel.status
+++ b/tests/language/language_kernel.status
@@ -25,6 +25,7 @@
const_map3_test/00: MissingCompileTimeError
const_switch2_test/01: MissingCompileTimeError
constants_test/05: MissingCompileTimeError
+constructor_call_as_function_test/01: CompileTimeError # Issue 32517
constructor_redirect1_negative_test: Fail
constructor_redirect2_negative_test: Fail
constructor_redirect_test/01: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 90f26a7..e031eda 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -584,6 +584,18 @@
assertion_test: RuntimeError, OK
[ $compiler == dart2js && !$checked && $fasta ]
+constructor_call_as_function_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_generic_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_composite_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_prefix_constructor_named_test: CompileTimeError # Issue 32517
+
cascaded_forwarding_stubs_generic_test: RuntimeError
cascaded_forwarding_stubs_test: RuntimeError
checked_setter3_test: RuntimeError # Issue 31128
@@ -859,7 +871,6 @@
generic_list_checked_test: RuntimeError
generic_local_functions_test: Crash # Unsupported operation: Unsupported type parameter type node Y.
generic_tearoff_test: Crash # Unsupported operation: Unsupported type parameter type node T.
-generic_test/none: RuntimeError
generic_typedef_test: Crash # Unsupported operation: Unsupported type parameter type node S.
getter_override2_test/02: MissingCompileTimeError
getter_override_test/00: MissingCompileTimeError
@@ -1066,18 +1077,10 @@
[ $compiler == dart2js && $fasta ]
async_error_timing_test: Crash
bug31436_test: RuntimeError
-call_method_as_cast_test/01: RuntimeError
-call_method_as_cast_test/02: RuntimeError
-call_method_as_cast_test/04: RuntimeError
-call_method_as_cast_test/05: RuntimeError
call_method_function_typed_value_test/02: RuntimeError
call_method_function_typed_value_test/04: RuntimeError
call_method_function_typed_value_test/06: RuntimeError
call_method_function_typed_value_test/08: RuntimeError
-call_method_is_check_test/01: RuntimeError
-call_method_is_check_test/02: RuntimeError
-call_method_is_check_test/04: RuntimeError
-call_method_is_check_test/05: RuntimeError
call_method_must_not_be_field_test/03: RuntimeError # Issue 32155
call_method_must_not_be_getter_test/03: RuntimeError # Issue 32155
call_with_no_such_method_test: RuntimeError
@@ -1434,6 +1437,7 @@
function_subtype_bound_closure5a_test: RuntimeError
function_subtype_bound_closure6_test: RuntimeError
function_subtype_bound_closure7_test: RuntimeError
+function_subtype_call0_test: RuntimeError
function_subtype_call1_test: RuntimeError
function_subtype_call2_test: RuntimeError
function_subtype_cast1_test: RuntimeError
@@ -2290,6 +2294,7 @@
function_subtype_bound_closure5a_test: RuntimeError
function_subtype_bound_closure6_test: RuntimeError
function_subtype_bound_closure7_test: RuntimeError
+function_subtype_call0_test: RuntimeError
function_subtype_call1_test: RuntimeError
function_subtype_call2_test: RuntimeError
function_subtype_cast1_test: RuntimeError
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index 5fdbc77..e94da20 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -393,6 +393,7 @@
const_types_test/39: MissingCompileTimeError
constant_string_interpolation2_test: RuntimeError # Issue 32194
constants_test/05: MissingCompileTimeError
+constructor_call_as_function_test: CompileTimeError # Issue 32517
constructor_redirect1_negative_test/01: MissingCompileTimeError
constructor_redirect2_negative_test: MissingCompileTimeError
constructor_redirect_test/01: MissingCompileTimeError
@@ -455,9 +456,28 @@
identical_const_test/02: MissingCompileTimeError
identical_const_test/03: MissingCompileTimeError
identical_const_test/04: MissingCompileTimeError
+implicit_creation/implicit_const_context_constructor_generic_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_generic_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_test: CompileTimeError # Issue 32517
implicit_creation/implicit_const_not_default_values_test/e.*: MissingCompileTimeError
-implicit_creation/implicit_new_or_const_composite_test: RuntimeError
-implicit_creation/implicit_new_or_const_test: RuntimeError
+implicit_creation/implicit_const_not_default_values_test/e12: Pass # Issue 32517
+implicit_creation/implicit_const_not_default_values_test/e15: Pass # Issue 32517
+implicit_creation/implicit_const_not_default_values_test/e18: Pass # Issue 32517
+implicit_creation/implicit_const_not_default_values_test/e21: Pass # Issue 32517
+implicit_creation/implicit_const_not_default_values_test/e24: Pass # Issue 32517
+implicit_creation/implicit_const_not_default_values_test/e27: Pass # Issue 32517
+implicit_creation/implicit_const_not_default_values_test/e3: Pass # Issue 32517
+implicit_creation/implicit_const_not_default_values_test/e30: Pass # Issue 32517
+implicit_creation/implicit_const_not_default_values_test/e6: Pass # Issue 32517
+implicit_creation/implicit_const_not_default_values_test/e9: Pass # Issue 32517
+implicit_creation/implicit_new_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_composite_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_prefix_constructor_named_test: CompileTimeError # Issue 32517
implicit_this_test/01: MissingCompileTimeError
implicit_this_test/04: MissingCompileTimeError
initializing_formal_type_annotation_test/01: MissingCompileTimeError
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 055e78b..83ebc63 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -33,33 +33,23 @@
implicit_creation/implicit_const_not_default_values_test/e1: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e10: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e11: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e12: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e13: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e14: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e15: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e16: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e17: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e18: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e19: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e2: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e20: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e21: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e22: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e23: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e24: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e25: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e26: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e27: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e28: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e29: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e3: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e30: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e4: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e5: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e6: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e7: MissingCompileTimeError
implicit_creation/implicit_const_not_default_values_test/e8: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e9: MissingCompileTimeError
[ $fasta ]
abstract_factory_constructor_test/00: MissingCompileTimeError # Issue 32013.
@@ -510,10 +500,12 @@
partial_tearoff_instantiation_test/08: Crash # Issue http://dartbug.com/32340
partial_tearoff_instantiation_test/none: Crash # Issue http://dartbug.com/32340
+[ $compiler != dart2js && $compiler != dartk && $compiler != dartkp && $fasta ]
+const_optional_args_test/01: MissingCompileTimeError
+
[ $compiler != dart2js && $fasta ]
compile_time_constant_c_test/02: MissingCompileTimeError
const_constructor_nonconst_field_test/01: MissingCompileTimeError
-const_optional_args_test/01: MissingCompileTimeError
const_syntax_test/05: MissingCompileTimeError
mixin_of_mixin_test/01: MissingCompileTimeError
mixin_of_mixin_test/02: MissingCompileTimeError
@@ -633,6 +625,7 @@
const_string_test: RuntimeError
constructor12_test: RuntimeError
constructor3_test: Fail, OK, Pass
+constructor_call_as_function_test: CompileTimeError # Issue 32517
ct_const2_test: Pass, Crash # Flaky
ct_const_test: RuntimeError
cyclic_type2_test: RuntimeError, CompileTimeError
@@ -675,7 +668,18 @@
generic_tearoff_test: CompileTimeError
generic_tearoff_test: RuntimeError
if_null_evaluation_order_test: Pass
+implicit_creation/implicit_const_context_constructor_generic_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_generic_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_test: CompileTimeError # Issue 32517
implicit_creation/implicit_new_constructor_generic_test: Pass
+implicit_creation/implicit_new_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_composite_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_prefix_constructor_named_test: CompileTimeError # Issue 32517
initializing_formal_type_annotation_test/01: MissingCompileTimeError
initializing_formal_type_annotation_test/02: MissingCompileTimeError
instantiate_tearoff_of_call_test: CompileTimeError
@@ -712,8 +716,8 @@
named_constructor_test/01: MissingRuntimeError # Fasta bug: Bad compilation of constructor reference.
named_parameters_default_eq_test/none: RuntimeError
nested_generic_closure_test: RuntimeError
-no_main_test/01: DartkCrash
no_main_test/01: Skip
+no_main_test/01: DartkCrash
no_such_method_mock_test: RuntimeError # Issue 31426
nosuchmethod_forwarding/nosuchmethod_forwarding_test/05: RuntimeError # Issue 31426
nosuchmethod_forwarding/nosuchmethod_forwarding_test/06: RuntimeError # Issue 31426
@@ -806,6 +810,7 @@
type_promotion_functions_test/07: Pass
type_promotion_functions_test/08: Pass
type_promotion_functions_test/10: Pass
+vm/precompiled_static_initializer_test: Pass, Slow
[ $compiler == dartkp && $mode == product && $runtime == dart_precompiled && $strong ]
vm/type_vm_test/28: MissingRuntimeError
@@ -1003,8 +1008,6 @@
generic_methods_recursive_bound_test/03: MissingRuntimeError
generic_methods_recursive_bound_test/03: Pass
generic_methods_reuse_type_variables_test: Pass
-generic_methods_tearoff_specialization_test: RuntimeError
-generic_methods_unused_parameter_test: RuntimeError # Issue 31402 (Variable declaration)
generic_no_such_method_dispatcher_simple_test: CompileTimeError # Issue 31533
generic_no_such_method_dispatcher_test: CompileTimeError # Issue 31533
generic_tearoff_test: CompileTimeError
@@ -1354,6 +1357,18 @@
compile_time_constant_k_test/03: MissingCompileTimeError
compile_time_constant_static2_test/04: MissingCompileTimeError
compile_time_constant_static3_test/04: MissingCompileTimeError
+constructor_call_as_function_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_generic_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_generic_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_composite_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_prefix_constructor_named_test: CompileTimeError # Issue 32517
initializing_formal_type_annotation_test/01: MissingCompileTimeError
initializing_formal_type_annotation_test/02: MissingCompileTimeError
issue18628_2_test/01: MissingCompileTimeError
@@ -1541,6 +1556,7 @@
constants_test/05: MissingCompileTimeError
constructor13_test/01: MissingCompileTimeError
constructor13_test/02: MissingCompileTimeError
+constructor_call_as_function_test: CompileTimeError # Issue 32517
constructor_call_wrong_argument_count_negative_test: Fail
constructor_duplicate_final_test/01: MissingCompileTimeError
constructor_duplicate_final_test/02: MissingCompileTimeError
@@ -1693,6 +1709,17 @@
if_null_assignment_static_test/42: MissingCompileTimeError
if_null_precedence_test/06: MissingCompileTimeError
if_null_precedence_test/07: MissingCompileTimeError
+implicit_creation/implicit_const_context_constructor_generic_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_generic_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_const_context_prefix_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_constructor_named_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_constructor_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_composite_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_or_const_test: CompileTimeError # Issue 32517
+implicit_creation/implicit_new_prefix_constructor_named_test: CompileTimeError # Issue 32517
implicit_this_test/02: MissingCompileTimeError
import_combinators2_test/00: MissingCompileTimeError
import_self_test/01: MissingCompileTimeError
@@ -2184,5 +2211,4 @@
[ $compiler == dartk || $compiler == dartkp ]
generic_function_bounds_test: RuntimeError # Issue 32076
generic_test/01: MissingCompileTimeError
-implicit_creation/implicit_const_not_default_values_test/e.*: MissingCompileTimeError
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 08d180a..9cd8d2c 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -164,6 +164,7 @@
mirrors/metadata_allowed_values_test/14: MissingCompileTimeError
mirrors/metadata_nested_constructor_call_test/03: MissingCompileTimeError
mirrors/metadata_nested_constructor_call_test/04: MissingCompileTimeError
+mirrors/metadata_nested_constructor_call_test/06: MissingCompileTimeError # Issue 32517
mirrors/native_class_test: CompileTimeError
mirrors/variable_is_const_test/01: MissingCompileTimeError
typed_data/int32x4_bigint_test: CompileTimeError
@@ -245,9 +246,18 @@
async/zone_empty_description2_test: RuntimeError # Timer interface not supported: Issue 7728.
mirrors/mirrors_reader_test: Skip # Running in v8 suffices. Issue 16589 - RuntimeError. Issue 22130 - Crash (out of memory).
+[ $compiler == dart2js && $browser && !$csp && $fast_startup && $fasta ]
+async/stream_iterator_test: RuntimeError
+
[ $compiler == dart2js && $checked ]
convert/utf85_test: Pass, Slow # Issue 12029.
+[ $compiler == dart2js && $checked && $fast_startup && $fasta && $minified ]
+async/stream_listen_zone_test: RuntimeError
+
+[ $compiler == dart2js && $checked && $fasta && $host_checked ]
+async/stream_listen_zone_test: RuntimeError
+
[ $compiler == dart2js && $fast_startup ]
mirrors/*: Fail # mirrors not supported
mirrors/library_imports_bad_metadata_test/01: Pass # expects failure, but it fails for the wrong reason
diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status
index 3cf06a1..fa940e0 100644
--- a/tests/lib_2/lib_2_dart2js.status
+++ b/tests/lib_2/lib_2_dart2js.status
@@ -357,6 +357,9 @@
js/null_test: RuntimeError
js/prototype_access_test: RuntimeError
+[ $compiler == dart2js && $runtime == d8 && $fasta && $minified ]
+collection/list_test: RuntimeError
+
[ $compiler == dart2js && $runtime != d8 ]
isolate/error_at_spawn_test: Skip # Issue 23876
isolate/error_exit_at_spawn_test: Skip # Issue 23876
@@ -408,6 +411,9 @@
html/websql_test: Fail
isolate/kill_self_synchronously_test: RuntimeError
+[ $compiler == dart2js && $runtime == ff && $fast_startup && $fasta ]
+html/fileapi_entry_test: RuntimeError
+
[ $compiler == dart2js && $runtime == ie11 ]
html/element_types_content_test: RuntimeError # Issue 29922
html/element_types_datalist_test: RuntimeError # Issue 29922
@@ -514,6 +520,21 @@
html/custom/element_upgrade_test: Fail # Issue 17298
html/custom/js_custom_test: Fail # Issue 14643
+[ $compiler == dart2js && $browser && !$csp && $fast_startup && $fasta ]
+async/stream_iterator_test: RuntimeError
+html/fileapi_directory_reader_test: RuntimeError
+html/fileapi_directory_test: RuntimeError
+html/fileapi_file_entry_test: RuntimeError
+html/fileapi_file_test: RuntimeError
+html/fileapi_supported_test: RuntimeError
+html/fileapi_supported_throws_test: RuntimeError
+html/websql_test: RuntimeError
+isolate/browser/package_resolve_browser_hook2_test: RuntimeError
+isolate/browser/package_resolve_browser_test: RuntimeError
+
+[ $compiler == dart2js && $browser && $fast_startup && $fasta ]
+isolate/browser/package_resolve_browser_hook_test: RuntimeError
+
[ $compiler == dart2js && !$browser && $fast_startup ]
isolate/isolate_current_test: Fail # please triage
@@ -521,6 +542,12 @@
convert/utf85_test: Pass, Slow # Issue 12029.
html/js_function_getter_trust_types_test: Skip # --trust-type-annotations incompatible with --checked
+[ $compiler == dart2js && $checked && $fasta ]
+async/stream_listen_zone_test: RuntimeError
+
+[ $compiler == dart2js && $csp && $fasta && $minified ]
+collection/list_test: RuntimeError
+
[ $compiler == dart2js && $csp && ($runtime == chrome || $runtime == chromeOnAndroid || $runtime == ff || $runtime == safari) ]
html/event_customevent_test: SkipByDesign
html/js_array_test: SkipByDesign
@@ -540,8 +567,155 @@
html/mirrors_js_typed_interop_test: SkipByDesign
html/postmessage_structured_test: SkipByDesign
+[ $compiler == dart2js && !$csp && $fasta && $minified ]
+html/async_spawnuri_test: RuntimeError
+html/async_test: RuntimeError
+html/audiobuffersourcenode_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/audiocontext_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/audioelement_test: RuntimeError
+html/b_element_test: RuntimeError
+html/blob_constructor_test: RuntimeError
+html/cache_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/callbacks_test: RuntimeError
+html/custom_element_method_clash_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/custom_element_name_clash_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/custom_elements_23127_test: Crash # Assertion failure: Cannot find value local(B2T.created#a) in (type_variable_local(B2T.T), local(C2T.created#a), local(C2T.created#b), local(C2T.created#c), BoxLocal(_box_0)) for j:constructor(C2T.created).
+html/custom_tags_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/dart_object_local_storage_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/datalistelement_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/document_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/documentfragment_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/dom_constructors_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/domparser_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/element_add_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/element_animate_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/element_classes_svg_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/element_constructor_1_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/element_dimensions_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/element_offset_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/element_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/element_test/ElementList: RuntimeError
+html/element_test/_ElementList: RuntimeError
+html/element_test/attributes: RuntimeError
+html/element_test/children: RuntimeError
+html/element_test/click: RuntimeError
+html/element_test/constructors: RuntimeError
+html/element_test/eventDelegation: RuntimeError
+html/element_test/eventListening: RuntimeError
+html/element_test/functional: RuntimeError
+html/element_test/matches: RuntimeError
+html/element_test/position: RuntimeError
+html/element_test/queryAll: RuntimeError
+html/element_types_constructors1_test: RuntimeError
+html/element_types_constructors2_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
+html/element_types_constructors3_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.