Version 2.0.0-dev.52.0
Merge commit '5087ffa48143196b3daa43c8f58c561b0a38a1e3' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 710c9a7..9d3a3cd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,20 @@
+## 2.0.0-dev.52.0
+
+### Tool Changes
+
+#### Dart Dev Compiler
+
+* Failed `as` casts on `Iterable<T>`, `Map<T>`, `Future<T>`, and `Stream<T>`
+ are no longer ignored. These failures were ignored to make it easier to
+ migrate Dart 1 code to strong mode, but ignoring them is a hole in the type
+ system. This closes part of that hole. (We still need to stop ignoring
+ "as" cast failures on function types, and implicit cast failures on the above
+ types and function types.)
+
+* `async` functions now start synchronously by default. Build tools
+ (e.g., build_runner) may override the default and/or allow
+ developers to configure.
+
## 2.0.0-dev.51.0
### Tool Changes
diff --git a/DEPS b/DEPS
index b6218f0..15caef2 100644
--- a/DEPS
+++ b/DEPS
@@ -81,7 +81,7 @@
# minutes later.
#
# For more details, see https://github.com/dart-lang/sdk/issues/30164
- "dart_style_tag": "@1.0.11", # Please see the note above before updating.
+ "dart_style_tag": "@1.0.12", # Please see the note above before updating.
"dartdoc_tag" : "@v0.18.1",
"fixnum_tag": "@0.10.5",
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
index 76d0115..9d52193 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_widget.dart
@@ -37,6 +37,7 @@
CorrectionUtils utils;
ClassElement classBuildContext;
+ ClassElement classKey;
ClassElement classStatefulWidget;
ClassElement classStatelessWidget;
ClassElement classWidget;
@@ -96,8 +97,8 @@
_enclosingUnitMember = (_expression ?? _method).getAncestor(
(n) => n is CompilationUnitMember && n.parent is CompilationUnit);
- result.addStatus(await _initializeParameters());
result.addStatus(await _initializeClasses());
+ result.addStatus(await _initializeParameters());
return result;
}
@@ -200,6 +201,7 @@
}
classBuildContext = await getClass('BuildContext');
+ classKey = await getClass('Key');
classStatelessWidget = await getClass('StatelessWidget');
classStatefulWidget = await getClass('StatefulWidget');
classWidget = await getClass('Widget');
@@ -229,6 +231,10 @@
// We added fields, now add the method parameters.
if (_method != null) {
for (var parameter in _method.parameters.parameters) {
+ if (parameter is DefaultFormalParameter) {
+ DefaultFormalParameter defaultFormalParameter = parameter;
+ parameter = defaultFormalParameter.parameter;
+ }
if (parameter is NormalFormalParameter) {
_parameters.add(new _Parameter(
parameter.identifier.name, parameter.element.type,
@@ -237,6 +243,18 @@
}
}
+ RefactoringStatus status = collector.status;
+
+ // If there is an existing parameter "key" warn the user.
+ // We could rename it, but that would require renaming references to it.
+ // It is probably pretty rare, and the user can always rename before.
+ for (var parameter in _parameters) {
+ if (parameter.name == 'key') {
+ status.addError(
+ "The parameter 'key' will conflict with the widget 'key'.");
+ }
+ }
+
return collector.status;
}
@@ -254,29 +272,31 @@
var collector = new _MethodInvocationsCollector(_method.element);
_enclosingClassNode.accept(collector);
for (var invocation in collector.invocations) {
- builder.addReplacement(
- range.startEnd(invocation, invocation.argumentList.leftParenthesis),
- (builder) {
- builder.write('new $name(');
+ List<Expression> arguments = invocation.argumentList.arguments;
+ builder.addReplacement(range.node(invocation), (builder) {
+ builder.write('new $name(');
- // Insert field references.
- for (var parameter in _parameters) {
- if (parameter.isMethodParameter) {
- break;
- }
- if (parameter != _parameters.first) {
- builder.write(', ');
- }
- builder.write(parameter.name);
- }
-
- // Separate references to fields and method arguments.
- if (_parameters.isNotEmpty &&
- invocation.argumentList.arguments.isNotEmpty) {
+ // Insert field references (as named arguments).
+ // Ensure that invocation arguments are named.
+ int argumentIndex = 0;
+ for (var parameter in _parameters) {
+ if (parameter != _parameters.first) {
builder.write(', ');
}
- },
- );
+ builder.write(parameter.name);
+ builder.write(': ');
+ if (parameter.isMethodParameter) {
+ Expression argument = arguments[argumentIndex++];
+ if (argument is NamedExpression) {
+ argument = (argument as NamedExpression).expression;
+ }
+ builder.write(utils.getNodeText(argument));
+ } else {
+ builder.write(parameter.name);
+ }
+ }
+ builder.write(')');
+ });
}
}
@@ -289,8 +309,8 @@
name,
superclass: classStatelessWidget.type,
membersWriter: () {
+ // Add the fields for the parameters.
if (_parameters.isNotEmpty) {
- // Add the fields for the parameters.
for (var parameter in _parameters) {
builder.write(' ');
builder.writeFieldDeclaration(parameter.name,
@@ -298,15 +318,34 @@
builder.writeln();
}
builder.writeln();
-
- // Add the constructor.
- builder.write(' ');
- builder.writeConstructorDeclaration(name,
- fieldNames: _parameters.map((e) => e.name).toList());
- builder.writeln();
- builder.writeln();
}
+ // Add the constructor.
+ builder.write(' ');
+ builder.writeConstructorDeclaration(
+ name,
+ parameterWriter: () {
+ builder.write('{');
+
+ // Add the required `key` parameter.
+ builder.writeParameter('key', type: classKey.type);
+
+ // Add parameters for fields, local, and method parameters.
+ for (int i = 0; i < _parameters.length; i++) {
+ builder.write(', ');
+ builder.write('this.');
+ builder.write(_parameters[i].name);
+ }
+
+ builder.write('}');
+ },
+ initializerWriter: () {
+ builder.write('super(key: key)');
+ },
+ );
+ builder.writeln();
+ builder.writeln();
+
// Widget build(BuildContext context) { ... }
builder.writeln(' @override');
builder.write(' ');
@@ -352,6 +391,8 @@
builder.write(', ');
}
builder.write(parameter.name);
+ builder.write(': ');
+ builder.write(parameter.name);
}
builder.write(')');
@@ -381,7 +422,7 @@
/// Whether the parameter is a parameter of the method being extracted.
final bool isMethodParameter;
- _Parameter(this.name, this.type, {this.isMethodParameter = false});
+ _Parameter(this.name, this.type, {this.isMethodParameter: false});
}
class _ParametersCollector extends RecursiveAstVisitor<void> {
diff --git a/pkg/analysis_server/test/services/refactoring/extract_widget_test.dart b/pkg/analysis_server/test/services/refactoring/extract_widget_test.dart
index 3355620..4e8323b 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_widget_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_widget_test.dart
@@ -130,6 +130,8 @@
}
class Test extends StatelessWidget {
+ Test({Key key}) : super(key: key);
+
@override
Widget build(BuildContext context) {
return new Column(
@@ -178,6 +180,8 @@
}
class Test extends StatelessWidget {
+ Test({Key key}) : super(key: key);
+
@override
Widget build(BuildContext context) {
return new Text('AAA');
@@ -211,6 +215,8 @@
}
class Test extends StatelessWidget {
+ Test({Key key}) : super(key: key);
+
@override
Widget build(BuildContext context) {
return new Container();
@@ -248,6 +254,8 @@
}
class Test extends StatelessWidget {
+ Test({Key key}) : super(key: key);
+
@override
Widget build(BuildContext context) {
return new Text('AAA');
@@ -345,14 +353,14 @@
@override
Widget build(BuildContext context) {
- return new Test(c);
+ return new Test(c: c);
}
}
class Test extends StatelessWidget {
final C c;
- Test(this.c);
+ Test({Key key, this.c}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -400,6 +408,8 @@
}
class Test extends StatelessWidget {
+ Test({Key key}) : super(key: key);
+
@override
Widget build(BuildContext context) {
var a = new Text('AAA');
@@ -453,8 +463,8 @@
int bar = 1;
return new Row(
children: <Widget>[
- new Test(foo, 'aaa', bar),
- new Test(foo, 'bbb', 2),
+ new Test(foo: foo, p1: 'aaa', p2: bar),
+ new Test(foo: foo, p1: 'bbb', p2: 2),
],
);
}
@@ -465,7 +475,74 @@
final String p1;
final int p2;
- Test(this.foo, this.p1, this.p2);
+ Test({Key key, this.foo, this.p1, this.p2}) : super(key: key);
+
+ @override
+ Widget build(BuildContext context) {
+ var a = new Text('$foo $p1');
+ var b = new Text('$p2');
+ return new Column(
+ children: <Widget>[a, b],
+ );
+ }
+}
+''');
+ }
+
+ test_method_parameters_named() async {
+ addFlutterPackage();
+ await indexTestUnit(r'''
+import 'package:flutter/material.dart';
+
+class MyWidget extends StatelessWidget {
+ String foo;
+
+ @override
+ Widget build(BuildContext context) {
+ int bar = 1;
+ return new Row(
+ children: <Widget>[
+ createColumn(p1: 'aaa', p2: bar),
+ createColumn(p1: 'bbb', p2: 2),
+ ],
+ );
+ }
+
+ Widget createColumn({String p1, int p2}) {
+ var a = new Text('$foo $p1');
+ var b = new Text('$p2');
+ return new Column(
+ children: <Widget>[a, b],
+ );
+ }
+}
+''');
+ _createRefactoringForStringOffset('createColumn({String');
+
+ await _assertSuccessfulRefactoring(r'''
+import 'package:flutter/material.dart';
+
+class MyWidget extends StatelessWidget {
+ String foo;
+
+ @override
+ Widget build(BuildContext context) {
+ int bar = 1;
+ return new Row(
+ children: <Widget>[
+ new Test(foo: foo, p1: 'aaa', p2: bar),
+ new Test(foo: foo, p1: 'bbb', p2: 2),
+ ],
+ );
+ }
+}
+
+class Test extends StatelessWidget {
+ final String foo;
+ final String p1;
+ final int p2;
+
+ Test({Key key, this.foo, this.p1, this.p2}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -503,14 +580,14 @@
@override
Widget build(BuildContext context) {
- return new Test(field);
+ return new Test(field: field);
}
}
class Test extends StatelessWidget {
final String field;
- Test(this.field);
+ Test({Key key, this.field}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -552,14 +629,14 @@
@override
Widget build(BuildContext context) {
- return new Test(c);
+ return new Test(c: c);
}
}
class Test extends StatelessWidget {
final C c;
- Test(this.c);
+ Test({Key key, this.c}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -598,6 +675,8 @@
}
class Test extends StatelessWidget {
+ Test({Key key}) : super(key: key);
+
@override
Widget build(BuildContext context) {
return new Text(field);
@@ -695,14 +774,14 @@
@override
Widget build(BuildContext context) {
- return new Test(c);
+ return new Test(c: c);
}
}
class Test extends StatelessWidget {
final C c;
- Test(this.c);
+ Test({Key key, this.c}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -717,6 +796,25 @@
''');
}
+ test_parameters_key() async {
+ addFlutterPackage();
+ await indexTestUnit(r'''
+import 'package:flutter/material.dart';
+
+class MyWidget extends StatelessWidget {
+ @override
+ Widget build(BuildContext context) {
+ String key;
+ return new Text('$key $key');
+ }
+}
+''');
+ _createRefactoringForStringOffset('new Text');
+
+ RefactoringStatus status = await refactoring.checkAllConditions();
+ assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR);
+ }
+
test_parameters_local_read_enclosingScope() async {
addFlutterPackage();
await indexTestUnit(r'''
@@ -739,14 +837,14 @@
@override
Widget build(BuildContext context) {
String local;
- return new Test(local);
+ return new Test(local: local);
}
}
class Test extends StatelessWidget {
final String local;
- Test(this.local);
+ Test({Key key, this.local}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -811,7 +909,7 @@
@override
Widget build(BuildContext context) {
String local;
- return new Test(field, local);
+ return new Test(field: field, local: local);
}
}
@@ -819,7 +917,7 @@
final String field;
final String local;
- Test(this.field, this.local);
+ Test({Key key, this.field, this.local}) : super(key: key);
@override
Widget build(BuildContext context) {
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 9aff4bc..d25a9bb 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,3 +1,53 @@
+## 0.31.2-alpha.2
+
+* Refactoring to make element model logic sharable with
+ linker. (#32525, #32674)
+* Gracefully handle an invalid packages file. (#32560)
+* Fix silent inconsistency in top level inference. (#32394)
+* Fix test to determine whether a library is in the SDK. (#32707)
+* Fix for type inference from instance creation arguments.
+* Make GenericFunctionTypeElementForLink implement
+ GenericFunctionTypeElementImpl (#32708)
+* Check for missing required libraries dart:core and dart:async. (#32686)
+* Add callable object support. (#32156, #32157, #32426)
+* Avoid putting libraries of all analyzed units in the current
+ session. (too expensive)
+* Deprecate the option to enable using a URI in a part-of directive.
+* Support implicit call() invocation in top-level inference. (#32740)
+* Don't emit errors for lint rule names.
+* Allow empty flutter: sections in pubspec files.
+* Remove the special casing of 'packages' files from the analyzer and analysis
+ server.
+* Initial implementation of API to build analysis contexts (replacing
+ ContextLocator.locateContexts).
+* Fix regression in Analyzer callable function support. (#32769)
+* Several performance enhancements, including:
+ * Add a shared cache of FileState contents (making flutter repo analysis
+ ~12% faster).
+ * Replace SourceFactory.resolveUri() with resolveRelativeUri() in
+ resynthesizer. (10% faster flutter repo analysis)
+ * Optimize computing exported namespaces in FileState.
+ * Optimize computing exported namespaces in prelinker. (8% faster
+ flutter repo analysis)
+ * Add NodeLintRule and UnitLintRule that replace AstVisitor in lints.
+ (6% faster flutter repo analysis)
+* Remove fuzzy arrow support from analyzer. (#31637)
+* More fixes for running the analyzer with Dart 2.
+* Add isXYZ accessors to ParameterElementForLink_VariableSetter. (#32896)
+* Demote IMPORT_DUPLICATED_LIBRARY_NAMED to a warning.
+* Deprecated/removed some unused classes and libraries from the public API.
+* Instantiate bounds to bounds.
+* Use package:path instead of AbsolutePathContext.
+* Check that argument is assignable to parameter in call() (#27098)
+* preview-dart-2 is now the default for the command line analyzer, also
+ implying strong. Use --no-strong and --no-preview-dart-2 to handle
+ Dart 1 code.
+* Export SyntheticBeginToken and SyntheticToken from the analyzer for
+ angular_analyzer_plugin.
+* Improve error messages for annotations involving undefined names (#27788)
+* Add support for getting parse results synchronously.
+* Change linter subscriptions from functions to AstVisitor(s).
+
## 0.31.2-alpha.1
* Don't expect type arguments for class type parameters of static methods.
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 1444d1b..9e72153 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 0.31.2-alpha.1
+version: 0.31.2-alpha.2
author: Dart Team <misc@dartlang.org>
description: Static analyzer for Dart.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/analyzer
@@ -11,10 +11,10 @@
collection: ^1.10.1
convert: ^2.0.0
crypto: '>=1.1.1 <3.0.0'
- front_end: 0.1.0-alpha.11
+ front_end: 0.1.0-alpha.12
glob: ^1.0.3
html: '>=0.12.0 <1.14.0'
- kernel: 0.3.0-alpha.11
+ kernel: 0.3.0-alpha.12
meta: ^1.0.2
package_config: '>=0.1.5 <2.0.0'
path: '>=0.9.0 <2.0.0'
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/import_directive_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/import_directive_test.dart
index 52cf298..e04d1b4 100644
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/import_directive_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/import_directive_test.dart
@@ -76,6 +76,15 @@
ParserErrorCode.EXPECTED_STRING_LITERAL
],
"import 'a.dart' if (b) '';"),
+ new TestDescriptor(
+ 'ifCondition',
+ "import 'a.dart' as",
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "import 'a.dart' as _s_;",
+ failing: ['functionNonVoid', 'getter']),
],
PartialCodeTest.prePartSuffixes);
}
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
index 9759e18..19623cc 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
@@ -134,10 +134,13 @@
@override
void writeConstructorDeclaration(String className,
{ArgumentList argumentList,
+ void bodyWriter(),
SimpleIdentifier constructorName,
String constructorNameGroupName,
List<String> fieldNames,
- bool isConst: false}) {
+ void initializerWriter(),
+ bool isConst: false,
+ void parameterWriter()}) {
if (isConst) {
write(Keyword.CONST.lexeme);
write(' ');
@@ -152,7 +155,9 @@
}
}
write('(');
- if (argumentList != null) {
+ if (parameterWriter != null) {
+ parameterWriter();
+ } else if (argumentList != null) {
writeParametersMatchingArguments(argumentList);
} else if (fieldNames != null) {
for (int i = 0; i < fieldNames.length; i++) {
@@ -163,7 +168,18 @@
write(fieldNames[i]);
}
}
- write(');');
+ write(')');
+
+ if (initializerWriter != null) {
+ write(' : ');
+ initializerWriter();
+ }
+
+ if (bodyWriter != null) {
+ bodyWriter();
+ } else {
+ write(';');
+ }
}
@override
diff --git a/pkg/analyzer_plugin/lib/utilities/change_builder/change_builder_dart.dart b/pkg/analyzer_plugin/lib/utilities/change_builder/change_builder_dart.dart
index c1165a1..86545f0 100644
--- a/pkg/analyzer_plugin/lib/utilities/change_builder/change_builder_dart.dart
+++ b/pkg/analyzer_plugin/lib/utilities/change_builder/change_builder_dart.dart
@@ -66,18 +66,26 @@
* as being a `const` constructor. If a [constructorName] is provided, then
* the constructor will have the given name. If both a constructor name and a
* [constructorNameGroupName] is provided, then the name of the constructor
- * will be included in the linked edit group with that name. If an
+ * will be included in the linked edit group with that name. If a
+ * [parameterWriter] is provided then it is used to write the constructor
+ * parameters (enclosing parenthesis are written for you). Otherwise, if an
* [argumentList] is provided then the constructor will have parameters that
* match the given arguments. If no argument list is given, but a list of
* [fieldNames] is provided, then field formal parameters will be created for
- * each of the field names.
+ * each of the field names. If an [initializerWriter] is provided then it is
+ * used to write the constructor initializers (the ` : ` prefix is written
+ * for you). If a [bodyWriter] is provided then it is used to write the
+ * constructor body, otherwise an empty body is written.
*/
void writeConstructorDeclaration(String className,
{ArgumentList argumentList,
+ void bodyWriter(),
SimpleIdentifier constructorName,
String constructorNameGroupName,
List<String> fieldNames,
- bool isConst: false});
+ void initializerWriter(),
+ bool isConst: false,
+ void parameterWriter()});
/**
* Write the code for a declaration of a field with the given [name]. If an
diff --git a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
index a849278..fdb1008 100644
--- a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
+++ b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart
@@ -470,6 +470,73 @@
expect(group.positions, hasLength(1));
}
+ test_writeConstructorDeclaration_bodyWriter() async {
+ String path = provider.convertPath('/test.dart');
+ addSource(path, 'class C {}');
+
+ DartChangeBuilderImpl builder = new DartChangeBuilder(session);
+ await builder.addFileEdit(path, (DartFileEditBuilder builder) {
+ builder.addInsertion(9, (DartEditBuilder builder) {
+ builder.writeConstructorDeclaration('A', bodyWriter: () {
+ builder.write(' { print(42); }');
+ });
+ });
+ });
+ SourceEdit edit = getEdit(builder);
+ expect(edit.replacement, equalsIgnoringWhitespace('A() { print(42); }'));
+ }
+
+ test_writeConstructorDeclaration_fieldNames() async {
+ String path = provider.convertPath('/test.dart');
+ addSource(path, r'''
+class C {
+ final int a;
+ final bool bb;
+}
+''');
+
+ DartChangeBuilderImpl builder = new DartChangeBuilder(session);
+ await builder.addFileEdit(path, (DartFileEditBuilder builder) {
+ builder.addInsertion(42, (DartEditBuilder builder) {
+ builder.writeConstructorDeclaration('A', fieldNames: ['a', 'bb']);
+ });
+ });
+ SourceEdit edit = getEdit(builder);
+ expect(edit.replacement, equalsIgnoringWhitespace('A(this.a, this.bb);'));
+ }
+
+ test_writeConstructorDeclaration_initializerWriter() async {
+ String path = provider.convertPath('/test.dart');
+ addSource(path, 'class C {}');
+
+ DartChangeBuilderImpl builder = new DartChangeBuilder(session);
+ await builder.addFileEdit(path, (DartFileEditBuilder builder) {
+ builder.addInsertion(9, (DartEditBuilder builder) {
+ builder.writeConstructorDeclaration('A', initializerWriter: () {
+ builder.write('super()');
+ });
+ });
+ });
+ SourceEdit edit = getEdit(builder);
+ expect(edit.replacement, equalsIgnoringWhitespace('A() : super();'));
+ }
+
+ test_writeConstructorDeclaration_parameterWriter() async {
+ String path = provider.convertPath('/test.dart');
+ addSource(path, 'class C {}');
+
+ DartChangeBuilderImpl builder = new DartChangeBuilder(session);
+ await builder.addFileEdit(path, (DartFileEditBuilder builder) {
+ builder.addInsertion(9, (DartEditBuilder builder) {
+ builder.writeConstructorDeclaration('A', parameterWriter: () {
+ builder.write('int a, {this.b}');
+ });
+ });
+ });
+ SourceEdit edit = getEdit(builder);
+ expect(edit.replacement, equalsIgnoringWhitespace('A(int a, {this.b});'));
+ }
+
test_writeFieldDeclaration_initializerWriter() async {
String path = provider.convertPath('/test.dart');
String content = 'class A {}';
diff --git a/pkg/compiler/lib/src/common_elements.dart b/pkg/compiler/lib/src/common_elements.dart
index 3dc07e6..055d40e 100644
--- a/pkg/compiler/lib/src/common_elements.dart
+++ b/pkg/compiler/lib/src/common_elements.dart
@@ -576,27 +576,27 @@
ClassEntity get controllerStream =>
_findAsyncHelperClass("_ControllerStream");
- ConstructorEntity get syncStarIterableConstructor =>
- _env.lookupConstructor(syncStarIterable, "");
-
- ConstructorEntity get syncCompleterConstructor =>
- _env.lookupConstructor(_findAsyncHelperClass("Completer"), "sync");
-
- ConstructorEntity get asyncAwaitCompleterConstructor =>
- _env.lookupConstructor(asyncAwaitCompleter, "");
-
- ClassEntity get asyncAwaitCompleter =>
- _findAsyncHelperClass("_AsyncAwaitCompleter");
-
- ClassEntity get asyncStarController =>
- _findAsyncHelperClass("_AsyncStarStreamController");
-
- ConstructorEntity get asyncStarControllerConstructor =>
- _env.lookupConstructor(asyncStarController, "", required: true);
-
ConstructorEntity get streamIteratorConstructor =>
_env.lookupConstructor(_findAsyncHelperClass("StreamIterator"), "");
+ FunctionEntity _syncStarIterableFactory;
+ FunctionEntity get syncStarIterableFactory => _syncStarIterableFactory ??=
+ _findAsyncHelperFunction('_makeSyncStarIterable');
+
+ FunctionEntity _asyncAwaitCompleterFactory;
+ FunctionEntity get asyncAwaitCompleterFactory =>
+ _asyncAwaitCompleterFactory ??=
+ _findAsyncHelperFunction('_makeAsyncAwaitCompleter');
+
+ FunctionEntity _syncCompleterFactory;
+ FunctionEntity get syncCompleterFactory =>
+ _syncCompleterFactory ??= _findAsyncHelperFunction('_makeSyncCompleter');
+
+ FunctionEntity _asyncStarStreamControllerFactory;
+ FunctionEntity get asyncStarStreamControllerFactory =>
+ _asyncStarStreamControllerFactory ??=
+ _findAsyncHelperFunction('_makeAsyncStarStreamController');
+
// From dart:mirrors
FunctionEntity _findMirrorsFunction(String name) {
LibraryEntity library = _env.lookupLibrary(Uris.dart__js_mirrors);
@@ -1492,11 +1492,16 @@
/// Returns the function type variables defined on [function].
List<TypeVariableType> getFunctionTypeVariables(FunctionEntity function);
- /// Returns the 'element' type of a function with an async, async* ot sync*
+ /// Returns the 'element' type of a function with an async, async* or sync*
/// marker. The return type of the method is inspected to determine the type
/// parameter of the Future, Stream or Iterable.
DartType getFunctionAsyncOrSyncStarElementType(FunctionEntity function);
+ /// Returns the 'element' type of a function with the async, async* or sync*
+ /// marker [marker]. [returnType] is the return type marked function.
+ DartType getAsyncOrSyncStarElementType(
+ AsyncMarker marker, DartType returnType);
+
/// Returns the type of [field].
DartType getFieldType(FieldEntity field);
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index dbe005f..c7db088 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -16,6 +16,7 @@
ConstructedConstantValue,
DeferredConstantValue,
DeferredGlobalConstantValue,
+ InstantiationConstantValue,
TypeConstantValue;
import 'elements/types.dart';
import 'elements/elements.dart'
@@ -389,6 +390,13 @@
_updateElementRecursive(type.element, oldSet, newSet, queue);
}
}
+ if (constant is InstantiationConstantValue) {
+ for (DartType type in constant.typeArguments) {
+ if (type is InterfaceType) {
+ _updateElementRecursive(type.element, oldSet, newSet, queue);
+ }
+ }
+ }
constant.getDependencies().forEach((ConstantValue dependency) {
if (dependency is DeferredConstantValue) {
/// New deferred-imports are only discovered when we are visiting the
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index dd73a35..c83d813 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -7,7 +7,7 @@
import '../common.dart';
import '../common/backend_api.dart'
show ForeignResolver, NativeRegistry, ImpactTransformer;
-import '../common/codegen.dart' show CodegenWorkItem;
+import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
import '../common/names.dart' show Uris;
import '../common/resolution.dart' show Resolution, Target;
import '../common/tasks.dart' show CompilerTask;
@@ -50,6 +50,7 @@
import '../universe/class_hierarchy_builder.dart'
show ClassHierarchyBuilder, ClassQueries;
import '../universe/selector.dart' show Selector;
+import '../universe/use.dart' show StaticUse;
import '../universe/world_builder.dart';
import '../universe/world_impact.dart'
show ImpactStrategy, ImpactUseCase, WorldImpact, WorldImpactVisitor;
@@ -974,7 +975,10 @@
_namer = determineNamer(closedWorld, codegenWorldBuilder);
tracer = new Tracer(closedWorld, namer, compiler.outputProvider);
_rtiEncoder = _namer.rtiEncoder = new RuntimeTypesEncoderImpl(
- namer, closedWorld.elementEnvironment, closedWorld.commonElements,
+ namer,
+ closedWorld.nativeData,
+ closedWorld.elementEnvironment,
+ closedWorld.commonElements,
strongMode: compiler.options.strongMode);
emitter.createEmitter(namer, closedWorld, codegenWorldBuilder, sorter);
// TODO(johnniwinther): Share the impact object created in
@@ -1157,6 +1161,7 @@
jsAst.Expression rewriteAsync(
CommonElements commonElements,
ElementEnvironment elementEnvironment,
+ CodegenRegistry registry,
FunctionEntity element,
jsAst.Expression code,
SourceInformation bodySourceInformation,
@@ -1169,14 +1174,14 @@
switch (element.asyncMarker) {
case AsyncMarker.ASYNC:
rewriter = _makeAsyncRewriter(
- commonElements, elementEnvironment, element, code, name);
+ commonElements, elementEnvironment, registry, element, code, name);
break;
case AsyncMarker.SYNC_STAR:
rewriter = new SyncStarRewriter(reporter, element,
endOfIteration:
emitter.staticFunctionAccess(commonElements.endOfIteration),
- iterableFactory: emitter.staticFunctionAccess(
- commonElements.syncStarIterableConstructor),
+ iterableFactory: emitter
+ .staticFunctionAccess(commonElements.syncStarIterableFactory),
iterableFactoryTypeArgument:
_fetchItemType(element, elementEnvironment),
yieldStarExpression:
@@ -1185,6 +1190,11 @@
.staticFunctionAccess(commonElements.syncStarUncaughtError),
safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
bodyName: namer.deriveAsyncBodyName(name));
+ registry.registerStaticUse(new StaticUse.staticInvoke(
+ commonElements.syncStarIterableFactory,
+ const CallStructure.unnamed(1, 1), [
+ elementEnvironment.getFunctionAsyncOrSyncStarElementType(element)
+ ]));
break;
case AsyncMarker.ASYNC_STAR:
rewriter = new AsyncStarRewriter(reporter, element,
@@ -1194,7 +1204,7 @@
emitter.staticFunctionAccess(commonElements.streamOfController),
wrapBody: emitter.staticFunctionAccess(commonElements.wrapBody),
newController: emitter.staticFunctionAccess(
- commonElements.asyncStarControllerConstructor),
+ commonElements.asyncStarStreamControllerFactory),
newControllerTypeArgument:
_fetchItemType(element, elementEnvironment),
safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
@@ -1203,6 +1213,11 @@
yieldStarExpression:
emitter.staticFunctionAccess(commonElements.yieldStar),
bodyName: namer.deriveAsyncBodyName(name));
+ registry.registerStaticUse(new StaticUse.staticInvoke(
+ commonElements.asyncStarStreamControllerFactory,
+ const CallStructure.unnamed(1, 1), [
+ elementEnvironment.getFunctionAsyncOrSyncStarElementType(element)
+ ]));
break;
}
return rewriter.rewrite(code, bodySourceInformation, exitSourceInformation);
@@ -1226,6 +1241,7 @@
AsyncRewriter _makeAsyncRewriter(
CommonElements commonElements,
ElementEnvironment elementEnvironment,
+ CodegenRegistry registry,
FunctionEntity element,
jsAst.Expression code,
jsAst.Name name) {
@@ -1234,9 +1250,9 @@
var startFunction = startAsyncSynchronously
? commonElements.asyncHelperStartSync
: commonElements.asyncHelperStart;
- var completerConstructor = startAsyncSynchronously
- ? commonElements.asyncAwaitCompleterConstructor
- : commonElements.syncCompleterConstructor;
+ var completerFactory = startAsyncSynchronously
+ ? commonElements.asyncAwaitCompleterFactory
+ : commonElements.syncCompleterFactory;
jsAst.Expression itemTypeExpression =
_fetchItemType(element, elementEnvironment);
@@ -1250,11 +1266,16 @@
asyncRethrow:
emitter.staticFunctionAccess(commonElements.asyncHelperRethrow),
wrapBody: emitter.staticFunctionAccess(commonElements.wrapBody),
- completerFactory: emitter.staticFunctionAccess(completerConstructor),
+ completerFactory: emitter.staticFunctionAccess(completerFactory),
completerFactoryTypeArgument: itemTypeExpression,
safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
bodyName: namer.deriveAsyncBodyName(name));
+ registry.registerStaticUse(new StaticUse.staticInvoke(
+ completerFactory,
+ const CallStructure.unnamed(0, 1),
+ [elementEnvironment.getFunctionAsyncOrSyncStarElementType(element)]));
+
return rewriter;
}
diff --git a/pkg/compiler/lib/src/js_backend/backend_impact.dart b/pkg/compiler/lib/src/js_backend/backend_impact.dart
index 8424c42..cf43c6c 100644
--- a/pkg/compiler/lib/src/js_backend/backend_impact.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_impact.dart
@@ -128,54 +128,67 @@
BackendImpact _asyncBody;
- BackendImpact get asyncBody {
- var staticUses = [
- _commonElements.asyncHelperAwait,
- _commonElements.asyncHelperReturn,
- _commonElements.asyncHelperRethrow,
- _commonElements.streamIteratorConstructor,
- _commonElements.wrapBody
- ];
- var instantiantedClasses = <ClassEntity>[];
- if (_options.startAsyncSynchronously) {
- staticUses.add(_commonElements.asyncAwaitCompleterConstructor);
- staticUses.add(_commonElements.asyncHelperStartSync);
- instantiantedClasses.add(_commonElements.asyncAwaitCompleter);
- } else {
- staticUses.add(_commonElements.syncCompleterConstructor);
- staticUses.add(_commonElements.asyncHelperStart);
- }
- return _asyncBody ??= new BackendImpact(
- staticUses: staticUses, instantiatedClasses: instantiantedClasses);
- }
+ BackendImpact get asyncBody => _asyncBody ??= () {
+ var staticUses = [
+ _commonElements.asyncHelperAwait,
+ _commonElements.asyncHelperReturn,
+ _commonElements.asyncHelperRethrow,
+ _commonElements.streamIteratorConstructor,
+ _commonElements.wrapBody
+ ];
+ if (_options.startAsyncSynchronously) {
+ staticUses.add(_commonElements.asyncHelperStartSync);
+ } else {
+ staticUses.add(_commonElements.asyncHelperStart);
+ }
+ if (!_options.useKernel) {
+ if (_options.startAsyncSynchronously) {
+ staticUses.add(_commonElements.asyncAwaitCompleterFactory);
+ } else {
+ staticUses.add(_commonElements.syncCompleterFactory);
+ }
+ }
+ return new BackendImpact(staticUses: staticUses);
+ }();
BackendImpact _syncStarBody;
BackendImpact get syncStarBody {
- return _syncStarBody ??= new BackendImpact(staticUses: [
- _commonElements.syncStarIterableConstructor,
- _commonElements.endOfIteration,
- _commonElements.yieldStar,
- _commonElements.syncStarUncaughtError
- ], instantiatedClasses: [
- _commonElements.syncStarIterable
- ]);
+ return _syncStarBody ??= _options.useKernel
+ ? new BackendImpact(staticUses: [
+ _commonElements.endOfIteration,
+ _commonElements.yieldStar,
+ _commonElements.syncStarUncaughtError,
+ ])
+ : new BackendImpact(staticUses: [
+ _commonElements.endOfIteration,
+ _commonElements.yieldStar,
+ _commonElements.syncStarUncaughtError,
+ _commonElements.syncStarIterableFactory,
+ ]);
}
BackendImpact _asyncStarBody;
BackendImpact get asyncStarBody {
- return _asyncStarBody ??= new BackendImpact(staticUses: [
- _commonElements.asyncStarHelper,
- _commonElements.streamOfController,
- _commonElements.yieldSingle,
- _commonElements.yieldStar,
- _commonElements.asyncStarControllerConstructor,
- _commonElements.streamIteratorConstructor,
- _commonElements.wrapBody
- ], instantiatedClasses: [
- _commonElements.asyncStarController
- ]);
+ return _asyncStarBody ??= _options.useKernel
+ ? new BackendImpact(staticUses: [
+ _commonElements.asyncStarHelper,
+ _commonElements.streamOfController,
+ _commonElements.yieldSingle,
+ _commonElements.yieldStar,
+ _commonElements.streamIteratorConstructor,
+ _commonElements.wrapBody,
+ ])
+ : new BackendImpact(staticUses: [
+ _commonElements.asyncStarHelper,
+ _commonElements.streamOfController,
+ _commonElements.yieldSingle,
+ _commonElements.yieldStar,
+ _commonElements.streamIteratorConstructor,
+ _commonElements.wrapBody,
+ _commonElements.asyncStarStreamControllerFactory,
+ ]);
}
BackendImpact _typeVariableBoundCheck;
diff --git a/pkg/compiler/lib/src/js_backend/backend_usage.dart b/pkg/compiler/lib/src/js_backend/backend_usage.dart
index c69a632..ac81356 100644
--- a/pkg/compiler/lib/src/js_backend/backend_usage.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_usage.dart
@@ -179,8 +179,7 @@
if (element is ConstructorEntity &&
(element == _commonElements.streamIteratorConstructor ||
_commonElements.isSymbolConstructor(element) ||
- _commonElements.isSymbolValidatedConstructor(element) ||
- element == _commonElements.syncCompleterConstructor)) {
+ _commonElements.isSymbolValidatedConstructor(element))) {
// TODO(johnniwinther): These are valid but we could be more precise.
return true;
} else if (element == _commonElements.symbolImplementationClass ||
diff --git a/pkg/compiler/lib/src/js_backend/codegen_listener.dart b/pkg/compiler/lib/src/js_backend/codegen_listener.dart
index 77e39a4..b5d3feb 100644
--- a/pkg/compiler/lib/src/js_backend/codegen_listener.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen_listener.dart
@@ -190,6 +190,19 @@
InterfaceType representedType = type.representedType;
_customElementsAnalysis.registerTypeConstant(representedType.element);
}
+ } else if (constant is InstantiationConstantValue) {
+ impactBuilder.registerTypeUse(new TypeUse.instantiation(
+ _elementEnvironment
+ .getThisType(_commonElements.instantiation1Class)));
+ impactBuilder.registerTypeUse(new TypeUse.instantiation(
+ _elementEnvironment
+ .getThisType(_commonElements.instantiation2Class)));
+ impactBuilder.registerTypeUse(new TypeUse.instantiation(
+ _elementEnvironment
+ .getThisType(_commonElements.instantiation2Class)));
+ impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
+ _commonElements.instantiatedGenericFunctionType,
+ CallStructure.TWO_ARGS));
}
}
diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
index c218a40..c5915dc 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -188,7 +188,7 @@
.toList(growable: false);
jsAst.ArrayInitializer array = new jsAst.ArrayInitializer(elements);
jsAst.Expression value = makeConstantList(array);
- return maybeAddTypeArguments(constant.type, value);
+ return maybeAddTypeArguments(constant, constant.type, value);
}
@override
@@ -262,7 +262,8 @@
}
if (_rtiNeed.classNeedsTypeArguments(classElement)) {
- arguments.add(_reifiedTypeArguments(constant.type));
+ arguments
+ .add(_reifiedTypeArguments(constant, constant.type.typeArguments));
}
jsAst.Expression constructor = _emitter.constructorAccess(classElement);
@@ -327,18 +328,38 @@
fields.add(constantReferenceGenerator(constant.fields[field]));
});
if (_rtiNeed.classNeedsTypeArguments(constant.type.element)) {
- fields.add(_reifiedTypeArguments(constant.type));
+ fields.add(_reifiedTypeArguments(constant, constant.type.typeArguments));
}
- jsAst.New instantiation = new jsAst.New(constructor, fields);
- return instantiation;
+ return new jsAst.New(constructor, fields);
}
@override
jsAst.Expression visitInstantiation(InstantiationConstantValue constant,
[_]) {
- // TODO(sigmund, sra): add a runtime representation for constant
- // instantiations. See issue 32774.
- return constantReferenceGenerator(constant.function);
+ // TODO(johnniwinther,sra): Support arbitrary type argument count.
+ ClassEntity cls;
+ switch (constant.typeArguments.length) {
+ case 1:
+ cls = _commonElements.instantiation1Class;
+ break;
+ case 2:
+ cls = _commonElements.instantiation2Class;
+ break;
+ case 3:
+ cls = _commonElements.instantiation3Class;
+ break;
+ default:
+ failedAt(
+ NO_LOCATION_SPANNABLE,
+ "Unsupported instantiation argument count: "
+ "${constant.typeArguments.length}");
+ }
+ List<jsAst.Expression> fields = <jsAst.Expression>[
+ constantReferenceGenerator(constant.function),
+ _reifiedTypeArguments(constant, constant.typeArguments)
+ ];
+ jsAst.Expression constructor = _emitter.constructorAccess(cls);
+ return new jsAst.New(constructor, fields);
}
String stripComments(String rawJavaScript) {
@@ -346,28 +367,29 @@
}
jsAst.Expression maybeAddTypeArguments(
- InterfaceType type, jsAst.Expression value) {
+ ConstantValue constant, InterfaceType type, jsAst.Expression value) {
if (type is InterfaceType &&
!type.treatAsRaw &&
_rtiNeed.classNeedsTypeArguments(type.element)) {
return new jsAst.Call(
getHelperProperty(_commonElements.setRuntimeTypeInfo),
- [value, _reifiedTypeArguments(type)]);
+ [value, _reifiedTypeArguments(constant, type.typeArguments)]);
}
return value;
}
- jsAst.Expression _reifiedTypeArguments(InterfaceType type) {
+ jsAst.Expression _reifiedTypeArguments(
+ ConstantValue constant, List<DartType> typeArguments) {
jsAst.Expression unexpected(TypeVariableType _variable) {
TypeVariableType variable = _variable;
throw failedAt(
NO_LOCATION_SPANNABLE,
"Unexpected type variable '${variable}'"
- " in constant type '${type}'");
+ " in constant '${constant.toDartText()}'");
}
List<jsAst.Expression> arguments = <jsAst.Expression>[];
- for (DartType argument in type.typeArguments) {
+ for (DartType argument in typeArguments) {
arguments.add(
_rtiEncoder.getTypeRepresentation(_emitter, argument, unexpected));
}
diff --git a/pkg/compiler/lib/src/js_backend/impact_transformer.dart b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
index 27b074b..4fb3ac1 100644
--- a/pkg/compiler/lib/src/js_backend/impact_transformer.dart
+++ b/pkg/compiler/lib/src/js_backend/impact_transformer.dart
@@ -151,6 +151,9 @@
case Feature.TYPE_VARIABLE_BOUNDS_CHECK:
registerImpact(_impacts.typeVariableBoundCheck);
break;
+ case Feature.LOAD_LIBRARY:
+ registerImpact(_impacts.loadLibrary);
+ break;
}
}
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index cb5a5f1..5b6488d 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -24,6 +24,7 @@
import '../world.dart' show ClosedWorld;
import 'backend_usage.dart';
import 'namer.dart';
+import 'native_data.dart';
bool cacheRtiDataForTesting = false;
@@ -324,9 +325,10 @@
bool isNativeClass = _closedWorld.nativeData.isNativeClass(cls);
if (classUse.typeArgument ||
(isNativeClass && classUse.checkedInstance)) {
+ Substitution substitution = computeSubstitution(cls, cls);
// We need [cls] at runtime - even if [cls] is not instantiated. Either
// as a type argument or for an is-test if [cls] is native.
- checks.add(new TypeCheck(cls, null, needsIs: isNativeClass));
+ checks.add(new TypeCheck(cls, substitution, needsIs: isNativeClass));
}
// Compute the set of classes that [cls] inherited properties from.
@@ -514,9 +516,19 @@
return true;
}
- // If there are no type variables or the type is the same, we do not need
- // a substitution.
- if (!_elementEnvironment.isGenericClass(check) || cls == check) {
+ // If there are no type variables, we do not need a substitution.
+ if (!_elementEnvironment.isGenericClass(check)) {
+ return true;
+ }
+
+ // JS-interop classes need an explicit substitution to mark the type
+ // arguments as `any` type.
+ if (_closedWorld.nativeData.isJsInteropClass(cls)) {
+ return false;
+ }
+
+ // If the type is the same, we do not need a substitution.
+ if (cls == check) {
return true;
}
@@ -565,7 +577,12 @@
InterfaceType type = _elementEnvironment.getThisType(cls);
InterfaceType target = _types.asInstanceOf(type, check);
List<DartType> typeVariables = type.typeArguments;
- if (typeVariables.isEmpty && !alwaysGenerateFunction) {
+ if (_closedWorld.nativeData.isJsInteropClass(cls)) {
+ int typeArguments = target.typeArguments.length;
+ // Generic JS-interop class need an explicit substitution to mark
+ // the type arguments as `any` type.
+ return new Substitution.jsInterop(typeArguments);
+ } else if (typeVariables.isEmpty && !alwaysGenerateFunction) {
return new Substitution.list(target.typeArguments);
} else {
return new Substitution.function(target.typeArguments, typeVariables);
@@ -624,6 +641,10 @@
/// is the dynamic type.
jsAst.Template get templateForIsDynamicType;
+ /// Returns the JavaScript template to determine at runtime if a type object
+ /// is a type argument of js-interop class.
+ jsAst.Template get templateForIsJsInteropTypeArgument;
+
jsAst.Name get getFunctionThatReturnsNullName;
/// Returns a [jsAst.Expression] representing the given [type]. Type variables
@@ -1834,11 +1855,11 @@
final CommonElements commonElements;
final TypeRepresentationGenerator _representationGenerator;
- RuntimeTypesEncoderImpl(
- this.namer, this._elementEnvironment, this.commonElements,
- {bool strongMode})
- : _representationGenerator =
- new TypeRepresentationGenerator(namer, strongMode: strongMode);
+ RuntimeTypesEncoderImpl(this.namer, NativeBasicData nativeData,
+ this._elementEnvironment, this.commonElements, {bool strongMode})
+ : _representationGenerator = new TypeRepresentationGenerator(
+ namer, nativeData,
+ strongMode: strongMode);
@override
bool isSimpleFunctionType(FunctionType type) {
@@ -1880,6 +1901,11 @@
}
@override
+ jsAst.Template get templateForIsJsInteropTypeArgument {
+ return _representationGenerator.templateForIsJsInteropTypeArgument;
+ }
+
+ @override
jsAst.Expression getTypeRepresentation(
Emitter emitter, DartType type, OnVariableCallback onVariable,
[ShouldEncodeTypedefCallback shouldEncodeTypedef]) {
@@ -1968,6 +1994,13 @@
return new jsAst.LiteralNull();
}
+ if (substitution.isJsInterop) {
+ return js(
+ 'function() { return # }',
+ _representationGenerator
+ .getJsInteropTypeArguments(substitution.length));
+ }
+
jsAst.Expression declaration(TypeVariableType variable) {
return new jsAst.Parameter(getVariableName(variable.element.name));
}
@@ -2036,6 +2069,7 @@
class TypeRepresentationGenerator
implements ResolutionDartTypeVisitor<jsAst.Expression, Emitter> {
final Namer namer;
+ final NativeBasicData _nativeData;
// If true, compile using strong mode.
final bool _strongMode;
OnVariableCallback onVariable;
@@ -2043,7 +2077,7 @@
Map<TypeVariableType, jsAst.Expression> typedefBindings;
List<FunctionTypeVariable> functionTypeVariables = <FunctionTypeVariable>[];
- TypeRepresentationGenerator(this.namer, {bool strongMode})
+ TypeRepresentationGenerator(this.namer, this._nativeData, {bool strongMode})
: _strongMode = strongMode;
/**
@@ -2075,6 +2109,7 @@
jsAst.Expression getVoidValue() => js('-1');
+ jsAst.Expression getJsInteropTypeArgumentValue() => js('-2');
@override
jsAst.Expression visit(DartType type, Emitter emitter) =>
type.accept(this, emitter);
@@ -2102,8 +2137,23 @@
return getDynamicValue();
}
+ jsAst.Expression getJsInteropTypeArguments(int count,
+ {jsAst.Expression name}) {
+ List<jsAst.Expression> elements = <jsAst.Expression>[];
+ if (name != null) {
+ elements.add(name);
+ }
+ for (int i = 0; i < count; i++) {
+ elements.add(getJsInteropTypeArgumentValue());
+ }
+ return new jsAst.ArrayInitializer(elements);
+ }
+
jsAst.Expression visitInterfaceType(InterfaceType type, Emitter emitter) {
jsAst.Expression name = getJavaScriptClassName(type.element, emitter);
+ if (_nativeData.isJsInteropClass(type.element)) {
+ return getJsInteropTypeArguments(type.typeArguments.length, name: name);
+ }
return type.treatAsRaw
? name
: visitList(type.typeArguments, emitter, head: name);
@@ -2150,6 +2200,10 @@
return jsAst.js.expressionTemplateFor("# == null");
}
+ jsAst.Template get templateForIsJsInteropTypeArgument {
+ return jsAst.js.expressionTemplateFor("# === -2");
+ }
+
jsAst.Expression visitFunctionType(FunctionType type, Emitter emitter) {
List<jsAst.Property> properties = <jsAst.Property>[];
@@ -2405,24 +2459,37 @@
final bool isFunction;
final List<DartType> arguments;
final List<DartType> parameters;
+ final int length;
const Substitution.trivial()
: isTrivial = true,
isFunction = false,
+ length = null,
arguments = const <DartType>[],
parameters = const <DartType>[];
Substitution.list(this.arguments)
: isTrivial = false,
isFunction = false,
+ length = null,
parameters = const <DartType>[];
Substitution.function(this.arguments, this.parameters)
: isTrivial = false,
- isFunction = true;
+ isFunction = true,
+ length = null;
+
+ Substitution.jsInterop(this.length)
+ : isTrivial = false,
+ isFunction = false,
+ arguments = const <DartType>[],
+ parameters = const <DartType>[];
+
+ bool get isJsInterop => length != null;
String toString() => 'Substitution(isTrivial=$isTrivial,'
- 'isFunction=$isFunction,arguments=$arguments,parameters=$parameters)';
+ 'isFunction=$isFunction,isJsInterop=$isJsInterop,arguments=$arguments,'
+ 'parameters=$parameters,length=$length)';
}
/**
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
index 7939804..6002105 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
@@ -345,6 +345,9 @@
case JsBuiltin.isDynamicType:
return backend.rtiEncoder.templateForIsDynamicType;
+ case JsBuiltin.isJsInteropTypeArgument:
+ return backend.rtiEncoder.templateForIsJsInteropTypeArgument;
+
case JsBuiltin.rawRtiToJsConstructorName:
return jsAst.js.expressionTemplateFor("#.$typeNameProperty");
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index 5e3279f..3b55095 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -768,6 +768,10 @@
List<StubMethod> checkedSetters = <StubMethod>[];
List<StubMethod> isChecks = <StubMethod>[];
if (_nativeData.isJsInteropClass(cls)) {
+ // TODO(johnniwinther): Instead of generating all stubs for each
+ // js-interop class we should generate a stub for each implemented class.
+ // Currently we generate duplicates if a class is implemented by multiple
+ // js-interop classes.
typeTests.forEachProperty(_sorter, (js.Name name, js.Node code) {
_classes[_commonElements.jsJavaScriptObjectClass]
.isChecks
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
index 18541ce..4d150cc 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
@@ -135,6 +135,9 @@
case JsBuiltin.isDynamicType:
return _backend.rtiEncoder.templateForIsDynamicType;
+ case JsBuiltin.isJsInteropTypeArgument:
+ return _backend.rtiEncoder.templateForIsJsInteropTypeArgument;
+
case JsBuiltin.rawRtiToJsConstructorName:
return js.js.expressionTemplateFor("#.name");
diff --git a/pkg/compiler/lib/src/js_model/closure_visitors.dart b/pkg/compiler/lib/src/js_model/closure_visitors.dart
index ea35aaf..5868aea 100644
--- a/pkg/compiler/lib/src/js_model/closure_visitors.dart
+++ b/pkg/compiler/lib/src/js_model/closure_visitors.dart
@@ -629,6 +629,11 @@
node.body.accept(this);
}
+ @override
+ visitInstantiation(ir.Instantiation node) {
+ visitChildrenInContext(node, VariableUse.explicit);
+ }
+
/// Returns true if the node is a field, or a constructor (factory or
/// generative).
bool _isFieldOrConstructor(ir.Node node) =>
diff --git a/pkg/compiler/lib/src/kernel/deferred_load.dart b/pkg/compiler/lib/src/kernel/deferred_load.dart
index f2641c6..f3f1a9c 100644
--- a/pkg/compiler/lib/src/kernel/deferred_load.dart
+++ b/pkg/compiler/lib/src/kernel/deferred_load.dart
@@ -6,8 +6,8 @@
import 'package:kernel/ast.dart' as ir;
-import '../compiler.dart' show Compiler;
import '../common_elements.dart';
+import '../compiler.dart' show Compiler;
import '../constants/values.dart' show ConstantValue;
import '../deferred_load.dart';
import '../elements/entities.dart';
@@ -141,8 +141,13 @@
CommonElements get commonElements => elementMap.commonElements;
- void add(ir.Expression node) =>
- constants.add(elementMap.getConstantValue(node));
+ void add(ir.Expression node, {bool required: true}) {
+ ConstantValue constant =
+ elementMap.getConstantValue(node, requireConstant: required);
+ if (constant != null) {
+ constants.add(constant);
+ }
+ }
@override
void visitIntLiteral(ir.IntLiteral literal) {}
@@ -193,4 +198,11 @@
void visitTypeLiteral(ir.TypeLiteral node) {
if (node.type is! ir.TypeParameterType) add(node);
}
+
+ @override
+ void visitInstantiation(ir.Instantiation node) {
+ // TODO(johnniwinther): The CFE should mark constant instantiations as
+ // constant.
+ add(node, required: false);
+ }
}
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
index d9c3e7a..d6167ba 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map.dart
@@ -189,6 +189,9 @@
/// Returns the static type of [node].
// TODO(johnniwinther): This should be provided directly from kernel.
DartType getStaticType(ir.Expression node);
+
+ /// Returns the element type of a async/sync*/async* function.
+ DartType getFunctionAsyncOrSyncStarElementType(ir.FunctionNode functionNode);
}
/// Interface that translates between Kernel IR nodes and entities used for
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index e7791c6..5216b83 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -1369,6 +1369,27 @@
ClassDefinition getClassDefinition(ClassEntity cls) {
return _getClassDefinition(cls);
}
+
+ /// Returns the element type of a async/sync*/async* function.
+ @override
+ DartType getFunctionAsyncOrSyncStarElementType(ir.FunctionNode functionNode) {
+ DartType returnType = getFunctionType(functionNode).returnType;
+ switch (functionNode.asyncMarker) {
+ case ir.AsyncMarker.SyncStar:
+ return elementEnvironment.getAsyncOrSyncStarElementType(
+ AsyncMarker.SYNC_STAR, returnType);
+ case ir.AsyncMarker.Async:
+ return elementEnvironment.getAsyncOrSyncStarElementType(
+ AsyncMarker.ASYNC, returnType);
+ case ir.AsyncMarker.AsyncStar:
+ return elementEnvironment.getAsyncOrSyncStarElementType(
+ AsyncMarker.ASYNC_STAR, returnType);
+ default:
+ failedAt(CURRENT_ELEMENT_SPANNABLE,
+ "Unexpected ir.AsyncMarker: ${functionNode.asyncMarker}");
+ }
+ return null;
+ }
}
class KernelElementEnvironment extends ElementEnvironment {
@@ -1451,7 +1472,13 @@
@override
DartType getFunctionAsyncOrSyncStarElementType(FunctionEntity function) {
DartType returnType = getFunctionType(function).returnType;
- switch (function.asyncMarker) {
+ return getAsyncOrSyncStarElementType(function.asyncMarker, returnType);
+ }
+
+ @override
+ DartType getAsyncOrSyncStarElementType(
+ AsyncMarker asyncMarker, DartType returnType) {
+ switch (asyncMarker) {
case AsyncMarker.SYNC:
return returnType;
case AsyncMarker.SYNC_STAR:
@@ -1477,7 +1504,7 @@
}
return dynamicType;
}
- assert(false, 'Unexpected marker ${function.asyncMarker}');
+ assert(false, 'Unexpected marker ${asyncMarker}');
return null;
}
diff --git a/pkg/compiler/lib/src/kernel/element_map_mixins.dart b/pkg/compiler/lib/src/kernel/element_map_mixins.dart
index 1a4ca53..3588b19 100644
--- a/pkg/compiler/lib/src/kernel/element_map_mixins.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_mixins.dart
@@ -500,6 +500,7 @@
ConstantExpression visit(ir.Expression node) {
ConstantExpression constant = node.accept(this);
if (constant == null && requireConstant) {
+ // TODO(johnniwinther): Support contextual error messages.
elementMap.reporter.reportErrorMessage(
computeSourceSpanFromTreeNode(failNode ?? node),
MessageKind.NOT_A_COMPILE_TIME_CONSTANT);
@@ -699,9 +700,16 @@
@override
ConstantExpression visitInstantiation(ir.Instantiation node) {
- return new InstantiationConstantExpression(
- node.typeArguments.map(elementMap.getDartType).toList(),
- visit(node.expression));
+ List<DartType> typeArguments =
+ node.typeArguments.map(elementMap.getDartType).toList();
+ for (DartType typeArgument in typeArguments) {
+ if (typeArgument.containsTypeVariables) {
+ return null;
+ }
+ }
+ ConstantExpression expression = visit(node.expression);
+ if (expression == null) return null;
+ return new InstantiationConstantExpression(typeArguments, expression);
}
@override
diff --git a/pkg/compiler/lib/src/resolution/resolution_strategy.dart b/pkg/compiler/lib/src/resolution/resolution_strategy.dart
index b73f923..06718ca 100644
--- a/pkg/compiler/lib/src/resolution/resolution_strategy.dart
+++ b/pkg/compiler/lib/src/resolution/resolution_strategy.dart
@@ -742,6 +742,11 @@
}
@override
+ DartType getAsyncOrSyncStarElementType(AsyncMarker marker, DartType type) {
+ return dynamicType;
+ }
+
+ @override
DartType getFieldType(covariant FieldElement field) {
field.computeType(_resolution);
return field.type;
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 06ebbe7..029f975 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -4028,6 +4028,7 @@
}
FunctionEntity _instantiator(int count) {
+ // TODO(johnniwinther,sra): Support arbitrary type argument count.
if (count == 1) return _commonElements.instantiate1;
if (count == 2) return _commonElements.instantiate2;
if (count == 3) return _commonElements.instantiate3;
@@ -4439,7 +4440,8 @@
js.Name operator = namer.operatorIs(element);
HInstruction isFieldName =
graph.addConstantStringFromName(operator, closedWorld);
- HInstruction asFieldName = closedWorld.hasAnyStrictSubtype(element)
+ HInstruction asFieldName = closedWorld.hasAnyStrictSubtype(element) ||
+ closedWorld.nativeData.isJsInteropClass(element)
? graph.addConstantStringFromName(
namer.substitutionName(element), closedWorld)
: graph.addConstantNull(closedWorld);
diff --git a/pkg/compiler/lib/src/ssa/kernel_impact.dart b/pkg/compiler/lib/src/ssa/kernel_impact.dart
index 6f96104..b22749f 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -146,19 +146,42 @@
return impactBuilder;
}
- void handleAsyncMarker(ir.AsyncMarker asyncMarker) {
+ void handleAsyncMarker(ir.FunctionNode function) {
+ ir.AsyncMarker asyncMarker = function.asyncMarker;
+ if (asyncMarker == ir.AsyncMarker.Sync) return;
+
+ DartType elementType =
+ elementMap.getFunctionAsyncOrSyncStarElementType(function);
+
switch (asyncMarker) {
- case ir.AsyncMarker.Sync:
- break;
case ir.AsyncMarker.SyncStar:
impactBuilder.registerFeature(Feature.SYNC_STAR);
+ impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
+ commonElements.syncStarIterableFactory,
+ const CallStructure.unnamed(1, 1),
+ <DartType>[elementType]));
break;
+
case ir.AsyncMarker.Async:
impactBuilder.registerFeature(Feature.ASYNC);
+ var completerFactory = _options.startAsyncSynchronously
+ ? commonElements.asyncAwaitCompleterFactory
+ : commonElements.syncCompleterFactory;
+ impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
+ completerFactory,
+ const CallStructure.unnamed(0, 1),
+ <DartType>[elementType]));
break;
+
case ir.AsyncMarker.AsyncStar:
impactBuilder.registerFeature(Feature.ASYNC_STAR);
+ impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
+ commonElements.asyncStarStreamControllerFactory,
+ const CallStructure.unnamed(1, 1),
+ <DartType>[elementType]));
break;
+
+ case ir.AsyncMarker.Sync:
case ir.AsyncMarker.SyncYielding:
failedAt(CURRENT_ELEMENT_SPANNABLE,
"Unexpected async marker: ${asyncMarker}");
@@ -168,7 +191,7 @@
ResolutionImpact buildProcedure(ir.Procedure procedure) {
handleSignature(procedure.function);
visitNode(procedure.function.body);
- handleAsyncMarker(procedure.function.asyncMarker);
+ handleAsyncMarker(procedure.function);
if (procedure.isExternal &&
!elementMap.isForeignLibrary(procedure.enclosingLibrary)) {
MemberEntity member = elementMap.getMember(procedure);
@@ -607,19 +630,19 @@
@override
void visitFunctionDeclaration(ir.FunctionDeclaration node) {
- impactBuilder.registerStaticUse(
- new StaticUse.closure(elementMap.getLocalFunction(node)));
+ Local function = elementMap.getLocalFunction(node);
+ impactBuilder.registerStaticUse(new StaticUse.closure(function));
handleSignature(node.function);
- handleAsyncMarker(node.function.asyncMarker);
+ handleAsyncMarker(node.function);
visitNode(node.function.body);
}
@override
void visitFunctionExpression(ir.FunctionExpression node) {
- impactBuilder.registerStaticUse(
- new StaticUse.closure(elementMap.getLocalFunction(node)));
+ Local function = elementMap.getLocalFunction(node);
+ impactBuilder.registerStaticUse(new StaticUse.closure(function));
handleSignature(node.function);
- handleAsyncMarker(node.function.asyncMarker);
+ handleAsyncMarker(node.function);
visitNode(node.function.body);
}
@@ -728,6 +751,7 @@
void visitLoadLibrary(ir.LoadLibrary node) {
impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
commonElements.loadDeferredLibrary, CallStructure.ONE_ARG));
+ impactBuilder.registerFeature(Feature.LOAD_LIBRARY);
}
// TODO(johnniwinther): Make this throw and visit child nodes explicitly
diff --git a/pkg/compiler/lib/src/ssa/ssa.dart b/pkg/compiler/lib/src/ssa/ssa.dart
index 4dd04bc..f9c45ea 100644
--- a/pkg/compiler/lib/src/ssa/ssa.dart
+++ b/pkg/compiler/lib/src/ssa/ssa.dart
@@ -51,6 +51,7 @@
result = backend.rewriteAsync(
closedWorld.commonElements,
closedWorld.elementEnvironment,
+ work.registry,
element,
result,
sourceInformationBuilder.buildAsyncBody(),
diff --git a/pkg/compiler/lib/src/universe/feature.dart b/pkg/compiler/lib/src/universe/feature.dart
index 611f6a8..d63fa34 100644
--- a/pkg/compiler/lib/src/universe/feature.dart
+++ b/pkg/compiler/lib/src/universe/feature.dart
@@ -46,11 +46,14 @@
/// A generic instantiation (application of type parameters).
GENERIC_INSTANTIATION,
+ /// A field whose initialization is not a constant.
+ LAZY_FIELD,
+
/// A local variable without an initializer.
LOCAL_WITHOUT_INITIALIZER,
- /// A field whose initialization is not a constant.
- LAZY_FIELD,
+ /// Access to `loadLibrary` on a deferred import.
+ LOAD_LIBRARY,
/// A catch clause with a variable for the stack trace.
STACK_TRACE_IN_CATCH,
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index 8fbce54..c7c523d 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -239,7 +239,7 @@
stringClass = _getLibrary(c, 'dart:core').getType('String'),
functionClass = _getLibrary(c, 'dart:core').getType('Function'),
privateSymbolClass =
- _getLibrary(c, 'dart:_internal').getType('PrivateSymbol'),
+ _getLibrary(c, 'dart:_js_helper').getType('PrivateSymbol'),
linkedHashMapImplType =
_getLibrary(c, 'dart:_js_helper').getType('LinkedMap').type,
identityHashMapImplType =
diff --git a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_async.dart b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_async.dart
index e6bcb2d..0f6165e 100644
--- a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_async.dart
+++ b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_async.dart
@@ -3,10 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
main() {
- // This call is no longer on the stack when the error is thrown.
- /*:main*/ test();
+ /*1:main*/ test();
}
-test() async {
- /*1:test*/ throw '>ExceptionMarker<';
+test /*ddk.2:test*/ () /*ddc.2:test*/ async {
+ /*3:test*/ throw '>ExceptionMarker<';
}
diff --git a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_awaited_async.dart b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_awaited_async.dart
index fbc5eff..2801397 100644
--- a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_awaited_async.dart
+++ b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_awaited_async.dart
@@ -3,14 +3,13 @@
// BSD-style license that can be found in the LICENSE file.
main() {
- test1();
+ /*1:main*/ test1();
}
-test1() async {
- // This call is no longer on the stack when the error is thrown.
- await /*:test1*/ test2();
+test1 /*ddk.2:test1*/ () /*ddc.2:test1*/ async {
+ await /*3:test1*/ test2();
}
-test2() async {
- /*1:test2*/ throw '>ExceptionMarker<';
+test2 /*ddk.4:test2*/ () /*ddc.4:test2*/ async {
+ /*5:test2*/ throw '>ExceptionMarker<';
}
diff --git a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_constructor_from_async.dart b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_constructor_from_async.dart
index 1eaf256..c3cf435 100644
--- a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_constructor_from_async.dart
+++ b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_constructor_from_async.dart
@@ -4,17 +4,17 @@
main() {
// This call is no longer on the stack when the error is thrown.
- /*:main*/ test();
+ /*1:main*/ test();
}
-test() async {
+test /*ddk.2:test*/ () /*ddc.2:test*/ async {
// ignore: UNUSED_LOCAL_VARIABLE
- var c = new /*1:test*/ Class();
+ var c = new /*3:test*/ Class();
}
class Class {
Class() {
// Some comment
- /*2:Class.new*/ throw '>ExceptionMarker<';
+ /*4:Class.new*/ throw '>ExceptionMarker<';
}
}
diff --git a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_top_level_method_from_async.dart b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_top_level_method_from_async.dart
index 0eeaefe..f58dde6 100644
--- a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_top_level_method_from_async.dart
+++ b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_top_level_method_from_async.dart
@@ -3,13 +3,13 @@
// BSD-style license that can be found in the LICENSE file.
main() {
- test1();
+ /*1:main*/ test1();
}
-test1() async {
- /*1:test1*/ test2();
+test1 /*ddk.2:test1*/ () /*ddc.2:test1*/ async {
+ /*3:test1*/ test2();
}
test2() {
- /*2:test2*/ throw '>ExceptionMarker<';
+ /*4:test2*/ throw '>ExceptionMarker<';
}
diff --git a/pkg/dev_compiler/test/sourcemap/testfiles/hello_async.dart b/pkg/dev_compiler/test/sourcemap/testfiles/hello_async.dart
index a462a3b..6758e46 100644
--- a/pkg/dev_compiler/test/sourcemap/testfiles/hello_async.dart
+++ b/pkg/dev_compiler/test/sourcemap/testfiles/hello_async.dart
@@ -5,10 +5,10 @@
main() {
/*bl*/
/*s:1*/ foo();
-/*nbb:0:3*/ /*s:3*/
+ /*s:4*/
}
-foo() async {
- /*nbb:0:4*/ /*bc:4*/ print("hello from foo");
-/*s:2*/
+foo() /*sl:2*/ async {
+ print("hello from foo");
+/*s:3*/
}
diff --git a/pkg/dev_compiler/tool/ddc b/pkg/dev_compiler/tool/ddc
index 9846cd6..cc8f410 100755
--- a/pkg/dev_compiler/tool/ddc
+++ b/pkg/dev_compiler/tool/ddc
@@ -60,12 +60,6 @@
shift
fi
-SYNC_ASYNC=false
-if [ "$1" = "--sync-async" ]; then
- SYNC_ASYNC=true
- shift
-fi
-
BASENAME=$( basename "${1%.*}")
LIBROOT=$(cd $( dirname "${1%.*}") && pwd)
@@ -110,7 +104,6 @@
let sdk = require(\"dart_sdk\");
let main = require(\"./$BASENAME\").$BASENAME.main;
sdk.dart.ignoreWhitelistedErrors(false);
- if ($SYNC_ASYNC) sdk.dart.setStartAsyncSynchronously();
try {
sdk._isolate_helper.startRootIsolate(main, []);
} catch(e) {
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart
index e6cfecf..584a6f1 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart
@@ -11,8 +11,9 @@
/// stepping stone for proposed ES7 async/await, and uses ES6 Promises.
part of dart._runtime;
-// TODO(vsm): Remove once this flag is the default.
-bool startAsyncSynchronously = false;
+// TODO(vsm): Remove once this flag we've removed the ability to
+// whitelist / fallback on the old behavior.
+bool startAsyncSynchronously = true;
void setStartAsyncSynchronously([bool value = true]) {
startAsyncSynchronously = value;
}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
index 6a36f63..b28594e 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -443,21 +443,23 @@
}
@JSExportName('as')
-cast(obj, type, bool typeError) {
+cast(obj, type, bool isExplicit) {
if (obj == null) return obj;
var actual = getReifiedType(obj);
var result = isSubtype(actual, type);
if (JS(
'bool',
- '# === true || # === null && dart.__ignoreWhitelistedErrors && #(#, #)',
+ '# === true || # === null && # && '
+ 'dart.__ignoreWhitelistedErrors && #(#, #)',
result,
result,
+ isExplicit,
_ignoreTypeFailure,
actual,
type)) {
return obj;
}
- return castError(obj, type, typeError);
+ return castError(obj, type, isExplicit);
}
bool test(bool obj) {
@@ -484,7 +486,7 @@
"type '${typeName(expected)}' in boolean expression");
}
-castError(obj, type, bool typeError) {
+castError(obj, type, bool isExplicit) {
var objType = getReifiedType(obj);
if (JS('bool', '!dart.__ignoreAllErrors')) {
var errorInStrongMode = isSubtype(objType, type) == null;
@@ -493,7 +495,7 @@
var expected = typeName(type);
if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
- var error = JS('bool', '#', typeError)
+ var error = JS('bool', '#', isExplicit)
? new TypeErrorImplementation(obj, actual, expected, errorInStrongMode)
: new CastErrorImplementation(obj, actual, expected, errorInStrongMode);
throw error;
diff --git a/pkg/front_end/lib/src/base/instrumentation.dart b/pkg/front_end/lib/src/base/instrumentation.dart
index 92ebf2f..4f537c7 100644
--- a/pkg/front_end/lib/src/base/instrumentation.dart
+++ b/pkg/front_end/lib/src/base/instrumentation.dart
@@ -65,9 +65,6 @@
buffer.write('abstract ');
}
var function = procedure.function;
- if (procedure.isGenericContravariant) {
- buffer.write('genericContravariant ');
- }
buffer.write(function.returnType);
buffer.write(' ');
switch (procedure.kind) {
diff --git a/pkg/front_end/lib/src/fasta/builder/class_builder.dart b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
index f6d512c..27e264e 100644
--- a/pkg/front_end/lib/src/fasta/builder/class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
@@ -227,4 +227,6 @@
{List<LocatedMessage> context}) {
library.addProblem(message, charOffset, length, fileUri, context: context);
}
+
+ int get typeVariablesCount;
}
diff --git a/pkg/front_end/lib/src/fasta/builder/function_type_alias_builder.dart b/pkg/front_end/lib/src/fasta/builder/function_type_alias_builder.dart
index 710e5e3..564c636 100644
--- a/pkg/front_end/lib/src/fasta/builder/function_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/function_type_alias_builder.dart
@@ -28,4 +28,6 @@
String get debugName => "FunctionTypeAliasBuilder";
LibraryBuilder get parent => super.parent;
+
+ int get typeVariablesCount;
}
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 2737d27..5ad37c7 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -31,6 +31,8 @@
ScopeBuilder,
TypeBuilder;
+import '../import.dart' show Import;
+
abstract class LibraryBuilder<T extends TypeBuilder, R>
extends ModifierBuilder {
final Scope scope;
@@ -215,4 +217,19 @@
if (!isPatch) return;
unsupported("${runtimeType}.applyPatches", -1, fileUri);
}
+
+ void addSpecificImportsToScope(Iterable<Import> imports) {
+ bool explicitCoreImport = this == loader.coreLibrary;
+ for (Import import in imports) {
+ if (import.imported == loader.coreLibrary) {
+ explicitCoreImport = true;
+ }
+ import.finalizeImports(this);
+ }
+ if (!explicitCoreImport) {
+ loader.coreLibrary.exportScope.forEach((String name, Builder member) {
+ addToScope(name, member, -1, true);
+ });
+ }
+ }
}
diff --git a/pkg/front_end/lib/src/fasta/builder/named_type_builder.dart b/pkg/front_end/lib/src/fasta/builder/named_type_builder.dart
index eca2778..fb021d6 100644
--- a/pkg/front_end/lib/src/fasta/builder/named_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/named_type_builder.dart
@@ -4,6 +4,8 @@
library fasta.named_type_builder;
+import '../fasta_codes.dart' show Message;
+
import 'builder.dart'
show
Builder,
@@ -23,7 +25,8 @@
NamedTypeBuilder(this.name, this.arguments);
- InvalidTypeBuilder<T, R> buildInvalidType(int charOffset, Uri fileUri);
+ InvalidTypeBuilder<T, R> buildInvalidType(int charOffset, Uri fileUri,
+ [Message message]);
@override
void bind(TypeDeclarationBuilder builder) {
diff --git a/pkg/front_end/lib/src/fasta/builder/unresolved_type.dart b/pkg/front_end/lib/src/fasta/builder/unresolved_type.dart
index fb09b30..ef75ed9 100644
--- a/pkg/front_end/lib/src/fasta/builder/unresolved_type.dart
+++ b/pkg/front_end/lib/src/fasta/builder/unresolved_type.dart
@@ -4,7 +4,16 @@
library fasta.unresolved_type;
-import 'builder.dart' show Scope, TypeBuilder;
+import '../fasta_codes.dart' show templateTypeArgumentMismatch;
+
+import 'builder.dart'
+ show
+ ClassBuilder,
+ FunctionTypeAliasBuilder,
+ NamedTypeBuilder,
+ Scope,
+ TypeBuilder,
+ TypeDeclarationBuilder;
/// A wrapper around a type that is yet to be resolved.
class UnresolvedType<T extends TypeBuilder> {
@@ -15,4 +24,31 @@
UnresolvedType(this.builder, this.charOffset, this.fileUri);
void resolveIn(Scope scope) => builder.resolveIn(scope, charOffset, fileUri);
+
+ /// Performs checks on the type after it's resolved.
+ void checkType() {
+ if (builder is NamedTypeBuilder) {
+ NamedTypeBuilder resolvedType = builder as NamedTypeBuilder;
+ TypeDeclarationBuilder declaration = resolvedType.builder;
+ if (declaration is ClassBuilder) {
+ if (resolvedType.arguments != null &&
+ resolvedType.arguments.length != declaration.typeVariablesCount) {
+ resolvedType.builder = resolvedType.buildInvalidType(
+ charOffset,
+ fileUri,
+ templateTypeArgumentMismatch.withArguments(
+ resolvedType.name, "${declaration.typeVariablesCount}"));
+ }
+ } else if (declaration is FunctionTypeAliasBuilder) {
+ if (resolvedType.arguments != null &&
+ resolvedType.arguments.length != declaration.typeVariablesCount) {
+ resolvedType.builder = resolvedType.buildInvalidType(
+ charOffset,
+ fileUri,
+ templateTypeArgumentMismatch.withArguments(
+ resolvedType.name, "${declaration.typeVariablesCount}"));
+ }
+ }
+ }
+ }
}
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_class_builder.dart b/pkg/front_end/lib/src/fasta/dill/dill_class_builder.dart
index caa23e7..a2089f3 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_class_builder.dart
@@ -60,6 +60,9 @@
}
}
+ @override
+ int get typeVariablesCount => cls.typeParameters.length;
+
List<TypeBuilder> get calculatedBounds {
if (super.calculatedBounds != null) {
return super.calculatedBounds;
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart b/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart
index 2b6c733..57cb4e0 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart
@@ -11,6 +11,7 @@
Class,
Field,
Library,
+ LibraryDependency,
ListLiteral,
Member,
Procedure,
@@ -18,9 +19,15 @@
StringLiteral,
Typedef;
+import 'package:kernel/ast.dart' as kernel show Combinator;
+
+import '../combinator.dart' show Combinator;
+
import '../fasta_codes.dart' show templateUnspecified;
-import '../problems.dart' show internalProblem, unhandled, unimplemented;
+import '../import.dart' show Import;
+
+import '../problems.dart' show internalProblem, unhandled;
import '../kernel/kernel_builder.dart'
show
@@ -118,7 +125,16 @@
@override
void addToScope(String name, Builder member, int charOffset, bool isImport) {
- unimplemented("addToScope", charOffset, fileUri);
+ Map<String, Builder> map = member.isSetter ? scope.setters : scope.local;
+ Builder existing = map[name];
+ if (existing != null) {
+ if (existing != member) {
+ map[name] = buildAmbiguousBuilder(name, existing, member, charOffset,
+ isImport: isImport);
+ }
+ } else {
+ map[name] = member;
+ }
}
@override
@@ -209,4 +225,23 @@
assert(node == builder.target);
}
}
+
+ void addImportsToScope(Map<Uri, LibraryBuilder> libraries) {
+ List<Import> imports = <Import>[];
+ for (LibraryDependency dependency in library.dependencies) {
+ if (!dependency.isImport) continue;
+ LibraryBuilder imported = libraries[dependency.targetLibrary.importUri];
+ assert(imported != null);
+
+ List<Combinator> syntheticCombinators = <Combinator>[];
+ for (kernel.Combinator combinator in dependency.combinators) {
+ syntheticCombinators.add(new Combinator(combinator.isShow,
+ new Set<String>.from(combinator.names), -1, uri));
+ }
+
+ imports.add(new Import(this, imported, false, dependency.name,
+ syntheticCombinators, [], dependency.fileOffset, -1));
+ }
+ addSpecificImportsToScope(imports);
+ }
}
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
index d033d7d..ea49d48 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_loader.dart
@@ -8,6 +8,8 @@
import 'package:kernel/ast.dart' show Library, Component, Source;
+import 'package:kernel/core_types.dart' show CoreTypes;
+
import '../fasta_codes.dart'
show SummaryTemplate, Template, templateDillOutlineSummary;
@@ -28,6 +30,9 @@
/// Sources for all appended components.
final Map<Uri, Source> uriToSource = <Uri, Source>{};
+ /// Should be set if code will be compiled in the context of this library.
+ CoreTypes coreTypes;
+
DillLoader(TargetImplementation target) : super(target);
Template<SummaryTemplate> get outlineSummaryTemplate =>
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_typedef_builder.dart b/pkg/front_end/lib/src/fasta/dill/dill_typedef_builder.dart
index 7f9ba1b..e6eebed 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_typedef_builder.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_typedef_builder.dart
@@ -33,6 +33,9 @@
return unimplemented("metadata", -1, null);
}
+ @override
+ int get typeVariablesCount => target.typeParameters.length;
+
List<TypeBuilder> get calculatedBounds {
if (super.calculatedBounds != null) {
return super.calculatedBounds;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
index 6584f7c..59f4546 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
@@ -122,6 +122,9 @@
return arguments == null ? cls.rawType : new InterfaceType(cls, arguments);
}
+ @override
+ int get typeVariablesCount => typeVariables?.length ?? 0;
+
List<DartType> buildTypeArguments(
LibraryBuilder library, List<KernelTypeBuilder> arguments) {
List<DartType> typeArguments = <DartType>[];
@@ -304,17 +307,26 @@
List<LocatedMessage> context = null;
+ bool mustHaveImplementation(Member member) {
+ // Forwarding stub
+ if (member is Procedure && member.isSyntheticForwarder) return false;
+ // Public member
+ if (!member.name.isPrivate) return true;
+ // Private member in different library
+ if (member.enclosingLibrary != cls.enclosingLibrary) return false;
+ // Private member in patch
+ if (member.fileUri != member.enclosingClass.fileUri) return false;
+ // Private member in same library
+ return true;
+ }
+
void findMissingImplementations({bool setters}) {
List<Member> dispatchTargets =
hierarchy.getDispatchTargets(cls, setters: setters);
int targetIndex = 0;
for (Member interfaceMember
in hierarchy.getInterfaceMembers(cls, setters: setters)) {
- // Is this either a public member or a visible private member?
- if (!interfaceMember.name.isPrivate ||
- (interfaceMember.enclosingLibrary == cls.enclosingLibrary &&
- interfaceMember.fileUri ==
- interfaceMember.enclosingClass.fileUri)) {
+ if (mustHaveImplementation(interfaceMember)) {
while (targetIndex < dispatchTargets.length &&
ClassHierarchy.compareMembers(
dispatchTargets[targetIndex], interfaceMember) <
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
index 1830ea2..28105fd 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
@@ -12,9 +12,9 @@
import 'kernel_builder.dart'
show
FormalParameterBuilder,
- KernelLibraryBuilder,
KernelTypeBuilder,
- MetadataBuilder;
+ MetadataBuilder,
+ LibraryBuilder;
import 'package:front_end/src/fasta/source/source_library_builder.dart'
show SourceLibraryBuilder;
@@ -30,7 +30,7 @@
KernelTypeBuilder type,
String name,
bool hasThis,
- KernelLibraryBuilder compilationUnit,
+ LibraryBuilder compilationUnit,
this.charOffset)
: super(metadata, modifiers, type, name, hasThis, compilationUnit,
charOffset);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
index 6bf1aa2..d91de6e 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
@@ -98,6 +98,9 @@
}
@override
+ int get typeVariablesCount => typeVariables?.length ?? 0;
+
+ @override
DartType buildType(
LibraryBuilder library, List<KernelTypeBuilder> arguments) {
arguments ??= calculatedBounds;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
index 3428329..c70f250f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
@@ -6,6 +6,8 @@
import 'package:kernel/ast.dart' show DartType, Supertype;
+import '../fasta_codes.dart' show Message;
+
import '../messages.dart'
show noLength, templateSupertypeIsIllegal, templateSupertypeIsTypeVariable;
@@ -17,6 +19,7 @@
LibraryBuilder,
NamedTypeBuilder,
TypeBuilder,
+ TypeDeclarationBuilder,
TypeVariableBuilder;
class KernelNamedTypeBuilder
@@ -25,10 +28,11 @@
KernelNamedTypeBuilder(Object name, List<KernelTypeBuilder> arguments)
: super(name, arguments);
- KernelInvalidTypeBuilder buildInvalidType(int charOffset, Uri fileUri) {
+ KernelInvalidTypeBuilder buildInvalidType(int charOffset, Uri fileUri,
+ [Message message]) {
// TODO(ahe): Consider if it makes sense to pass a QualifiedName to
// KernelInvalidTypeBuilder?
- return new KernelInvalidTypeBuilder("$name", charOffset, fileUri);
+ return new KernelInvalidTypeBuilder("$name", charOffset, fileUri, message);
}
Supertype handleInvalidSupertype(
@@ -47,9 +51,16 @@
Supertype buildSupertype(
LibraryBuilder library, int charOffset, Uri fileUri) {
- if (builder is KernelClassBuilder) {
- KernelClassBuilder builder = this.builder;
- return builder.buildSupertype(library, arguments);
+ TypeDeclarationBuilder declaration = builder;
+ if (declaration is KernelClassBuilder) {
+ return declaration.buildSupertype(library, arguments);
+ } else if (declaration is KernelInvalidTypeBuilder) {
+ library.addCompileTimeError(
+ declaration.message.messageObject,
+ declaration.message.charOffset,
+ declaration.message.length,
+ declaration.message.uri);
+ return null;
} else {
return handleInvalidSupertype(library, charOffset, fileUri);
}
@@ -57,9 +68,16 @@
Supertype buildMixedInType(
LibraryBuilder library, int charOffset, Uri fileUri) {
- if (builder is KernelClassBuilder) {
- KernelClassBuilder builder = this.builder;
- return builder.buildMixedInType(library, arguments);
+ TypeDeclarationBuilder declaration = builder;
+ if (declaration is KernelClassBuilder) {
+ return declaration.buildMixedInType(library, arguments);
+ } else if (declaration is KernelInvalidTypeBuilder) {
+ library.addCompileTimeError(
+ declaration.message.messageObject,
+ declaration.message.charOffset,
+ declaration.message.length,
+ declaration.message.uri);
+ return null;
} else {
return handleInvalidSupertype(library, charOffset, fileUri);
}
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 4255dbc..d27cf0d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -106,9 +106,6 @@
/// Shared with [CompilerContext].
final Map<Uri, Source> uriToSource;
- /// The [MetadataCollector] to write metadata to.
- final MetadataCollector metadataCollector;
-
SourceLoader<Library> loader;
Component component;
@@ -133,8 +130,8 @@
{Map<Uri, Source> uriToSource, MetadataCollector metadataCollector})
: dillTarget = dillTarget,
uriToSource = uriToSource ?? CompilerContext.current.uriToSource,
- metadataCollector = metadataCollector,
- super(dillTarget.ticker, uriTranslator, dillTarget.backendTarget) {
+ super(dillTarget.ticker, uriTranslator, dillTarget.backendTarget,
+ metadataCollector) {
resetCrashReporting();
loader = createLoader();
}
diff --git a/pkg/front_end/lib/src/fasta/parser/identifier_context.dart b/pkg/front_end/lib/src/fasta/parser/identifier_context.dart
index 26dea92..0199b13 100644
--- a/pkg/front_end/lib/src/fasta/parser/identifier_context.dart
+++ b/pkg/front_end/lib/src/fasta/parser/identifier_context.dart
@@ -22,10 +22,7 @@
class IdentifierContext {
/// Identifier is being declared as the name of an import prefix (i.e. `Foo`
/// in `import "..." as Foo;`)
- static const importPrefixDeclaration = const IdentifierContext(
- 'importPrefixDeclaration',
- inDeclaration: true,
- isBuiltInIdentifierAllowed: false);
+ static const importPrefixDeclaration = const ImportPrefixIdentifierContext();
/// Identifier is the start of a dotted name in a conditional import or
/// export.
diff --git a/pkg/front_end/lib/src/fasta/parser/identifier_context_impl.dart b/pkg/front_end/lib/src/fasta/parser/identifier_context_impl.dart
index 97798fb..000b2f2 100644
--- a/pkg/front_end/lib/src/fasta/parser/identifier_context_impl.dart
+++ b/pkg/front_end/lib/src/fasta/parser/identifier_context_impl.dart
@@ -31,6 +31,7 @@
return identifier;
}
+ // Recovery
if (looksLikeStartOfNextTopLevelDeclaration(identifier) ||
isOneOfOrEof(
identifier, const ['<', '{', 'extends', 'with', 'implements'])) {
@@ -76,6 +77,7 @@
}
}
+ // Recovery
if (looksLikeStartOfNextTopLevelDeclaration(identifier) ||
isOneOfOrEof(identifier, followingValues)) {
identifier = parser.insertSyntheticIdentifier(token, this,
@@ -123,6 +125,8 @@
}
return identifier;
}
+
+ // Recovery
parser.reportRecoverableErrorWithToken(
identifier, fasta.templateExpectedIdentifier);
if (identifier.isKeywordOrIdentifier) {
@@ -152,6 +156,7 @@
if (identifier.isIdentifier) {
return identifier;
}
+
// Recovery
if (isOneOfOrEof(identifier, const [';', '=', ',', '}']) ||
looksLikeStartOfNextClassMember(identifier)) {
@@ -183,6 +188,8 @@
if (identifier.isIdentifier) {
return identifier;
}
+
+ // Recovery
parser.reportRecoverableErrorWithToken(
identifier, fasta.templateExpectedIdentifier);
// Insert a synthetic identifier to satisfy listeners.
@@ -190,6 +197,43 @@
}
}
+/// See [IdentifierContext].importPrefixDeclaration
+class ImportPrefixIdentifierContext extends IdentifierContext {
+ const ImportPrefixIdentifierContext()
+ : super('importPrefixDeclaration',
+ inDeclaration: true, isBuiltInIdentifierAllowed: false);
+
+ @override
+ Token ensureIdentifier(Token token, Parser parser) {
+ Token identifier = token.next;
+ assert(identifier.kind != IDENTIFIER_TOKEN);
+ if (identifier.type.isPseudo) {
+ return identifier;
+ }
+
+ // Recovery
+ const followingValues = const [';', 'if', 'show', 'hide', 'deferred', 'as'];
+ if (identifier.type.isBuiltIn &&
+ isOneOfOrEof(identifier.next, followingValues)) {
+ parser.reportRecoverableErrorWithToken(
+ identifier, fasta.templateBuiltInIdentifierInDeclaration);
+ } else if (looksLikeStartOfNextTopLevelDeclaration(identifier) ||
+ isOneOfOrEof(identifier, followingValues)) {
+ identifier = parser.insertSyntheticIdentifier(token, this,
+ message: fasta.templateExpectedIdentifier.withArguments(identifier));
+ } else {
+ parser.reportRecoverableErrorWithToken(
+ identifier, fasta.templateExpectedIdentifier);
+ if (!identifier.isKeywordOrIdentifier) {
+ // When in doubt, consume the token to ensure we make progress
+ // but insert a synthetic identifier to satisfy listeners.
+ identifier = insertSyntheticIdentifierAfter(identifier, parser);
+ }
+ }
+ return identifier;
+ }
+}
+
/// See [IdentifierContext].libraryName
class LibraryIdentifierContext extends IdentifierContext {
const LibraryIdentifierContext()
@@ -213,6 +257,8 @@
// is invalid and this looks like the start of the next declaration.
// In this situation, fall through to insert a synthetic library name.
}
+
+ // Recovery
if (isOneOfOrEof(identifier, const ['.', ';']) ||
looksLikeStartOfNextTopLevelDeclaration(identifier)) {
identifier = parser.insertSyntheticIdentifier(token, this,
@@ -243,6 +289,8 @@
checkAsyncAwaitYieldAsIdentifier(identifier, parser);
return identifier;
}
+
+ // Recovery
if (isOneOfOrEof(identifier, const [';', '=', ',', '{', '}']) ||
looksLikeStartOfNextStatement(identifier)) {
identifier = parser.insertSyntheticIdentifier(token, this,
@@ -275,6 +323,7 @@
if (identifier.isIdentifier) {
return identifier;
}
+
// Recovery
if (identifier.isUserDefinableOperator && !isContinuation) {
return parser.insertSyntheticIdentifier(identifier, this,
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index e66820c..d58fa45 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -2005,8 +2005,6 @@
followingValues = [',', '}'];
} else if (context == IdentifierContext.formalParameterDeclaration) {
followingValues = [':', '=', ',', '(', ')', '[', ']', '{', '}'];
- } else if (context == IdentifierContext.importPrefixDeclaration) {
- followingValues = [';', 'hide', 'show', 'deferred', 'as'];
} else if (context == IdentifierContext.labelDeclaration) {
followingValues = [':'];
} else if (context == IdentifierContext.literalSymbol ||
@@ -2084,8 +2082,6 @@
..addAll(classMemberKeywords())
..addAll(statementKeywords())
..add('covariant');
- } else if (context == IdentifierContext.importPrefixDeclaration) {
- initialKeywords = topLevelKeywords();
} else if (context == IdentifierContext.labelDeclaration) {
initialKeywords = statementKeywords();
} else if (context == IdentifierContext.localAccessorDeclaration) {
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 149991e..6def2ba 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -652,18 +652,7 @@
}
void addImportsToScope() {
- bool explicitCoreImport = this == loader.coreLibrary;
- for (Import import in imports) {
- if (import.imported == loader.coreLibrary) {
- explicitCoreImport = true;
- }
- import.finalizeImports(this);
- }
- if (!explicitCoreImport) {
- loader.coreLibrary.exportScope.forEach((String name, Builder member) {
- addToScope(name, member, -1, true);
- });
- }
+ super.addSpecificImportsToScope(imports);
}
@override
@@ -687,6 +676,9 @@
int typeCount = types.length;
for (UnresolvedType<T> t in types) {
t.resolveIn(scope);
+ if (loader.target.strongMode) {
+ t.checkType();
+ }
}
types.clear();
return typeCount;
diff --git a/pkg/front_end/lib/src/fasta/target_implementation.dart b/pkg/front_end/lib/src/fasta/target_implementation.dart
index 5abbd00..2c21ecf 100644
--- a/pkg/front_end/lib/src/fasta/target_implementation.dart
+++ b/pkg/front_end/lib/src/fasta/target_implementation.dart
@@ -18,6 +18,8 @@
import 'uri_translator.dart' show UriTranslator;
+import 'kernel/metadata_collector.dart' show MetadataCollector;
+
/// Provides the implementation details used by a loader for a target.
abstract class TargetImplementation extends Target {
final UriTranslator uriTranslator;
@@ -33,7 +35,13 @@
Builder cachedNativeAnnotation;
Builder cachedNativeExtensionAnnotation;
- TargetImplementation(Ticker ticker, this.uriTranslator, this.backendTarget)
+ /// The [MetadataCollector] to write metadata to.
+ ///
+ /// Maybe be [null] for targets where metadata cannot be written.
+ final MetadataCollector metadataCollector;
+
+ TargetImplementation(Ticker ticker, this.uriTranslator, this.backendTarget,
+ [this.metadataCollector = null])
: super(ticker);
/// Creates a [LibraryBuilder] corresponding to [uri], if one doesn't exist
diff --git a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
index 6fbd643..d041aac 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
@@ -230,15 +230,6 @@
bool needsCheck(DartType type) => needsCheckVisitor == null
? false
: substitution.substituteType(type).accept(needsCheckVisitor);
- needsCheckVisitor?.inCovariantContext = false;
- var isGenericContravariant = needsCheck(interfaceFunction.returnType);
- needsCheckVisitor?.inCovariantContext = true;
- if (isGenericContravariant != interfaceMember.isGenericContravariant) {
- fixes.add((FunctionNode function) {
- Procedure procedure = function.parent;
- procedure.isGenericContravariant = isGenericContravariant;
- });
- }
for (int i = 0; i < interfacePositionalParameters.length; i++) {
var parameter = interfacePositionalParameters[i];
var isGenericCovariantInterface = needsCheck(parameter.type);
@@ -491,8 +482,7 @@
fileUri: enclosingClass.fileUri,
forwardingStubInterfaceTarget: finalTarget)
..fileOffset = enclosingClass.fileOffset
- ..parent = enclosingClass
- ..isGenericContravariant = target.isGenericContravariant;
+ ..parent = enclosingClass;
}
/// Creates a forwarding stub for this node if necessary, and propagates
@@ -1103,13 +1093,6 @@
}
}
- void recordContravariance(int fileOffset, bool isGenericContravariant) {
- if (isGenericContravariant) {
- _instrumentation.record(uri, fileOffset, 'genericContravariant',
- new InstrumentationValueLiteral('true'));
- }
- }
-
for (var procedure in class_.procedures) {
if (procedure.isStatic) continue;
// Forwarding stubs are annotated separately
@@ -1132,14 +1115,11 @@
procedure.function.positionalParameters.forEach(recordFormalAnnotations);
procedure.function.namedParameters.forEach(recordFormalAnnotations);
procedure.function.typeParameters.forEach(recordTypeParameterAnnotations);
- recordContravariance(
- procedure.fileOffset, procedure.isGenericContravariant);
}
for (var field in class_.fields) {
if (field.isStatic) continue;
recordCovariance(field.fileOffset, field.isCovariant,
field.isGenericCovariantInterface, field.isGenericCovariantImpl);
- recordContravariance(field.fileOffset, field.isGenericContravariant);
}
}
@@ -1250,16 +1230,6 @@
@override
DartType get getterType => _field.type;
- @override
- bool get isGenericContravariant =>
- kind == ProcedureKind.Getter && _field.isGenericContravariant;
-
- @override
- void set isGenericContravariant(bool value) {
- assert(kind == ProcedureKind.Getter);
- _field.isGenericContravariant = value;
- }
-
static getField(SyntheticAccessor accessor) => accessor._field;
}
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 23a9329..4971952 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
@@ -89,7 +89,8 @@
import 'type_constraint_gatherer.dart' show TypeConstraintGatherer;
-import 'type_inference_engine.dart' show TypeInferenceEngineImpl;
+import 'type_inference_engine.dart'
+ show IncludesTypeParametersCovariantly, TypeInferenceEngineImpl;
import 'type_promotion.dart' show TypePromoter, TypePromoterDisabled;
@@ -867,9 +868,12 @@
interfaceMember != null &&
receiver is! ThisExpression) {
if (interfaceMember is Procedure) {
- checkReturn = interfaceMember.isGenericContravariant;
+ checkReturn = typeParametersOccurNegatively(
+ interfaceMember.enclosingClass,
+ interfaceMember.function.returnType);
} else if (interfaceMember is Field) {
- checkReturn = interfaceMember.isGenericContravariant;
+ checkReturn = typeParametersOccurNegatively(
+ interfaceMember.enclosingClass, interfaceMember.type);
}
}
var replacedExpression = desugaredGet ?? expression;
@@ -1397,6 +1401,19 @@
return tearoffType;
}
+ /// True if [type] has negative occurrences of any of [class_]'s type
+ /// parameters.
+ ///
+ /// A negative occurrence of a type parameter is one that is to the left of
+ /// an odd number of arrows. For example, T occurs negatively in T -> T0,
+ /// T0 -> (T -> T1), (T0 -> T) -> T1 but not in (T -> T0) -> T1.
+ static bool typeParametersOccurNegatively(Class class_, DartType type) {
+ if (class_.typeParameters.isEmpty) return false;
+ var checker = new IncludesTypeParametersCovariantly(class_.typeParameters)
+ ..inCovariantContext = false;
+ return type.accept(checker);
+ }
+
/// Determines the dispatch category of a [MethodInvocation] and returns a
/// boolean indicating whether an "as" check will need to be added due to
/// contravariance.
@@ -1416,16 +1433,19 @@
}
if (receiver != null && receiver is! ThisExpression) {
if ((interfaceMember is Field &&
- interfaceMember.isGenericContravariant) ||
+ typeParametersOccurNegatively(
+ interfaceMember.enclosingClass, interfaceMember.type)) ||
(interfaceMember is Procedure &&
- interfaceMember.isGenericContravariant)) {
+ typeParametersOccurNegatively(interfaceMember.enclosingClass,
+ interfaceMember.function.returnType))) {
return MethodContravarianceCheckKind.checkGetterReturn;
}
}
} else if (receiver != null &&
receiver is! ThisExpression &&
interfaceMember is Procedure &&
- interfaceMember.isGenericContravariant) {
+ typeParametersOccurNegatively(interfaceMember.enclosingClass,
+ interfaceMember.function.returnType)) {
return MethodContravarianceCheckKind.checkMethodReturn;
}
return MethodContravarianceCheckKind.none;
diff --git a/pkg/front_end/pubspec.yaml b/pkg/front_end/pubspec.yaml
index e4a0be5..1f9aa73 100644
--- a/pkg/front_end/pubspec.yaml
+++ b/pkg/front_end/pubspec.yaml
@@ -1,5 +1,5 @@
name: front_end
-version: 0.1.0-alpha.11
+version: 0.1.0-alpha.12
author: Dart Team <misc@dartlang.org>
description: Front end for compilation of Dart code.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/front_end
@@ -9,7 +9,7 @@
charcode: '^1.1.1'
convert: '^2.0.1'
crypto: '^2.0.2'
- kernel: 0.3.0-alpha.11
+ kernel: 0.3.0-alpha.12
meta: '^1.1.1'
package_config: '^1.0.1'
path: '^1.3.9'
diff --git a/pkg/front_end/test/fasta/expression_test.dart b/pkg/front_end/test/fasta/expression_test.dart
new file mode 100644
index 0000000..c0611b0
--- /dev/null
+++ b/pkg/front_end/test/fasta/expression_test.dart
@@ -0,0 +1,380 @@
+// 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.md file.
+
+library fasta.test.incremental_test;
+
+import "dart:async" show Future;
+
+import "dart:convert" show JsonEncoder;
+
+import "dart:io" show File, IOSink;
+
+import "package:kernel/ast.dart"
+ show
+ Procedure,
+ Component,
+ CanonicalName,
+ DynamicType,
+ DartType,
+ TypeParameter;
+
+import "package:testing/testing.dart"
+ show Chain, ChainContext, Result, Step, TestDescription, runMe;
+
+import "package:yaml/yaml.dart" show YamlMap, YamlList, loadYamlNode;
+
+import "package:front_end/src/api_prototype/front_end.dart"
+ show CompilationMessage, CompilerOptions;
+
+import "package:front_end/src/api_prototype/memory_file_system.dart"
+ show MemoryFileSystem;
+
+import 'package:front_end/src/compute_platform_binaries_location.dart'
+ show computePlatformBinariesLocation;
+
+import 'package:front_end/src/external_state_snapshot.dart'
+ show ExternalStateSnapshot;
+
+import 'package:front_end/src/base/processed_options.dart'
+ show ProcessedOptions;
+
+import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
+
+import 'package:front_end/src/fasta/incremental_compiler.dart'
+ show IncrementalCompiler;
+
+import 'package:kernel/text/ast_to_text.dart' show Printer;
+
+import '../../lib/src/fasta/testing/kernel_chain.dart' show runDiff, openWrite;
+
+import '../../lib/src/fasta/kernel/utils.dart' show writeComponentToFile;
+
+const JsonEncoder json = const JsonEncoder.withIndent(" ");
+
+class Context extends ChainContext {
+ final CompilerContext compilerContext;
+ final ExternalStateSnapshot snapshot;
+ final List<CompilationMessage> errors;
+
+ final List<Step> steps;
+
+ Context(
+ this.compilerContext, this.snapshot, this.errors, bool updateExpectations)
+ : steps = <Step>[
+ const ReadTest(),
+ const CompileExpression(),
+ new MatchProcedureExpectations(".expect",
+ updateExpectations: updateExpectations)
+ ];
+
+ ProcessedOptions get options => compilerContext.options;
+
+ MemoryFileSystem get fileSystem => options.fileSystem;
+
+ T runInContext<T>(T action(CompilerContext c)) {
+ return compilerContext.runInContext<T>(action);
+ }
+
+ void reset() {
+ errors.clear();
+ snapshot.restore();
+ }
+
+ List<CompilationMessage> takeErrors() {
+ List<CompilationMessage> result = new List<CompilationMessage>.from(errors);
+ errors.clear();
+ return result;
+ }
+}
+
+class CompilationResult {
+ Procedure compiledProcedure;
+ List<CompilationMessage> errors;
+ CompilationResult(this.compiledProcedure, this.errors);
+
+ String printResult(Uri entryPoint, Context context) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.write("Errors: {\n");
+ for (var error in errors) {
+ buffer.write(" ");
+ buffer.write("${error.message} (@${error.span.start.offset})");
+ buffer.write("\n");
+ }
+ buffer.write("}\n");
+ if (compiledProcedure == null) {
+ buffer.write("<no procedure>");
+ } else {
+ new Printer(buffer).visitProcedure(compiledProcedure);
+ }
+ Uri base = entryPoint.resolve(".");
+ return "$buffer".replaceAll("$base", "org-dartlang-testcase:///");
+ }
+}
+
+class TestCase {
+ final TestDescription description;
+
+ final Uri entryPoint;
+
+ final List<String> definitions;
+
+ final List<String> typeDefinitions;
+
+ final bool isStaticMethod;
+
+ final CanonicalName enclosingNode;
+
+ String expression;
+
+ List<CompilationResult> results = [];
+
+ TestCase(
+ this.description,
+ this.entryPoint,
+ this.definitions,
+ this.typeDefinitions,
+ this.isStaticMethod,
+ this.enclosingNode,
+ this.expression);
+
+ String toString() {
+ return "TestCase("
+ "$entryPoint, "
+ "$definitions, "
+ "$typeDefinitions,"
+ "$enclosingNode, "
+ "static = $isStaticMethod)";
+ }
+
+ String validate() {
+ print(this);
+ if (entryPoint == null) {
+ return "No entryPoint.";
+ }
+ if (!(new File.fromUri(entryPoint)).existsSync()) {
+ return "Entry point $entryPoint doesn't exist.";
+ }
+ if (enclosingNode == null || enclosingNode == "") {
+ return "No enclosing node.";
+ }
+ if (expression == null) {
+ return "No expression to compile.";
+ }
+ return null;
+ }
+}
+
+class MatchProcedureExpectations extends Step<List<TestCase>, Null, Context> {
+ final String suffix;
+ final bool updateExpectations;
+
+ const MatchProcedureExpectations(this.suffix,
+ {this.updateExpectations: false});
+
+ String get name => "match expectations";
+
+ Future<Result<Null>> run(List<TestCase> tests, Context context) async {
+ String actual = "";
+ for (var test in tests) {
+ var primary = test.results.first.printResult(test.entryPoint, context);
+ actual += primary;
+ for (int i = 1; i < test.results.length; ++i) {
+ var secondary = test.results[i].printResult(test.entryPoint, context);
+ if (primary != secondary) {
+ return fail(
+ null,
+ "Multiple expectations don't match on $test:" +
+ "\nFirst expectation:\n$actual\n" +
+ "\nSecond expectation:\n$secondary\n");
+ }
+ }
+ }
+ var test = tests.first;
+ Uri testUri = test.description.uri;
+ File expectedFile = new File("${testUri.toFilePath()}$suffix");
+ if (await expectedFile.exists()) {
+ String expected = await expectedFile.readAsString();
+ if (expected.trim() != actual.trim()) {
+ if (!updateExpectations) {
+ String diff = await runDiff(expectedFile.uri, actual);
+ return fail(
+ null, "$testUri doesn't match ${expectedFile.uri}\n$diff");
+ }
+ } else {
+ return pass(null);
+ }
+ }
+ if (updateExpectations) {
+ await openWrite(expectedFile.uri, (IOSink sink) {
+ sink.writeln(actual.trim());
+ });
+ return pass(null);
+ } else {
+ return fail(null, """
+Please create file ${expectedFile.path} with this content:
+$actual""");
+ }
+ }
+}
+
+class ReadTest extends Step<TestDescription, List<TestCase>, Context> {
+ const ReadTest();
+
+ String get name => "read test";
+
+ Future<Result<List<TestCase>>> run(
+ TestDescription description, Context context) async {
+ context.reset();
+ Uri uri = description.uri;
+ String contents = await new File.fromUri(uri).readAsString();
+
+ Uri entryPoint;
+ List<String> definitions = <String>[];
+ List<String> typeDefinitions = <String>[];
+ bool isStaticMethod = false;
+ CanonicalName enclosingNode;
+ String expression;
+
+ dynamic maps = loadYamlNode(contents, sourceUrl: uri);
+ if (maps is YamlMap) maps = [maps];
+
+ final List<TestCase> tests = [];
+ for (YamlMap map in maps) {
+ for (var _key in map.keys) {
+ String key = _key;
+ var value = map[key];
+
+ if (key == "entry_point") {
+ entryPoint = description.uri.resolveUri(Uri.parse(value as String));
+ } else if (key == "position") {
+ Uri positionUri =
+ description.uri.resolveUri(Uri.parse(value as String));
+ enclosingNode = new CanonicalName.root();
+ enclosingNode =
+ enclosingNode.getChild("${positionUri.removeFragment()}");
+ if (positionUri.fragment != null && positionUri.fragment != '') {
+ enclosingNode = enclosingNode.getChild(positionUri.fragment);
+ }
+ } else if (key == "definitions") {
+ definitions = (value as YamlList).map((x) => x as String).toList();
+ } else if (key == "type_definitions") {
+ typeDefinitions =
+ (value as YamlList).map((x) => x as String).toList();
+ } else if (key == "static") {
+ isStaticMethod = value;
+ } else if (key == "expression") {
+ expression = value;
+ }
+ }
+ var test = new TestCase(description, entryPoint, definitions,
+ typeDefinitions, isStaticMethod, enclosingNode, expression);
+ var result = test.validate();
+ if (result != null) {
+ return new Result.fail(tests, result);
+ }
+ tests.add(test);
+ }
+ return new Result.pass(tests);
+ }
+}
+
+class CompileExpression extends Step<List<TestCase>, List<TestCase>, Context> {
+ const CompileExpression();
+
+ String get name => "compile expression";
+
+ Future<Result<List<TestCase>>> run(
+ List<TestCase> tests, Context context) async {
+ for (var test in tests) {
+ context.fileSystem.entityForUri(test.entryPoint).writeAsBytesSync(
+ await new File.fromUri(test.entryPoint).readAsBytes());
+
+ var sourceCompiler = new IncrementalCompiler(context.compilerContext);
+ Component component =
+ await sourceCompiler.computeDelta(entryPoint: test.entryPoint);
+ var errors = context.takeErrors();
+ if (!errors.isEmpty) {
+ return fail(tests, "Couldn't compile entry-point: $errors");
+ }
+ Uri dillFileUri = new Uri(
+ scheme: test.entryPoint.scheme, path: test.entryPoint.path + ".dill");
+ File dillFile = new File.fromUri(dillFileUri);
+ if (!await dillFile.exists()) {
+ await writeComponentToFile(component, dillFileUri);
+ }
+
+ var dillCompiler =
+ new IncrementalCompiler(context.compilerContext, dillFileUri);
+ await dillCompiler.computeDelta(entryPoint: test.entryPoint);
+ await dillFile.delete();
+
+ errors = context.takeErrors();
+
+ // Since it compiled successfully from source, the bootstrap-from-Dill
+ // should also succeed without errors.
+ assert(errors.isEmpty);
+
+ Map<String, DartType> definitions = {};
+ for (String name in test.definitions) {
+ definitions[name] = new DynamicType();
+ }
+ List<TypeParameter> typeParams = [];
+ for (String name in test.typeDefinitions) {
+ typeParams.add(new TypeParameter(name, new DynamicType()));
+ }
+
+ for (var compiler in [sourceCompiler, dillCompiler]) {
+ // TODO: actually run the compiler
+ test.results
+ .add(new CompilationResult(compiler == null ? null : null, []));
+ }
+ }
+ return new Result.pass(tests);
+ }
+}
+
+Future<Context> createContext(
+ Chain suite, Map<String, String> environment) async {
+ final Uri base = Uri.parse("org-dartlang-test:///");
+
+ /// Unused because we supply entry points to [computeDelta] directly above.
+ final Uri entryPoint = base.resolve("nothing.dart");
+
+ /// The custom URI used to locate the dill file in the MemoryFileSystem.
+ final Uri sdkSummary = base.resolve("vm_platform.dill");
+
+ /// The actual location of the dill file.
+ final Uri sdkSummaryFile =
+ computePlatformBinariesLocation().resolve("vm_platform.dill");
+
+ final MemoryFileSystem fs = new MemoryFileSystem(base);
+
+ fs
+ .entityForUri(sdkSummary)
+ .writeAsBytesSync(await new File.fromUri(sdkSummaryFile).readAsBytes());
+
+ final List<CompilationMessage> errors = <CompilationMessage>[];
+
+ final CompilerOptions optionBuilder = new CompilerOptions()
+ ..strongMode = false
+ ..reportMessages = true
+ ..verbose = true
+ ..fileSystem = fs
+ ..sdkSummary = sdkSummary
+ ..onError = (CompilationMessage message) {
+ errors.add(message);
+ };
+
+ final ProcessedOptions options =
+ new ProcessedOptions(optionBuilder, false, [entryPoint]);
+
+ final ExternalStateSnapshot snapshot =
+ new ExternalStateSnapshot(await options.loadSdkSummary(null));
+
+ return new Context(new CompilerContext(options), snapshot, errors,
+ new String.fromEnvironment("updateExpectations") == "true");
+}
+
+main([List<String> arguments = const []]) =>
+ runMe(arguments, createContext, "../../testing.json");
diff --git a/pkg/front_end/testcases/expression.status b/pkg/front_end/testcases/expression.status
index de541b8..87a97a3 100644
--- a/pkg/front_end/testcases/expression.status
+++ b/pkg/front_end/testcases/expression.status
@@ -2,51 +2,46 @@
// 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_capture.expression: Crash
-class_getter.expression: Crash
-class_invalid_static.expression: Crash
-class_invalid_static_capture.expression: Crash
-class_invalid_static_getter.expression: Crash
-class_invalid_static_setter.expression: Crash
-class_method.expression: Crash
-class_setter.expression: Crash
-class_static.expression: Crash
-class_static2.expression: Crash
-class_static3.expression: Crash
-class_type_param_bound.expression: Crash
-class_type_param_bound_illegal.expression: Crash
-class_type_param_reference.expression: Crash
-class_type_param_reference_arg.expression: Crash
-class_type_param_reference_arg_inferred.expression: Crash
-class_type_param_reference_ctor.expression: Crash
-class_type_param_reference_ctor_inferred.expression: Crash
-class_type_param_reference_var.expression: Crash
-core_lib_imported.expression: Crash
-core_lib_internal.expression: Crash
-eval.dart: Crash
-invalid.expression: Crash
-invalid_type_variable.expression: Crash
-invalid_variable.expression: Crash
-lib_ctor.expression: Crash
-lib_external_ctor.expression: Crash
-lib_nonctor.expression: Crash
-lib_nonreference.expression: Crash
-lib_nonshown_ctor.expression: Crash
-lib_reference.expression: Crash
-lib_simple.expression: Crash
-missing_variable_types.expression: Crash
-noclass.expression: Crash
-nolib.expression: Crash
-param_assign.expression: Crash
-param_capture.expression: Crash
-param_conflict.expression: Crash
-param_conflict_class.expression: Crash
-param_method.expression: Crash
-type_param_bound.expression: Crash
-type_param_shadow.expression: Crash
-type_param_shadow_arg.expression: Crash
-type_param_shadow_arg_ctor_inferred.expression: Crash
-type_param_shadow_arg_inferred.expression: Crash
-type_param_shadow_ctor.expression: Crash
-type_param_shadow_var.expression: Crash
-
+class_capture.expression: Fail
+class_getter.expression: Fail
+class_invalid_static.expression: Fail
+class_invalid_static_capture.expression: Fail
+class_invalid_static_getter.expression: Fail
+class_invalid_static_setter.expression: Fail
+class_method.expression: Fail
+class_setter.expression: Fail
+class_static.expression: Fail
+class_static2.expression: Fail
+class_static3.expression: Fail
+class_type_param_bound.expression: Fail
+class_type_param_bound_illegal.expression: Fail
+class_type_param_reference.expression: Fail
+class_type_param_reference_arg.expression: Fail
+class_type_param_reference_arg_inferred.expression: Fail
+class_type_param_reference_ctor.expression: Fail
+class_type_param_reference_ctor_inferred.expression: Fail
+class_type_param_reference_var.expression: Fail
+core_lib_imported.expression: Fail
+core_lib_internal.expression: Fail
+eval.dart: Fail
+invalid.expression: Fail
+lib_ctor.expression: Fail
+lib_external_ctor.expression: Fail
+lib_nonctor.expression: Fail
+lib_nonreference.expression: Fail
+lib_nonshown_ctor.expression: Fail
+lib_reference.expression: Fail
+lib_simple.expression: Fail
+missing_variable_types.expression: Fail
+param_assign.expression: Fail
+param_capture.expression: Fail
+param_conflict.expression: Fail
+param_conflict_class.expression: Fail
+param_method.expression: Fail
+type_param_bound.expression: Fail
+type_param_shadow.expression: Fail
+type_param_shadow_arg.expression: Fail
+type_param_shadow_arg_ctor_inferred.expression: Fail
+type_param_shadow_arg_inferred.expression: Fail
+type_param_shadow_ctor.expression: Fail
+type_param_shadow_var.expression: Fail
diff --git a/pkg/front_end/testcases/expression/class_capture.expression.yaml b/pkg/front_end/testcases/expression/class_capture.expression.yaml
index 8d7121f..fdce2d6 100644
--- a/pkg/front_end/testcases/expression/class_capture.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_capture.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_getter.expression.yaml b/pkg/front_end/testcases/expression/class_getter.expression.yaml
index b633a11..f6e64e6 100644
--- a/pkg/front_end/testcases/expression/class_getter.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_getter.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_invalid_static.expression.yaml b/pkg/front_end/testcases/expression/class_invalid_static.expression.yaml
index d607088..59c21b9 100644
--- a/pkg/front_end/testcases/expression/class_invalid_static.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_invalid_static.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_invalid_static_capture.expression.yaml b/pkg/front_end/testcases/expression/class_invalid_static_capture.expression.yaml
index 9e410c8..0c6f18a 100644
--- a/pkg/front_end/testcases/expression/class_invalid_static_capture.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_invalid_static_capture.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_invalid_static_getter.expression.yaml b/pkg/front_end/testcases/expression/class_invalid_static_getter.expression.yaml
index e9fa6d2..2fd524f 100644
--- a/pkg/front_end/testcases/expression/class_invalid_static_getter.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_invalid_static_getter.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_invalid_static_setter.expression.yaml b/pkg/front_end/testcases/expression/class_invalid_static_setter.expression.yaml
index 17539fb..289cf59 100644
--- a/pkg/front_end/testcases/expression/class_invalid_static_setter.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_invalid_static_setter.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_method.expression.yaml b/pkg/front_end/testcases/expression/class_method.expression.yaml
index 5a08e80..13b9772 100644
--- a/pkg/front_end/testcases/expression/class_method.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_method.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_setter.expression.yaml b/pkg/front_end/testcases/expression/class_setter.expression.yaml
index 44d76b6..f559566 100644
--- a/pkg/front_end/testcases/expression/class_setter.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_setter.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_static.expression.yaml b/pkg/front_end/testcases/expression/class_static.expression.yaml
index 51be2c2..309ff3f 100644
--- a/pkg/front_end/testcases/expression/class_static.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_static.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_static2.expression.yaml b/pkg/front_end/testcases/expression/class_static2.expression.yaml
index 2c8e2b0..69e19b9 100644
--- a/pkg/front_end/testcases/expression/class_static2.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_static2.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_static3.expression.yaml b/pkg/front_end/testcases/expression/class_static3.expression.yaml
index 935b013..e1e7796 100644
--- a/pkg/front_end/testcases/expression/class_static3.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_static3.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
- entry_point: "eval.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/class_type_param_bound.expression.yaml b/pkg/front_end/testcases/expression/class_type_param_bound.expression.yaml
index be7df51..b415f4a 100644
--- a/pkg/front_end/testcases/expression/class_type_param_bound.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_type_param_bound.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/expression/class_type_param_bound_illegal.expression.yaml b/pkg/front_end/testcases/expression/class_type_param_bound_illegal.expression.yaml
index d2b970d..2ff676d 100644
--- a/pkg/front_end/testcases/expression/class_type_param_bound_illegal.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_type_param_bound_illegal.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/expression/class_type_param_reference.expression.yaml b/pkg/front_end/testcases/expression/class_type_param_reference.expression.yaml
index d5afdd7..18371de 100644
--- a/pkg/front_end/testcases/expression/class_type_param_reference.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_type_param_reference.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/expression/class_type_param_reference_arg.expression.yaml b/pkg/front_end/testcases/expression/class_type_param_reference_arg.expression.yaml
index fa1365b..13ab5ef 100644
--- a/pkg/front_end/testcases/expression/class_type_param_reference_arg.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_type_param_reference_arg.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/expression/class_type_param_reference_arg_inferred.expression.yaml b/pkg/front_end/testcases/expression/class_type_param_reference_arg_inferred.expression.yaml
index 900cff7..d42666f 100644
--- a/pkg/front_end/testcases/expression/class_type_param_reference_arg_inferred.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_type_param_reference_arg_inferred.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/expression/class_type_param_reference_ctor.expression.yaml b/pkg/front_end/testcases/expression/class_type_param_reference_ctor.expression.yaml
index 7312962..a1526e4 100644
--- a/pkg/front_end/testcases/expression/class_type_param_reference_ctor.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_type_param_reference_ctor.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/expression/class_type_param_reference_ctor_inferred.expression.yaml b/pkg/front_end/testcases/expression/class_type_param_reference_ctor_inferred.expression.yaml
index 5ae73cf..39ff366 100644
--- a/pkg/front_end/testcases/expression/class_type_param_reference_ctor_inferred.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_type_param_reference_ctor_inferred.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/expression/class_type_param_reference_var.expression.yaml b/pkg/front_end/testcases/expression/class_type_param_reference_var.expression.yaml
index 1426f35..642f7ef 100644
--- a/pkg/front_end/testcases/expression/class_type_param_reference_var.expression.yaml
+++ b/pkg/front_end/testcases/expression/class_type_param_reference_var.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/core_lib_imported.expression.yaml b/pkg/front_end/testcases/expression/core_lib_imported.expression.yaml
index 328df34..61f679b 100644
--- a/pkg/front_end/testcases/expression/core_lib_imported.expression.yaml
+++ b/pkg/front_end/testcases/expression/core_lib_imported.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
- entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/core_lib_internal.expression.yaml b/pkg/front_end/testcases/expression/core_lib_internal.expression.yaml
index f3a1533..6a2652b 100644
--- a/pkg/front_end/testcases/expression/core_lib_internal.expression.yaml
+++ b/pkg/front_end/testcases/expression/core_lib_internal.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
- entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/invalid.expression.yaml b/pkg/front_end/testcases/expression/invalid.expression.yaml
index 410e7a9..374eda8 100644
--- a/pkg/front_end/testcases/expression/invalid.expression.yaml
+++ b/pkg/front_end/testcases/expression/invalid.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/invalid_type_variable.expression.yaml b/pkg/front_end/testcases/expression/invalid_type_variable.expression.yaml
index 79ff7ae..70beb29 100644
--- a/pkg/front_end/testcases/expression/invalid_type_variable.expression.yaml
+++ b/pkg/front_end/testcases/expression/invalid_type_variable.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
type_definitions: ["a#b"]
diff --git a/pkg/front_end/testcases/expression/invalid_variable.expression.yaml b/pkg/front_end/testcases/expression/invalid_variable.expression.yaml
index 3409817..6d44881 100644
--- a/pkg/front_end/testcases/expression/invalid_variable.expression.yaml
+++ b/pkg/front_end/testcases/expression/invalid_variable.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["a#b"]
diff --git a/pkg/front_end/testcases/expression/lib_ctor.expression.yaml b/pkg/front_end/testcases/expression/lib_ctor.expression.yaml
index 9bfc310..c1d5cee 100644
--- a/pkg/front_end/testcases/expression/lib_ctor.expression.yaml
+++ b/pkg/front_end/testcases/expression/lib_ctor.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/lib_external_ctor.expression.yaml b/pkg/front_end/testcases/expression/lib_external_ctor.expression.yaml
index aac6c87..51e04a2 100644
--- a/pkg/front_end/testcases/expression/lib_external_ctor.expression.yaml
+++ b/pkg/front_end/testcases/expression/lib_external_ctor.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/lib_nonctor.expression.yaml b/pkg/front_end/testcases/expression/lib_nonctor.expression.yaml
index 4cf924a..bae7baa 100644
--- a/pkg/front_end/testcases/expression/lib_nonctor.expression.yaml
+++ b/pkg/front_end/testcases/expression/lib_nonctor.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/lib_nonreference.expression.yaml b/pkg/front_end/testcases/expression/lib_nonreference.expression.yaml
index 67849fd..a50ac5c 100644
--- a/pkg/front_end/testcases/expression/lib_nonreference.expression.yaml
+++ b/pkg/front_end/testcases/expression/lib_nonreference.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/lib_nonshown_ctor.expression.yaml b/pkg/front_end/testcases/expression/lib_nonshown_ctor.expression.yaml
index dbc9544..db9b51c 100644
--- a/pkg/front_end/testcases/expression/lib_nonshown_ctor.expression.yaml
+++ b/pkg/front_end/testcases/expression/lib_nonshown_ctor.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/lib_reference.expression.yaml b/pkg/front_end/testcases/expression/lib_reference.expression.yaml
index e4f0254..59999cc 100644
--- a/pkg/front_end/testcases/expression/lib_reference.expression.yaml
+++ b/pkg/front_end/testcases/expression/lib_reference.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/lib_simple.expression.yaml b/pkg/front_end/testcases/expression/lib_simple.expression.yaml
index 0e7ca4c..052b9b4 100644
--- a/pkg/front_end/testcases/expression/lib_simple.expression.yaml
+++ b/pkg/front_end/testcases/expression/lib_simple.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/missing_variable_types.expression.yaml b/pkg/front_end/testcases/expression/missing_variable_types.expression.yaml
index 9411454..2c83b92 100644
--- a/pkg/front_end/testcases/expression/missing_variable_types.expression.yaml
+++ b/pkg/front_end/testcases/expression/missing_variable_types.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["s"]
diff --git a/pkg/front_end/testcases/expression/noclass.expression.yaml b/pkg/front_end/testcases/expression/noclass.expression.yaml
index ef09ec8..bc5edf0 100644
--- a/pkg/front_end/testcases/expression/noclass.expression.yaml
+++ b/pkg/front_end/testcases/expression/noclass.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/nolib.expression.yaml b/pkg/front_end/testcases/expression/nolib.expression.yaml
index 1502f41..9ec59b7 100644
--- a/pkg/front_end/testcases/expression/nolib.expression.yaml
+++ b/pkg/front_end/testcases/expression/nolib.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/param_assign.expression.yaml b/pkg/front_end/testcases/expression/param_assign.expression.yaml
index a0262f1..137e2a4 100644
--- a/pkg/front_end/testcases/expression/param_assign.expression.yaml
+++ b/pkg/front_end/testcases/expression/param_assign.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x", "y"]
diff --git a/pkg/front_end/testcases/expression/param_capture.expression.yaml b/pkg/front_end/testcases/expression/param_capture.expression.yaml
index 72b991d..ac45276 100644
--- a/pkg/front_end/testcases/expression/param_capture.expression.yaml
+++ b/pkg/front_end/testcases/expression/param_capture.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x", "y"]
diff --git a/pkg/front_end/testcases/expression/param_conflict.expression.yaml b/pkg/front_end/testcases/expression/param_conflict.expression.yaml
index 8304043..b63adf0 100644
--- a/pkg/front_end/testcases/expression/param_conflict.expression.yaml
+++ b/pkg/front_end/testcases/expression/param_conflict.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["dostat", "y"]
diff --git a/pkg/front_end/testcases/expression/param_conflict_class.expression.yaml b/pkg/front_end/testcases/expression/param_conflict_class.expression.yaml
index 48969a2..2bf8db6 100644
--- a/pkg/front_end/testcases/expression/param_conflict_class.expression.yaml
+++ b/pkg/front_end/testcases/expression/param_conflict_class.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["A", "y"]
diff --git a/pkg/front_end/testcases/expression/param_method.expression.yaml b/pkg/front_end/testcases/expression/param_method.expression.yaml
index da82702..dbb3b59 100644
--- a/pkg/front_end/testcases/expression/param_method.expression.yaml
+++ b/pkg/front_end/testcases/expression/param_method.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x", "y"]
diff --git a/pkg/front_end/testcases/expression/type_param_bound.expression.yaml b/pkg/front_end/testcases/expression/type_param_bound.expression.yaml
index 9c3a1ce..e2d74e1 100644
--- a/pkg/front_end/testcases/expression/type_param_bound.expression.yaml
+++ b/pkg/front_end/testcases/expression/type_param_bound.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/type_param_shadow.expression.yaml b/pkg/front_end/testcases/expression/type_param_shadow.expression.yaml
index 4a291a5..1cc3d38 100644
--- a/pkg/front_end/testcases/expression/type_param_shadow.expression.yaml
+++ b/pkg/front_end/testcases/expression/type_param_shadow.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/expression/type_param_shadow_arg.expression.yaml b/pkg/front_end/testcases/expression/type_param_shadow_arg.expression.yaml
index 412fea8..f18d8d3 100644
--- a/pkg/front_end/testcases/expression/type_param_shadow_arg.expression.yaml
+++ b/pkg/front_end/testcases/expression/type_param_shadow_arg.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/expression/type_param_shadow_arg_ctor_inferred.expression.yaml b/pkg/front_end/testcases/expression/type_param_shadow_arg_ctor_inferred.expression.yaml
index 94e653b..4078116 100644
--- a/pkg/front_end/testcases/expression/type_param_shadow_arg_ctor_inferred.expression.yaml
+++ b/pkg/front_end/testcases/expression/type_param_shadow_arg_ctor_inferred.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/type_param_shadow_arg_inferred.expression.yaml b/pkg/front_end/testcases/expression/type_param_shadow_arg_inferred.expression.yaml
index fa853f1..c379cd5 100644
--- a/pkg/front_end/testcases/expression/type_param_shadow_arg_inferred.expression.yaml
+++ b/pkg/front_end/testcases/expression/type_param_shadow_arg_inferred.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/type_param_shadow_ctor.expression.yaml b/pkg/front_end/testcases/expression/type_param_shadow_ctor.expression.yaml
index 6dacbfb..bcc4445 100644
--- a/pkg/front_end/testcases/expression/type_param_shadow_ctor.expression.yaml
+++ b/pkg/front_end/testcases/expression/type_param_shadow_ctor.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: []
diff --git a/pkg/front_end/testcases/expression/type_param_shadow_var.expression.yaml b/pkg/front_end/testcases/expression/type_param_shadow_var.expression.yaml
index bf266c6..c1c6c10 100644
--- a/pkg/front_end/testcases/expression/type_param_shadow_var.expression.yaml
+++ b/pkg/front_end/testcases/expression/type_param_shadow_var.expression.yaml
@@ -1,6 +1,6 @@
-// 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.
+# 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.
entry_point: "main.dart"
definitions: ["x"]
diff --git a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.expect b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.expect
index 33bcd2c..4a97594 100644
--- a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.expect
@@ -4,7 +4,7 @@
typedef Function2<S extends core::Object, T extends core::Object> = (S) → T;
class A<T extends core::Object> extends core::Object {
- generic-covariant-impl generic-covariant-interface generic-contravariant field (self::A::T) → self::A::T x;
+ generic-covariant-impl generic-covariant-interface field (self::A::T) → self::A::T x;
constructor •((self::A::T) → self::A::T x) → void
: self::A::x = x, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect
index 33bcd2c..4a97594 100644
--- a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect
@@ -4,7 +4,7 @@
typedef Function2<S extends core::Object, T extends core::Object> = (S) → T;
class A<T extends core::Object> extends core::Object {
- generic-covariant-impl generic-covariant-interface generic-contravariant field (self::A::T) → self::A::T x;
+ generic-covariant-impl generic-covariant-interface field (self::A::T) → self::A::T x;
constructor •((self::A::T) → self::A::T x) → void
: self::A::x = x, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.expect b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.expect
index d26a271..5dc12db 100644
--- a/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant method f<U extends core::Object>(self::C::f::U x) → (self::C::T) → void
+ method f<U extends core::Object>(self::C::f::U x) → (self::C::T) → void
return (self::C::T y) → core::Null {};
}
static method test(self::C<core::String> c) → void {
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.transformed.expect
index d26a271..5dc12db 100644
--- a/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant method f<U extends core::Object>(self::C::f::U x) → (self::C::T) → void
+ method f<U extends core::Object>(self::C::f::U x) → (self::C::T) → void
return (self::C::T y) → core::Null {};
}
static method test(self::C<core::String> c) → void {
diff --git a/pkg/front_end/testcases/inference/non_const_invocation.dart.strong.expect b/pkg/front_end/testcases/inference/non_const_invocation.dart.strong.expect
index e409ade..2175864 100644
--- a/pkg/front_end/testcases/inference/non_const_invocation.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/non_const_invocation.dart.strong.expect
@@ -11,19 +11,19 @@
return new self::Bar::•<self::Foo::T>();
get v2() → self::Bar<core::List<self::Foo::T>>
return new self::Bar::•<core::List<self::Foo::T>>();
- generic-contravariant get v3() → self::Bar<(self::Foo::T) → self::Foo::T>
+ get v3() → self::Bar<(self::Foo::T) → self::Foo::T>
return new self::Bar::•<(self::Foo::T) → self::Foo::T>();
- generic-contravariant get v4() → self::Bar<((self::Foo::T) → self::Foo::T) → self::Foo::T>
+ get v4() → self::Bar<((self::Foo::T) → self::Foo::T) → self::Foo::T>
return new self::Bar::•<((self::Foo::T) → self::Foo::T) → self::Foo::T>();
get v5() → core::List<self::Foo::T>
return <self::Foo::T>[];
- generic-contravariant get v6() → core::List<(self::Foo::T) → self::Foo::T>
+ get v6() → core::List<(self::Foo::T) → self::Foo::T>
return <(self::Foo::T) → self::Foo::T>[];
get v7() → core::Map<self::Foo::T, self::Foo::T>
return <self::Foo::T, self::Foo::T>{};
- generic-contravariant get v8() → core::Map<(self::Foo::T) → self::Foo::T, self::Foo::T>
+ get v8() → core::Map<(self::Foo::T) → self::Foo::T, self::Foo::T>
return <(self::Foo::T) → self::Foo::T, self::Foo::T>{};
- generic-contravariant get v9() → core::Map<self::Foo::T, (self::Foo::T) → self::Foo::T>
+ get v9() → core::Map<self::Foo::T, (self::Foo::T) → self::Foo::T>
return <self::Foo::T, (self::Foo::T) → self::Foo::T>{};
}
class Bar<T extends core::Object> extends core::Object {
diff --git a/pkg/front_end/testcases/inference/non_const_invocation.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/non_const_invocation.dart.strong.transformed.expect
index e409ade..2175864 100644
--- a/pkg/front_end/testcases/inference/non_const_invocation.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/non_const_invocation.dart.strong.transformed.expect
@@ -11,19 +11,19 @@
return new self::Bar::•<self::Foo::T>();
get v2() → self::Bar<core::List<self::Foo::T>>
return new self::Bar::•<core::List<self::Foo::T>>();
- generic-contravariant get v3() → self::Bar<(self::Foo::T) → self::Foo::T>
+ get v3() → self::Bar<(self::Foo::T) → self::Foo::T>
return new self::Bar::•<(self::Foo::T) → self::Foo::T>();
- generic-contravariant get v4() → self::Bar<((self::Foo::T) → self::Foo::T) → self::Foo::T>
+ get v4() → self::Bar<((self::Foo::T) → self::Foo::T) → self::Foo::T>
return new self::Bar::•<((self::Foo::T) → self::Foo::T) → self::Foo::T>();
get v5() → core::List<self::Foo::T>
return <self::Foo::T>[];
- generic-contravariant get v6() → core::List<(self::Foo::T) → self::Foo::T>
+ get v6() → core::List<(self::Foo::T) → self::Foo::T>
return <(self::Foo::T) → self::Foo::T>[];
get v7() → core::Map<self::Foo::T, self::Foo::T>
return <self::Foo::T, self::Foo::T>{};
- generic-contravariant get v8() → core::Map<(self::Foo::T) → self::Foo::T, self::Foo::T>
+ get v8() → core::Map<(self::Foo::T) → self::Foo::T, self::Foo::T>
return <(self::Foo::T) → self::Foo::T, self::Foo::T>{};
- generic-contravariant get v9() → core::Map<self::Foo::T, (self::Foo::T) → self::Foo::T>
+ get v9() → core::Map<self::Foo::T, (self::Foo::T) → self::Foo::T>
return <self::Foo::T, (self::Foo::T) → self::Foo::T>{};
}
class Bar<T extends core::Object> extends core::Object {
diff --git a/pkg/front_end/testcases/inference_new/const_invocation.dart.strong.expect b/pkg/front_end/testcases/inference_new/const_invocation.dart.strong.expect
index ae42957..6926e12 100644
--- a/pkg/front_end/testcases/inference_new/const_invocation.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/const_invocation.dart.strong.expect
@@ -11,19 +11,19 @@
return const self::Bar::•<core::Null>();
get v2() → self::Bar<core::List<self::Foo::T>>
return const self::Bar::•<core::List<core::Null>>();
- generic-contravariant get v3() → self::Bar<(self::Foo::T) → self::Foo::T>
+ get v3() → self::Bar<(self::Foo::T) → self::Foo::T>
return const self::Bar::•<(core::Object) → core::Null>();
- generic-contravariant get v4() → self::Bar<((self::Foo::T) → self::Foo::T) → self::Foo::T>
+ get v4() → self::Bar<((self::Foo::T) → self::Foo::T) → self::Foo::T>
return const self::Bar::•<((core::Null) → core::Object) → core::Null>();
get v5() → core::List<self::Foo::T>
return const <core::Null>[];
- generic-contravariant get v6() → core::List<(self::Foo::T) → self::Foo::T>
+ get v6() → core::List<(self::Foo::T) → self::Foo::T>
return const <(core::Object) → core::Null>[];
get v7() → core::Map<self::Foo::T, self::Foo::T>
return const <core::Null, core::Null>{};
- generic-contravariant get v8() → core::Map<(self::Foo::T) → self::Foo::T, self::Foo::T>
+ get v8() → core::Map<(self::Foo::T) → self::Foo::T, self::Foo::T>
return const <(core::Object) → core::Null, core::Null>{};
- generic-contravariant get v9() → core::Map<self::Foo::T, (self::Foo::T) → self::Foo::T>
+ get v9() → core::Map<self::Foo::T, (self::Foo::T) → self::Foo::T>
return const <core::Null, (core::Object) → core::Null>{};
}
class Bar<T extends core::Object> extends core::Object {
diff --git a/pkg/front_end/testcases/inference_new/const_invocation.dart.strong.transformed.expect b/pkg/front_end/testcases/inference_new/const_invocation.dart.strong.transformed.expect
index ae42957..6926e12 100644
--- a/pkg/front_end/testcases/inference_new/const_invocation.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference_new/const_invocation.dart.strong.transformed.expect
@@ -11,19 +11,19 @@
return const self::Bar::•<core::Null>();
get v2() → self::Bar<core::List<self::Foo::T>>
return const self::Bar::•<core::List<core::Null>>();
- generic-contravariant get v3() → self::Bar<(self::Foo::T) → self::Foo::T>
+ get v3() → self::Bar<(self::Foo::T) → self::Foo::T>
return const self::Bar::•<(core::Object) → core::Null>();
- generic-contravariant get v4() → self::Bar<((self::Foo::T) → self::Foo::T) → self::Foo::T>
+ get v4() → self::Bar<((self::Foo::T) → self::Foo::T) → self::Foo::T>
return const self::Bar::•<((core::Null) → core::Object) → core::Null>();
get v5() → core::List<self::Foo::T>
return const <core::Null>[];
- generic-contravariant get v6() → core::List<(self::Foo::T) → self::Foo::T>
+ get v6() → core::List<(self::Foo::T) → self::Foo::T>
return const <(core::Object) → core::Null>[];
get v7() → core::Map<self::Foo::T, self::Foo::T>
return const <core::Null, core::Null>{};
- generic-contravariant get v8() → core::Map<(self::Foo::T) → self::Foo::T, self::Foo::T>
+ get v8() → core::Map<(self::Foo::T) → self::Foo::T, self::Foo::T>
return const <(core::Object) → core::Null, core::Null>{};
- generic-contravariant get v9() → core::Map<self::Foo::T, (self::Foo::T) → self::Foo::T>
+ get v9() → core::Map<self::Foo::T, (self::Foo::T) → self::Foo::T>
return const <core::Null, (core::Object) → core::Null>{};
}
class Bar<T extends core::Object> extends core::Object {
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.strong.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.strong.expect
index e674c32..b156915 100644
--- a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.strong.expect
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.strong.expect
@@ -4,7 +4,7 @@
typedef A<T extends core::Object> = (T) → dynamic;
class B<S extends core::Object> extends core::Object {
- generic-contravariant final field core::List<(self::B::S) → dynamic> foo = <(self::B::S) → dynamic>[];
+ final field core::List<(self::B::S) → dynamic> foo = <(self::B::S) → dynamic>[];
final field core::List<(core::num) → dynamic> bar = <(core::num) → dynamic>[];
synthetic constructor •() → void
: super core::Object::•()
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.strong.transformed.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.strong.transformed.expect
index e674c32..b156915 100644
--- a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.strong.transformed.expect
@@ -4,7 +4,7 @@
typedef A<T extends core::Object> = (T) → dynamic;
class B<S extends core::Object> extends core::Object {
- generic-contravariant final field core::List<(self::B::S) → dynamic> foo = <(self::B::S) → dynamic>[];
+ final field core::List<(self::B::S) → dynamic> foo = <(self::B::S) → dynamic>[];
final field core::List<(core::num) → dynamic> bar = <(core::num) → dynamic>[];
synthetic constructor •() → void
: super core::Object::•()
diff --git a/pkg/front_end/testcases/qualified.dart.direct.expect b/pkg/front_end/testcases/qualified.dart.direct.expect
index 85f2bbf..9a7583a 100644
--- a/pkg/front_end/testcases/qualified.dart.direct.expect
+++ b/pkg/front_end/testcases/qualified.dart.direct.expect
@@ -25,9 +25,9 @@
static factory b<T extends core::Object>() → self::C<self::C::b::T>
let dynamic #redirecting_factory = lib::C::b in let self::C::b::T #typeArg0 = null in invalid-expression;
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:11:7: Error: The type 'lib.Missing' can't be used as supertype.
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:11:19: Error: Type 'lib.Missing' not found.
class Bad extends lib.Missing {
- ^"]/* from null */;
+ ^"]/* from null */;
static method main() → dynamic {
new self::C::•<core::String>();
new self::C::a<core::String>();
diff --git a/pkg/front_end/testcases/qualified.dart.direct.transformed.expect b/pkg/front_end/testcases/qualified.dart.direct.transformed.expect
index 6849bb6..a428888 100644
--- a/pkg/front_end/testcases/qualified.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/qualified.dart.direct.transformed.expect
@@ -31,9 +31,9 @@
static factory b<T extends core::Object>() → self::C<self::C::b::T>
let dynamic #redirecting_factory = lib::C::b in let self::C::b::T #typeArg0 = null in invalid-expression;
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:11:7: Error: The type 'lib.Missing' can't be used as supertype.
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:11:19: Error: Type 'lib.Missing' not found.
class Bad extends lib.Missing {
- ^"]/* from null */;
+ ^"]/* from null */;
static method main() → dynamic {
new self::C::•<core::String>();
new self::C::a<core::String>();
diff --git a/pkg/front_end/testcases/qualified.dart.strong.expect b/pkg/front_end/testcases/qualified.dart.strong.expect
index 4522e74..7136bf5 100644
--- a/pkg/front_end/testcases/qualified.dart.strong.expect
+++ b/pkg/front_end/testcases/qualified.dart.strong.expect
@@ -27,9 +27,9 @@
}
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:12:3: Error: Type 'lib.Missing' not found.
lib.Missing method() {}
- ^", "pkg/front_end/testcases/qualified.dart:11:7: Error: The type 'lib.Missing' can't be used as supertype.
+ ^", "pkg/front_end/testcases/qualified.dart:11:19: Error: Type 'lib.Missing' not found.
class Bad extends lib.Missing {
- ^", "pkg/front_end/testcases/qualified.dart: Error: Couldn't find constructor 'WrongName'."]/* from null */;
+ ^", "pkg/front_end/testcases/qualified.dart: Error: Couldn't find constructor 'WrongName'."]/* from null */;
static method main() → dynamic {
new self::C::•<core::String>();
new self::C::a<core::String>();
diff --git a/pkg/front_end/testcases/qualified.dart.strong.transformed.expect b/pkg/front_end/testcases/qualified.dart.strong.transformed.expect
index 5a41492..b90128a 100644
--- a/pkg/front_end/testcases/qualified.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/qualified.dart.strong.transformed.expect
@@ -33,9 +33,9 @@
}
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:12:3: Error: Type 'lib.Missing' not found.
lib.Missing method() {}
- ^", "pkg/front_end/testcases/qualified.dart:11:7: Error: The type 'lib.Missing' can't be used as supertype.
+ ^", "pkg/front_end/testcases/qualified.dart:11:19: Error: Type 'lib.Missing' not found.
class Bad extends lib.Missing {
- ^", "pkg/front_end/testcases/qualified.dart: Error: Couldn't find constructor 'WrongName'."]/* from null */;
+ ^", "pkg/front_end/testcases/qualified.dart: Error: Couldn't find constructor 'WrongName'."]/* from null */;
static method main() → dynamic {
new self::C::•<core::String>();
new self::C::a<core::String>();
diff --git a/pkg/front_end/testcases/regress/issue_29981.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29981.dart.strong.expect
index 1aa328a..c4d09ee 100644
--- a/pkg/front_end/testcases/regress/issue_29981.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29981.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object> extends core::Object {
- field self::C<dynamic> field = null;
+ field invalid-type field = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/regress/issue_29981.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/issue_29981.dart.strong.transformed.expect
index 1aa328a..c4d09ee 100644
--- a/pkg/front_end/testcases/regress/issue_29981.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_29981.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object> extends core::Object {
- field self::C<dynamic> field = null;
+ field invalid-type field = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_field.dart b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart
index c730901..e953f32 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_field.dart
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart
@@ -8,7 +8,7 @@
typedef void F<T>(T x);
class C<T> {
- F<T> /*@genericContravariant=true*/ y;
+ F<T> y;
void f() {
var x = this.y;
}
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
index c2e5212..c6d729f 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.strong.expect
@@ -4,7 +4,7 @@
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;
+ field (self::C::T) → void y = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.strong.transformed.expect
index c2e5212..c6d729f 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_field.dart.strong.transformed.expect
@@ -4,7 +4,7 @@
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;
+ field (self::C::T) → void y = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart
index 12df74a..8072cc9 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart
@@ -8,8 +8,8 @@
typedef void F<T>(T x);
class C<T> {
- F<T> /*@genericContravariant=true*/ f1() {}
- List<F<T>> /*@genericContravariant=true*/ f2() {
+ F<T> f1() {}
+ List<F<T>> f2() {
return [this.f1()];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart.strong.expect
index adab8ca..a18c06b 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart.strong.expect
@@ -7,8 +7,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant method f1() → (self::C::T) → void {}
- generic-contravariant method f2() → core::List<(self::C::T) → void> {
+ method f1() → (self::C::T) → void {}
+ method f2() → core::List<(self::C::T) → void> {
return <(self::C::T) → void>[this.{self::C::f1}()];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart.strong.transformed.expect
index adab8ca..a18c06b 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return.dart.strong.transformed.expect
@@ -7,8 +7,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant method f1() → (self::C::T) → void {}
- generic-contravariant method f2() → core::List<(self::C::T) → void> {
+ method f1() → (self::C::T) → void {}
+ method f2() → core::List<(self::C::T) → void> {
return <(self::C::T) → void>[this.{self::C::f1}()];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart
index 0531ccf..24609f7 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart
@@ -8,8 +8,8 @@
typedef void F<T>(T x);
class C<T> {
- F<T> /*@genericContravariant=true*/ f1() {}
- List<F<T>> /*@genericContravariant=true*/ f2() {
+ F<T> f1() {}
+ List<F<T>> f2() {
return [this?.f1()];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart.strong.expect
index 7635298..a67d03d 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart.strong.expect
@@ -7,8 +7,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant method f1() → (self::C::T) → void {}
- generic-contravariant method f2() → core::List<(self::C::T) → void> {
+ method f1() → (self::C::T) → void {}
+ method f2() → core::List<(self::C::T) → void> {
return <(self::C::T) → void>[this.{self::C::f1}()];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart.strong.transformed.expect
index 7635298..a67d03d 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_null_aware.dart.strong.transformed.expect
@@ -7,8 +7,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant method f1() → (self::C::T) → void {}
- generic-contravariant method f2() → core::List<(self::C::T) → void> {
+ method f1() → (self::C::T) → void {}
+ method f2() → core::List<(self::C::T) → void> {
return <(self::C::T) → void>[this.{self::C::f1}()];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart
index e0de24f..4b202f2 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart
@@ -9,9 +9,9 @@
typedef F<T> G<T>();
class C<T> {
- F<T> /*@genericContravariant=true*/ _x;
+ F<T> _x;
C(this._x);
- F<T> /*@genericContravariant=true*/ f() => _x;
+ F<T> f() => _x;
}
G<num> g(C<num> c) {
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart.strong.expect
index f667624..ce92ed1 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart.strong.expect
@@ -5,11 +5,11 @@
typedef F<T extends core::Object> = (T) → void;
typedef G<T extends core::Object> = () → (T) → void;
class C<T extends core::Object> extends core::Object {
- generic-contravariant field (self::C::T) → void _x;
+ field (self::C::T) → void _x;
constructor •((self::C::T) → void _x) → void
: self::C::_x = _x, super core::Object::•()
;
- generic-contravariant method f() → (self::C::T) → void
+ method f() → (self::C::T) → void
return this.{self::C::_x};
}
static method g(self::C<core::num> c) → () → (core::num) → void {
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart.strong.transformed.expect
index f667624..ce92ed1 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_generic_return_tear_off.dart.strong.transformed.expect
@@ -5,11 +5,11 @@
typedef F<T extends core::Object> = (T) → void;
typedef G<T extends core::Object> = () → (T) → void;
class C<T extends core::Object> extends core::Object {
- generic-contravariant field (self::C::T) → void _x;
+ field (self::C::T) → void _x;
constructor •((self::C::T) → void _x) → void
: self::C::_x = _x, super core::Object::•()
;
- generic-contravariant method f() → (self::C::T) → void
+ method f() → (self::C::T) → void
return this.{self::C::_x};
}
static method g(self::C<core::num> c) → () → (core::num) → void {
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart
index cebae23..93f520f 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart
@@ -8,7 +8,7 @@
typedef void F<T>(T x);
class C<T> {
- F<T> /*@genericContravariant=true*/ y;
+ F<T> y;
void f(T /*@covariance=genericInterface, genericImpl*/ value) {
this.y(value);
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.expect
index 88625d3..a13a055 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.expect
@@ -4,7 +4,7 @@
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;
+ field (self::C::T) → void y = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.transformed.expect
index 88625d3..a13a055 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.transformed.expect
@@ -4,7 +4,7 @@
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;
+ field (self::C::T) → void y = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart
index 9f1f536..8900412 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart
@@ -8,8 +8,8 @@
typedef void F<T>(T x);
class C<T> {
- F<T> get /*@genericContravariant=true*/ f1 => null;
- List<F<T>> get /*@genericContravariant=true*/ f2 {
+ F<T> get f1 => null;
+ List<F<T>> get f2 {
return [this.f1];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart.strong.expect
index 5c3e2d2..5f2899e 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart.strong.expect
@@ -7,9 +7,9 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant get f1() → (self::C::T) → void
+ get f1() → (self::C::T) → void
return null;
- generic-contravariant get f2() → core::List<(self::C::T) → void> {
+ get f2() → core::List<(self::C::T) → void> {
return <(self::C::T) → void>[this.{self::C::f1}];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart.strong.transformed.expect
index 5c3e2d2..5f2899e 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return.dart.strong.transformed.expect
@@ -7,9 +7,9 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant get f1() → (self::C::T) → void
+ get f1() → (self::C::T) → void
return null;
- generic-contravariant get f2() → core::List<(self::C::T) → void> {
+ get f2() → core::List<(self::C::T) → void> {
return <(self::C::T) → void>[this.{self::C::f1}];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart
index 546563d..a8cd708 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart
@@ -8,8 +8,8 @@
typedef void F<T>(T x);
class C<T> {
- F<T> get /*@genericContravariant=true*/ f1 => null;
- List<F<T>> get /*@genericContravariant=true*/ f2 {
+ F<T> get f1 => null;
+ List<F<T>> get f2 {
return [this?.f1];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart.strong.expect
index fcd0c39..764aea8 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart.strong.expect
@@ -7,9 +7,9 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant get f1() → (self::C::T) → void
+ get f1() → (self::C::T) → void
return null;
- generic-contravariant get f2() → core::List<(self::C::T) → void> {
+ get f2() → core::List<(self::C::T) → void> {
return <(self::C::T) → void>[this.{self::C::f1}];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart.strong.transformed.expect
index fcd0c39..764aea8 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter_return_null_aware.dart.strong.transformed.expect
@@ -7,9 +7,9 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant get f1() → (self::C::T) → void
+ get f1() → (self::C::T) → void
return null;
- generic-contravariant get f2() → core::List<(self::C::T) → void> {
+ get f2() → core::List<(self::C::T) → void> {
return <(self::C::T) → void>[this.{self::C::f1}];
}
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart
index 4f77378..a28b798 100644
--- a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart
@@ -22,27 +22,27 @@
c.f(x);
}
- F<T> /*@genericContravariant=true*/ g4() => this.f;
+ F<T> g4() => this.f;
}
class
/*@forwardingStub=abstract void f(covariance=(genericImpl) int x)*/
/*@forwardingStub=abstract void g1(covariance=(genericImpl) int x)*/
/*@forwardingStub=abstract void g2(covariance=(genericImpl) int x)*/
-/*@forwardingStub=abstract (int) -> dynamic g4()*/
/*@forwardingStub=abstract void g3(covariance=(genericImpl) C<int> c, covariance=(genericImpl) int x)*/
+
D extends C<int> {}
class /*@forwardingStub=abstract void g1(covariance=(genericImpl) num x)*/
/*@forwardingStub=abstract void g2(covariance=(genericImpl) num x)*/
-/*@forwardingStub=abstract (num) -> dynamic g4()*/
/*@forwardingStub=abstract void g3(covariance=(genericImpl) C<num> c, covariance=(genericImpl) num x)*/
+
E extends C<num> {
void f(covariant int /*@covariance=explicit*/ x) {}
}
test() {
- var x = new D().g4() as F<Object>;
+ var x = new D().g4 /*@checkReturn=(int) -> dynamic*/ () as F<Object>;
x('hi');
new E().g1(1.5);
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.expect
index 1a496c8..a8e4634 100644
--- a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.expect
@@ -17,7 +17,7 @@
method g3(generic-covariant-impl generic-covariant-interface self::C<self::C::T> c, generic-covariant-impl generic-covariant-interface self::C::T x) → void {
c.{self::C::f}(x);
}
- generic-contravariant method g4() → (self::C::T) → dynamic
+ method g4() → (self::C::T) → dynamic
return this.{self::C::f};
}
class D extends self::C<core::int> {
@@ -27,7 +27,6 @@
abstract forwarding-stub method f(generic-covariant-impl core::int x) → void;
abstract forwarding-stub method g1(generic-covariant-impl core::int x) → void;
abstract forwarding-stub method g2(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method g4() → (core::int) → dynamic;
abstract forwarding-stub method g3(generic-covariant-impl self::C<core::int> c, generic-covariant-impl core::int x) → void;
}
class E extends self::C<core::num> {
@@ -37,11 +36,10 @@
method f(covariant generic-covariant-impl core::int x) → void {}
abstract forwarding-stub method g1(generic-covariant-impl core::num x) → void;
abstract forwarding-stub method g2(generic-covariant-impl core::num x) → void;
- abstract forwarding-stub method g4() → (core::num) → dynamic;
abstract forwarding-stub method g3(generic-covariant-impl self::C<core::num> c, generic-covariant-impl core::num x) → void;
}
static method test() → dynamic {
- (core::Object) → dynamic x = new self::D::•().{self::D::g4}() as (core::Object) → dynamic;
+ (core::Object) → dynamic x = (new self::D::•().{self::C::g4}() as{TypeError} (core::int) → dynamic) as (core::Object) → dynamic;
x.call("hi");
new self::E::•().{self::E::g1}(1.5);
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.transformed.expect
index 1a496c8..a8e4634 100644
--- a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.transformed.expect
@@ -17,7 +17,7 @@
method g3(generic-covariant-impl generic-covariant-interface self::C<self::C::T> c, generic-covariant-impl generic-covariant-interface self::C::T x) → void {
c.{self::C::f}(x);
}
- generic-contravariant method g4() → (self::C::T) → dynamic
+ method g4() → (self::C::T) → dynamic
return this.{self::C::f};
}
class D extends self::C<core::int> {
@@ -27,7 +27,6 @@
abstract forwarding-stub method f(generic-covariant-impl core::int x) → void;
abstract forwarding-stub method g1(generic-covariant-impl core::int x) → void;
abstract forwarding-stub method g2(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method g4() → (core::int) → dynamic;
abstract forwarding-stub method g3(generic-covariant-impl self::C<core::int> c, generic-covariant-impl core::int x) → void;
}
class E extends self::C<core::num> {
@@ -37,11 +36,10 @@
method f(covariant generic-covariant-impl core::int x) → void {}
abstract forwarding-stub method g1(generic-covariant-impl core::num x) → void;
abstract forwarding-stub method g2(generic-covariant-impl core::num x) → void;
- abstract forwarding-stub method g4() → (core::num) → dynamic;
abstract forwarding-stub method g3(generic-covariant-impl self::C<core::num> c, generic-covariant-impl core::num x) → void;
}
static method test() → dynamic {
- (core::Object) → dynamic x = new self::D::•().{self::D::g4}() as (core::Object) → dynamic;
+ (core::Object) → dynamic x = (new self::D::•().{self::C::g4}() as{TypeError} (core::int) → dynamic) as (core::Object) → dynamic;
x.call("hi");
new self::E::•().{self::E::g1}(1.5);
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart b/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart
index 08ade7a..d272d69 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart
@@ -8,7 +8,7 @@
typedef void F<T>(T x);
class B<T, U extends F<T>> {
- B<T, F<T>> operator /*@genericContravariant=true*/ +(other) => null;
+ B<T, F<T>> operator +(other) => null;
}
class C {
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart.strong.expect
index 0449783..abb7c26 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart.strong.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant operator +(dynamic other) → self::B<self::B::T, (self::B::T) → void>
+ operator +(dynamic other) → self::B<self::B::T, (self::B::T) → void>
return null;
}
class C extends core::Object {
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart.strong.transformed.expect
index 0449783..abb7c26 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_combiner.dart.strong.transformed.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant operator +(dynamic other) → self::B<self::B::T, (self::B::T) → void>
+ operator +(dynamic other) → self::B<self::B::T, (self::B::T) → void>
return null;
}
class C extends core::Object {
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart b/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart
index ea84715..ed38b37 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart
@@ -20,9 +20,8 @@
class C<T> {
C(this.plusResult);
- final num Function(T) /*@genericContravariant=true*/ plusResult;
- num Function(T) operator /*@genericContravariant=true*/ +(int i) =>
- plusResult;
+ final num Function(T) plusResult;
+ num Function(T) operator +(int i) => plusResult;
}
class D {
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart.strong.expect
index 3a6e93a..8a36099 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart.strong.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class C<T extends core::Object> extends core::Object {
- generic-contravariant final field (self::C::T) → core::num plusResult;
+ final field (self::C::T) → core::num plusResult;
constructor •((self::C::T) → core::num plusResult) → void
: self::C::plusResult = plusResult, super core::Object::•()
;
- generic-contravariant operator +(core::int i) → (self::C::T) → core::num
+ operator +(core::int i) → (self::C::T) → core::num
return this.{self::C::plusResult};
}
class D extends core::Object {
@@ -41,14 +41,14 @@
return 2;
static method main() → void {
self::D d = new self::D::•(new self::C::•<core::num>(self::numToInt));
- let final self::D #t1 = d in #t1.{self::D::value} = let final dynamic #t2 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart:50:41: Error: A value of type '(dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::int'.
+ let final self::D #t1 = d in #t1.{self::D::value} = let final dynamic #t2 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart:49:41: Error: A value of type '(dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to '(dart.core::int) \u8594 dart.core::int'.
d.value /*@checkReturn=(num) -> num*/ += 1;
^" in let final dynamic #t3 = #t1.{self::D::value}.{self::C::+}(1) as{TypeError} (core::num) → core::num in null;
self::expect(d.{self::D::setValue}(0), 1);
d = new self::D::•(new self::C::•<core::num>(self::numToNum));
self::expectTypeError(() → core::Null {
- let final self::D #t4 = d in #t4.{self::D::value} = let final dynamic #t5 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart:54:43: Error: A value of type '(dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::int'.
+ let final self::D #t4 = d in #t4.{self::D::value} = let final dynamic #t5 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart:53:43: Error: A value of type '(dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to '(dart.core::int) \u8594 dart.core::int'.
d.value /*@checkReturn=(num) -> num*/ += 1;
^" in let final dynamic #t6 = #t4.{self::D::value}.{self::C::+}(1) as{TypeError} (core::num) → core::num in null;
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart.strong.transformed.expect
index 9a89e10..9e71b47 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart.strong.transformed.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class C<T extends core::Object> extends core::Object {
- generic-contravariant final field (self::C::T) → core::num plusResult;
+ final field (self::C::T) → core::num plusResult;
constructor •((self::C::T) → core::num plusResult) → void
: self::C::plusResult = plusResult, super core::Object::•()
;
- generic-contravariant operator +(core::int i) → (self::C::T) → core::num
+ operator +(core::int i) → (self::C::T) → core::num
return this.{self::C::plusResult};
}
class D extends core::Object {
@@ -41,14 +41,14 @@
return 2;
static method main() → void {
self::D d = new self::D::•(new self::C::•<core::num>(self::numToInt));
- let final self::D #t1 = d in #t1.{self::D::value} = let final dynamic #t2 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart:50:41: Error: A value of type '(dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::int'.
+ let final self::D #t1 = d in #t1.{self::D::value} = let final dynamic #t2 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart:49:41: Error: A value of type '(dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to '(dart.core::int) \u8594 dart.core::int'.
d.value /*@checkReturn=(num) -> num*/ += 1;
^" in let final (core::num) → core::num #t3 = #t1.{self::D::value}.{self::C::+}(1) as{TypeError} (core::num) → core::num in null;
self::expect(d.{self::D::setValue}(0), 1);
d = new self::D::•(new self::C::•<core::num>(self::numToNum));
self::expectTypeError(() → core::Null {
- let final self::D #t4 = d in #t4.{self::D::value} = let final dynamic #t5 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart:54:43: Error: A value of type '(dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::int'.
+ let final self::D #t4 = d in #t4.{self::D::value} = let final dynamic #t5 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_generic_return_with_compound_assign_implicit_downcast.dart:53:43: Error: A value of type '(dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int) \u8594 dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to '(dart.core::int) \u8594 dart.core::int'.
d.value /*@checkReturn=(num) -> num*/ += 1;
^" in let final (core::num) → core::num #t6 = #t4.{self::D::value}.{self::C::+}(1) as{TypeError} (core::num) → core::num in null;
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart
index 604513f..15854b3 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart
@@ -13,7 +13,7 @@
}
class C<T> {
- B<F<T>> get /*@genericContravariant=true*/ x => null;
+ B<F<T>> get x => null;
void set x(B<F<T>> value) {}
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.expect
index ee09fb4..5661177 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.expect
@@ -14,7 +14,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant get x() → self::B<(self::C::T) → void>
+ get x() → self::B<(self::C::T) → void>
return null;
set x(self::B<(self::C::T) → void> value) → void {}
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.transformed.expect
index f379cd8..7a9ab98 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant get x() → self::B<(self::C::T) → void>
+ get x() → self::B<(self::C::T) → void>
return null;
set x(self::B<(self::C::T) → void> value) → void {}
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart
index 4be3197..ffa9c1d 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart
@@ -13,7 +13,7 @@
}
class C<T> {
- B<F<T>> operator /*@genericContravariant=true*/ [](int i) => null;
+ B<F<T>> operator [](int i) => null;
void operator []=(int i, B<F<T>> x) {}
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.expect
index 74c67a7..4c7b92c 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.expect
@@ -14,7 +14,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant operator [](core::int i) → self::B<(self::C::T) → void>
+ operator [](core::int i) → self::B<(self::C::T) → void>
return null;
operator []=(core::int i, self::B<(self::C::T) → void> x) → void {}
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.transformed.expect
index 74c67a7..4c7b92c 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant operator [](core::int i) → self::B<(self::C::T) → void>
+ operator [](core::int i) → self::B<(self::C::T) → void>
return null;
operator []=(core::int i, self::B<(self::C::T) → void> x) → void {}
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart
index 0c5a7fc..722ec8b 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart
@@ -8,7 +8,7 @@
typedef void F<T>(T x);
class C<T> {
- F<T> operator /*@genericContravariant=true*/ [](int i) => null;
+ F<T> operator [](int i) => null;
}
F<num> test(C<num> c) {
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart.strong.expect
index 5653b2b..4c9a372 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart.strong.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant operator [](core::int i) → (self::C::T) → void
+ operator [](core::int i) → (self::C::T) → void
return null;
}
static method test(self::C<core::num> c) → (core::num) → void {
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart.strong.transformed.expect
index 5653b2b..4c9a372 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_get.dart.strong.transformed.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- generic-contravariant operator [](core::int i) → (self::C::T) → void
+ operator [](core::int i) → (self::C::T) → void
return null;
}
static method test(self::C<core::num> c) → (core::num) → void {
diff --git a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart
index a1739c5..7797a4a 100644
--- a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart
@@ -31,7 +31,7 @@
}
abstract class I<T> {
- F<T> get /*@genericContravariant=true*/ x;
+ F<T> get x;
void set x(Object value);
}
@@ -44,10 +44,7 @@
T f();
}
-abstract class
-/*@forwardingStub=abstract genericContravariant (C::T) -> void f()*/
-/*@forwardingStub=abstract genericContravariant (C::T) -> void get x()*/
- C<T> = B with M<F<T>> implements I<T>;
+abstract class C<T> = B with M<F<T>> implements I<T>;
class D extends C<int> {
F<int> f() => (int i) {
diff --git a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart.strong.expect
index 66a0075..f3d6139 100644
--- a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_getter.dart.strong.expect
@@ -18,7 +18,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract generic-contravariant get x() → (self::I::T) → void;
+ abstract get x() → (self::I::T) → void;
abstract set x(core::Object value) → void;
}
abstract class M<T extends core::Object> extends core::Object {
@@ -36,8 +36,6 @@
synthetic constructor •() → void
: super self::B::•()
;
- abstract forwarding-stub generic-contravariant method f() → (self::C::T) → void;
- abstract forwarding-stub generic-contravariant get x() → (self::C::T) → void;
}
class D extends self::C<core::int> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart
index 0ae133d..34982db 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart
@@ -16,7 +16,7 @@
}
class
-/*@forwardingStub=abstract genericContravariant (C::T) -> void f(covariance=() Object x)*/
+/*@forwardingStub=abstract (C::T) -> void f(covariance=() Object x)*/
C<T> extends B<F<T>> implements I<F<T>> {}
void main() {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart.strong.expect
index 0278865..fde8b6f 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_contravariant_from_class.dart.strong.expect
@@ -19,6 +19,6 @@
synthetic constructor •() → void
: super self::B::•()
;
- abstract forwarding-stub generic-contravariant method f(core::Object x) → (self::C::T) → void;
+ abstract forwarding-stub method f(core::Object x) → (self::C::T) → void;
}
static method main() → void {}
diff --git a/pkg/front_end/testing.json b/pkg/front_end/testing.json
index 231aa5e..c283616 100644
--- a/pkg/front_end/testing.json
+++ b/pkg/front_end/testing.json
@@ -149,7 +149,18 @@
"exclude": [
]
},
-
+ {
+ "name": "expression",
+ "kind": "Chain",
+ "source": "test/fasta/expression_test.dart",
+ "path": "testcases/expression/",
+ "status": "testcases/expression.status",
+ "pattern": [
+ "\\.expression\\.yaml$"
+ ],
+ "exclude": [
+ ]
+ },
{
"name": "incremental_load_from_dill",
"kind": "Chain",
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index f87de3d..c5638dd 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -42,6 +42,8 @@
type UInt32 = big endian 32-bit unsigned integer
+type Double = Double-precision floating-point number.
+
type List<T> {
UInt length;
T[length] items;
@@ -312,7 +314,6 @@
FileOffset fileEndOffset;
Byte flags (isFinal, isConst, isStatic, hasImplicitGetter, hasImplicitSetter,
isCovariant, isGenericCovariantImpl, isGenericCovariantInterface);
- Byte flags2 (isGenericContravariant);
Name name;
List<Expression> annotations;
DartType type;
@@ -351,9 +352,9 @@
FileOffset fileEndOffset;
Byte kind; // Index into the ProcedureKind enum above.
Byte flags (isStatic, isAbstract, isExternal, isConst, isForwardingStub,
- isGenericContravariant, isForwardingSemiStub,
- isRedirectingFactoryConstructor);
- Byte flags2 (isNoSuchMethodForwarder);
+ isForwardingSemiStub,
+ isRedirectingFactoryConstructor,
+ isNoSuchMethodForwarder);
Name name;
List<Expression> annotations;
// Only present if the 'isForwardingStub' flag is set.
@@ -712,7 +713,7 @@
type DoubleLiteral extends Expression {
Byte tag = 40;
- StringReference valueString;
+ Double value;
}
type TrueLiteral extends Expression {
@@ -875,7 +876,7 @@
type DoubleConstant extends Constant {
Byte tag = 3;
- StringReference value;
+ Double value;
}
type StringConstant extends Constant {
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 4d44b72..3bfd973 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -1039,7 +1039,6 @@
class Field extends Member {
DartType type; // Not null. Defaults to DynamicType.
int flags = 0;
- int flags2 = 0;
Expression initializer; // May be null.
Field(Name name,
@@ -1075,9 +1074,6 @@
static const int FlagGenericCovariantImpl = 1 << 6;
static const int FlagGenericCovariantInterface = 1 << 7;
- // Must match serialized bit positions
- static const int Flag2GenericContravariant = 1 << 0;
-
/// Whether the field is declared with the `covariant` keyword.
bool get isCovariant => flags & FlagCovariant != 0;
@@ -1120,14 +1116,6 @@
bool get isGenericCovariantInterface =>
flags & FlagGenericCovariantInterface != 0;
- /// Indicates whether getter invocations using this interface target may need
- /// to perform a runtime type check to deal with generic covariance.
- ///
- /// Note that the appropriate runtime checks are inserted by the front end, so
- /// back ends need not consult this flag; this flag exists merely to reduce
- /// front end computational overhead.
- bool get isGenericContravariant => flags2 & Flag2GenericContravariant != 0;
-
void set isCovariant(bool value) {
flags = value ? (flags | FlagCovariant) : (flags & ~FlagCovariant);
}
@@ -1168,12 +1156,6 @@
: (flags & ~FlagGenericCovariantInterface);
}
- void set isGenericContravariant(bool value) {
- flags2 = value
- ? (flags2 | Flag2GenericContravariant)
- : (flags2 & ~Flag2GenericContravariant);
- }
-
/// True if the field is neither final nor const.
bool get isMutable => flags & (FlagFinal | FlagConst) == 0;
bool get isInstanceMember => !isStatic;
@@ -1450,7 +1432,6 @@
class Procedure extends Member {
ProcedureKind kind;
int flags = 0;
- int flags2 = 0;
// function is null if and only if abstract, external.
FunctionNode function;
@@ -1535,11 +1516,10 @@
static const int FlagExternal = 1 << 2;
static const int FlagConst = 1 << 3; // Only for external const factories.
static const int FlagForwardingStub = 1 << 4;
- static const int FlagGenericContravariant = 1 << 5;
- static const int FlagForwardingSemiStub = 1 << 6;
+ static const int FlagForwardingSemiStub = 1 << 5;
// TODO(29841): Remove this flag after the issue is resolved.
- static const int FlagRedirectingFactoryConstructor = 1 << 7;
- static const int Flag2NoSuchMethodForwarder = 1 << 0;
+ static const int FlagRedirectingFactoryConstructor = 1 << 6;
+ static const int FlagNoSuchMethodForwarder = 1 << 7;
bool get isStatic => flags & FlagStatic != 0;
bool get isAbstract => flags & FlagAbstract != 0;
@@ -1559,14 +1539,6 @@
/// was present in the source, consult [isSyntheticForwarder].
bool get isForwardingStub => flags & FlagForwardingStub != 0;
- /// Indicates whether invocations using this interface target may need to
- /// perform a runtime type check to deal with generic covariance.
- ///
- /// Note that the appropriate runtime checks are inserted by the front end, so
- /// back ends need not consult this flag; this flag exists merely to reduce
- /// front end computational overhead.
- bool get isGenericContravariant => flags & FlagGenericContravariant != 0;
-
/// If set, this flag indicates that although this function is a forwarding
/// stub, it was present in the original source as an abstract method.
bool get isForwardingSemiStub => flags & FlagForwardingSemiStub != 0;
@@ -1582,7 +1554,7 @@
/// and forwarding to [forwardingStubSuperTarget].
bool get isSyntheticForwarder => isForwardingStub && !isForwardingSemiStub;
- bool get isNoSuchMethodForwarder => flags2 & Flag2NoSuchMethodForwarder != 0;
+ bool get isNoSuchMethodForwarder => flags & FlagNoSuchMethodForwarder != 0;
void set isStatic(bool value) {
flags = value ? (flags | FlagStatic) : (flags & ~FlagStatic);
@@ -1605,12 +1577,6 @@
value ? (flags | FlagForwardingStub) : (flags & ~FlagForwardingStub);
}
- void set isGenericContravariant(bool value) {
- flags = value
- ? (flags | FlagGenericContravariant)
- : (flags & ~FlagGenericContravariant);
- }
-
void set isForwardingSemiStub(bool value) {
flags = value
? (flags | FlagForwardingSemiStub)
@@ -1625,9 +1591,9 @@
void set isNoSuchMethodForwarder(bool value) {
assert(isAbstract);
- flags2 = value
- ? (flags2 | Flag2NoSuchMethodForwarder)
- : (flags2 & ~Flag2NoSuchMethodForwarder);
+ flags = value
+ ? (flags | FlagNoSuchMethodForwarder)
+ : (flags & ~FlagNoSuchMethodForwarder);
}
bool get isInstanceMember => !isStatic;
@@ -3445,8 +3411,7 @@
assert(constant != null);
}
- DartType getStaticType(TypeEnvironment types) =>
- throw 'ConstantExpression.staticType() is unimplemented';
+ DartType getStaticType(TypeEnvironment types) => constant.getType(types);
accept(ExpressionVisitor v) => v.visitConstantExpression(this);
accept1(ExpressionVisitor1 v, arg) => v.visitConstantExpression(this, arg);
@@ -5191,6 +5156,9 @@
/// comparable via hashCode/==!
int get hashCode;
bool operator ==(Object other);
+
+ /// Gets the type of this constant.
+ DartType getType(TypeEnvironment types);
}
abstract class PrimitiveConstant<T> extends Constant {
@@ -5212,6 +5180,8 @@
visitChildren(Visitor v) {}
accept(ConstantVisitor v) => v.visitNullConstant(this);
acceptReference(Visitor v) => v.visitNullConstantReference(this);
+
+ DartType getType(TypeEnvironment types) => types.nullType;
}
class BoolConstant extends PrimitiveConstant<bool> {
@@ -5220,6 +5190,8 @@
visitChildren(Visitor v) {}
accept(ConstantVisitor v) => v.visitBoolConstant(this);
acceptReference(Visitor v) => v.visitBoolConstantReference(this);
+
+ DartType getType(TypeEnvironment types) => types.boolType;
}
class IntConstant extends PrimitiveConstant<int> {
@@ -5228,6 +5200,8 @@
visitChildren(Visitor v) {}
accept(ConstantVisitor v) => v.visitIntConstant(this);
acceptReference(Visitor v) => v.visitIntConstantReference(this);
+
+ DartType getType(TypeEnvironment types) => types.intType;
}
class DoubleConstant extends PrimitiveConstant<double> {
@@ -5241,6 +5215,8 @@
bool operator ==(Object other) =>
other is DoubleConstant &&
(other.value == value || identical(value, other.value) /* For NaN */);
+
+ DartType getType(TypeEnvironment types) => types.doubleType;
}
class StringConstant extends PrimitiveConstant<String> {
@@ -5251,6 +5227,8 @@
visitChildren(Visitor v) {}
accept(ConstantVisitor v) => v.visitStringConstant(this);
acceptReference(Visitor v) => v.visitStringConstantReference(this);
+
+ DartType getType(TypeEnvironment types) => types.stringType;
}
class MapConstant extends Constant {
@@ -5288,6 +5266,9 @@
other.keyType == keyType &&
other.valueType == valueType &&
listEquals(other.entries, entries));
+
+ DartType getType(TypeEnvironment types) =>
+ types.literalMapType(keyType, valueType);
}
class ConstantMapEntry {
@@ -5331,6 +5312,9 @@
(other is ListConstant &&
other.typeArgument == typeArgument &&
listEquals(other.entries, entries));
+
+ DartType getType(TypeEnvironment types) =>
+ types.literalListType(typeArgument);
}
class InstanceConstant extends Constant {
@@ -5386,6 +5370,9 @@
listEquals(other.typeArguments, typeArguments) &&
mapEquals(other.fieldValues, fieldValues));
}
+
+ DartType getType(TypeEnvironment types) =>
+ new InterfaceType(klass, typeArguments);
}
class PartialInstantiationConstant extends Constant {
@@ -5414,6 +5401,15 @@
other.tearOffConstant == tearOffConstant &&
listEquals(other.types, types);
}
+
+ DartType getType(TypeEnvironment typeEnvironment) {
+ final FunctionType type = tearOffConstant.getType(typeEnvironment);
+ final mapping = <TypeParameter, DartType>{};
+ for (final parameter in type.typeParameters) {
+ mapping[parameter] = types[mapping.length];
+ }
+ return substitute(type.withoutTypeParameters, mapping);
+ }
}
class TearOffConstant extends Constant {
@@ -5444,6 +5440,9 @@
bool operator ==(Object other) {
return other is TearOffConstant && other.procedure == procedure;
}
+
+ FunctionType getType(TypeEnvironment types) =>
+ procedure.function.functionType;
}
class TypeLiteralConstant extends Constant {
@@ -5465,6 +5464,8 @@
bool operator ==(Object other) {
return other is TypeLiteralConstant && other.type == type;
}
+
+ DartType getType(TypeEnvironment types) => types.typeType;
}
// ------------------------------------------------------------------------
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index bfdf151..384fcf5 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -97,6 +97,22 @@
readByte();
}
+ final Float64List _doubleBuffer = new Float64List(1);
+ Uint8List _doubleBufferUint8;
+
+ double readDouble() {
+ _doubleBufferUint8 ??= _doubleBuffer.buffer.asUint8List();
+ _doubleBufferUint8[0] = readByte();
+ _doubleBufferUint8[1] = readByte();
+ _doubleBufferUint8[2] = readByte();
+ _doubleBufferUint8[3] = readByte();
+ _doubleBufferUint8[4] = readByte();
+ _doubleBufferUint8[5] = readByte();
+ _doubleBufferUint8[6] = readByte();
+ _doubleBufferUint8[7] = readByte();
+ return _doubleBuffer[0];
+ }
+
List<int> readByteList() {
List<int> bytes = new Uint8List(readUInt());
bytes.setRange(0, bytes.length, _bytes, _byteOffset);
@@ -174,7 +190,7 @@
case ConstantTag.IntConstant:
return new IntConstant((readExpression() as IntLiteral).value);
case ConstantTag.DoubleConstant:
- return new DoubleConstant(double.parse(readStringReference()));
+ return new DoubleConstant(readDouble());
case ConstantTag.StringConstant:
return new StringConstant(readStringReference());
case ConstantTag.MapConstant:
@@ -857,7 +873,6 @@
int fileOffset = readOffset();
int fileEndOffset = readOffset();
int flags = readByte();
- int flags2 = readByte();
var name = readName();
var annotations = readAnnotationList(node);
assert(() {
@@ -872,7 +887,6 @@
node.fileOffset = fileOffset;
node.fileEndOffset = fileEndOffset;
node.flags = flags;
- node.flags2 = flags2;
node.name = name;
node.fileUri = fileUri;
node.annotations = annotations;
@@ -944,7 +958,6 @@
int kindIndex = readByte();
var kind = ProcedureKind.values[kindIndex];
var flags = readByte();
- var flags2 = readByte();
var name = readName();
var annotations = readAnnotationList(node);
assert(() {
@@ -968,7 +981,6 @@
node.fileEndOffset = fileEndOffset;
node.kind = kind;
node.flags = flags;
- node.flags2 = flags2;
node.name = name;
node.fileUri = fileUri;
node.annotations = annotations;
@@ -1337,7 +1349,7 @@
case Tag.BigIntLiteral:
return new IntLiteral(int.parse(readStringReference()));
case Tag.DoubleLiteral:
- return new DoubleLiteral(double.parse(readStringReference()));
+ return new DoubleLiteral(readDouble());
case Tag.TrueLiteral:
return new BoolLiteral(true);
case Tag.FalseLiteral:
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index 3c8dc01..7314521 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -147,7 +147,7 @@
writeInteger(constant.value);
} else if (constant is DoubleConstant) {
writeByte(ConstantTag.DoubleConstant);
- writeStringReference('${constant.value}');
+ writeDouble(constant.value);
} else if (constant is StringConstant) {
writeByte(ConstantTag.StringConstant);
writeStringReference(constant.value);
@@ -830,7 +830,6 @@
writeOffset(node.fileEndOffset);
writeByte(node.kind.index);
writeByte(node.flags);
- writeByte(node.flags2);
writeName(node.name ?? '');
writeAnnotationList(node.annotations);
writeOptionalReference(node.forwardingStubSuperTargetReference);
@@ -860,7 +859,6 @@
writeOffset(node.fileOffset);
writeOffset(node.fileEndOffset);
writeByte(node.flags);
- writeByte(node.flags2);
writeName(node.name);
writeAnnotationList(node.annotations);
writeNode(node.type);
@@ -1240,13 +1238,12 @@
@override
void visitDoubleLiteral(DoubleLiteral node) {
+ writeByte(Tag.DoubleLiteral);
writeDouble(node.value);
}
writeDouble(double value) {
- // TODO: Pick a better format for double literals.
- writeByte(Tag.DoubleLiteral);
- writeStringReference('$value');
+ _sink.addDouble(value);
}
@override
@@ -2193,8 +2190,20 @@
int length = 0;
int flushedLength = 0;
+ Float64List _doubleBuffer = new Float64List(1);
+ Uint8List _doubleBufferUint8;
+
BufferedSink(this._sink);
+ void addDouble(double d) {
+ _doubleBufferUint8 ??= _doubleBuffer.buffer.asUint8List();
+ _doubleBuffer[0] = d;
+ addByte4(_doubleBufferUint8[0], _doubleBufferUint8[1],
+ _doubleBufferUint8[2], _doubleBufferUint8[3]);
+ addByte4(_doubleBufferUint8[4], _doubleBufferUint8[5],
+ _doubleBufferUint8[6], _doubleBufferUint8[7]);
+ }
+
void addByte(int byte) {
_buffer[length++] = byte;
if (length == SIZE) {
diff --git a/pkg/kernel/lib/binary/tag.dart b/pkg/kernel/lib/binary/tag.dart
index bc70203..877657f 100644
--- a/pkg/kernel/lib/binary/tag.dart
+++ b/pkg/kernel/lib/binary/tag.dart
@@ -135,7 +135,7 @@
/// Internal version of kernel binary format.
/// Bump it when making incompatible changes in kernel binaries.
/// Keep in sync with runtime/vm/kernel_binary.h.
- static const int BinaryFormatVersion = 4;
+ static const int BinaryFormatVersion = 5;
}
abstract class ConstantTag {
diff --git a/pkg/kernel/lib/clone.dart b/pkg/kernel/lib/clone.dart
index c104afe..b7cfe0a 100644
--- a/pkg/kernel/lib/clone.dart
+++ b/pkg/kernel/lib/clone.dart
@@ -424,9 +424,7 @@
forwardingStubInterfaceTarget: node.forwardingStubInterfaceTarget)
..fileOffset = _cloneFileOffset(node.fileOffset)
..fileEndOffset = _cloneFileOffset(node.fileEndOffset)
- ..isGenericContravariant = node.isGenericContravariant
- ..flags = node.flags
- ..flags2 = node.flags2;
+ ..flags = node.flags;
}
visitField(Field node) {
@@ -443,8 +441,7 @@
fileUri: _activeFileUri)
..fileOffset = _cloneFileOffset(node.fileOffset)
..fileEndOffset = _cloneFileOffset(node.fileEndOffset)
- ..flags = node.flags
- ..flags2 = node.flags2;
+ ..flags = node.flags;
}
visitRedirectingFactoryConstructor(RedirectingFactoryConstructor node) {
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index 1a19346..4ec4cbd 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -887,7 +887,6 @@
writeModifier(node.isGenericCovariantImpl, 'generic-covariant-impl');
writeModifier(
node.isGenericCovariantInterface, 'generic-covariant-interface');
- writeModifier(node.isGenericContravariant, 'generic-contravariant');
writeModifier(node.isFinal, 'final');
writeModifier(node.isConst, 'const');
// Only show implicit getter/setter modifiers in cases where they are
@@ -928,7 +927,6 @@
writeModifier(node.isAbstract, 'abstract');
writeModifier(node.isForwardingStub, 'forwarding-stub');
writeModifier(node.isForwardingSemiStub, 'forwarding-semi-stub');
- writeModifier(node.isGenericContravariant, 'generic-contravariant');
writeModifier(node.isNoSuchMethodForwarder, 'no-such-method-forwarder');
writeWord(procedureKindToString(node.kind));
if ((node.enclosingClass == null &&
diff --git a/pkg/kernel/lib/transformations/constants.dart b/pkg/kernel/lib/transformations/constants.dart
index c618d81..2c55885 100644
--- a/pkg/kernel/lib/transformations/constants.dart
+++ b/pkg/kernel/lib/transformations/constants.dart
@@ -18,6 +18,8 @@
/// language. Issue(http://dartbug.com/31799)
library kernel.transformations.constants;
+import 'dart:io' as io;
+
import '../kernel.dart';
import '../ast.dart';
import '../core_types.dart';
@@ -30,8 +32,10 @@
{bool keepFields: false,
bool strongMode: false,
bool enableAsserts: false,
+ bool evaluateAnnotations: true,
CoreTypes coreTypes,
- ClassHierarchy hierarchy}) {
+ ClassHierarchy hierarchy,
+ ErrorReporter errorReporter: const _SimpleErrorReporter()}) {
coreTypes ??= new CoreTypes(component);
hierarchy ??= new ClassHierarchy(component);
@@ -41,7 +45,9 @@
transformLibraries(component.libraries, backend, coreTypes, typeEnvironment,
keepFields: keepFields,
strongMode: strongMode,
- enableAsserts: enableAsserts);
+ enableAsserts: enableAsserts,
+ evaluateAnnotations: evaluateAnnotations,
+ errorReporter: errorReporter);
return component;
}
@@ -49,47 +55,22 @@
CoreTypes coreTypes, TypeEnvironment typeEnvironment,
{bool keepFields: false,
bool keepVariables: false,
+ bool evaluateAnnotations: true,
bool strongMode: false,
- bool enableAsserts: false}) {
+ bool enableAsserts: false,
+ ErrorReporter errorReporter: const _SimpleErrorReporter()}) {
final ConstantsTransformer constantsTransformer = new ConstantsTransformer(
backend,
keepFields,
keepVariables,
+ evaluateAnnotations,
coreTypes,
typeEnvironment,
strongMode,
- enableAsserts);
+ enableAsserts,
+ errorReporter);
for (final Library library in libraries) {
- for (final Field field in library.fields.toList()) {
- constantsTransformer.convertField(field);
- }
- for (final Procedure procedure in library.procedures) {
- constantsTransformer.convertProcedure(procedure);
- }
- for (final Class klass in library.classes) {
- constantsTransformer.convertClassAnnotations(klass);
-
- for (final Field field in klass.fields.toList()) {
- constantsTransformer.convertField(field);
- }
- for (final Procedure procedure in klass.procedures) {
- constantsTransformer.convertProcedure(procedure);
- }
- for (final Constructor constructor in klass.constructors) {
- constantsTransformer.convertConstructor(constructor);
- }
- }
- for (final Typedef td in library.typedefs) {
- constantsTransformer.convertTypedef(td);
- }
-
- if (!keepFields) {
- // The transformer API does not iterate over `Library.additionalExports`,
- // so we manually delete the references to shaken nodes.
- library.additionalExports.removeWhere((Reference reference) {
- return reference.canonicalName == null;
- });
- }
+ constantsTransformer.convertLibrary(library);
}
}
@@ -101,56 +82,157 @@
/// Whether to preserve constant [Field]s. All use-sites will be rewritten.
final bool keepFields;
final bool keepVariables;
+ final bool evaluateAnnotations;
ConstantsTransformer(
ConstantsBackend backend,
this.keepFields,
this.keepVariables,
+ this.evaluateAnnotations,
this.coreTypes,
this.typeEnvironment,
bool strongMode,
- bool enableAsserts)
- : constantEvaluator = new ConstantEvaluator(
- backend, typeEnvironment, coreTypes, strongMode, enableAsserts);
+ bool enableAsserts,
+ ErrorReporter errorReporter)
+ : constantEvaluator = new ConstantEvaluator(backend, typeEnvironment,
+ coreTypes, strongMode, enableAsserts, errorReporter);
// Transform the library/class members:
- void convertClassAnnotations(Class klass) {
- constantEvaluator.withNewEnvironment(() {
- transformList(klass.annotations, this, klass);
- });
+ void convertLibrary(Library library) {
+ transformAnnotations(library.annotations, library);
+
+ transformList(library.dependencies, this, library);
+ transformList(library.parts, this, library);
+ transformList(library.typedefs, this, library);
+ transformList(library.classes, this, library);
+ transformList(library.procedures, this, library);
+ transformList(library.fields, this, library);
+
+ if (!keepFields) {
+ // The transformer API does not iterate over `Library.additionalExports`,
+ // so we manually delete the references to shaken nodes.
+ library.additionalExports.removeWhere((Reference reference) {
+ return reference.canonicalName == null;
+ });
+ }
}
- void convertProcedure(Procedure procedure) {
+ visitLibraryPart(LibraryPart node) {
constantEvaluator.withNewEnvironment(() {
- procedure.accept(this);
+ transformAnnotations(node.annotations, node);
});
+ return node;
}
- void convertConstructor(Constructor constructor) {
+ visitLibraryDependency(LibraryDependency node) {
constantEvaluator.withNewEnvironment(() {
- constructor.accept(this);
+ transformAnnotations(node.annotations, node);
});
+ return node;
}
- void convertField(Field field) {
+ visitClass(Class node) {
constantEvaluator.withNewEnvironment(() {
- if (field.accept(this) == null) field.remove();
+ transformAnnotations(node.annotations, node);
+ transformList(node.fields, this, node);
+ transformList(node.typeParameters, this, node);
+ transformList(node.constructors, this, node);
+ transformList(node.procedures, this, node);
+ transformList(node.redirectingFactoryConstructors, this, node);
});
+ return node;
}
- void convertTypedef(Typedef td) {
- // A typedef can have annotations on variables which are constants.
+ visitProcedure(Procedure node) {
constantEvaluator.withNewEnvironment(() {
- td.accept(this);
+ transformAnnotations(node.annotations, node);
+ node.function = node.function.accept(this)..parent = node;
});
+ return node;
+ }
+
+ visitConstructor(Constructor node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ transformList(node.initializers, this, node);
+ node.function = node.function.accept(this)..parent = node;
+ });
+ return node;
+ }
+
+ visitTypedef(Typedef node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ });
+ return node;
+ }
+
+ visitRedirectingFactoryConstructor(RedirectingFactoryConstructor node) {
+ constantEvaluator.withNewEnvironment(() {
+ transformAnnotations(node.annotations, node);
+ transformList(node.typeParameters, this, node);
+ transformList(node.positionalParameters, this, node);
+ transformList(node.namedParameters, this, node);
+ });
+ return node;
+ }
+
+ visitTypeParameter(TypeParameter node) {
+ transformAnnotations(node.annotations, node);
+ return node;
+ }
+
+ void transformAnnotations(List<Expression> nodes, TreeNode parent) {
+ if (evaluateAnnotations && nodes.length > 0) {
+ constantEvaluator.withNewEnvironment(() {
+ for (int i = 0; i < nodes.length; ++i) {
+ nodes[i] = tryEvaluateAndTransformWithContext(parent, nodes[i])
+ ..parent = parent;
+ }
+ });
+ }
}
// Handle definition of constants:
+ visitFunctionNode(FunctionNode node) {
+ final positionalParameterCount = node.positionalParameters.length;
+ for (int i = node.requiredParameterCount;
+ i < positionalParameterCount;
+ ++i) {
+ final VariableDeclaration variable = node.positionalParameters[i];
+ if (variable.initializer != null) {
+ variable.initializer =
+ tryEvaluateAndTransformWithContext(variable, variable.initializer)
+ ..parent = node;
+ }
+ }
+ for (final VariableDeclaration variable in node.namedParameters) {
+ if (variable.initializer != null) {
+ variable.initializer =
+ tryEvaluateAndTransformWithContext(variable, variable.initializer)
+ ..parent = node;
+ }
+ }
+ if (node.body != null) {
+ node.body = node.body.accept(this)..parent = node;
+ }
+ return node;
+ }
+
visitVariableDeclaration(VariableDeclaration node) {
+ transformAnnotations(node.annotations, node);
+
if (node.isConst) {
- final Constant constant = constantEvaluator.evaluate(node.initializer);
+ final Constant constant = tryEvaluateWithContext(node, node.initializer);
+
+ // If there was a constant evaluation error we will not continue and
+ // simply keep the old [node].
+ if (constant == null) {
+ return node;
+ }
+
constantEvaluator.env.addVariableValue(node, constant);
if (keepVariables) {
@@ -170,20 +252,30 @@
}
visitField(Field node) {
- if (node.isConst) {
- // Since we convert all use-sites of constants, the constant [Field]
- // cannot be referenced anymore. We therefore get rid of it if
- // [keepFields] was not specified.
- if (!keepFields) return null;
+ return constantEvaluator.withNewEnvironment(() {
+ if (node.isConst) {
+ // Since we convert all use-sites of constants, the constant [Field]
+ // cannot be referenced anymore. We therefore get rid of it if
+ // [keepFields] was not specified.
+ if (!keepFields) {
+ return null;
+ }
- // Otherwise we keep the constant [Field] and convert it's initializer.
- if (node.initializer != null) {
- final Constant constant = constantEvaluator.evaluate(node.initializer);
- node.initializer = new ConstantExpression(constant)..parent = node;
+ // Otherwise we keep the constant [Field] and convert it's initializer.
+ transformAnnotations(node.annotations, node);
+ if (node.initializer != null) {
+ node.initializer =
+ tryEvaluateAndTransformWithContext(node, node.initializer)
+ ..parent = node;
+ }
+ } else {
+ transformAnnotations(node.annotations, node);
+ if (node.initializer != null) {
+ node.initializer = node.initializer.accept(this)..parent = node;
+ }
}
return node;
- }
- return super.visitField(node);
+ });
}
// Handle use-sites of constants (and "inline" constant expressions):
@@ -191,44 +283,65 @@
visitStaticGet(StaticGet node) {
final Member target = node.target;
if (target is Field && target.isConst) {
- final Constant constant = constantEvaluator.evaluate(target.initializer);
- return new ConstantExpression(constant);
+ final Constant constant =
+ tryEvaluateWithContext(node, target.initializer);
+ return constant != null ? new ConstantExpression(constant) : node;
} else if (target is Procedure && target.kind == ProcedureKind.Method) {
- final Constant constant = constantEvaluator.evaluate(node);
- return new ConstantExpression(constant);
+ return tryEvaluateAndTransformWithContext(node, node);
}
return super.visitStaticGet(node);
}
visitVariableGet(VariableGet node) {
if (node.variable.isConst) {
- final Constant constant =
- constantEvaluator.evaluate(node.variable.initializer);
- return new ConstantExpression(constant);
+ return tryEvaluateAndTransformWithContext(node, node);
}
return super.visitVariableGet(node);
}
visitListLiteral(ListLiteral node) {
if (node.isConst) {
- return new ConstantExpression(constantEvaluator.evaluate(node));
+ return tryEvaluateAndTransformWithContext(node, node);
}
return super.visitListLiteral(node);
}
visitMapLiteral(MapLiteral node) {
if (node.isConst) {
- return new ConstantExpression(constantEvaluator.evaluate(node));
+ return tryEvaluateAndTransformWithContext(node, node);
}
return super.visitMapLiteral(node);
}
visitConstructorInvocation(ConstructorInvocation node) {
if (node.isConst) {
- return new ConstantExpression(constantEvaluator.evaluate(node));
+ return tryEvaluateAndTransformWithContext(node, node);
}
return super.visitConstructorInvocation(node);
}
+
+ tryEvaluateAndTransformWithContext(TreeNode treeContext, Expression node) {
+ final Constant constant = tryEvaluateWithContext(treeContext, node);
+ return constant != null ? new ConstantExpression(constant) : node;
+ }
+
+ tryEvaluateWithContext(TreeNode treeContext, Expression node) {
+ if (treeContext == node) {
+ try {
+ return constantEvaluator.evaluate(node);
+ } on _AbortCurrentEvaluation catch (_) {
+ return null;
+ }
+ }
+
+ return constantEvaluator.runInsideContext(treeContext, () {
+ try {
+ return constantEvaluator.evaluate(node);
+ } on _AbortCurrentEvaluation catch (_) {
+ return null;
+ }
+ });
+ }
}
class ConstantEvaluator extends RecursiveVisitor {
@@ -237,19 +350,23 @@
final TypeEnvironment typeEnvironment;
final bool strongMode;
final bool enableAsserts;
+ final ErrorReporter errorReporter;
final Map<Constant, Constant> canonicalizationCache;
- final Map<Node, Constant> nodeCache;
+ final Map<Node, Object> nodeCache;
final NullConstant nullConstant = new NullConstant();
final BoolConstant trueConstant = new BoolConstant(true);
final BoolConstant falseConstant = new BoolConstant(false);
+ final List<TreeNode> contextChain = [];
+
InstanceBuilder instanceBuilder;
EvaluationEnvironment env;
ConstantEvaluator(this.backend, this.typeEnvironment, this.coreTypes,
- this.strongMode, this.enableAsserts)
+ this.strongMode, this.enableAsserts,
+ [this.errorReporter = const _SimpleErrorReporter()])
: canonicalizationCache = <Constant, Constant>{},
nodeCache = <Node, Constant>{};
@@ -257,16 +374,44 @@
Constant evaluate(Expression node) {
if (node == null) return nullConstant;
if (env.isEmpty) {
- return nodeCache.putIfAbsent(node, () => node.accept(this));
+ // We only try to evaluate the same [node] *once* within an empty
+ // environment.
+ if (nodeCache.containsKey(node)) {
+ final Constant constant = nodeCache[node];
+ if (constant == null) throw const _AbortCurrentEvaluation();
+ return constant;
+ }
+
+ nodeCache[node] = null;
+ return nodeCache[node] = node.accept(this);
}
return node.accept(this);
}
+ Constant runInsideContext(TreeNode node, Constant fun()) {
+ try {
+ pushContext(node);
+ return fun();
+ } finally {
+ popContext(node);
+ }
+ }
+
+ pushContext(TreeNode contextNode) {
+ contextChain.add(contextNode);
+ }
+
+ popContext(TreeNode contextNode) {
+ assert(contextChain.last == contextNode);
+ contextChain.length = contextChain.length - 1;
+ }
+
defaultTreeNode(Node node) {
// Only a subset of the expression language is valid for constant
// evaluation.
- throw new ConstantEvaluationError(
+ errorReporter.unimplemented(contextChain, node,
'Constant evaluation has no support for ${node.runtimeType} yet!');
+ throw const _AbortCurrentEvaluation();
}
visitNullLiteral(NullLiteral node) => nullConstant;
@@ -303,6 +448,10 @@
}
visitListLiteral(ListLiteral node) {
+ if (!node.isConst) {
+ errorReporter.nonConstantLiteral(contextChain, node, 'List');
+ throw const _AbortCurrentEvaluation();
+ }
final List<Constant> entries = new List<Constant>(node.expressions.length);
for (int i = 0; i < node.expressions.length; ++i) {
entries[i] = node.expressions[i].accept(this);
@@ -313,6 +462,10 @@
}
visitMapLiteral(MapLiteral node) {
+ if (!node.isConst) {
+ errorReporter.nonConstantLiteral(contextChain, node, 'Map');
+ throw const _AbortCurrentEvaluation();
+ }
final Set<Constant> usedKeys = new Set<Constant>();
final List<ConstantMapEntry> entries =
new List<ConstantMapEntry>(node.entries.length);
@@ -320,8 +473,8 @@
final key = node.entries[i].key.accept(this);
final value = node.entries[i].value.accept(this);
if (!usedKeys.add(key)) {
- throw new ConstantEvaluationError(
- 'Duplicate key "$key" in constant map literal.');
+ errorReporter.duplicateKey(contextChain, node.entries[i], key);
+ throw const _AbortCurrentEvaluation();
}
entries[i] = new ConstantMapEntry(key, value);
}
@@ -335,6 +488,21 @@
visitConstructorInvocation(ConstructorInvocation node) {
final Constructor constructor = node.target;
final Class klass = constructor.enclosingClass;
+ if (!constructor.isConst) {
+ errorReporter.nonConstConstructorInvocation(
+ contextChain, node, constructor);
+ throw const _AbortCurrentEvaluation();
+ }
+ if (constructor.function.body is! EmptyStatement) {
+ errorReporter.unreachable(contextChain, node,
+ 'Constructor "$node" has non-trivial body "${constructor.function.body.runtimeType}".');
+ throw const _AbortCurrentEvaluation();
+ }
+ if (klass.isAbstract) {
+ errorReporter.unreachable(contextChain, node,
+ 'Constructor "$node" belongs to abstract class "${klass}".');
+ throw const _AbortCurrentEvaluation();
+ }
final typeArguments = evaluateTypeArguments(node.arguments);
final positionals = evaluatePositionalArguments(node.arguments);
@@ -355,80 +523,87 @@
});
}
- void handleConstructorInvocation(
+ handleConstructorInvocation(
Constructor constructor,
List<DartType> typeArguments,
List<Constant> positionalArguments,
Map<String, Constant> namedArguments) {
- return withNewEnvironment(() {
- final Class klass = constructor.enclosingClass;
- final FunctionNode function = constructor.function;
+ return runInsideContext(constructor, () {
+ return withNewEnvironment(() {
+ final Class klass = constructor.enclosingClass;
+ final FunctionNode function = constructor.function;
- // We simulate now the constructor invocation.
+ // We simulate now the constructor invocation.
- // Step 1) Map type arguments and normal arguments from caller to callee.
- for (int i = 0; i < klass.typeParameters.length; i++) {
- env.addTypeParameterValue(klass.typeParameters[i], typeArguments[i]);
- }
- for (int i = 0; i < function.positionalParameters.length; i++) {
- final VariableDeclaration parameter = function.positionalParameters[i];
- final Constant value = (i < positionalArguments.length)
- ? positionalArguments[i]
- : evaluate(parameter.initializer);
- env.addVariableValue(parameter, value);
- }
- for (final VariableDeclaration parameter in function.namedParameters) {
- final Constant value =
- namedArguments[parameter.name] ?? evaluate(parameter.initializer);
- env.addVariableValue(parameter, value);
- }
-
- // Step 2) Run all initializers (including super calls) with environment setup.
- for (final Field field in klass.fields) {
- if (!field.isStatic) {
- instanceBuilder.setFieldValue(field, evaluate(field.initializer));
+ // Step 1) Map type arguments and normal arguments from caller to callee.
+ for (int i = 0; i < klass.typeParameters.length; i++) {
+ env.addTypeParameterValue(klass.typeParameters[i], typeArguments[i]);
}
- }
- for (final Initializer init in constructor.initializers) {
- if (init is FieldInitializer) {
- instanceBuilder.setFieldValue(init.field, evaluate(init.value));
- } else if (init is LocalInitializer) {
- final VariableDeclaration variable = init.variable;
- env.addVariableValue(variable, evaluate(variable.initializer));
- } else if (init is SuperInitializer) {
- handleConstructorInvocation(
- init.target,
- evaluateSuperTypeArguments(constructor.enclosingClass.supertype),
- evaluatePositionalArguments(init.arguments),
- evaluateNamedArguments(init.arguments));
- } else if (init is RedirectingInitializer) {
- // Since a redirecting constructor targets a constructor of the same
- // class, we pass the same [typeArguments].
- handleConstructorInvocation(
- init.target,
- typeArguments,
- evaluatePositionalArguments(init.arguments),
- evaluateNamedArguments(init.arguments));
- } else if (init is AssertInitializer) {
- if (enableAsserts) {
- final Constant condition = init.statement.condition.accept(this);
+ for (int i = 0; i < function.positionalParameters.length; i++) {
+ final VariableDeclaration parameter =
+ function.positionalParameters[i];
+ final Constant value = (i < positionalArguments.length)
+ ? positionalArguments[i]
+ : evaluate(parameter.initializer);
+ env.addVariableValue(parameter, value);
+ }
+ for (final VariableDeclaration parameter in function.namedParameters) {
+ final Constant value =
+ namedArguments[parameter.name] ?? evaluate(parameter.initializer);
+ env.addVariableValue(parameter, value);
+ }
- if (condition is BoolConstant) {
- if (!condition.value) {
- final Constant message = init.statement.message?.accept(this);
- throw new ConstantEvaluationError(
- 'Assert initializer condition failed with message: $message.');
- }
- } else {
- throw new ConstantEvaluationError(
- 'Assert initializer did not evaluate to a boolean condition.');
- }
+ // Step 2) Run all initializers (including super calls) with environment setup.
+ for (final Field field in klass.fields) {
+ if (!field.isStatic) {
+ instanceBuilder.setFieldValue(field, evaluate(field.initializer));
}
- } else {
- throw new ConstantEvaluationError(
- 'Cannot evaluate constant with [${init.runtimeType}].');
}
- }
+ for (final Initializer init in constructor.initializers) {
+ if (init is FieldInitializer) {
+ instanceBuilder.setFieldValue(init.field, evaluate(init.value));
+ } else if (init is LocalInitializer) {
+ final VariableDeclaration variable = init.variable;
+ env.addVariableValue(variable, evaluate(variable.initializer));
+ } else if (init is SuperInitializer) {
+ handleConstructorInvocation(
+ init.target,
+ evaluateSuperTypeArguments(
+ constructor.enclosingClass.supertype),
+ evaluatePositionalArguments(init.arguments),
+ evaluateNamedArguments(init.arguments));
+ } else if (init is RedirectingInitializer) {
+ // Since a redirecting constructor targets a constructor of the same
+ // class, we pass the same [typeArguments].
+ handleConstructorInvocation(
+ init.target,
+ typeArguments,
+ evaluatePositionalArguments(init.arguments),
+ evaluateNamedArguments(init.arguments));
+ } else if (init is AssertInitializer) {
+ if (enableAsserts) {
+ final Constant condition = init.statement.condition.accept(this);
+
+ if (condition is BoolConstant) {
+ if (!condition.value) {
+ final Constant message = init.statement.message?.accept(this);
+ errorReporter.failedAssertion(
+ contextChain, init.statement.condition, message);
+ throw const _AbortCurrentEvaluation();
+ }
+ } else {
+ errorReporter.invalidType(
+ contextChain, init.statement.condition, condition, 'bool');
+ throw const _AbortCurrentEvaluation();
+ }
+ }
+ } else {
+ errorReporter.unimplemented(contextChain, init,
+ 'No support for handling initializer of type "${init.runtimeType}".');
+ throw const _AbortCurrentEvaluation();
+ }
+ }
+ });
});
}
@@ -463,9 +638,14 @@
if (arguments.length == 1) {
switch (node.name.name) {
case '+':
- final StringConstant other = arguments[0];
- return canonicalize(
- new StringConstant(receiver.value + other.value));
+ final Constant other = arguments[0];
+ if (other is StringConstant) {
+ return canonicalize(
+ new StringConstant(receiver.value + other.value));
+ }
+ errorReporter.invalidBinaryOperandType(
+ contextChain, node, 'String', '+', 'String', '$other');
+ throw const _AbortCurrentEvaluation();
}
}
} else if (receiver is BoolConstant) {
@@ -488,8 +668,9 @@
: falseConstant;
}
}
- throw new ConstantEvaluationError(
- 'Method "${node.name}" is only allowed with boolean arguments.');
+ errorReporter.invalidBinaryOperandType(
+ contextChain, node, 'bool', '${node.name.name}', 'bool', '$right');
+ throw const _AbortCurrentEvaluation();
}
} else if (receiver is IntConstant) {
if (arguments.length == 0) {
@@ -526,8 +707,12 @@
? other.value
: (other as DoubleConstant).value;
return evaluateBinaryNumericOperation(
- node.name.name, receiver.value, value);
+ node.name.name, receiver.value, value, node);
}
+
+ errorReporter.invalidBinaryOperandType(contextChain, node, 'int',
+ '${node.name.name}', 'int/double', '$other');
+ throw const _AbortCurrentEvaluation();
}
} else if (receiver is DoubleConstant) {
if (arguments.length == 0) {
@@ -543,14 +728,16 @@
? other.value
: (other as DoubleConstant).value;
return evaluateBinaryNumericOperation(
- node.name.name, receiver.value, value);
+ node.name.name, receiver.value, value, node);
}
+ errorReporter.invalidBinaryOperandType(contextChain, node, 'double',
+ '${node.name.name}', 'int/double', '$other');
+ throw const _AbortCurrentEvaluation();
}
}
-
- throw new ConstantEvaluationError(
- 'Cannot evaluate general method invocation: '
- 'receiver: $receiver, method: ${node.name}, arguments: $arguments!');
+ errorReporter.invalidMethodInvocation(
+ contextChain, node, receiver, node.name.name);
+ throw const _AbortCurrentEvaluation();
}
visitLogicalExpression(LogicalExpression node) {
@@ -564,11 +751,13 @@
if (right is BoolConstant) {
return right;
}
- throw new ConstantEvaluationError(
- '"$right" is not bool constant and is disallowed with "||".');
+ errorReporter.invalidBinaryOperandType(
+ contextChain, node, 'bool', '${node.operator}', 'bool', '$right');
+ throw const _AbortCurrentEvaluation();
}
- throw new ConstantEvaluationError(
- '"$left" is not bool constant and is disallowed with "||".');
+ errorReporter.invalidMethodInvocation(
+ contextChain, node, left, '${node.operator}');
+ throw const _AbortCurrentEvaluation();
case '&&':
if (left is BoolConstant) {
if (!left.value) return falseConstant;
@@ -577,16 +766,19 @@
if (right is BoolConstant) {
return right;
}
- throw new ConstantEvaluationError(
- '"$right" is not bool constant and is disallowed with "&&".');
+ errorReporter.invalidBinaryOperandType(
+ contextChain, node, 'bool', '${node.operator}', 'bool', '$right');
+ throw const _AbortCurrentEvaluation();
}
- throw new ConstantEvaluationError(
- '"$left" is not bool constant and is disallowed with "&&".');
+ errorReporter.invalidMethodInvocation(
+ contextChain, node, left, '${node.operator}');
+ throw const _AbortCurrentEvaluation();
case '??':
return (left is! NullConstant) ? left : evaluate(node.right);
default:
- throw new ConstantEvaluationError(
- 'No support for logical operator ${node.operator}.');
+ errorReporter.invalidMethodInvocation(
+ contextChain, node, left, '${node.operator}');
+ throw const _AbortCurrentEvaluation();
}
}
@@ -597,8 +789,8 @@
} else if (constant == falseConstant) {
return evaluate(node.otherwise);
} else {
- throw new ConstantEvaluationError(
- 'Cannot use $constant as condition in a conditional expression.');
+ errorReporter.invalidType(contextChain, node, constant, 'bool');
+ throw const _AbortCurrentEvaluation();
}
}
@@ -623,7 +815,6 @@
}
}
}
-
throw 'Could not evaluate property get on $receiver.';
}
@@ -633,6 +824,19 @@
}
visitVariableGet(VariableGet node) {
+ // Not every variable which a [VariableGet] refers to must be marked as
+ // constant. For example function parameters as well as constructs
+ // desugared to [Let] expressions are ok.
+ //
+ // TODO(kustermann): The heuristic of allowing all [VariableGet]s on [Let]
+ // variables might allow more than it should.
+ final VariableDeclaration variable = node.variable;
+ if (!variable.isConst &&
+ !_isFormalParameter(variable) &&
+ variable.parent is! Let) {
+ errorReporter.nonConstantVariableGet(contextChain, node);
+ throw const _AbortCurrentEvaluation();
+ }
return env.lookupVariable(node.variable);
}
@@ -640,11 +844,20 @@
return withNewEnvironment(() {
final Member target = node.target;
if (target is Field && target.isConst) {
- return evaluate(target.initializer);
+ return runInsideContext(target, () {
+ return evaluate(target.initializer);
+ });
} else if (target is Procedure) {
- return canonicalize(new TearOffConstant(target));
+ if (target.kind == ProcedureKind.Method) {
+ return canonicalize(new TearOffConstant(target));
+ }
+ errorReporter.invalidStaticInvocation(contextChain, node, target);
+ throw const _AbortCurrentEvaluation();
+ } else {
+ errorReporter.unreachable(contextChain, node,
+ 'No support for ${target.runtimeType} in a static-get.');
+ throw const _AbortCurrentEvaluation();
}
- throw 'Could not handle static get of $target.';
});
}
@@ -663,55 +876,51 @@
} else if (constant is StringConstant) {
return constant.value;
} else {
- throw new ConstantEvaluationError(
- 'Only null/bool/int/double/String values are allowed as string '
- 'interpolation expressions during constant evaluation.');
+ errorReporter.invalidStringInterpolationOperand(
+ contextChain, node, constant);
+ throw const _AbortCurrentEvaluation();
}
}).join('');
return canonicalize(new StringConstant(value));
}
visitStaticInvocation(StaticInvocation node) {
- final Member target = node.target;
- if (target is Procedure) {
- if (target.kind == ProcedureKind.Factory) {
- final String nativeName = findNativeName(target);
- if (nativeName != null) {
- final Constant constant = backend.buildConstantForNative(
- nativeName,
- evaluateTypeArguments(node.arguments),
- evaluatePositionalArguments(node.arguments),
- evaluateNamedArguments(node.arguments));
- assert(constant != null);
- return canonicalize(constant);
- }
- } else if (target.name.name == 'identical') {
- // Ensure the "identical()" function comes from dart:core.
- final parent = target.parent;
- if (parent is Library && parent == coreTypes.coreLibrary) {
- final positionalArguments =
- evaluatePositionalArguments(node.arguments);
- final Constant left = positionalArguments[0];
- // TODO(http://dartbug.com/31799): Re-enable these checks.
- //ensurePrimitiveConstant(left);
- final Constant right = positionalArguments[1];
- // TODO(http://dartbug.com/31799): Re-enable these checks.
- //ensurePrimitiveConstant(right);
- // Since we canonicalize constants during the evaluation, we can use
- // identical here.
- assert(left == right);
- return identical(left, right) ? trueConstant : falseConstant;
- }
+ final Procedure target = node.target;
+ if (target.kind == ProcedureKind.Factory) {
+ final String nativeName = findNativeName(target);
+ if (nativeName != null) {
+ final Constant constant = backend.buildConstantForNative(
+ nativeName,
+ evaluateTypeArguments(node.arguments),
+ evaluatePositionalArguments(node.arguments),
+ evaluateNamedArguments(node.arguments));
+ assert(constant != null);
+ return canonicalize(constant);
+ }
+ } else if (target.name.name == 'identical') {
+ // Ensure the "identical()" function comes from dart:core.
+ final parent = target.parent;
+ if (parent is Library && parent == coreTypes.coreLibrary) {
+ final positionalArguments = evaluatePositionalArguments(node.arguments);
+ final Constant left = positionalArguments[0];
+ // TODO(http://dartbug.com/31799): Re-enable these checks.
+ //ensurePrimitiveConstant(left, node);
+ final Constant right = positionalArguments[1];
+ // TODO(http://dartbug.com/31799): Re-enable these checks.
+ //ensurePrimitiveConstant(right, node);
+ // Since we canonicalize constants during the evaluation, we can use
+ // identical here.
+ assert(left == right);
+ return identical(left, right) ? trueConstant : falseConstant;
}
}
-
- throw new ConstantEvaluationError(
- 'Calling "$target" during constant evaluation is disallowed.');
+ errorReporter.invalidStaticInvocation(contextChain, node, target);
+ throw const _AbortCurrentEvaluation();
}
visitAsExpression(AsExpression node) {
final Constant constant = node.operand.accept(this);
- ensureIsSubtype(constant, evaluateDartType(node.type));
+ ensureIsSubtype(constant, evaluateDartType(node.type), node);
return constant;
}
@@ -720,8 +929,8 @@
if (constant is BoolConstant) {
return constant == trueConstant ? falseConstant : trueConstant;
}
- throw new ConstantEvaluationError(
- 'A not expression must have a boolean operand.');
+ errorReporter.invalidType(contextChain, node, constant, 'bool');
+ throw const _AbortCurrentEvaluation();
}
visitSymbolLiteral(SymbolLiteral node) {
@@ -737,17 +946,21 @@
return canonicalize(
new PartialInstantiationConstant(constant, node.typeArguments));
}
- throw new ConstantEvaluationError(
+ errorReporter.unreachable(
+ contextChain,
+ node,
'The number of type arguments supplied in the partial instantiation '
'does not match the number of type arguments of the $constant.');
+ throw const _AbortCurrentEvaluation();
}
- throw new ConstantEvaluationError(
+ errorReporter.unreachable(contextChain, node,
'Only tear-off constants can be partially instantiated.');
+ throw const _AbortCurrentEvaluation();
}
// Helper methods:
- void ensureIsSubtype(Constant constant, DartType type) {
+ void ensureIsSubtype(Constant constant, DartType type, TreeNode node) {
DartType constantType;
if (constant is NullConstant) {
constantType = new InterfaceType(coreTypes.nullClass);
@@ -772,13 +985,14 @@
} else if (constant is TypeLiteralConstant) {
constantType = new InterfaceType(coreTypes.typeClass);
} else {
- throw new ConstantEvaluationError(
- 'No support for obtaining the type of $constant.');
+ errorReporter.unreachable(contextChain, node,
+ 'No support for ${constant.runtimeType}.runtimeType');
+ throw const _AbortCurrentEvaluation();
}
if (!typeEnvironment.isSubtypeOf(constantType, type)) {
- throw new ConstantEvaluationError(
- 'Constant $constant is not a subtype of ${type}.');
+ errorReporter.invalidType(contextChain, node, constant, '$type');
+ throw const _AbortCurrentEvaluation();
}
}
@@ -821,33 +1035,37 @@
withNewInstanceBuilder(Class klass, List<DartType> typeArguments, fn()) {
InstanceBuilder old = instanceBuilder;
- instanceBuilder = new InstanceBuilder(klass, typeArguments);
- final result = fn();
- instanceBuilder = old;
- return result;
+ try {
+ instanceBuilder = new InstanceBuilder(klass, typeArguments);
+ return fn();
+ } finally {
+ instanceBuilder = old;
+ }
}
withNewEnvironment(fn()) {
final EvaluationEnvironment oldEnv = env;
- env = new EvaluationEnvironment();
- final result = fn();
- env = oldEnv;
- return result;
+ try {
+ env = new EvaluationEnvironment();
+ return fn();
+ } finally {
+ env = oldEnv;
+ }
}
- ensurePrimitiveConstant(Constant value) {
+ ensurePrimitiveConstant(Constant value, TreeNode node) {
if (value is! NullConstant &&
value is! BoolConstant &&
value is! IntConstant &&
value is! DoubleConstant &&
value is! StringConstant) {
- throw new ConstantEvaluationError(
- '"$value" is not a primitive constant (null/bool/int/double/string) '
- ' and is disallowed in this context.');
+ errorReporter.invalidType(
+ contextChain, node, value, 'bool/int/double/Null/String');
+ throw const _AbortCurrentEvaluation();
}
}
- evaluateBinaryNumericOperation(String op, num a, num b) {
+ evaluateBinaryNumericOperation(String op, num a, num b, TreeNode node) {
num result;
switch (op) {
case '+':
@@ -887,8 +1105,8 @@
return a > b ? trueConstant : falseConstant;
}
- throw new ConstantEvaluationError(
- 'Binary operation "$op" on num is disallowed.');
+ errorReporter.invalidBinaryMethodInvocation(contextChain, node, op);
+ throw const _AbortCurrentEvaluation();
}
int _wrapAroundInteger(int value) {
@@ -985,11 +1203,165 @@
Constant lowerMapConstant(MapConstant constant);
}
-/// Represents a compile-time error reported during constant evaluation.
-class ConstantEvaluationError {
- final String message;
+// Used as control-flow to abort the current evaluation.
+class _AbortCurrentEvaluation {
+ const _AbortCurrentEvaluation();
+}
- ConstantEvaluationError(this.message);
+abstract class ErrorReporter {
+ const ErrorReporter();
- String toString() => 'Error during constant evaluation: $message';
+ invalidType(List<TreeNode> context, TreeNode node, Constant receiver,
+ String expectedType);
+ invalidBinaryOperandType(List<TreeNode> context, TreeNode node,
+ String receiverType, String op, String expectedType, String actualType);
+ invalidBinaryMethodInvocation(
+ List<TreeNode> context, TreeNode node, String op);
+ invalidMethodInvocation(
+ List<TreeNode> context, TreeNode node, Constant receiver, String op);
+ invalidStaticInvocation(
+ List<TreeNode> context, TreeNode node, Procedure target);
+ invalidStringInterpolationOperand(
+ List<TreeNode> context, TreeNode node, Constant constant);
+ duplicateKey(List<TreeNode> context, TreeNode node, Constant key);
+ nonConstantLiteral(List<TreeNode> context, TreeNode node, String literalType);
+ nonConstantVariableGet(List<TreeNode> context, VariableGet node);
+ nonConstConstructorInvocation(
+ List<TreeNode> context, TreeNode node, Constructor target);
+ failedAssertion(List<TreeNode> context, TreeNode node, Constant message);
+ unimplemented(List<TreeNode> context, TreeNode node, String message);
+ unreachable(List<TreeNode> context, TreeNode node, String message);
+}
+
+abstract class ErrorReporterBase implements ErrorReporter {
+ const ErrorReporterBase();
+
+ report(List<TreeNode> context, String message, TreeNode node);
+
+ getFileUri(TreeNode node) {
+ while (node is! FileUriNode) {
+ node = node.parent;
+ }
+ return (node as FileUriNode).fileUri;
+ }
+
+ getFileOffset(TreeNode node) {
+ while (node.fileOffset == TreeNode.noOffset) {
+ node = node.parent;
+ }
+ return node == null ? TreeNode.noOffset : node.fileOffset;
+ }
+
+ invalidType(List<TreeNode> context, TreeNode node, Constant receiver,
+ String expectedType) {
+ report(
+ context,
+ 'Expected expression to evaluate to "$expectedType" but got "$receiver.',
+ node);
+ }
+
+ invalidBinaryOperandType(List<TreeNode> context, TreeNode node,
+ String receiverType, String op, String expectedType, String actualType) {
+ report(
+ context,
+ 'Calling "$op" on "$receiverType" needs operand of type '
+ '"$expectedType" (but got "$actualType")',
+ node);
+ }
+
+ invalidBinaryMethodInvocation(
+ List<TreeNode> context, TreeNode node, String op) {
+ report(context, 'Cannot call "$op" on a numeric constant receiver', node);
+ }
+
+ invalidMethodInvocation(
+ List<TreeNode> context, TreeNode node, Constant receiver, String op) {
+ report(context, 'Cannot call "$op" on "$receiver" in constant expression',
+ node);
+ }
+
+ invalidStaticInvocation(
+ List<TreeNode> context, TreeNode node, Procedure target) {
+ report(
+ context, 'Cannot invoke "$target" inside a constant expression', node);
+ }
+
+ invalidStringInterpolationOperand(
+ List<TreeNode> context, TreeNode node, Constant constant) {
+ report(
+ context,
+ 'Only null/bool/int/double/String values are allowed as string '
+ 'interpolation expressions during constant evaluation (was: "$constant").',
+ node);
+ }
+
+ duplicateKey(List<TreeNode> context, TreeNode node, Constant key) {
+ report(
+ context,
+ 'Duplicate keys are not allowed in constant maps (found duplicate key "$key")',
+ node);
+ }
+
+ nonConstantLiteral(
+ List<TreeNode> context, TreeNode node, String literalType) {
+ report(
+ context,
+ '"$literalType" literals inside constant expressions are required to '
+ 'be constant.',
+ node);
+ }
+
+ nonConstantVariableGet(List<TreeNode> context, VariableGet node) {
+ report(
+ context,
+ 'The variable "${node.variable.name}" is non-const and '
+ 'can therefore not be used inside a constant expression.'
+ ' (${node}, ${node.parent.parent}, )',
+ node);
+ }
+
+ nonConstConstructorInvocation(
+ List<TreeNode> context, TreeNode node, Constructor target) {
+ report(
+ context,
+ 'The non-const constructor "$target" cannot be called inside a '
+ 'constant expression',
+ node);
+ }
+
+ failedAssertion(List<TreeNode> context, TreeNode node, Constant message) {
+ report(
+ context,
+ 'The assertion condition evaluated to "false" with message "$message"',
+ node);
+ }
+
+ unimplemented(List<TreeNode> context, TreeNode node, String message) {
+ report(context, 'Unimplemented: $message', node);
+ }
+
+ unreachable(List<TreeNode> context, TreeNode node, String message) {
+ report(context, 'Unreachable: $message', node);
+ }
+}
+
+class _SimpleErrorReporter extends ErrorReporterBase {
+ const _SimpleErrorReporter();
+
+ report(List<TreeNode> context, String message, TreeNode node) {
+ io.exitCode = 42;
+ final Uri uri = getFileUri(node);
+ final int fileOffset = getFileOffset(node);
+
+ io.stderr.writeln('$uri:$fileOffset Constant evaluation error: $message');
+ }
+}
+
+bool _isFormalParameter(VariableDeclaration variable) {
+ final parent = variable.parent;
+ if (parent is FunctionNode) {
+ return parent.positionalParameters.contains(variable) ||
+ parent.namedParameters.contains(variable);
+ }
+ return false;
}
diff --git a/pkg/kernel/pubspec.yaml b/pkg/kernel/pubspec.yaml
index a08802c..9e5e4f8 100644
--- a/pkg/kernel/pubspec.yaml
+++ b/pkg/kernel/pubspec.yaml
@@ -1,5 +1,5 @@
name: kernel
-version: 0.3.0-alpha.11
+version: 0.3.0-alpha.12
author: Dart Team <misc@dartlang.org>
description: Dart IR (Intermediate Representation)
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/kernel
@@ -12,7 +12,7 @@
package_config: ^1.0.0
dev_dependencies:
analyzer: '>=0.30.0 <0.32.0'
- front_end: 0.1.0-alpha.11
+ front_end: 0.1.0-alpha.12
test: ^0.12.15+6
stack_trace: ^1.6.6
ansicolor: ^0.0.9
diff --git a/pkg/sourcemap_testing/lib/src/annotated_code_helper.dart b/pkg/sourcemap_testing/lib/src/annotated_code_helper.dart
index b446f0e..d6291b9 100644
--- a/pkg/sourcemap_testing/lib/src/annotated_code_helper.dart
+++ b/pkg/sourcemap_testing/lib/src/annotated_code_helper.dart
@@ -25,6 +25,9 @@
final String text;
Annotation(this.lineNo, this.columnNo, this.offset, this.text);
+
+ String toString() =>
+ 'Annotation(lineNo=$lineNo,columnNo=$columnNo,offset=$offset,text=$text)';
}
/// A source code text with annotated positions.
@@ -183,17 +186,30 @@
for (String prefix in prefixes) {
map[prefix] = <Annotation>[];
}
- outer:
for (Annotation annotation in annotatedCode.annotations) {
- for (String prefix in prefixes) {
- if (annotation.text.startsWith(prefix)) {
- map[prefix].add(new Annotation(annotation.lineNo, annotation.columnNo,
- annotation.offset, annotation.text.substring(prefix.length)));
- continue outer;
- }
+ String annotationText = annotation.text;
+ String annotationPrefix;
+ bool not = false;
+ if (annotationText.startsWith('!')) {
+ annotationText = annotationText.substring(1);
+ not = true;
}
for (String prefix in prefixes) {
- map[prefix].add(annotation);
+ if (annotationText.startsWith(prefix)) {
+ annotationPrefix = prefix;
+ annotation = new Annotation(annotation.lineNo, annotation.columnNo,
+ annotation.offset, annotationText.substring(prefix.length));
+ }
+ }
+
+ for (String prefix in prefixes) {
+ if (annotationPrefix == null) {
+ map[prefix].add(annotation);
+ } else if (annotationPrefix != prefix && not) {
+ map[prefix].add(annotation);
+ } else if (annotationPrefix == prefix && !not) {
+ map[prefix].add(annotation);
+ }
}
}
Map<String, AnnotatedCode> split = <String, AnnotatedCode>{};
diff --git a/pkg/vm/lib/transformations/no_dynamic_invocations_annotator.dart b/pkg/vm/lib/transformations/no_dynamic_invocations_annotator.dart
index 9806c89..aff93fa 100644
--- a/pkg/vm/lib/transformations/no_dynamic_invocations_annotator.dart
+++ b/pkg/vm/lib/transformations/no_dynamic_invocations_annotator.dart
@@ -164,6 +164,13 @@
}
@override
+ visitConstantExpression(ConstantExpression node) {
+ // We run the kernel2kernel "constants" transformation before running the
+ // this transformation, so we will encounter constant expressions.
+ // We don't need to do anything here, because there are no invocations.
+ }
+
+ @override
visitMethodInvocation(MethodInvocation node) {
super.visitMethodInvocation(node);
diff --git a/runtime/bin/io_buffer.cc b/runtime/bin/io_buffer.cc
index ec8962a..b213a85 100644
--- a/runtime/bin/io_buffer.cc
+++ b/runtime/bin/io_buffer.cc
@@ -12,9 +12,8 @@
if (data == NULL) {
return Dart_Null();
}
- Dart_Handle result =
- Dart_NewExternalTypedData(Dart_TypedData_kUint8, data, size);
- Dart_NewWeakPersistentHandle(result, data, size, IOBuffer::Finalizer);
+ Dart_Handle result = Dart_NewExternalTypedDataWithFinalizer(
+ Dart_TypedData_kUint8, data, size, data, size, IOBuffer::Finalizer);
if (Dart_IsError(result)) {
Free(data);
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 1e9e8e1..7d7a298 100644
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -2086,9 +2086,8 @@
* Returns a TypedData object which references an external data array.
*
* \param type The type of the data array.
- * \param value A data array. This array must not move.
+ * \param data A data array. This array must not move.
* \param length The length of the data array (length in type units).
- * \param peer An external pointer to associate with this array.
*
* \return The TypedData object if no error occurs. Otherwise returns
* an error handle.
@@ -2098,6 +2097,31 @@
intptr_t length);
/**
+ * Returns a TypedData object which references an external data array.
+ *
+ * \param type The type of the data array.
+ * \param data A data array. This array must not move.
+ * \param length The length of the data array (length in type units).
+ * \param peer A pointer to a native object or NULL. This value is
+ * provided to callback when it is invoked.
+ * \param external_allocation_size The number of externally allocated
+ * bytes for peer. Used to inform the garbage collector.
+ * \param callback A function pointer that will be invoked sometime
+ * after the object is garbage collected, unless the handle has been deleted.
+ * A valid callback needs to be specified it cannot be NULL.
+ *
+ * \return The TypedData object if no error occurs. Otherwise returns
+ * an error handle.
+ */
+DART_EXPORT Dart_Handle Dart_NewExternalTypedDataWithFinalizer(
+ Dart_TypedData_Type type,
+ void* data,
+ intptr_t length,
+ void* peer,
+ intptr_t external_allocation_size,
+ Dart_WeakPersistentHandleFinalizer callback);
+
+/**
* Returns a ByteBuffer object for the typed data.
*
* \param type_data The TypedData object.
diff --git a/runtime/lib/vmservice.cc b/runtime/lib/vmservice.cc
index eeeeb50..fce6e21 100644
--- a/runtime/lib/vmservice.cc
+++ b/runtime/lib/vmservice.cc
@@ -403,11 +403,10 @@
FilenameFinalizer);
ASSERT(!Dart_IsError(dart_filename));
- Dart_Handle dart_contents = Dart_NewExternalTypedData(
- Dart_TypedData_kUint8, contents, contents_length);
+ Dart_Handle dart_contents = Dart_NewExternalTypedDataWithFinalizer(
+ Dart_TypedData_kUint8, contents, contents_length, contents,
+ contents_length, ContentsFinalizer);
ASSERT(!Dart_IsError(dart_contents));
- Dart_NewWeakPersistentHandle(dart_contents, contents, contents_length,
- ContentsFinalizer);
Dart_ListSetAt(result_list, idx, dart_filename);
Dart_ListSetAt(result_list, (idx + 1), dart_contents);
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index 10e307c..ef225bc 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -245,13 +245,6 @@
#error Architecture was not detected as supported by Dart.
#endif
-#if defined(TARGET_ARCH_ARM64) || defined(TARGET_ARCH_X64)
-// On 64 bit architectures the optimizing compilers should prefer unboxed int64
-// and unboxed uint32 values, which have direct support in the instruction set.
-// We avoid the unboxed signed int32 type.
-#define AVOID_UNBOXED_INT32 1
-#endif
-
// DART_FORCE_INLINE strongly hints to the compiler that a function should
// be inlined. Your function is not guaranteed to be inlined but this is
// stronger than just using "inline".
diff --git a/runtime/platform/utils.h b/runtime/platform/utils.h
index c717cbc..2917008 100644
--- a/runtime/platform/utils.h
+++ b/runtime/platform/utils.h
@@ -317,7 +317,7 @@
static uword NBitMask(uint32_t n) {
ASSERT(n <= kBitsPerWord);
if (n == kBitsPerWord) {
-#if defined(ARCH_IS_64_BIT)
+#if defined(TARGET_ARCH_X64)
return 0xffffffffffffffffll;
#else
return 0xffffffff;
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 650db2a..e465222 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -5348,6 +5348,13 @@
}
RawApiError* Deserializer::VerifyVersionAndFeatures(Isolate* isolate) {
+ if (image_reader_ != NULL) {
+ RawApiError* error = image_reader_->VerifyAlignment();
+ if (error != ApiError::null()) {
+ return error;
+ }
+ }
+
// If the version string doesn't match, return an error.
// Note: New things are allocated only if we're going to return an error.
diff --git a/runtime/vm/compiler/assembler/assembler_arm.h b/runtime/vm/compiler/assembler/assembler_arm.h
index 9b81f54..ab6f811 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.h
+++ b/runtime/vm/compiler/assembler/assembler_arm.h
@@ -141,11 +141,6 @@
static_cast<uint32_t>(rm);
}
- static bool CanHold(uint32_t immediate) {
- Operand dummy;
- return CanHold(immediate, &dummy);
- }
-
static bool CanHold(uint32_t immediate, Operand* o) {
// Avoid the more expensive test for frequent small immediate values.
if (immediate < (1 << kImmed8Bits)) {
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.cc b/runtime/vm/compiler/assembler/assembler_arm64.cc
index 255c85b..a322f7c 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64.cc
@@ -660,43 +660,24 @@
blr(TMP);
}
-void Assembler::AddImmediate(Register dest,
- Register rn,
- int64_t imm,
- OperandSize sz) {
+void Assembler::AddImmediate(Register dest, Register rn, int64_t imm) {
Operand op;
if (imm == 0) {
if (dest != rn) {
- if (sz == kWord) {
- uxtw(dest, rn);
- } else {
- mov(dest, rn);
- }
+ mov(dest, rn);
}
return;
}
if (Operand::CanHold(imm, kXRegSizeInBits, &op) == Operand::Immediate) {
- if (sz == kDoubleWord) {
- add(dest, rn, op);
- } else {
- addw(dest, rn, op);
- }
+ add(dest, rn, op);
} else if (Operand::CanHold(-imm, kXRegSizeInBits, &op) ==
Operand::Immediate) {
- if (sz == kDoubleWord) {
- sub(dest, rn, op);
- } else {
- subw(dest, rn, op);
- }
+ sub(dest, rn, op);
} else {
// TODO(zra): Try adding top 12 bits, then bottom 12 bits.
ASSERT(rn != TMP2);
LoadImmediate(TMP2, imm);
- if (sz == kDoubleWord) {
- add(dest, rn, Operand(TMP2));
- } else {
- addw(dest, rn, Operand(TMP2));
- }
+ add(dest, rn, Operand(TMP2));
}
}
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.h b/runtime/vm/compiler/assembler/assembler_arm64.h
index 437c246..5a6a9d1 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.h
+++ b/runtime/vm/compiler/assembler/assembler_arm64.h
@@ -390,17 +390,6 @@
// undefined.
static bool IsImmLogical(uint64_t value, uint8_t width, Operand* imm_op);
- static bool IsImmLogical(int64_t imm) {
- Operand operand;
- return IsImmLogical(imm, kXRegSizeInBits, &operand);
- }
-
- static bool IsImmArithmethic(int64_t imm) {
- Operand operand;
- CanHold(imm, kXRegSizeInBits, &operand);
- return operand.type_ == Immediate;
- }
-
// An immediate imm can be an operand to add/sub when the return value is
// Immediate, or a logical operation over sz bits when the return value is
// BitfieldImm. If the return value is Unknown, then the immediate can't be
@@ -1418,10 +1407,7 @@
// the object pool when possible. Unless you are sure that the untagged object
// pool pointer is in another register, or that it is not available at all,
// PP should be passed for pp.
- void AddImmediate(Register dest,
- Register rn,
- int64_t imm,
- OperandSize sz = kDoubleWord);
+ void AddImmediate(Register dest, Register rn, int64_t imm);
void AddImmediateSetFlags(Register dest,
Register rn,
int64_t imm,
@@ -1641,27 +1627,6 @@
#endif
}
- void AssertValidUint32(Register r) {
-#if defined(DEBUG)
- Label ok;
- cmp(ZR, Operand(r, LSR, 32));
- b(&ok, EQ);
- Stop("uint32 should be zero extended");
- Bind(&ok);
-#endif
- }
-
- void AssertValidSignExtendedInt32(Register r) {
-#if defined(DEBUGFOO)
- Label ok;
- AsrImmediate(TMP, r, 63); // 0 or -1.
- cmp(TMP, Operand(r, ASR, 31));
- b(&ok, EQ);
- Stop("int32 should be sign extended");
- Bind(&ok);
-#endif
- }
-
private:
AssemblerBuffer buffer_; // Contains position independent code.
ObjectPoolWrapper object_pool_wrapper_;
diff --git a/runtime/vm/compiler/assembler/assembler_x64.h b/runtime/vm/compiler/assembler/assembler_x64.h
index 70c492a..5d9375d3 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.h
+++ b/runtime/vm/compiler/assembler/assembler_x64.h
@@ -977,24 +977,6 @@
static bool IsSafe(const Object& object) { return true; }
static bool IsSafeSmi(const Object& object) { return object.IsSmi(); }
- void AssertValidUint32(Register r) {
- Label ok;
- movl(TMP, r);
- cmpq(TMP, r);
- j(EQUAL, &ok);
- Stop("uint32 should be zero extended");
- Bind(&ok);
- }
-
- void AssertValidSignExtendedInt32(Register r) {
- Label ok;
- movsxd(TMP, r);
- cmpq(TMP, r);
- j(EQUAL, &ok);
- Stop("int32 should be sign extended");
- Bind(&ok);
- }
-
private:
AssemblerBuffer buffer_;
diff --git a/runtime/vm/compiler/backend/flow_graph.cc b/runtime/vm/compiler/backend/flow_graph.cc
index df9fc5b..499bfc7 100644
--- a/runtime/vm/compiler/backend/flow_graph.cc
+++ b/runtime/vm/compiler/backend/flow_graph.cc
@@ -1643,14 +1643,10 @@
}
if (should_unbox) {
-#if defined(AVOID_UNBOXED_INT32)
- unboxed = kUnboxedInt64;
-#else
unboxed =
RangeUtils::Fits(phi->range(), RangeBoundary::kRangeBoundaryInt32)
? kUnboxedInt32
: kUnboxedInt64;
-#endif
}
}
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 772b0e8..fa6d94a 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -776,7 +776,9 @@
const Object& Value::BoundConstant() const {
ASSERT(BindsToConstant());
- return definition()->AsConstant()->value();
+ ConstantInstr* constant = definition()->AsConstant();
+ ASSERT(constant != NULL);
+ return constant->value();
}
GraphEntryInstr::GraphEntryInstr(const ParsedFunction& parsed_function,
@@ -1867,9 +1869,9 @@
case Token::kBIT_NOT:
if (value.IsSmi()) {
- result = Integer::New(~Smi::Cast(value).Value(), Heap::kOld);
+ result = Integer::New(~Smi::Cast(value).Value());
} else if (value.IsMint()) {
- result = Integer::New(~Mint::Cast(value).value(), Heap::kOld);
+ result = Integer::New(~Mint::Cast(value).value());
}
break;
@@ -2104,7 +2106,7 @@
case Token::kBIT_AND:
if (rhs == 0) {
return right()->definition();
- } else if ((rhs & range_mask) == range_mask) {
+ } else if (rhs == range_mask) {
return left()->definition();
}
break;
@@ -2493,11 +2495,9 @@
Definition* replacement = this;
switch (conv->from()) {
-#if !defined(AVOID_UNBOXED_INT32)
case kUnboxedInt32:
replacement = new BoxInt32Instr(conv->value()->CopyWithType());
break;
-#endif
case kUnboxedUint32:
replacement = new BoxUint32Instr(conv->value()->CopyWithType());
break;
@@ -2675,35 +2675,6 @@
return replacement;
}
- if (value()->BindsToConstant()) {
- const Object& input = value()->BoundConstant();
- int64_t constant;
- if (input.IsSmi()) {
- constant = Smi::Cast(input).Value();
- } else if (input.IsMint()) {
- constant = Mint::Cast(input).value();
- } else {
- return this;
- }
- Definition* replacement = NULL;
- if (to() == kUnboxedUint32) {
- const Object& cast = Integer::Handle(
- flow_graph->zone(),
- Integer::New(static_cast<uint32_t>(constant), Heap::kOld));
- replacement = new UnboxedConstantInstr(cast, kUnboxedUint32);
- } else if (to() == kUnboxedInt32) {
- const Object& cast = Integer::Handle(
- flow_graph->zone(),
- Integer::New(static_cast<int32_t>(constant), Heap::kOld));
- replacement = new UnboxedConstantInstr(cast, kUnboxedUint32);
- } else if (to() == kUnboxedInt64) {
- replacement = new UnboxedConstantInstr(input, kUnboxedInt64);
- }
- if (replacement != NULL) {
- flow_graph->InsertBefore(this, replacement, env(), FlowGraph::kValue);
- return replacement;
- }
- }
return this;
}
@@ -3049,10 +3020,8 @@
BoxInstr* BoxInstr::Create(Representation from, Value* value) {
switch (from) {
-#if !defined(AVOID_UNBOXED_INT32)
case kUnboxedInt32:
return new BoxInt32Instr(value);
-#endif
case kUnboxedUint32:
return new BoxUint32Instr(value);
@@ -3077,11 +3046,10 @@
intptr_t deopt_id,
SpeculativeMode speculative_mode) {
switch (to) {
-#if !defined(AVOID_UNBOXED_INT32)
case kUnboxedInt32:
return new UnboxInt32Instr(UnboxInt32Instr::kNoTruncation, value,
deopt_id, speculative_mode);
-#endif
+
case kUnboxedUint32:
return new UnboxUint32Instr(value, deopt_id, speculative_mode);
@@ -4793,7 +4761,7 @@
// Make representaion from type name used by SIMD_OP_LIST.
#define REP(T) (kUnboxed##T)
static const Representation kUnboxedBool = kTagged;
-static const Representation kUnboxedInt8 = kUnboxedUint32;
+static const Representation kUnboxedInt8 = kUnboxedInt32;
#define ENCODE_INPUTS_0()
#define ENCODE_INPUTS_1(In0) REP(In0)
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 6fd8fdd..62ebc72 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -2012,12 +2012,7 @@
virtual Representation representation() const { return representation_; }
- virtual void set_representation(Representation r) {
-#if defined(AVOID_UNBOXED_INT32)
- ASSERT(r != kUnboxedInt32);
-#endif
- representation_ = r;
- }
+ virtual void set_representation(Representation r) { representation_ = r; }
virtual intptr_t Hashcode() const {
UNREACHABLE();
@@ -2804,14 +2799,13 @@
virtual TokenPosition token_pos() const { return token_pos_; }
- bool IsUnboxedIntegerConstant() const {
- return representation() == kUnboxedUint32 ||
- representation() == kUnboxedInt32 ||
+ bool IsUnboxedSignedIntegerConstant() const {
+ return representation() == kUnboxedInt32 ||
representation() == kUnboxedInt64;
}
- int64_t GetUnboxedIntegerConstantValue() const {
- ASSERT(IsUnboxedIntegerConstant());
+ int64_t GetUnboxedSignedIntegerConstantValue() const {
+ ASSERT(IsUnboxedSignedIntegerConstant());
return value_.IsSmi() ? Smi::Cast(value_).Value()
: Mint::Cast(value_).value();
}
@@ -5434,11 +5428,7 @@
truncation_mode,
value,
deopt_id,
- speculative_mode) {
-#if defined(AVOID_UNBOXED_INT32)
- UNREACHABLE();
-#endif
- }
+ speculative_mode) {}
virtual bool ComputeCanDeoptimize() const;
@@ -6974,15 +6964,10 @@
to_representation_(to),
is_truncating_(to == kUnboxedUint32) {
ASSERT(from != to);
-#if !defined(AVOID_UNBOXED_INT32)
ASSERT((from == kUnboxedInt64) || (from == kUnboxedUint32) ||
(from == kUnboxedInt32));
ASSERT((to == kUnboxedInt64) || (to == kUnboxedUint32) ||
(to == kUnboxedInt32));
-#else
- ASSERT((from == kUnboxedInt64) || (from == kUnboxedUint32));
- ASSERT((to == kUnboxedInt64) || (to == kUnboxedUint32));
-#endif
SetInputAt(0, value);
}
@@ -7090,12 +7075,6 @@
#define SIMD_CONVERSION(M, FromType, ToType) \
M(1, _, FromType##To##ToType, (FromType), ToType)
-#if defined(AVOID_UNBOXED_INT32)
-#define Int32x4Arg Uint32
-#else
-#define Int32x4Arg Int32
-#endif
-
// List of all recognized SIMD operations.
// Note: except for operations that map to operators (Add, Mul, Sub, Div,
// BitXor, BitOr) all other operations must match names used by
@@ -7121,8 +7100,7 @@
M(2, _, Float32x4LessThan, (Float32x4, Float32x4), Int32x4) \
M(2, _, Float32x4LessThanOrEqual, (Float32x4, Float32x4), Int32x4) \
M(2, _, Float32x4NotEqual, (Float32x4, Float32x4), Int32x4) \
- M(4, _, Int32x4Constructor, \
- (Int32x4Arg, Int32x4Arg, Int32x4Arg, Int32x4Arg), Int32x4) \
+ M(4, _, Int32x4Constructor, (Int32, Int32, Int32, Int32), Int32x4) \
M(4, _, Int32x4BoolConstructor, (Bool, Bool, Bool, Bool), Int32x4) \
M(4, _, Float32x4Constructor, (Double, Double, Double, Double), Float32x4) \
M(2, _, Float64x2Constructor, (Double, Double), Float64x2) \
diff --git a/runtime/vm/compiler/backend/il_arm.cc b/runtime/vm/compiler/backend/il_arm.cc
index 6e310bf..9b5729c 100644
--- a/runtime/vm/compiler/backend/il_arm.cc
+++ b/runtime/vm/compiler/backend/il_arm.cc
@@ -328,8 +328,7 @@
const Location& destination,
Register tmp) {
if (destination.IsRegister()) {
- if (representation() == kUnboxedInt32 ||
- representation() == kUnboxedUint32) {
+ if (representation() == kUnboxedInt32) {
__ LoadImmediate(destination.reg(), Smi::Cast(value_).Value());
} else {
ASSERT(representation() == kTagged);
@@ -5986,45 +5985,34 @@
LocationSummary* summary = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
+ summary->set_in(1, Location::RequiresRegister());
summary->set_out(0, Location::RequiresRegister());
- ConstantInstr* right_constant = right()->definition()->AsConstant();
- if (right_constant != NULL && op_kind() != Token::kMUL &&
- right_constant->value().IsSmi() &&
- Operand::CanHold(Smi::Cast(right_constant->value()).Value())) {
- summary->set_in(1, Location::Constant(right_constant));
- } else {
- summary->set_in(1, Location::RequiresRegister());
- }
return summary;
}
void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register left = locs()->in(0).reg();
+ Register right = locs()->in(1).reg();
Register out = locs()->out(0).reg();
ASSERT(out != left);
- Location r = locs()->in(1);
- if (op_kind() == Token::kMUL) {
- __ mul(out, left, r.reg());
- return;
- }
- const Operand right = r.IsRegister()
- ? Operand(r.reg())
- : Operand(Smi::Cast(r.constant()).Value());
switch (op_kind()) {
case Token::kBIT_AND:
- __ and_(out, left, right);
+ __ and_(out, left, Operand(right));
break;
case Token::kBIT_OR:
- __ orr(out, left, right);
+ __ orr(out, left, Operand(right));
break;
case Token::kBIT_XOR:
- __ eor(out, left, right);
+ __ eor(out, left, Operand(right));
break;
case Token::kADD:
- __ add(out, left, right);
+ __ add(out, left, Operand(right));
break;
case Token::kSUB:
- __ sub(out, left, right);
+ __ sub(out, left, Operand(right));
+ break;
+ case Token::kMUL:
+ __ mul(out, left, right);
break;
default:
UNREACHABLE();
diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc
index abafd9d..4f4a097 100644
--- a/runtime/vm/compiler/backend/il_arm64.cc
+++ b/runtime/vm/compiler/backend/il_arm64.cc
@@ -324,9 +324,8 @@
void ConstantInstr::EmitMoveToLocation(FlowGraphCompiler* compiler,
const Location& destination,
Register tmp) {
- ASSERT(representation() != kUnboxedInt32);
if (destination.IsRegister()) {
- if (representation() == kUnboxedUint32 ||
+ if (representation() == kUnboxedInt32 ||
representation() == kUnboxedInt64) {
const int64_t value = value_.IsSmi() ? Smi::Cast(value_).Value()
: Mint::Cast(value_).value();
@@ -354,7 +353,11 @@
ASSERT(destination.IsStackSlot());
ASSERT(tmp != kNoRegister);
const intptr_t dest_offset = destination.ToStackSlotOffset();
- __ LoadObject(tmp, value_);
+ if (value_.IsSmi() && representation() == kUnboxedInt32) {
+ __ LoadImmediate(tmp, static_cast<int32_t>(Smi::Cast(value_).Value()));
+ } else {
+ __ LoadObject(tmp, value_);
+ }
__ StoreToOffset(tmp, destination.base_reg(), dest_offset);
}
}
@@ -362,7 +365,7 @@
LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 0;
- const intptr_t kNumTemps = IsUnboxedIntegerConstant() ? 0 : 1;
+ const intptr_t kNumTemps = IsUnboxedSignedIntegerConstant() ? 0 : 1;
LocationSummary* locs = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
switch (representation()) {
@@ -370,7 +373,7 @@
locs->set_out(0, Location::RequiresFpuRegister());
locs->set_temp(0, Location::RequiresRegister());
break;
- case kUnboxedUint32: // We don't used signed int32 on ARM64.
+ case kUnboxedInt32:
case kUnboxedInt64:
locs->set_out(0, Location::RequiresRegister());
break;
@@ -384,7 +387,7 @@
void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
if (!locs()->out(0).IsInvalid()) {
const Register scratch =
- IsUnboxedIntegerConstant() ? kNoRegister : locs()->temp(0).reg();
+ IsUnboxedSignedIntegerConstant() ? kNoRegister : locs()->temp(0).reg();
EmitMoveToLocation(compiler, locs()->out(0), scratch);
}
}
@@ -590,9 +593,9 @@
right_constant = right.constant_instruction();
}
- if (right_constant->IsUnboxedIntegerConstant()) {
- __ CompareImmediate(left.reg(),
- right_constant->GetUnboxedIntegerConstantValue());
+ if (right_constant->IsUnboxedSignedIntegerConstant()) {
+ __ CompareImmediate(
+ left.reg(), right_constant->GetUnboxedSignedIntegerConstantValue());
} else {
ASSERT(right_constant->representation() == kTagged);
__ CompareObject(left.reg(), right.constant());
@@ -1025,10 +1028,11 @@
case kExternalTwoByteStringCid:
return kTagged;
case kTypedDataInt32ArrayCid:
- case kTypedDataInt64ArrayCid:
- return kUnboxedInt64;
+ return kUnboxedInt32;
case kTypedDataUint32ArrayCid:
return kUnboxedUint32;
+ case kTypedDataInt64ArrayCid:
+ return kUnboxedInt64;
case kTypedDataFloat32ArrayCid:
case kTypedDataFloat64ArrayCid:
return kUnboxedDouble;
@@ -1154,35 +1158,24 @@
return;
}
- if (representation() == kUnboxedUint32) {
- ASSERT(class_id() == kTypedDataUint32ArrayCid);
+ if ((representation() == kUnboxedInt32) ||
+ (representation() == kUnboxedUint32)) {
const Register result = locs()->out(0).reg();
- if (aligned()) {
- __ ldr(result, element_address, kUnsignedWord);
- } else {
- __ LoadUnaligned(result, address, TMP, kUnsignedWord);
- }
- __ AssertValidUint32(result);
- return;
- }
-
- if (representation() == kUnboxedInt64) {
- Register result = locs()->out(0).reg();
switch (class_id()) {
case kTypedDataInt32ArrayCid:
- ASSERT(representation() == kUnboxedInt64);
+ ASSERT(representation() == kUnboxedInt32);
if (aligned()) {
__ ldr(result, element_address, kWord);
} else {
__ LoadUnaligned(result, address, TMP, kWord);
}
- __ AssertValidSignExtendedInt32(result);
break;
- case kTypedDataInt64ArrayCid:
+ case kTypedDataUint32ArrayCid:
+ ASSERT(representation() == kUnboxedUint32);
if (aligned()) {
- __ ldr(result, element_address, kDoubleWord);
+ __ ldr(result, element_address, kUnsignedWord);
} else {
- __ LoadUnaligned(result, address, TMP, kDoubleWord);
+ __ LoadUnaligned(result, address, TMP, kUnsignedWord);
}
break;
default:
@@ -1191,6 +1184,17 @@
return;
}
+ if (representation() == kUnboxedInt64) {
+ ASSERT(class_id() == kTypedDataInt64ArrayCid);
+ Register result = locs()->out(0).reg();
+ if (aligned()) {
+ __ ldr(result, element_address, kDoubleWord);
+ } else {
+ __ LoadUnaligned(result, address, TMP, kDoubleWord);
+ }
+ return;
+ }
+
ASSERT(representation() == kTagged);
const Register result = locs()->out(0).reg();
switch (class_id()) {
@@ -1315,6 +1319,7 @@
case kTypedDataUint16ArrayCid:
return kTagged;
case kTypedDataInt32ArrayCid:
+ return kUnboxedInt32;
case kTypedDataUint32ArrayCid:
return kUnboxedUint32;
case kTypedDataInt64ArrayCid:
@@ -3591,7 +3596,8 @@
LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone,
bool opt) const {
- ASSERT(from_representation() == kUnboxedUint32);
+ ASSERT((from_representation() == kUnboxedInt32) ||
+ (from_representation() == kUnboxedUint32));
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = ValueFitsSmi() ? 0 : 1;
LocationSummary* summary = new (zone)
@@ -3710,37 +3716,44 @@
}
void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
- // We don't use unboxed signed int32 on 64 bit platforms, so this is an
- // unboxing to 32 bit unsigned integer, zero extended.
- ASSERT(representation() == kUnboxedUint32);
- ASSERT(is_truncating());
const intptr_t value_cid = value()->Type()->ToCid();
const Register out = locs()->out(0).reg();
const Register value = locs()->in(0).reg();
+ Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub(
+ GetDeoptId(), ICData::kDeoptUnboxInteger)
+ : NULL;
if (value_cid == kSmiCid) {
- ASSERT(kSmiTagSize == 1);
- // Unsigned bitfield extract, untags the Smi, truncating to 32 bit unsigned.
- __ ubfx(out, value, 1, 32);
+ __ SmiUntag(out, value);
} else if (value_cid == kMintCid) {
- __ LoadFieldFromOffset(out, value, Mint::value_offset(), kUnsignedWord);
- } else {
- // Type information is not conclusive.
+ __ LoadFieldFromOffset(out, value, Mint::value_offset());
+ } else if (!CanDeoptimize()) {
+ // Type information is not conclusive, but range analysis found
+ // the value to be in int64 range. Therefore it must be a smi
+ // or mint value.
+ ASSERT(is_truncating());
Label done;
- ASSERT(kSmiTagSize == 1);
- // Unsigned bitfield extract, untags the Smi, truncating to 32 bit unsigned.
- __ ubfx(out, value, 1, 32);
+ __ SmiUntag(out, value);
__ BranchIfSmi(value, &done);
- if (CanDeoptimize()) {
- Label* deopt =
- compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger);
- __ CompareClassId(value, kMintCid);
- __ b(deopt, NE);
- }
- __ LoadFieldFromOffset(out, value, Mint::value_offset(), kUnsignedWord);
+ __ LoadFieldFromOffset(out, value, Mint::value_offset());
+ __ Bind(&done);
+ } else {
+ Label done;
+ __ SmiUntag(out, value);
+ __ BranchIfSmi(value, &done);
+ __ CompareClassId(value, kMintCid);
+ __ b(deopt, NE);
+ __ LoadFieldFromOffset(out, value, Mint::value_offset());
__ Bind(&done);
}
- __ AssertValidUint32(out);
+
+ // TODO(vegorov): as it is implemented right now truncating unboxing would
+ // leave "garbage" in the higher word.
+ if (!is_truncating() && (deopt != NULL)) {
+ ASSERT(representation() == kUnboxedInt32);
+ __ cmp(out, Operand(out, SXTW, 0));
+ __ b(deopt, NE);
+ }
}
LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone,
@@ -5099,7 +5112,8 @@
Register r = TMP;
if (right.IsConstant()) {
ConstantInstr* constant_instr = right.constant_instruction();
- const int64_t value = constant_instr->GetUnboxedIntegerConstantValue();
+ const int64_t value =
+ constant_instr->GetUnboxedSignedIntegerConstantValue();
__ LoadImmediate(r, value);
} else {
r = right.reg();
@@ -5116,7 +5130,8 @@
if (right.IsConstant()) {
ConstantInstr* constant_instr = right.constant_instruction();
- const int64_t value = constant_instr->GetUnboxedIntegerConstantValue();
+ const int64_t value =
+ constant_instr->GetUnboxedSignedIntegerConstantValue();
switch (op_kind()) {
case Token::kADD:
if (CanDeoptimize()) {
@@ -5296,82 +5311,37 @@
LocationSummary* summary = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
- summary->set_out(0, Location::RequiresRegister());
- ConstantInstr* right_constant = right()->definition()->AsConstant();
- if (right_constant != NULL &&
- (right_constant->value().IsSmi() || right_constant->value().IsMint())) {
- int64_t imm = right_constant->GetUnboxedIntegerConstantValue();
- bool is_arithmetic = op_kind() == Token::kADD || op_kind() == Token::kSUB;
- bool is_logical = op_kind() == Token::kBIT_AND ||
- op_kind() == Token::kBIT_OR ||
- op_kind() == Token::kBIT_XOR;
- if ((is_logical && Operand::IsImmLogical(imm)) ||
- (is_arithmetic && Operand::IsImmArithmethic(imm))) {
- summary->set_in(1, Location::Constant(right_constant));
- return summary;
- }
- }
summary->set_in(1, Location::RequiresRegister());
+ summary->set_out(0, Location::RequiresRegister());
return summary;
}
void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- ConstantInstr* right_constant = right()->definition()->AsConstant();
Register left = locs()->in(0).reg();
- Location right = locs()->in(1);
+ Register right = locs()->in(1).reg();
+ Operand r = Operand(right);
Register out = locs()->out(0).reg();
- int64_t imm = 0;
- if (right_constant != NULL) {
- const Object& constant = right_constant->value();
- if (constant.IsSmi()) {
- imm = Smi::Cast(constant).AsInt64Value();
- } else {
- imm = Mint::Cast(constant).value();
- }
- }
- if (right.IsRegister()) {
- switch (op_kind()) {
- case Token::kBIT_AND:
- __ and_(out, left, Operand(right.reg()));
- break;
- case Token::kBIT_OR:
- __ orr(out, left, Operand(right.reg()));
- break;
- case Token::kBIT_XOR:
- __ eor(out, left, Operand(right.reg()));
- break;
- case Token::kADD:
- __ addw(out, left, Operand(right.reg()));
- break;
- case Token::kSUB:
- __ subw(out, left, Operand(right.reg()));
- break;
- case Token::kMUL:
- __ mulw(out, left, right.reg());
- break;
- default:
- UNREACHABLE();
- }
- } else {
- switch (op_kind()) {
- case Token::kBIT_AND:
- __ andi(out, left, Immediate(imm));
- break;
- case Token::kBIT_OR:
- __ orri(out, left, Immediate(imm));
- break;
- case Token::kBIT_XOR:
- __ eori(out, left, Immediate(imm));
- break;
- case Token::kADD:
- __ AddImmediate(out, left, imm, kWord);
- break;
- case Token::kSUB:
- __ AddImmediate(out, left, -imm, kWord);
- break;
- default:
- UNREACHABLE();
- }
+ switch (op_kind()) {
+ case Token::kBIT_AND:
+ __ and_(out, left, r);
+ break;
+ case Token::kBIT_OR:
+ __ orr(out, left, r);
+ break;
+ case Token::kBIT_XOR:
+ __ eor(out, left, r);
+ break;
+ case Token::kADD:
+ __ addw(out, left, r);
+ break;
+ case Token::kSUB:
+ __ subw(out, left, r);
+ break;
+ case Token::kMUL:
+ __ mulw(out, left, right);
+ break;
+ default:
+ UNREACHABLE();
}
}
@@ -5476,14 +5446,19 @@
LocationSummary* summary = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
if (from() == kUnboxedInt64) {
- ASSERT(to() == kUnboxedUint32); // No unboxed int32 on ARM64.
+ ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32));
+ } else if (to() == kUnboxedInt64) {
+ ASSERT((from() == kUnboxedUint32) || (from() == kUnboxedInt32));
} else {
- ASSERT(to() == kUnboxedInt64);
- ASSERT(from() == kUnboxedUint32); // No unboxed int32 on ARM64.
+ ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32));
+ ASSERT((from() == kUnboxedUint32) || (from() == kUnboxedInt32));
}
- ASSERT(!CanDeoptimize());
summary->set_in(0, Location::RequiresRegister());
- summary->set_out(0, Location::SameAsFirstInput());
+ if (CanDeoptimize()) {
+ summary->set_out(0, Location::RequiresRegister());
+ } else {
+ summary->set_out(0, Location::SameAsFirstInput());
+ }
return summary;
}
@@ -5491,16 +5466,52 @@
ASSERT(from() != to()); // We don't convert from a representation to itself.
const Register value = locs()->in(0).reg();
const Register out = locs()->out(0).reg();
- ASSERT(!CanDeoptimize());
- if (from() == kUnboxedInt64) {
- ASSERT(to() == kUnboxedUint32);
- __ uxtw(out, value); // Zero the top bits.
- } else {
- ASSERT(from() == kUnboxedUint32);
- ASSERT(to() == kUnboxedInt64);
- if (out != value) {
- __ mov(out, value); // Bits are the same.
+ Label* deopt = !CanDeoptimize() ? NULL
+ : compiler->AddDeoptStub(
+ deopt_id(), ICData::kDeoptUnboxInteger);
+ if (from() == kUnboxedInt32 && to() == kUnboxedUint32) {
+ if (CanDeoptimize()) {
+ __ tbnz(deopt, value,
+ 31); // If sign bit is set it won't fit in a uint32.
}
+ if (out != value) {
+ __ mov(out, value); // For positive values the bits are the same.
+ }
+ } else if (from() == kUnboxedUint32 && to() == kUnboxedInt32) {
+ if (CanDeoptimize()) {
+ __ tbnz(deopt, value,
+ 31); // If high bit is set it won't fit in an int32.
+ }
+ if (out != value) {
+ __ mov(out, value); // For 31 bit values the bits are the same.
+ }
+ } else if (from() == kUnboxedInt64) {
+ if (to() == kUnboxedInt32) {
+ if (is_truncating() || out != value) {
+ __ sxtw(out, value); // Signed extension 64->32.
+ }
+ } else {
+ ASSERT(to() == kUnboxedUint32);
+ if (is_truncating() || out != value) {
+ __ uxtw(out, value); // Unsigned extension 64->32.
+ }
+ }
+ if (CanDeoptimize()) {
+ ASSERT(to() == kUnboxedInt32);
+ __ cmp(out, Operand(value));
+ __ b(deopt, NE); // Value cannot be held in Int32, deopt.
+ }
+ } else if (to() == kUnboxedInt64) {
+ if (from() == kUnboxedUint32) {
+ if (out != value) {
+ __ mov(out, value);
+ }
+ } else {
+ ASSERT(from() == kUnboxedInt32);
+ __ sxtw(out, value); // Signed extension 32->64.
+ }
+ } else {
+ UNREACHABLE();
}
}
diff --git a/runtime/vm/compiler/backend/il_ia32.cc b/runtime/vm/compiler/backend/il_ia32.cc
index 4505c0f..c92b517 100644
--- a/runtime/vm/compiler/backend/il_ia32.cc
+++ b/runtime/vm/compiler/backend/il_ia32.cc
@@ -187,8 +187,7 @@
if (destination.IsRegister()) {
if (value_.IsSmi() && Smi::Cast(value_).Value() == 0) {
__ xorl(destination.reg(), destination.reg());
- } else if (value_.IsSmi() && (representation() == kUnboxedInt32 ||
- representation() == kUnboxedUint32)) {
+ } else if (value_.IsSmi() && (representation() == kUnboxedInt32)) {
__ movl(destination.reg(), Immediate(Smi::Cast(value_).Value()));
} else {
ASSERT(representation() == kTagged);
@@ -3237,16 +3236,6 @@
bool opt) const {
const intptr_t kNumInputs = 2;
const intptr_t kNumTemps = (op_kind() == Token::kMUL) ? 1 : 0;
- ConstantInstr* right_constant = right()->definition()->AsConstant();
- if (right_constant != NULL && right_constant->value().IsSmi() &&
- op_kind() != Token::kMUL) {
- LocationSummary* summary = new (zone)
- LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
- summary->set_in(0, Location::RequiresRegister());
- summary->set_in(1, Location::Constant(right_constant));
- summary->set_out(0, Location::SameAsFirstInput());
- return summary;
- }
LocationSummary* summary = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
if (op_kind() == Token::kMUL) {
@@ -3262,33 +3251,25 @@
void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register left = locs()->in(0).reg();
+ Register right = locs()->in(1).reg();
Register out = locs()->out(0).reg();
ASSERT(out == left);
- if (locs()->in(1).IsRegister()) {
- Register right = locs()->in(1).reg();
- switch (op_kind()) {
- case Token::kBIT_AND:
- case Token::kBIT_OR:
- case Token::kBIT_XOR:
- case Token::kADD:
- case Token::kSUB:
- EmitIntegerArithmetic(compiler, op_kind(), left, right, NULL);
- return;
+ switch (op_kind()) {
+ case Token::kBIT_AND:
+ case Token::kBIT_OR:
+ case Token::kBIT_XOR:
+ case Token::kADD:
+ case Token::kSUB:
+ EmitIntegerArithmetic(compiler, op_kind(), left, right, NULL);
+ return;
- case Token::kMUL:
- __ mull(right); // Result in EDX:EAX.
- ASSERT(out == EAX);
- ASSERT(locs()->temp(0).reg() == EDX);
- break;
- default:
- UNREACHABLE();
- }
- } else {
- ASSERT(locs()->in(1).IsConstant());
- ConstantInstr* right_constant = right()->definition()->AsConstant();
- const Object& constant = right_constant->value();
- int64_t imm = Smi::Cast(constant).AsInt64Value();
- EmitIntegerArithmetic(compiler, op_kind(), left, Immediate(imm), NULL);
+ case Token::kMUL:
+ __ mull(right); // Result in EDX:EAX.
+ ASSERT(out == EAX);
+ ASSERT(locs()->temp(0).reg() == EDX);
+ break;
+ default:
+ UNREACHABLE();
}
}
diff --git a/runtime/vm/compiler/backend/il_x64.cc b/runtime/vm/compiler/backend/il_x64.cc
index a564b48..bf409ff 100644
--- a/runtime/vm/compiler/backend/il_x64.cc
+++ b/runtime/vm/compiler/backend/il_x64.cc
@@ -287,7 +287,7 @@
const Location& destination,
Register tmp) {
if (destination.IsRegister()) {
- if (representation() == kUnboxedUint32 ||
+ if (representation() == kUnboxedInt32 ||
representation() == kUnboxedInt64) {
const int64_t value = value_.IsSmi() ? Smi::Cast(value_).Value()
: Mint::Cast(value_).value();
@@ -320,14 +320,19 @@
__ movsd(destination.ToStackSlotAddress(), XMM0);
} else {
ASSERT(destination.IsStackSlot());
- __ StoreObject(destination.ToStackSlotAddress(), value_);
+ if (value_.IsSmi() && representation() == kUnboxedInt32) {
+ __ movl(destination.ToStackSlotAddress(),
+ Immediate(Smi::Cast(value_).Value()));
+ } else {
+ __ StoreObject(destination.ToStackSlotAddress(), value_);
+ }
}
}
LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 0;
- const intptr_t kNumTemps = IsUnboxedIntegerConstant() ? 0 : 1;
+ const intptr_t kNumTemps = IsUnboxedSignedIntegerConstant() ? 0 : 1;
LocationSummary* locs = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
switch (representation()) {
@@ -335,7 +340,7 @@
locs->set_out(0, Location::RequiresFpuRegister());
locs->set_temp(0, Location::RequiresRegister());
break;
- case kUnboxedUint32:
+ case kUnboxedInt32:
case kUnboxedInt64:
locs->set_out(0, Location::RequiresRegister());
break;
@@ -350,7 +355,7 @@
// The register allocator drops constant definitions that have no uses.
if (!locs()->out(0).IsInvalid()) {
const Register scratch =
- IsUnboxedIntegerConstant() ? kNoRegister : locs()->temp(0).reg();
+ IsUnboxedSignedIntegerConstant() ? kNoRegister : locs()->temp(0).reg();
EmitMoveToLocation(compiler, locs()->out(0), scratch);
}
}
@@ -604,9 +609,9 @@
constant = right.constant_instruction();
}
- if (constant->IsUnboxedIntegerConstant()) {
+ if (constant->IsUnboxedSignedIntegerConstant()) {
__ cmpq(left.reg(),
- Immediate(constant->GetUnboxedIntegerConstantValue()));
+ Immediate(constant->GetUnboxedSignedIntegerConstantValue()));
} else {
ASSERT(constant->representation() == kTagged);
__ CompareObject(left.reg(), right.constant());
@@ -1100,9 +1105,10 @@
case kExternalOneByteStringCid:
case kExternalTwoByteStringCid:
return kTagged;
+ case kTypedDataInt32ArrayCid:
+ return kUnboxedInt32;
case kTypedDataUint32ArrayCid:
return kUnboxedUint32;
- case kTypedDataInt32ArrayCid:
case kTypedDataInt64ArrayCid:
return kUnboxedInt64;
case kTypedDataFloat32ArrayCid:
@@ -1187,31 +1193,20 @@
return;
}
- if ((representation() == kUnboxedUint32)) {
- ASSERT(class_id() == kTypedDataUint32ArrayCid);
- if ((index_scale() == 1) && index.IsRegister()) {
- __ SmiUntag(index.reg());
- }
- Register result = locs()->out(0).reg();
- __ movl(result, element_address);
- return;
- }
-
- if (representation() == kUnboxedInt64) {
+ if ((representation() == kUnboxedUint32) ||
+ (representation() == kUnboxedInt32)) {
if ((index_scale() == 1) && index.IsRegister()) {
__ SmiUntag(index.reg());
}
Register result = locs()->out(0).reg();
switch (class_id()) {
case kTypedDataInt32ArrayCid:
- ASSERT(representation() == kUnboxedInt64);
- __ movl(result, element_address);
- __ movsxd(result, result);
- __ AssertValidSignExtendedInt32(result);
+ ASSERT(representation() == kUnboxedInt32);
+ __ movsxd(result, element_address);
break;
- case kTypedDataInt64ArrayCid:
- ASSERT(representation() == kUnboxedInt64);
- __ movq(result, element_address);
+ case kTypedDataUint32ArrayCid:
+ ASSERT(representation() == kUnboxedUint32);
+ __ movl(result, element_address);
break;
default:
UNREACHABLE();
@@ -1219,6 +1214,16 @@
return;
}
+ if (representation() == kUnboxedInt64) {
+ ASSERT(class_id() == kTypedDataInt64ArrayCid);
+ if ((index_scale() == 1) && index.IsRegister()) {
+ __ SmiUntag(index.reg());
+ }
+ Register result = locs()->out(0).reg();
+ __ movq(result, element_address);
+ return;
+ }
+
ASSERT(representation() == kTagged);
if ((index_scale() == 1) && index.IsRegister()) {
@@ -1366,9 +1371,10 @@
case kTypedDataInt16ArrayCid:
case kTypedDataUint16ArrayCid:
return kTagged;
+ case kTypedDataInt32ArrayCid:
+ return kUnboxedInt32;
case kTypedDataUint32ArrayCid:
return kUnboxedUint32;
- case kTypedDataInt32ArrayCid:
case kTypedDataInt64ArrayCid:
return kUnboxedInt64;
case kTypedDataFloat32ArrayCid:
@@ -3157,16 +3163,6 @@
Immediate(reinterpret_cast<int64_t>(constant.raw())).is_int32();
}
-static bool CanBeUint32Immediate(const Object& constant) {
- if (constant.IsSmi()) {
- return Immediate(Smi::Cast(constant).Value()).is_uint32();
- }
- if (constant.IsMint()) {
- return Immediate(Mint::Cast(constant).value()).is_uint32();
- }
- return false;
-}
-
static bool IsSmiValue(const Object& constant, intptr_t value) {
return constant.IsSmi() && (Smi::Cast(constant).Value() == value);
}
@@ -3771,12 +3767,7 @@
LocationSummary* summary = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
- const intptr_t value_cid = value()->Type()->ToCid();
- if (value_cid == kSmiCid || value_cid == kMintCid) {
- summary->set_out(0, Location::SameAsFirstInput());
- } else {
- summary->set_out(0, Location::RequiresRegister());
- }
+ summary->set_out(0, Location::SameAsFirstInput());
if (kNumTemps > 0) {
summary->set_temp(0, Location::RequiresRegister());
}
@@ -3784,47 +3775,64 @@
}
void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
- // We don't use unboxed signed int32 on 64 bit platforms, so this is an
- // unboxing to 32 bit unsigned integer, zero extended.
- ASSERT(representation() == kUnboxedUint32);
- ASSERT(is_truncating());
const intptr_t value_cid = value()->Type()->ToCid();
const Register value = locs()->in(0).reg();
- const Register out = locs()->out(0).reg();
+ Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub(
+ GetDeoptId(), ICData::kDeoptUnboxInteger)
+ : NULL;
+ ASSERT(value == locs()->out(0).reg());
Label done_and_no_need_to_check_range;
+ ASSERT(locs()->out(0).reg() == value);
+
if (value_cid == kSmiCid) {
- ASSERT(value == out);
__ AssertSmiInRange(value);
- // A 32 bit Smi (31 bits plus tag) can just be made into a uint32 with a 32
- // bit sar operation.
- __ sarl(value, Immediate(kSmiTagShift));
+ __ SmiUntag(value);
+ return;
} else if (value_cid == kMintCid) {
- ASSERT(value == out);
- __ movl(value, FieldAddress(value, Mint::value_offset()));
- } else {
+ __ movq(value, FieldAddress(value, Mint::value_offset()));
+ } else if (!CanDeoptimize()) {
Label done;
- ASSERT(out != value);
- __ movl(out, value);
- __ sarl(out, Immediate(kSmiTagShift)); // See sarl comment above.
- ASSERT(kSmiTag == 0);
+ __ SmiUntag(value);
__ j(NOT_CARRY, &done, Assembler::kNearJump);
- if (CanDeoptimize()) {
- Label* deopt =
- compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger);
- __ LoadClassId(TMP, value);
- __ cmpl(TMP, Immediate(kMintCid));
- __ j(NOT_EQUAL, deopt);
+ // Multiply by two in addressing mode because we erroneously
+ // untagged a pointer by dividing it by two.
+ Address value_field(value, TIMES_2, Mint::value_offset());
+ if (is_truncating()) {
+ __ movl(value, value_field);
+ __ movsxd(value, value);
+ } else {
+ __ movq(value, value_field);
}
- __ movl(out, FieldAddress(value, Mint::value_offset()));
__ Bind(&done);
+ return;
+ } else {
+ __ SmiUntagOrCheckClass(value, kMintCid, &done_and_no_need_to_check_range);
+ __ j(NOT_EQUAL, deopt);
+ // Multiply by two in addressing mode because we erroneously
+ // untagged a pointer by dividing it by two.
+ __ movq(value, Address(value, TIMES_2, Mint::value_offset()));
}
- __ AssertValidUint32(locs()->out(0).reg());
+
+ // We get here for the Mint cases, which might be out of range for an
+ // unboxed int32 output.
+
+ // TODO(vegorov): Truncating unboxing leaves garbage in the higher word.
+ // Is this the best semantics?
+ if (!is_truncating() && (deopt != NULL)) {
+ ASSERT(representation() == kUnboxedInt32);
+ const Register temp = locs()->temp(0).reg();
+ __ movsxd(temp, value);
+ __ cmpq(temp, value);
+ __ j(NOT_EQUAL, deopt);
+ }
+ __ Bind(&done_and_no_need_to_check_range);
}
LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone,
bool opt) const {
- ASSERT(from_representation() == kUnboxedUint32);
+ ASSERT((from_representation() == kUnboxedInt32) ||
+ (from_representation() == kUnboxedUint32));
const intptr_t kNumInputs = 1;
const intptr_t kNumTemps = ValueFitsSmi() ? 0 : 1;
LocationSummary* summary = new (zone)
@@ -3846,23 +3854,38 @@
void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
const Register value = locs()->in(0).reg();
const Register out = locs()->out(0).reg();
+ Label done;
- // Unsigned unboxed 32 bit to sign extended 31 bit Smi.
- __ leaq(out, Address(value, value, TIMES_1, 0));
+ if (from_representation() == kUnboxedInt32) {
+ __ MoveRegister(out, value);
+ ASSERT(kSmiTagMask == 1 && kSmiTag == 0);
+ __ addl(out, out);
+ __ movsxd(out, out); // Does not affect flags.
+ } else {
+ // Unsigned.
+ __ movl(out, value);
+ __ SmiTag(out);
+ }
if (!ValueFitsSmi()) {
- Label done;
- ASSERT(value != out);
- __ TestImmediate(value, Immediate(0xc0000000ll));
- __ j(ZERO, &done);
-
+ if (from_representation() == kUnboxedInt32) {
+ __ j(NO_OVERFLOW, &done);
+ } else {
+ ASSERT(value != out);
+ __ TestImmediate(value, Immediate(0xc0000000ll));
+ __ j(ZERO, &done);
+ }
// Allocate a mint.
// Value input is a writable register and we have to inform the compiler of
// the type so it can be preserved untagged on the slow path
locs()->live_registers()->Add(locs()->in(0), kUnboxedInt32);
BoxAllocationSlowPath::Allocate(compiler, this, compiler->mint_class(), out,
locs()->temp(0).reg());
- __ AssertValidUint32(value);
+ if (from_representation() == kUnboxedInt32) {
+ __ movsxd(value, value);
+ } else {
+ __ movl(value, value);
+ }
__ movq(FieldAddress(out, Mint::value_offset()), value);
__ Bind(&done);
}
@@ -5315,7 +5338,8 @@
if (right.IsConstant()) {
ConstantInstr* constant_instr = right.constant_instruction();
- const int64_t value = constant_instr->GetUnboxedIntegerConstantValue();
+ const int64_t value =
+ constant_instr->GetUnboxedSignedIntegerConstantValue();
EmitInt64Arithmetic(compiler, op_kind(), left.reg(), Immediate(value),
deopt);
} else {
@@ -5446,16 +5470,6 @@
bool opt) const {
const intptr_t kNumInputs = 2;
const intptr_t kNumTemps = 0;
- ConstantInstr* right_constant = right()->definition()->AsConstant();
- if (right_constant != NULL && op_kind() != Token::kMUL &&
- CanBeUint32Immediate(right_constant->value())) {
- LocationSummary* summary = new (zone)
- LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
- summary->set_in(0, Location::RequiresRegister());
- summary->set_in(1, Location::Constant(right_constant));
- summary->set_out(0, Location::SameAsFirstInput());
- return summary;
- }
LocationSummary* summary = new (zone)
LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
summary->set_in(0, Location::RequiresRegister());
@@ -5469,7 +5483,6 @@
Token::Kind op_kind,
Register left,
const OperandType& right) {
- __ AssertValidUint32(left);
switch (op_kind) {
case Token::kADD:
__ addl(left, right);
@@ -5492,21 +5505,24 @@
default:
UNREACHABLE();
}
- __ AssertValidUint32(left);
}
void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register left = locs()->in(0).reg();
+ Register right = locs()->in(1).reg();
Register out = locs()->out(0).reg();
ASSERT(out == left);
- if (locs()->in(1).IsRegister()) {
- Register right = locs()->in(1).reg();
- EmitIntegerArithmetic(compiler, op_kind(), left, right);
- } else {
- ASSERT(locs()->in(1).IsConstant());
- ConstantInstr* right_constant = right()->definition()->AsConstant();
- int32_t imm = right_constant->GetUnboxedIntegerConstantValue();
- EmitIntegerArithmetic(compiler, op_kind(), left, Immediate(imm));
+ switch (op_kind()) {
+ case Token::kBIT_AND:
+ case Token::kBIT_OR:
+ case Token::kBIT_XOR:
+ case Token::kADD:
+ case Token::kSUB:
+ case Token::kMUL:
+ EmitIntegerArithmetic(compiler, op_kind(), left, right);
+ return;
+ default:
+ UNREACHABLE();
}
}
@@ -5594,7 +5610,6 @@
}
DEFINE_BACKEND(UnaryUint32Op, (SameAsFirstInput, Register value)) {
- __ AssertValidUint32(value);
__ notl(value);
}
diff --git a/runtime/vm/compiler/backend/inliner.cc b/runtime/vm/compiler/backend/inliner.cc
index 5db455b..e137fad 100644
--- a/runtime/vm/compiler/backend/inliner.cc
+++ b/runtime/vm/compiler/backend/inliner.cc
@@ -2478,16 +2478,13 @@
DoubleToFloatInstr(new (Z) Value(stored_value), call->deopt_id());
cursor =
flow_graph->AppendTo(cursor, stored_value, NULL, FlowGraph::kValue);
-#if !defined(AVOID_UNBOXED_INT32)
} else if (array_cid == kTypedDataInt32ArrayCid) {
stored_value =
new (Z) UnboxInt32Instr(UnboxInt32Instr::kTruncate,
new (Z) Value(stored_value), call->deopt_id());
cursor = flow_graph->AppendTo(cursor, stored_value, call->env(),
FlowGraph::kValue);
-#endif
- } else if (array_cid == kTypedDataUint32ArrayCid ||
- array_cid == kTypedDataInt32ArrayCid) {
+ } else if (array_cid == kTypedDataUint32ArrayCid) {
stored_value =
new (Z) UnboxUint32Instr(new (Z) Value(stored_value), call->deopt_id());
ASSERT(stored_value->AsUnboxInteger()->is_truncating());
@@ -2789,16 +2786,13 @@
DoubleToFloatInstr(new (Z) Value(stored_value), call->deopt_id());
cursor =
flow_graph->AppendTo(cursor, stored_value, NULL, FlowGraph::kValue);
-#if !defined(AVOID_UNBOXED_INT32)
} else if (view_cid == kTypedDataInt32ArrayCid) {
stored_value =
new (Z) UnboxInt32Instr(UnboxInt32Instr::kTruncate,
new (Z) Value(stored_value), call->deopt_id());
cursor = flow_graph->AppendTo(cursor, stored_value, call->env(),
FlowGraph::kValue);
-#endif
- } else if (view_cid == kTypedDataInt32ArrayCid || // Again, outside ifdef.
- view_cid == kTypedDataUint32ArrayCid) {
+ } else if (view_cid == kTypedDataUint32ArrayCid) {
stored_value =
new (Z) UnboxUint32Instr(new (Z) Value(stored_value), call->deopt_id());
ASSERT(stored_value->AsUnboxInteger()->is_truncating());
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 82d89d1..11c5abc 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -175,9 +175,6 @@
case kFlags:
flags_ = helper_->ReadFlags();
if (++next_read_ == field) return;
- case kFlags2:
- secondary_flags_ = helper_->ReadFlags();
- if (++next_read_ == field) return;
case kName:
helper_->SkipName(); // read name.
if (++next_read_ == field) return;
@@ -246,7 +243,6 @@
if (++next_read_ == field) return;
case kFlags:
flags_ = helper_->ReadFlags();
- flags2_ = helper_->ReadFlags();
if (++next_read_ == field) return;
case kName:
helper_->SkipName(); // read name.
@@ -1552,7 +1548,7 @@
builder_->ReadUInt(); // read value.
return;
case kDoubleLiteral:
- builder_->SkipStringReference(); // read index into string table.
+ builder_->ReadDouble(); // read value.
return;
case kTrueLiteral:
return;
@@ -3546,8 +3542,7 @@
}
void StreamingConstantEvaluator::EvaluateDoubleLiteral() {
- result_ = Double::New(H.DartString(builder_->ReadStringReference()),
- Heap::kOld); // read string reference.
+ result_ = Double::New(builder_->ReadDouble(), Heap::kOld); // read value.
result_ = H.Canonicalize(result_);
}
@@ -4423,7 +4418,7 @@
}
BuildHash(name.Hash());
- BuildHash((field_helper.flags_ << 8) | field_helper.secondary_flags_);
+ BuildHash(field_helper.flags_);
BuildHash(field_helper.annotation_count_);
return hash_;
}
@@ -4469,7 +4464,6 @@
BuildHash(procedure_helper.kind_);
BuildHash(procedure_helper.flags_);
- BuildHash(procedure_helper.flags2_);
BuildHash(procedure_helper.annotation_count_);
BuildHash(name.Hash());
return hash_;
@@ -6027,6 +6021,10 @@
return reader_.ReadUInt();
}
+double KernelReaderHelper::ReadDouble() {
+ return reader_.ReadDouble();
+}
+
uint32_t KernelReaderHelper::PeekListLength() {
AlternativeReadingScope alt(&reader_);
return reader_.ReadListLength();
@@ -6494,7 +6492,7 @@
ReadUInt(); // read value.
return;
case kDoubleLiteral:
- SkipStringReference(); // read index into string table.
+ ReadDouble(); // read value.
return;
case kTrueLiteral:
return;
@@ -8987,8 +8985,7 @@
if (position != NULL) *position = TokenPosition::kNoSource;
Double& constant = Double::ZoneHandle(
- Z, Double::NewCanonical(
- H.DartString(ReadStringReference()))); // read string reference.
+ Z, Double::NewCanonical(ReadDouble())); // read double.
return Constant(constant);
}
@@ -10822,8 +10819,7 @@
break;
}
case kDoubleConstant: {
- temp_instance_ = Double::New(
- H.DartString(builder_.ReadStringReference()), Heap::kOld);
+ temp_instance_ = Double::New(builder_.ReadDouble(), Heap::kOld);
temp_instance_ = H.Canonicalize(temp_instance_);
break;
}
@@ -10852,8 +10848,13 @@
break;
}
case kInstanceConstant: {
- temp_class_ =
- H.LookupClassByKernelClass(builder_.ReadCanonicalNameReference());
+ const NameIndex index = builder_.ReadCanonicalNameReference();
+ if (ShouldSkipConstant(index)) {
+ temp_instance_ = Instance::null();
+ break;
+ }
+
+ temp_class_ = H.LookupClassByKernelClass(index);
temp_object_ = temp_class_.EnsureIsFinalized(H.thread());
ASSERT(temp_object_.IsNull());
@@ -10889,16 +10890,19 @@
const intptr_t entry_index = builder_.ReadUInt();
temp_object_ = constants.At(entry_index);
+ // Happens if the tearoff was in the vmservice library and we have
+ // [skip_vm_service_library] enabled.
+ if (temp_object_.IsNull()) {
+ temp_instance_ = Instance::null();
+ break;
+ }
+
const intptr_t number_of_type_arguments = builder_.ReadUInt();
- if (temp_class_.NumTypeArguments() > 0) {
- temp_type_arguments_ =
- TypeArguments::New(number_of_type_arguments, Heap::kOld);
- for (intptr_t j = 0; j < number_of_type_arguments; ++j) {
- temp_type_arguments_.SetTypeAt(j, type_translator_.BuildType());
- }
- } else {
- ASSERT(number_of_type_arguments == 0);
- temp_type_arguments_ = TypeArguments::null();
+ ASSERT(number_of_type_arguments > 0);
+ temp_type_arguments_ =
+ TypeArguments::New(number_of_type_arguments, Heap::kOld);
+ for (intptr_t j = 0; j < number_of_type_arguments; ++j) {
+ temp_type_arguments_.SetTypeAt(j, type_translator_.BuildType());
}
// Make a copy of the old closure, with the delayed type arguments
@@ -10916,12 +10920,7 @@
}
case kTearOffConstant: {
const NameIndex index = builder_.ReadCanonicalNameReference();
- NameIndex lib_index = index;
- while (!H.IsLibrary(lib_index)) {
- lib_index = H.CanonicalNameParent(lib_index);
- }
- ASSERT(H.IsLibrary(lib_index));
- if (lib_index == skip_vmservice_library_) {
+ if (ShouldSkipConstant(index)) {
temp_instance_ = Instance::null();
break;
}
@@ -10960,6 +10959,19 @@
*type_arguments = temp_type_.arguments();
}
+// If [index] has `dart:vm_service` as a parent and we are skipping the VM
+// service library, this method returns `true`, otherwise `false`.
+bool ConstantHelper::ShouldSkipConstant(NameIndex index) {
+ if (index == NameIndex::kInvalidName) {
+ return false;
+ }
+ while (!H.IsLibrary(index)) {
+ index = H.CanonicalNameParent(index);
+ }
+ ASSERT(H.IsLibrary(index));
+ return index == skip_vmservice_library_;
+}
+
} // namespace kernel
} // namespace dart
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index b4c4b83..a572a7d 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -202,7 +202,6 @@
kPosition,
kEndPosition,
kFlags,
- kFlags2,
kName,
kAnnotations,
kType,
@@ -260,7 +259,6 @@
TokenPosition position_;
TokenPosition end_position_;
uint8_t flags_;
- uint8_t secondary_flags_;
intptr_t source_uri_index_;
intptr_t annotation_count_;
@@ -314,11 +312,8 @@
kForwardingStub = 1 << 4,
// TODO(29841): Remove this line after the issue is resolved.
- kRedirectingFactoryConstructor = 1 << 7,
- };
-
- enum Flag2 {
- kNoSuchMethodForwarder = 1 << 0,
+ kRedirectingFactoryConstructor = 1 << 6,
+ kNoSuchMethodForwarder = 1 << 7,
};
explicit ProcedureHelper(KernelReaderHelper* helper)
@@ -342,7 +337,7 @@
return (flags_ & kRedirectingFactoryConstructor) != 0;
}
bool IsNoSuchMethodForwarder() {
- return (flags2_ & kNoSuchMethodForwarder) != 0;
+ return (flags_ & kNoSuchMethodForwarder) != 0;
}
NameIndex canonical_name_;
@@ -350,7 +345,6 @@
TokenPosition end_position_;
Kind kind_;
uint8_t flags_;
- uint8_t flags2_;
intptr_t source_uri_index_;
intptr_t annotation_count_;
@@ -1049,6 +1043,7 @@
uint32_t ReadUInt();
uint32_t ReadUInt32();
uint32_t PeekUInt();
+ double ReadDouble();
uint32_t PeekListLength();
StringIndex ReadStringReference();
NameIndex ReadCanonicalNameReference();
@@ -1704,6 +1699,10 @@
void InstantiateTypeArguments(const Class& receiver_class,
TypeArguments* type_arguments);
+ // If [index] has `dart:vm_service` as a parent and we are skipping the VM
+ // service library, this method returns `true`, otherwise `false`.
+ bool ShouldSkipConstant(NameIndex index);
+
NameIndex skip_vmservice_library_;
ActiveClass* active_class_;
StreamingFlowGraphBuilder& builder_;
diff --git a/runtime/vm/compiler/intrinsifier.cc b/runtime/vm/compiler/intrinsifier.cc
index 8ea16bb..654d33c 100644
--- a/runtime/vm/compiler/intrinsifier.cc
+++ b/runtime/vm/compiler/intrinsifier.cc
@@ -373,9 +373,6 @@
}
Definition* AddUnboxInstr(Representation rep, Value* value, bool is_checked) {
-#if defined(AVOID_UNBOXED_INT32)
- ASSERT(rep != kUnboxedInt32);
-#endif
Definition* unboxed_value =
AddDefinition(UnboxInstr::Create(rep, value, Thread::kNoDeoptId));
if (is_checked) {
@@ -458,11 +455,7 @@
case kTypedDataInt32ArrayCid:
case kExternalTypedDataInt32ArrayCid:
result = builder.AddDefinition(
-#if defined(AVOID_UNBOXED_INT32)
- BoxInstr::Create(kUnboxedInt64, new Value(result)));
-#else
BoxInstr::Create(kUnboxedInt32, new Value(result)));
-#endif
break;
case kTypedDataUint32ArrayCid:
case kExternalTypedDataUint32ArrayCid:
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 8ae8279..7398646 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -946,13 +946,10 @@
static Dart_WeakPersistentHandle AllocateFinalizableHandle(
Thread* thread,
- Dart_Handle object,
+ const Object& ref,
void* peer,
intptr_t external_allocation_size,
Dart_WeakPersistentHandleFinalizer callback) {
- REUSABLE_OBJECT_HANDLESCOPE(thread);
- Object& ref = thread->ObjectHandle();
- ref = Api::UnwrapHandle(object);
if (!ref.raw()->IsHeapObject()) {
return NULL;
}
@@ -962,6 +959,19 @@
return finalizable_ref->apiHandle();
}
+static Dart_WeakPersistentHandle AllocateFinalizableHandle(
+ Thread* thread,
+ Dart_Handle object,
+ void* peer,
+ intptr_t external_allocation_size,
+ Dart_WeakPersistentHandleFinalizer callback) {
+ REUSABLE_OBJECT_HANDLESCOPE(thread);
+ Object& ref = thread->ObjectHandle();
+ ref = Api::UnwrapHandle(object);
+ return AllocateFinalizableHandle(thread, ref, peer, external_allocation_size,
+ callback);
+}
+
DART_EXPORT Dart_WeakPersistentHandle
Dart_NewWeakPersistentHandle(Dart_Handle object,
void* peer,
@@ -3285,25 +3295,38 @@
return Api::NewHandle(thread, TypedData::New(cid, length));
}
-static Dart_Handle NewExternalTypedData(Thread* thread,
- intptr_t cid,
- void* data,
- intptr_t length) {
+static Dart_Handle NewExternalTypedData(
+ Thread* thread,
+ intptr_t cid,
+ void* data,
+ intptr_t length,
+ void* peer,
+ intptr_t external_allocation_size,
+ Dart_WeakPersistentHandleFinalizer callback) {
CHECK_LENGTH(length, ExternalTypedData::MaxElements(cid));
Zone* zone = thread->zone();
intptr_t bytes = length * ExternalTypedData::ElementSizeInBytes(cid);
const ExternalTypedData& result = ExternalTypedData::Handle(
zone, ExternalTypedData::New(cid, reinterpret_cast<uint8_t*>(data),
length, SpaceForExternal(thread, bytes)));
+ if (callback != NULL) {
+ AllocateFinalizableHandle(thread, result, peer, external_allocation_size,
+ callback);
+ }
return Api::NewHandle(thread, result.raw());
}
-static Dart_Handle NewExternalByteData(Thread* thread,
- void* data,
- intptr_t length) {
+static Dart_Handle NewExternalByteData(
+ Thread* thread,
+ void* data,
+ intptr_t length,
+ void* peer,
+ intptr_t external_allocation_size,
+ Dart_WeakPersistentHandleFinalizer callback) {
Zone* zone = thread->zone();
- Dart_Handle ext_data = NewExternalTypedData(
- thread, kExternalTypedDataUint8ArrayCid, data, length);
+ Dart_Handle ext_data =
+ NewExternalTypedData(thread, kExternalTypedDataUint8ArrayCid, data,
+ length, peer, external_allocation_size, callback);
if (::Dart_IsError(ext_data)) {
return ext_data;
}
@@ -3376,6 +3399,17 @@
DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type,
void* data,
intptr_t length) {
+ return Dart_NewExternalTypedDataWithFinalizer(type, data, length, NULL, 0,
+ NULL);
+}
+
+DART_EXPORT Dart_Handle Dart_NewExternalTypedDataWithFinalizer(
+ Dart_TypedData_Type type,
+ void* data,
+ intptr_t length,
+ void* peer,
+ intptr_t external_allocation_size,
+ Dart_WeakPersistentHandleFinalizer callback) {
DARTSCOPE(Thread::Current());
if (data == NULL && length != 0) {
RETURN_NULL_ERROR(data);
@@ -3383,43 +3417,56 @@
CHECK_CALLBACK_STATE(T);
switch (type) {
case Dart_TypedData_kByteData:
- return NewExternalByteData(T, data, length);
+ return NewExternalByteData(T, data, length, peer,
+ external_allocation_size, callback);
case Dart_TypedData_kInt8:
return NewExternalTypedData(T, kExternalTypedDataInt8ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kUint8:
return NewExternalTypedData(T, kExternalTypedDataUint8ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kUint8Clamped:
return NewExternalTypedData(T, kExternalTypedDataUint8ClampedArrayCid,
- data, length);
+ data, length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kInt16:
return NewExternalTypedData(T, kExternalTypedDataInt16ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kUint16:
return NewExternalTypedData(T, kExternalTypedDataUint16ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kInt32:
return NewExternalTypedData(T, kExternalTypedDataInt32ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kUint32:
return NewExternalTypedData(T, kExternalTypedDataUint32ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kInt64:
return NewExternalTypedData(T, kExternalTypedDataInt64ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kUint64:
return NewExternalTypedData(T, kExternalTypedDataUint64ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kFloat32:
return NewExternalTypedData(T, kExternalTypedDataFloat32ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kFloat64:
return NewExternalTypedData(T, kExternalTypedDataFloat64ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
case Dart_TypedData_kFloat32x4:
return NewExternalTypedData(T, kExternalTypedDataFloat32x4ArrayCid, data,
- length);
+ length, peer, external_allocation_size,
+ callback);
default:
return Api::NewError(
"%s expects argument 'type' to be of"
@@ -6089,7 +6136,7 @@
const char** argument_values) {
return;
}
-#else // defined(PRODUCT)
+#else // defined(PRODUCT)
DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback(
const char* name,
Dart_ServiceRequestCallback callback,
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 377cff0..7e7b9d7 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -1955,6 +1955,68 @@
}
}
+static bool byte_data_finalizer_run = false;
+void ByteDataFinalizer(void* isolate_data,
+ Dart_WeakPersistentHandle handle,
+ void* peer) {
+ ASSERT(!byte_data_finalizer_run);
+ free(peer);
+ byte_data_finalizer_run = true;
+}
+
+TEST_CASE(DartAPI_ExternalByteDataFinalizer) {
+ // Check finalizer associated with the underlying array instead of the
+ // wrapper.
+ const char* kScriptChars =
+ "var array;\n"
+ "extractAndSaveArray(byteData) {\n"
+ " array = byteData.buffer.asUint8List();\n"
+ "}\n"
+ "releaseArray() {\n"
+ " array = null;\n"
+ "}\n";
+ // Create a test library and Load up a test script in it.
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+
+ {
+ Dart_EnterScope();
+
+ const intptr_t kBufferSize = 100;
+ void* buffer = malloc(kBufferSize);
+ Dart_Handle byte_data = Dart_NewExternalTypedDataWithFinalizer(
+ Dart_TypedData_kByteData, buffer, kBufferSize, buffer, kBufferSize,
+ ByteDataFinalizer);
+
+ Dart_Handle result =
+ Dart_Invoke(lib, NewString("extractAndSaveArray"), 1, &byte_data);
+ EXPECT_VALID(result);
+
+ // ByteData wrapper is still reachable from the scoped handle.
+ EXPECT(!byte_data_finalizer_run);
+
+ // The ByteData wrapper is now unreachable, but the underlying
+ // ExternalUint8List is still alive.
+ Dart_ExitScope();
+ }
+
+ {
+ TransitionNativeToVM transition(Thread::Current());
+ Isolate::Current()->heap()->CollectAllGarbage();
+ }
+
+ EXPECT(!byte_data_finalizer_run);
+
+ Dart_Handle result = Dart_Invoke(lib, NewString("releaseArray"), 0, NULL);
+ EXPECT_VALID(result);
+
+ {
+ TransitionNativeToVM transition(Thread::Current());
+ Isolate::Current()->heap()->CollectAllGarbage();
+ }
+
+ EXPECT(byte_data_finalizer_run);
+}
+
#ifndef PRODUCT
static const intptr_t kOptExtLength = 16;
@@ -2405,10 +2467,9 @@
{
Dart_EnterScope();
uint8_t data[] = {1, 2, 3, 4};
- Dart_Handle obj = Dart_NewExternalTypedData(Dart_TypedData_kUint8, data,
- ARRAY_SIZE(data));
- Dart_NewWeakPersistentHandle(obj, &peer, sizeof(data),
- ExternalTypedDataFinalizer);
+ Dart_Handle obj = Dart_NewExternalTypedDataWithFinalizer(
+ Dart_TypedData_kUint8, data, ARRAY_SIZE(data), &peer, sizeof(data),
+ ExternalTypedDataFinalizer);
EXPECT_VALID(obj);
Dart_ExitScope();
}
@@ -2496,10 +2557,9 @@
// Dart_NewExternalTypedData.
Dart_EnterScope();
{
- Dart_Handle lcl =
- Dart_NewExternalTypedData(Dart_TypedData_kFloat32x4, data, 10);
- Dart_NewWeakPersistentHandle(lcl, &peer, sizeof(data),
- ExternalTypedDataFinalizer);
+ Dart_Handle lcl = Dart_NewExternalTypedDataWithFinalizer(
+ Dart_TypedData_kFloat32x4, data, 10, &peer, sizeof(data),
+ ExternalTypedDataFinalizer);
CheckFloat32x4Data(lcl);
}
Dart_ExitScope();
diff --git a/runtime/vm/image_snapshot.cc b/runtime/vm/image_snapshot.cc
index 4210097..162f58b 100644
--- a/runtime/vm/image_snapshot.cc
+++ b/runtime/vm/image_snapshot.cc
@@ -583,10 +583,19 @@
shared_instructions_image_(shared_instructions_image) {
ASSERT(data_image != NULL);
ASSERT(instructions_image != NULL);
- ASSERT(Utils::IsAligned(reinterpret_cast<uword>(instructions_image),
- OS::PreferredCodeAlignment()));
- ASSERT(Utils::IsAligned(reinterpret_cast<uword>(shared_instructions_image),
- OS::PreferredCodeAlignment()));
+}
+
+RawApiError* ImageReader::VerifyAlignment() const {
+ if (!Utils::IsAligned(data_image_, kObjectAlignment) ||
+ !Utils::IsAligned(shared_data_image_, kObjectAlignment) ||
+ !Utils::IsAligned(instructions_image_, OS::PreferredCodeAlignment()) ||
+ !Utils::IsAligned(shared_instructions_image_,
+ OS::PreferredCodeAlignment())) {
+ return ApiError::New(
+ String::Handle(String::New("Snapshot is misaligned", Heap::kOld)),
+ Heap::kOld);
+ }
+ return ApiError::null();
}
RawInstructions* ImageReader::GetInstructionsAt(int32_t offset) const {
diff --git a/runtime/vm/image_snapshot.h b/runtime/vm/image_snapshot.h
index 99a3e02..a4af7e4 100644
--- a/runtime/vm/image_snapshot.h
+++ b/runtime/vm/image_snapshot.h
@@ -19,6 +19,7 @@
class Dwarf;
class Instructions;
class Object;
+class RawApiError;
class RawCode;
class RawInstructions;
class RawObject;
@@ -54,6 +55,8 @@
const uint8_t* shared_data_image,
const uint8_t* shared_instructions_image);
+ RawApiError* VerifyAlignment() const;
+
RawInstructions* GetInstructionsAt(int32_t offset) const;
RawObject* GetObjectAt(uint32_t offset) const;
RawObject* GetSharedObjectAt(uint32_t offset) const;
diff --git a/runtime/vm/kernel.h b/runtime/vm/kernel.h
index 8568139..036e3a4 100644
--- a/runtime/vm/kernel.h
+++ b/runtime/vm/kernel.h
@@ -16,7 +16,9 @@
namespace kernel {
class NameIndex {
public:
- NameIndex() : value_(-1) {}
+ static const int kInvalidName = -1;
+
+ NameIndex() : value_(kInvalidName) {}
explicit NameIndex(int value) : value_(value) {}
operator int() const { return value_; }
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index e426f4d..daee540 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -19,7 +19,7 @@
// Keep in sync with package:kernel/lib/binary/tag.dart.
static const uint32_t kMagicProgramFile = 0x90ABCDEFu;
-static const uint32_t kBinaryFormatVersion = 4;
+static const uint32_t kBinaryFormatVersion = 5;
// Keep in sync with package:kernel/lib/binary/tag.dart
#define KERNEL_TAG_LIST(V) \
@@ -213,6 +213,14 @@
return value;
}
+ double ReadDouble() {
+ ASSERT((size_ >= 8) && (offset_ >= 0) && (offset_ <= size_ - 8));
+ double value = ReadUnaligned(
+ reinterpret_cast<const double*>(&this->buffer()[offset_]));
+ offset_ += 8;
+ return value;
+ }
+
uint32_t ReadUInt() {
ASSERT((size_ >= 1) && (offset_ >= 0) && (offset_ <= size_ - 1));
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index 4b83212..6a3358c 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -82,8 +82,7 @@
return true;
case kDoubleLiteral:
simple_value_ = &Double::ZoneHandle(
- Z, Double::New(H.DartString(builder_->ReadStringReference()),
- Heap::kOld)); // read string reference.
+ Z, Double::New(builder_->ReadDouble(), Heap::kOld)); // read value.
*simple_value_ = H.Canonicalize(*simple_value_);
return true;
case kTrueLiteral:
diff --git a/runtime/vm/os_android.cc b/runtime/vm/os_android.cc
index 0b796ff..4481f19 100644
--- a/runtime/vm/os_android.cc
+++ b/runtime/vm/os_android.cc
@@ -243,7 +243,7 @@
__builtin_trap();
}
-uintptr_t DART_NOINLINE OS::GetProgramCounter() {
+DART_NOINLINE uintptr_t OS::GetProgramCounter() {
return reinterpret_cast<uintptr_t>(
__builtin_extract_return_addr(__builtin_return_address(0)));
}
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index 2424836..879df86 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -160,7 +160,7 @@
UNIMPLEMENTED();
}
-uintptr_t DART_NOINLINE OS::GetProgramCounter() {
+DART_NOINLINE uintptr_t OS::GetProgramCounter() {
return reinterpret_cast<uintptr_t>(
__builtin_extract_return_addr(__builtin_return_address(0)));
}
diff --git a/runtime/vm/os_linux.cc b/runtime/vm/os_linux.cc
index 4a4bf3d..6c28bd6 100644
--- a/runtime/vm/os_linux.cc
+++ b/runtime/vm/os_linux.cc
@@ -253,7 +253,7 @@
__builtin_trap();
}
-uintptr_t DART_NOINLINE OS::GetProgramCounter() {
+DART_NOINLINE uintptr_t OS::GetProgramCounter() {
return reinterpret_cast<uintptr_t>(
__builtin_extract_return_addr(__builtin_return_address(0)));
}
diff --git a/runtime/vm/os_macos.cc b/runtime/vm/os_macos.cc
index 0d52e03..8c5e2c9 100644
--- a/runtime/vm/os_macos.cc
+++ b/runtime/vm/os_macos.cc
@@ -207,7 +207,7 @@
__builtin_trap();
}
-uintptr_t DART_NOINLINE OS::GetProgramCounter() {
+DART_NOINLINE uintptr_t OS::GetProgramCounter() {
return reinterpret_cast<uintptr_t>(
__builtin_extract_return_addr(__builtin_return_address(0)));
}
diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc
index 6aa8ab9..5b62d16 100644
--- a/runtime/vm/os_thread.cc
+++ b/runtime/vm/os_thread.cc
@@ -97,6 +97,7 @@
// stack (SafeStack).
NO_SANITIZE_ADDRESS
NO_SANITIZE_SAFE_STACK
+DART_NOINLINE
uword OSThread::GetCurrentStackPointer() {
uword stack_allocated_local = reinterpret_cast<uword>(&stack_allocated_local);
return stack_allocated_local;
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index 59edcb4..c9906c3 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -1008,7 +1008,7 @@
// Note: functions below are marked DART_NOINLINE to recover performance on
// ARM where inlining these functions into the interpreter loop seemed to cause
// some code quality issues.
-static DART_NOINLINE bool InvokeRuntime(Thread* thread,
+DART_NOINLINE static bool InvokeRuntime(Thread* thread,
Simulator* sim,
RuntimeFunction drt,
const NativeArguments& args) {
@@ -1024,7 +1024,7 @@
}
}
-static DART_NOINLINE bool InvokeNative(Thread* thread,
+DART_NOINLINE static bool InvokeNative(Thread* thread,
Simulator* sim,
NativeFunctionWrapper wrapper,
Dart_NativeFunction function,
diff --git a/sdk/lib/_internal/js_runtime/lib/async_patch.dart b/sdk/lib/_internal/js_runtime/lib/async_patch.dart
index 5f04f0b..0c5c995 100644
--- a/sdk/lib/_internal/js_runtime/lib/async_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/async_patch.dart
@@ -162,6 +162,20 @@
bool get isCompleted => _completer.isCompleted;
}
+/// Creates a Completer for an `async` function.
+///
+/// Used as part of the runtime support for the async/await transformation.
+Completer<T> _makeAsyncAwaitCompleter<T>() {
+ return new _AsyncAwaitCompleter<T>();
+}
+
+/// Creates a Completer for an `async` function.
+///
+/// Used as part of the runtime support for the async/await transformation.
+Completer<T> _makeSyncCompleter<T>() {
+ return new Completer<T>.sync();
+}
+
/// Initiates the computation of an `async` function and starts the body
/// synchronously.
///
@@ -464,9 +478,12 @@
}
}
-//_makeAsyncStarController(body) {
-// return new _AsyncStarStreamController(body);
-//}
+/// Creates a stream controller for an `async*` function.
+///
+/// Used as part of the runtime support for the async/await transformation.
+_makeAsyncStarStreamController<T>(_WrappedAsyncBody body) {
+ return new _AsyncStarStreamController<T>(body);
+}
class _IterationMarker {
static const YIELD_SINGLE = 0;
@@ -618,6 +635,13 @@
}
}
+/// Creates an Iterable for a `sync*` function.
+///
+/// Used as part of the runtime support for the async/await transformation.
+_SyncStarIterable<T> _makeSyncStarIterable<T>(body) {
+ return new _SyncStarIterable<T>(body);
+}
+
/// An Iterable corresponding to a sync* method.
///
/// Each invocation of a sync* method will return a new instance of this class.
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index 28307ad..a89baa8 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -182,6 +182,12 @@
'returns:bool;effects:none;depends:none', JsBuiltin.isDynamicType, type);
}
+@ForceInline()
+bool isDartJsInteropTypeArgumentRti(type) {
+ return JS_BUILTIN('returns:bool;effects:none;depends:none',
+ JsBuiltin.isJsInteropTypeArgument, type);
+}
+
/// Returns whether the given type is _the_ Dart Object type.
// TODO(floitsch): move this to foreign_helper.dart or similar.
@ForceInline()
diff --git a/sdk/lib/_internal/js_runtime/lib/js_rti.dart b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
index 427a1b0..6fe6853 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_rti.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
@@ -256,6 +256,9 @@
var typeArgument = getFutureOrArgument(rti);
return 'FutureOr<${runtimeTypeToStringV2(typeArgument, genericContext)}>';
}
+ if (isDartJsInteropTypeArgumentRti(rti)) {
+ return 'dynamic';
+ }
// We should not get here.
return 'unknown-reified-type';
}
@@ -745,7 +748,8 @@
bool isTopTypeV2(var type) {
return isDartDynamicTypeRti(type) ||
isDartVoidTypeRti(type) ||
- isDartObjectTypeRti(type);
+ isDartObjectTypeRti(type) ||
+ isDartJsInteropTypeArgumentRti(type);
}
/// Returns `true` if the runtime type representation [type] is a supertype of
@@ -776,7 +780,8 @@
return isDartDynamicTypeRti(type) ||
isDartObjectTypeRti(type) ||
isNullTypeRti(type) ||
- isDartVoidTypeRti(type);
+ isDartVoidTypeRti(type) ||
+ isDartJsInteropTypeArgumentRti(type);
}
/// Returns `true` if the runtime type representation [type] is a `FutureOr`
@@ -946,6 +951,8 @@
// [t] is a top type?
if (isTopTypeV2(t)) return true;
+ if (isDartJsInteropTypeArgumentRti(s)) return true;
+
// [s] is a top type?
if (isTopTypeV2(s)) {
if (isGenericFunctionTypeParameter(t)) {
diff --git a/sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart b/sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart
index fdcc183..36c5e25 100644
--- a/sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart
+++ b/sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart
@@ -428,6 +428,12 @@
/// JS_BUILTIN('bool', JsBuiltin.isDynamicType, o)
isDynamicType,
+ /// Returns true if the given type is a type argument of a js-interop class
+ /// or a supertype of a js-interop class.
+ ///
+ /// JS_BUILTIN('bool', JsBuiltin.isJsInteropTypeArgument, o)
+ isJsInteropTypeArgument,
+
/// Returns the JavaScript-constructor name given an rti encoding.
///
/// JS_BUILTIN('String', JsBuiltin.rawRtiToJsConstructorName, rti)
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index e0024cf..a8cc728 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -6929,12 +6929,8 @@
Language/Statements/Assert/execution_t03: RuntimeError # Please triage this failure
Language/Statements/Assert/execution_t11: RuntimeError # Please triage this failure
Language/Statements/Return/runtime_type_t04: RuntimeError # Issue 26584
-Language/Statements/Return/type_t03: RuntimeError # Would pass if FutureOr checked
-Language/Statements/Return/type_t04: RuntimeError # Would pass if FutureOr checked
Language/Statements/Switch/execution_t01: Fail # Missing type check in switch expression
Language/Statements/Switch/type_t01: RuntimeError # Issue 16089
-Language/Statements/Yield_and_Yield_Each/Yield/static_type_t01: RuntimeError
-Language/Statements/Yield_and_Yield_Each/Yield/static_type_t02: RuntimeError
Language/Types/Dynamic_Type_System/malbounded_type_error_t01: RuntimeError # Issue 21088
Language/Types/Parameterized_Types/malbounded_t06: RuntimeError # Issue 21088
Language/Types/Static_Types/malformed_type_t01: RuntimeError # Issue 21089
diff --git a/tests/compiler/dart2js/closure/data/instantiation_strong.dart b/tests/compiler/dart2js/closure/data/instantiation_strong.dart
new file mode 100644
index 0000000..10b70e9
--- /dev/null
+++ b/tests/compiler/dart2js/closure/data/instantiation_strong.dart
@@ -0,0 +1,15 @@
+// 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.
+
+T id<T>(T t) => t;
+
+method<S>(S s) {
+ /*fields=[S],free=[S]*/
+ S Function(S) getId() => id;
+ return getId();
+}
+
+main() {
+ method(0);
+}
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index 52efe99..d7f0004 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -41,7 +41,8 @@
packages/*: Skip # Skip packages folder
quarantined/http_test: RuntimeError # not supported with CFE, consider deleting.
rti/rti_emission_test: Pass, Slow
-rti/rti_need_test: Pass, Slow
+rti/rti_need0_test: Pass, Slow
+rti/rti_need1_test: Pass, Slow
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
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
index 02b0d5e..82bea10 100644
--- a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
+++ b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
@@ -43,25 +43,44 @@
}
}
-/// Colorize diffs [left] and [right] and [delimiter], if ANSI colors are
-/// supported.
-String colorizeDiff(String left, String delimiter, String right) {
+/// Colorize the actual annotation [text], if ANSI colors are supported.
+String colorizeActual(String text) {
if (useColors) {
- return '${colors.green(left)}'
- '${colors.yellow(delimiter)}${colors.red(right)}';
+ return '${colors.red(text)}';
} else {
- return '$left$delimiter$right';
+ return text;
}
}
+/// Colorize an expected annotation [text], if ANSI colors are supported.
+String colorizeExpected(String text) {
+ if (useColors) {
+ return '${colors.green(text)}';
+ } else {
+ return text;
+ }
+}
+
+/// Colorize delimiter [text], if ANSI colors are supported.
+String colorizeDelimiter(String text) {
+ if (useColors) {
+ return '${colors.yellow(text)}';
+ } else {
+ return text;
+ }
+}
+
+/// Colorize diffs [expected] and [actual] and [delimiter], if ANSI colors are
+/// supported.
+String colorizeDiff(String expected, String delimiter, String actual) {
+ return '${colorizeExpected(expected)}'
+ '${colorizeDelimiter(delimiter)}${colorizeActual(actual)}';
+}
+
/// Colorize annotation delimiters [start] and [end] surrounding [text], if
/// ANSI colors are supported.
String colorizeAnnotation(String start, String text, String end) {
- if (useColors) {
- return '${colors.yellow(start)}$text${colors.yellow(end)}';
- } else {
- return '$start$text$end';
- }
+ return '${colorizeDelimiter(start)}$text${colorizeDelimiter(end)}';
}
/// Function that computes a data mapping for [member].
@@ -98,6 +117,10 @@
/// Display name used for strong mode compilation using the new common frontend.
const String strongName = 'strong mode';
+/// Display name used for strong mode compilation without implicit checks using
+/// the new common frontend.
+const String trustName = 'strong mode without implicit checks';
+
/// Compute actual data for all members defined in the program with the
/// [entryPoint] and [memorySourceFiles].
///
@@ -226,7 +249,7 @@
}
Expect.isNotNull(
member,
- "Global member '$member' not found in the global "
+ "Global member '$memberName' not found in the global "
"libraries: ${globalLibraries.map((l) => l.canonicalUri).join(', ')}");
return member;
}
@@ -275,7 +298,7 @@
String value1 = '${data1.value}';
annotations
.putIfAbsent(data1.offset, () => [])
- .add(colorizeSingle(value1));
+ .add(colorizeActual(value1));
});
return annotations;
}
@@ -455,7 +478,8 @@
ComputeClassDataFunction computeClassDataFromAst,
ComputeClassDataFunction computeClassDataFromKernel,
int shards: 1,
- int shardIndex: 0}) async {
+ int shardIndex: 0,
+ bool testOmit: false}) async {
args = args.toList();
bool verbose = args.remove('-v');
bool shouldContinue = args.remove('-c');
@@ -511,6 +535,7 @@
astMarker: new MemberAnnotations<IdValue>(),
kernelMarker: new MemberAnnotations<IdValue>(),
strongMarker: new MemberAnnotations<IdValue>(),
+ omitMarker: new MemberAnnotations<IdValue>(),
};
computeExpectedMap(entryPoint, code[entryPoint], expectedMaps);
Map<String, String> memorySourceFiles = {
@@ -590,7 +615,7 @@
} else {
print('--from kernel (strong mode)-----------------------------------');
List<String> options = [Flags.strongMode]..addAll(testOptions);
- if (trustTypeAnnotations) {
+ if (trustTypeAnnotations && !testOmit) {
options.add(Flags.omitImplicitChecks);
}
MemberAnnotations<IdValue> annotations = expectedMaps[strongMarker];
@@ -609,6 +634,29 @@
}
}
}
+ if (testOmit) {
+ if (skipForStrong.contains(name)) {
+ print('--skipped for kernel (strong mode, omit-implicit-checks)------');
+ } else {
+ print('--from kernel (strong mode, omit-implicit-checks)-------------');
+ List<String> options = [Flags.strongMode, Flags.omitImplicitChecks]
+ ..addAll(testOptions);
+ MemberAnnotations<IdValue> annotations = expectedMaps[omitMarker];
+ CompiledData compiledData2 = await computeData(
+ entryPoint, memorySourceFiles, computeFromKernel,
+ computeClassData: computeClassDataFromKernel,
+ options: options,
+ verbose: verbose,
+ forUserLibrariesOnly: forUserLibrariesOnly,
+ globalIds: annotations.globalData.keys);
+ if (await checkCode(
+ trustName, entity.uri, code, annotations, compiledData2,
+ filterActualData: filterActualData,
+ fatalErrors: !testAfterFailures)) {
+ hasFailures = true;
+ }
+ }
+ }
}
Expect.isFalse(hasFailures, 'Errors found.');
}
@@ -642,7 +690,7 @@
data.compiler.reporter,
actualData.sourceSpan,
'EXTRA $mode DATA for ${id.descriptor} = '
- '${colors.red('$actual')} for ${actualData.objectText}. '
+ '${colorizeActual('$actual')} for ${actualData.objectText}. '
'Data was expected for these ids: ${expectedMap.keys}');
if (filterActualData == null || filterActualData(null, actualData)) {
hasLocalFailure = true;
@@ -656,8 +704,8 @@
actualData.sourceSpan,
'UNEXPECTED $mode DATA for ${id.descriptor}: '
'Object: ${actualData.objectText}\n '
- 'expected: ${colors.green('$expected')}\n '
- 'actual: ${colors.red('$actual')}');
+ 'expected: ${colorizeExpected('$expected')}\n '
+ 'actual: ${colorizeActual('$actual')}');
if (filterActualData == null ||
filterActualData(expected, actualData)) {
hasLocalFailure = true;
@@ -771,6 +819,7 @@
const String astMarker = 'ast.';
const String kernelMarker = 'kernel.';
const String strongMarker = 'strong.';
+const String omitMarker = 'omit.';
/// Compute three [MemberAnnotations] objects from [code] specifying the
/// expected annotations we anticipate encountering; one corresponding to the
@@ -787,11 +836,12 @@
/// annotations without prefixes.
void computeExpectedMap(Uri sourceUri, AnnotatedCode code,
Map<String, MemberAnnotations<IdValue>> maps) {
- List<String> mapKeys = [astMarker, kernelMarker, strongMarker];
+ List<String> mapKeys = [astMarker, kernelMarker, strongMarker, omitMarker];
Map<String, AnnotatedCode> split = splitByPrefixes(code, mapKeys);
split.forEach((String marker, AnnotatedCode code) {
MemberAnnotations<IdValue> fileAnnotations = maps[marker];
+ assert(fileAnnotations != null, "No annotations for $marker in $maps");
Map<Id, IdValue> expectedValues = fileAnnotations[sourceUri];
for (Annotation annotation in code.annotations) {
String text = annotation.text;
@@ -799,14 +849,14 @@
if (idValue.id.isGlobal) {
Expect.isFalse(
fileAnnotations.globalData.containsKey(idValue.id),
- "Duplicate annotations for ${idValue.id}: ${idValue} and "
- "${fileAnnotations.globalData[idValue.id]}.");
+ "Duplicate annotations for ${idValue.id} in $marker: "
+ "${idValue} and ${fileAnnotations.globalData[idValue.id]}.");
fileAnnotations.globalData[idValue.id] = idValue;
} else {
Expect.isFalse(
expectedValues.containsKey(idValue.id),
- "Duplicate annotations for ${idValue.id}: ${idValue} and "
- "${expectedValues[idValue.id]}.");
+ "Duplicate annotations for ${idValue.id} in $marker: "
+ "${idValue} and ${expectedValues[idValue.id]}.");
expectedValues[idValue.id] = idValue;
}
}
diff --git a/tests/compiler/dart2js/inference/load_deferred_library_test.dart b/tests/compiler/dart2js/inference/load_deferred_library_test.dart
new file mode 100644
index 0000000..985453c
--- /dev/null
+++ b/tests/compiler/dart2js/inference/load_deferred_library_test.dart
@@ -0,0 +1,80 @@
+// 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:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
+import 'package:compiler/src/common_elements.dart';
+import 'package:compiler/src/common/names.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/js_model/js_strategy.dart';
+import 'package:compiler/src/kernel/element_map.dart';
+import 'package:compiler/src/types/types.dart';
+import 'package:compiler/src/world.dart';
+import 'package:expect/expect.dart';
+import 'package:kernel/ast.dart' as ir;
+import '../memory_compiler.dart';
+
+const String source = '''
+import 'package:expect/expect.dart' deferred as expect;
+
+main() {
+ callLoadLibrary();
+}
+
+callLoadLibrary() => expect.loadLibrary();
+''';
+
+main() async {
+ asyncTest(() async {
+ print('--test Dart 1 --use-old-frontend ---------------------------------');
+ await runTest([Flags.useOldFrontend], trust: false, useOldFrontend: true);
+ print('--test Dart 1 ----------------------------------------------------');
+ await runTest([], trust: false);
+ print('--test Dart 1 --trust-type-annotations ---------------------------');
+ await runTest([Flags.trustTypeAnnotations]);
+ print('--test Dart 2 ----------------------------------------------------');
+ await runTest([Flags.strongMode], trust: false);
+ print('--test Dart 2 --omit-implicit-checks -----------------------------');
+ await runTest([Flags.strongMode, Flags.omitImplicitChecks]);
+ });
+}
+
+runTest(List<String> options,
+ {bool trust: true, bool useOldFrontend: false}) async {
+ CompilationResult result = await runCompiler(
+ memorySourceFiles: {'main.dart': source}, options: options);
+ Expect.isTrue(result.isSuccess);
+ Compiler compiler = result.compiler;
+ ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
+ ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
+ LibraryEntity helperLibrary =
+ elementEnvironment.lookupLibrary(Uris.dart__js_helper);
+ FunctionEntity loadDeferredLibrary = elementEnvironment.lookupLibraryMember(
+ helperLibrary, 'loadDeferredLibrary');
+ TypeMask typeMask;
+ if (useOldFrontend) {
+ MethodElement method = loadDeferredLibrary;
+ typeMask = compiler.globalInference.results
+ .resultOfParameter(method.parameters.first)
+ .type;
+ } else {
+ JsBackendStrategy backendStrategy = compiler.backendStrategy;
+ KernelToLocalsMap localsMap = backendStrategy.globalLocalsMapForTesting
+ .getLocalsMap(loadDeferredLibrary);
+ MemberDefinition definition =
+ backendStrategy.elementMap.getMemberDefinition(loadDeferredLibrary);
+ ir.Procedure procedure = definition.node;
+ typeMask = compiler.globalInference.results
+ .resultOfParameter(localsMap
+ .getLocalVariable(procedure.function.positionalParameters.first))
+ .type;
+ }
+ if (trust) {
+ Expect.equals(closedWorld.commonMasks.stringType.nullable(), typeMask);
+ } else {
+ Expect.equals(closedWorld.commonMasks.dynamicType, typeMask);
+ }
+}
diff --git a/tests/compiler/dart2js/jsinterop/world_test.dart b/tests/compiler/dart2js/jsinterop/world_test.dart
index a706741..94e990a 100644
--- a/tests/compiler/dart2js/jsinterop/world_test.dart
+++ b/tests/compiler/dart2js/jsinterop/world_test.dart
@@ -7,25 +7,36 @@
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/common_elements.dart';
+import 'package:compiler/src/commandline_options.dart';
+import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/elements/entities.dart' show ClassEntity;
import 'package:compiler/src/elements/names.dart';
import 'package:compiler/src/universe/selector.dart';
import 'package:compiler/src/world.dart';
-import '../type_test_helper.dart';
+import '../helpers/element_lookup.dart';
+import '../memory_compiler.dart';
void main() {
asyncTest(() async {
- await testClasses(CompileMode.memory);
- await testClasses(CompileMode.kernel);
+ print('--test from ast---------------------------------------------------');
+ await testClasses([Flags.useOldFrontend]);
+ print('--test from kernel------------------------------------------------');
+ await testClasses([]);
+ print('--test from kernel (strong mode)----------------------------------');
+ // TODO(johnniwinther): Update the test to be strong mode compliant.
+ //await testClasses([Flags.strongMode]);
});
}
-testClasses(CompileMode compileMode) async {
+testClasses(List<String> options) async {
test(String mainSource,
{List<String> directlyInstantiated: const <String>[],
List<String> abstractlyInstantiated: const <String>[],
List<String> indirectlyInstantiated: const <String>[]}) async {
- TypeEnvironment env = await TypeEnvironment.create(r"""
+ CompilationResult result = await runCompiler(memorySourceFiles: {
+ 'main.dart': """
+import 'package:js/js.dart';
+
@JS()
class A {
get foo;
@@ -74,11 +85,11 @@
newD() => new D(foo: 3);
newE() => new E(4);
newF() => new F(5);
-""", mainSource: """
-import 'package:js/js.dart';
$mainSource
-""", compileMode: compileMode);
+"""
+ }, options: options);
+ Compiler compiler = result.compiler;
Map<String, ClassEntity> classEnvironment = <String, ClassEntity>{};
ClassEntity registerClass(ClassEntity cls) {
@@ -86,19 +97,19 @@
return cls;
}
- ClosedWorld world = env.closedWorld;
+ ClosedWorld world = compiler.backendClosedWorldForTesting;
ElementEnvironment elementEnvironment = world.elementEnvironment;
ClassEntity Object_ = registerClass(world.commonElements.objectClass);
ClassEntity Interceptor =
registerClass(world.commonElements.jsInterceptorClass);
ClassEntity JavaScriptObject =
registerClass(world.commonElements.jsJavaScriptObjectClass);
- ClassEntity A = registerClass(env.getClass('A'));
- ClassEntity B = registerClass(env.getClass('B'));
- ClassEntity C = registerClass(env.getClass('C'));
- ClassEntity D = registerClass(env.getClass('D'));
- ClassEntity E = registerClass(env.getClass('E'));
- ClassEntity F = registerClass(env.getClass('F'));
+ ClassEntity A = registerClass(findClass(world, 'A'));
+ ClassEntity B = registerClass(findClass(world, 'B'));
+ ClassEntity C = registerClass(findClass(world, 'C'));
+ ClassEntity D = registerClass(findClass(world, 'D'));
+ ClassEntity E = registerClass(findClass(world, 'E'));
+ ClassEntity F = registerClass(findClass(world, 'F'));
Selector nonExisting = new Selector.getter(const PublicName('nonExisting'));
diff --git a/tests/compiler/dart2js/kernel/impact_test.dart b/tests/compiler/dart2js/kernel/impact_test.dart
index 1e21b09..0138247 100644
--- a/tests/compiler/dart2js/kernel/impact_test.dart
+++ b/tests/compiler/dart2js/kernel/impact_test.dart
@@ -100,21 +100,23 @@
testIfNotNullSet(null);
testIfNull(null);
testSetIfNull(null);
- testSyncStar();
- testAsync();
- testAsyncStar();
- testLocalSyncStar();
- testLocalAsync();
- testLocalAsyncStar();
- testAnonymousSyncStar();
- testAnonymousAsync();
- testAnonymousAsyncStar();
+ // Following tests are disabled because we changed the Kernel version to
+ // register helper function calls with explicit type arguments.
+ //testSyncStar();
+ //testAsync();
+ //testAsyncStar();
+ //testLocalSyncStar();
+ //testLocalAsync();
+ //testLocalAsyncStar();
+ //testAnonymousSyncStar();
+ //testAnonymousAsync();
+ //testAnonymousAsyncStar();
+ //testAsyncForIn(null);
+ //testAsyncForInTyped(null);
testIfThen();
testIfThenElse();
testForIn(null);
testForInTyped(null);
- testAsyncForIn(null);
- testAsyncForInTyped(null);
testTryCatch();
testTryCatchOn();
testTryCatchStackTrace();
@@ -284,30 +286,32 @@
testIfNull(o) => o ?? 42;
testSetIfNull(o) => o ??= 42;
-testSyncStar() sync* {}
-testAsync() async {}
-testAsyncStar() async* {}
-testLocalSyncStar() {
- local() sync* {}
- return local;
-}
-testLocalAsync() {
- local() async {}
- return local;
-}
-testLocalAsyncStar() {
- local() async* {}
- return local;
-}
-testAnonymousSyncStar() {
- return () sync* {};
-}
-testAnonymousAsync() {
- return () async {};
-}
-testAnonymousAsyncStar() {
- return () async* {};
-}
+// Following tests are disabled because we changed the Kernel version to
+// register helper function calls with explicit type arguments.
+//testSyncStar() sync* {}
+//testAsync() async {}
+//testAsyncStar() async* {}
+//testLocalSyncStar() {
+// local() sync* {}
+// return local;
+//}
+//testLocalAsync() {
+// local() async {}
+// return local;
+//}
+//testLocalAsyncStar() {
+// local() async* {}
+// return local;
+//}
+//testAnonymousSyncStar() {
+// return () sync* {};
+//}
+//testAnonymousAsync() {
+// return () async {};
+//}
+//testAnonymousAsyncStar() {
+// return () async* {};
+//}
testIfThen() {
if (false) return 42;
@@ -326,12 +330,12 @@
testForInTyped(o) {
for (int e in o) {}
}
-testAsyncForIn(o) async {
- await for (var e in o) {}
-}
-testAsyncForInTyped(o) async {
- await for (int e in o) {}
-}
+//testAsyncForIn(o) async {
+// await for (var e in o) {}
+//}
+//testAsyncForInTyped(o) async {
+// await for (int e in o) {}
+//}
testTryCatch() {
try {} catch (e) {}
}
diff --git a/tests/compiler/dart2js/rti/data/call_typed_generic.dart b/tests/compiler/dart2js/rti/data/call_typed_generic.dart
index 494b90c..2db2947 100644
--- a/tests/compiler/dart2js/rti/data/call_typed_generic.dart
+++ b/tests/compiler/dart2js/rti/data/call_typed_generic.dart
@@ -5,7 +5,8 @@
import 'package:expect/expect.dart';
import 'package:meta/dart2js.dart';
-/*class: A:needsArgs*/
+/*!strong.class: A:needsArgs*/
+/*strong.class: A:direct,explicit=[A.T],needsArgs*/
class A<T> {
/*element: A.call:needsSignature*/
call(T t) {}
diff --git a/tests/compiler/dart2js/rti/data/call_typed_generic_strong.dart b/tests/compiler/dart2js/rti/data/call_typed_generic_strong.dart
index ef0e3cb..6678ce8 100644
--- a/tests/compiler/dart2js/rti/data/call_typed_generic_strong.dart
+++ b/tests/compiler/dart2js/rti/data/call_typed_generic_strong.dart
@@ -5,7 +5,8 @@
import 'package:expect/expect.dart';
import 'package:meta/dart2js.dart';
-/*class: A:needsArgs*/
+/*!strong.class: A:needsArgs*/
+/*strong.class: A:direct,explicit=[A.T],needsArgs*/
class A<T> {
/*element: A.call:needsSignature*/
call(T t) {}
diff --git a/tests/compiler/dart2js/rti/data/closure.dart b/tests/compiler/dart2js/rti/data/closure.dart
index 7b45cde..8b23eeb 100644
--- a/tests/compiler/dart2js/rti/data/closure.dart
+++ b/tests/compiler/dart2js/rti/data/closure.dart
@@ -2,7 +2,8 @@
// 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*/
+/*!strong.class: A:needsArgs*/
+/*strong.class: A:direct,explicit=[A.T],needsArgs*/
class A<T> {
m() {
return /*needsSignature*/ (T t) {};
@@ -11,7 +12,12 @@
/*element: A.f:*/
f() {
// TODO(johnniwinther): Optimize local function type signature need.
- return /*ast.*/ /*kernel.*/ /*strong.needsSignature*/ (int t) {};
+ return
+ /*ast.*/
+ /*kernel.*/
+ /*strong.needsSignature*/
+ /*omit.needsSignature*/
+ (int t) {};
}
}
diff --git a/tests/compiler/dart2js/rti/data/closure_generic_unneeded_strong.dart b/tests/compiler/dart2js/rti/data/closure_generic_unneeded_strong.dart
index 5e985bd..0b26509f 100644
--- a/tests/compiler/dart2js/rti/data/closure_generic_unneeded_strong.dart
+++ b/tests/compiler/dart2js/rti/data/closure_generic_unneeded_strong.dart
@@ -4,7 +4,8 @@
import 'package:expect/expect.dart';
-/*class: A:*/
+/*!strong.class: A:*/
+/*strong.class: A:direct,explicit=[A.T],needsArgs*/
class A<T> {
@NoInline()
m() {
diff --git a/tests/compiler/dart2js/rti/data/closure_unneeded.dart b/tests/compiler/dart2js/rti/data/closure_unneeded.dart
index 5e985bd..0b26509f 100644
--- a/tests/compiler/dart2js/rti/data/closure_unneeded.dart
+++ b/tests/compiler/dart2js/rti/data/closure_unneeded.dart
@@ -4,7 +4,8 @@
import 'package:expect/expect.dart';
-/*class: A:*/
+/*!strong.class: A:*/
+/*strong.class: A:direct,explicit=[A.T],needsArgs*/
class A<T> {
@NoInline()
m() {
diff --git a/tests/compiler/dart2js/rti/data/dynamic_is2_strong.dart b/tests/compiler/dart2js/rti/data/dynamic_is2_strong.dart
index f3b260d..e928292 100644
--- a/tests/compiler/dart2js/rti/data/dynamic_is2_strong.dart
+++ b/tests/compiler/dart2js/rti/data/dynamic_is2_strong.dart
@@ -2,6 +2,8 @@
// 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.
+/*!strong.class: A:*/
+/*strong.class: A:explicit=[A]*/
class A {
/*element: A.instanceMethod:deps=[B.instanceMethod],direct,explicit=[instanceMethod.T],needsArgs,selectors=[Selector(call, instanceMethod, arity=1, types=1)]*/
instanceMethod<T>(t) => t is T;
diff --git a/tests/compiler/dart2js/rti/data/dynamic_not2_strong.dart b/tests/compiler/dart2js/rti/data/dynamic_not2_strong.dart
index d04a960..55caaec 100644
--- a/tests/compiler/dart2js/rti/data/dynamic_not2_strong.dart
+++ b/tests/compiler/dart2js/rti/data/dynamic_not2_strong.dart
@@ -2,6 +2,8 @@
// 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.
+/*!strong.class: A:*/
+/*strong.class: A:explicit=[A]*/
class A {
/*element: A.instanceMethod:deps=[B.instanceMethod]*/
instanceMethod<T>(t) => t;
diff --git a/tests/compiler/dart2js/rti/data/dynamic_tear_off3_strong.dart b/tests/compiler/dart2js/rti/data/dynamic_tear_off3_strong.dart
index 8a9c2d6..ba29c64 100644
--- a/tests/compiler/dart2js/rti/data/dynamic_tear_off3_strong.dart
+++ b/tests/compiler/dart2js/rti/data/dynamic_tear_off3_strong.dart
@@ -2,6 +2,8 @@
// 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.
+/*!strong.class: A:*/
+/*strong.class: A:explicit=[A]*/
class A {
/*element: A.instanceMethod:deps=[staticMethod],direct,explicit=[instanceMethod.T],needsArgs,selectors=[Selector(call, instanceMethod, arity=1, types=1)]*/
instanceMethod<T>(t) => t is T;
diff --git a/tests/compiler/dart2js/rti/data/dynamic_type_literal2_strong.dart b/tests/compiler/dart2js/rti/data/dynamic_type_literal2_strong.dart
index b9826a5..975f814 100644
--- a/tests/compiler/dart2js/rti/data/dynamic_type_literal2_strong.dart
+++ b/tests/compiler/dart2js/rti/data/dynamic_type_literal2_strong.dart
@@ -2,6 +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.
+/*strong.class: A:explicit=[A]*/
class A {
/*element: A.instanceMethod:deps=[B.instanceMethod],exp,needsArgs,selectors=[Selector(call, instanceMethod, arity=0, types=1)]*/
instanceMethod<T>() => T;
diff --git a/tests/compiler/dart2js/rti/data/function_subtype_local5.dart b/tests/compiler/dart2js/rti/data/function_subtype_local5.dart
index 521daf0..b1cb012 100644
--- a/tests/compiler/dart2js/rti/data/function_subtype_local5.dart
+++ b/tests/compiler/dart2js/rti/data/function_subtype_local5.dart
@@ -18,9 +18,15 @@
class C<T> {
void test(String nameOfT, bool expectedResult) {
// TODO(johnniwinther): Optimize local function type signature need.
- /*ast.*/ /*kernel.*/ /*strong.needsSignature*/
+ /*ast.*/
+ /*kernel.*/
+ /*strong.needsSignature*/
+ /*omit.needsSignature*/
int foo(bool a, [String b]) => null;
- /*ast.*/ /*kernel.*/ /*strong.needsSignature*/
+ /*ast.*/
+ /*kernel.*/
+ /*strong.needsSignature*/
+ /*omit.needsSignature*/
int baz(bool a, {String b}) => null;
Expect.equals(expectedResult, foo is Foo<T>, 'foo is Foo<$nameOfT>');
diff --git a/tests/compiler/dart2js/rti/data/generic_class_is2.dart b/tests/compiler/dart2js/rti/data/generic_class_is2.dart
index 508466d..4a84003 100644
--- a/tests/compiler/dart2js/rti/data/generic_class_is2.dart
+++ b/tests/compiler/dart2js/rti/data/generic_class_is2.dart
@@ -8,6 +8,8 @@
/*class: A:implicit=[List<A<C2>>,List<A<C>>]*/
class A<T> {}
+/*!strong.class: A1:*/
+/*strong.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 a9fb97fe..0162882 100644
--- a/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart
+++ b/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart
@@ -11,6 +11,7 @@
/*ast.element: method:*/
/*kernel.element: method:*/
/*strong.element: method:needsArgs*/
+/*omit.element: method:needsArgs*/
method<T>() => new B<T>();
main() {
diff --git a/tests/compiler/dart2js/rti/data/generic_method_is.dart b/tests/compiler/dart2js/rti/data/generic_method_is.dart
index 5478c03..a2cfa4a 100644
--- a/tests/compiler/dart2js/rti/data/generic_method_is.dart
+++ b/tests/compiler/dart2js/rti/data/generic_method_is.dart
@@ -5,6 +5,7 @@
/*ast.element: method:direct,explicit=[method.T]*/
/*kernel.element: method:direct,explicit=[method.T]*/
/*strong.element: method:direct,explicit=[method.T],needsArgs*/
+/*omit.element: method:direct,explicit=[method.T],needsArgs*/
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
index 2ed28c3..4caa1c3 100644
--- a/tests/compiler/dart2js/rti/data/generic_method_is2_strong.dart
+++ b/tests/compiler/dart2js/rti/data/generic_method_is2_strong.dart
@@ -5,16 +5,19 @@
/*class: A1:implicit=[A1]*/
class A1 {}
+/*strong.class: A2:implicit=[A2]*/
class A2 {}
/*class: B1:implicit=[B1]*/
class B1 {}
+/*strong.class: B2:implicit=[B2]*/
class B2 {}
/*class: C1:implicit=[C1]*/
class C1 {}
+/*strong.class: C2:implicit=[C2]*/
class C2 {}
/*class: C3:implicit=[C3]*/
@@ -23,16 +26,19 @@
/*class: D1:implicit=[D1]*/
class D1 {}
+/*strong.class: D2:implicit=[D2]*/
class D2 {}
/*class: E1:implicit=[E1]*/
class E1 {}
+/*strong.class: E2:implicit=[E2]*/
class E2 {}
/*class: F1:implicit=[F1]*/
class F1 {}
+/*strong.class: F2:implicit=[F2]*/
class F2 {}
/*class: F3:implicit=[F3]*/
@@ -42,6 +48,7 @@
// Calls to this imply a check of the passed type arguments.
bool topLevelMethod1<T>(T t, {a1}) => t is T;
+/*strong.element: topLevelMethod2:direct,explicit=[topLevelMethod2.T],needsArgs,selectors=[Selector(call, call, arity=2, named=[a2], types=1)]*/
// Calls to this does _not_ imply a check of the passed type arguments.
T topLevelMethod2<T>(T t, {a2}) => t;
@@ -50,6 +57,7 @@
// Calls to this imply a check of the passed type arguments.
bool instanceMethod1<S>(S s, {b1}) => s is S;
+ /*strong.element: Class.instanceMethod2:direct,explicit=[instanceMethod2.S],needsArgs,selectors=[Selector(call, call, arity=2, named=[b2], types=1),Selector(call, instanceMethod2, arity=2, named=[b2], types=1)]*/
// Calls to this does _not_ imply a check of the passed type arguments.
S instanceMethod2<S>(S s, {b2}) => s;
}
@@ -60,11 +68,13 @@
bool localFunction1<U>(U u, {c1}) => u is U;
// Calls to this does _not_ imply a check of the passed type arguments.
+ /*strong.direct,explicit=[localFunction2.U],needsArgs,selectors=[Selector(call, call, arity=2, named=[c2], types=1)]*/
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.
+ /*strong.direct,explicit=[localFunction3.U],needsArgs,selectors=[Selector(call, call, arity=2, named=[c1], types=1)]*/
localFunction3<U>(U u, {c1}) => u;
var c = new Class();
diff --git a/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05_strong.dart b/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05_strong.dart
index b0b6317..6208ec6 100644
--- a/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05_strong.dart
+++ b/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05_strong.dart
@@ -4,18 +4,23 @@
// Test derived from language_2/generic_methods_dynamic_test/05
-/*class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SubListIterable],explicit=[JSArray],needsArgs*/
-/*class: global#List:deps=[C.bar,EmptyIterable,Iterable,JSArray,ListIterable],explicit=[List,List<B>],needsArgs*/
+/*!strong.class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SubListIterable],explicit=[JSArray],needsArgs*/
+/*strong.class: global#JSArray:deps=[ArrayIterator,EmptyIterable,List,ListIterable,SubListIterable],direct,explicit=[Iterable<JSArray.E>,JSArray,JSArray.E,JSArray<ArrayIterator.E>,List<JSArray.E>],implicit=[JSArray.E],needsArgs*/
+
+/*!strong.class: global#List:deps=[C.bar,EmptyIterable,Iterable,JSArray,ListIterable],explicit=[List,List<B>],needsArgs*/
+/*strong.class: global#List:deps=[C.bar,EmptyIterable,Iterable,JSArray,ListIterable,makeListFixedLength],direct,explicit=[List,List.E,List<B>,List<JSArray.E>,List<String>,List<makeListFixedLength.T>],implicit=[List.E],needsArgs*/
import "package:expect/expect.dart";
class A {}
-/*class: B:explicit=[List<B>]*/
+/*!strong.class: B:explicit=[List<B>]*/
+/*strong.class: B:explicit=[List<B>],implicit=[B]*/
class B {}
class C {
- /*element: C.bar:needsArgs,selectors=[Selector(call, bar, arity=1, types=1)]*/
+ /*!strong.element: C.bar:needsArgs,selectors=[Selector(call, bar, arity=1, types=1)]*/
+ /*strong.element: C.bar:explicit=[Iterable<bar.T>],implicit=[bar.T],indirect,needsArgs,selectors=[Selector(call, bar, arity=1, types=1)]*/
List<T> bar<T>(Iterable<T> t) => <T>[t.first];
}
diff --git a/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05a_strong.dart b/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05a_strong.dart
index 8940f95..e7b8007 100644
--- a/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05a_strong.dart
+++ b/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05a_strong.dart
@@ -6,18 +6,21 @@
import "package:expect/expect.dart";
-/*class: A:deps=[C.bar],explicit=[A<B>],needsArgs*/
+/*!strong.class: A:deps=[C.bar],explicit=[A<B>],needsArgs*/
+/*strong.class: A:deps=[C.bar],direct,explicit=[A.T,A<B>,A<bar.T>],needsArgs*/
class A<T> {
final T field;
A(this.field);
}
-/*class: B:explicit=[A<B>]*/
+/*!strong.class: B:explicit=[A<B>]*/
+/*strong.class: B:explicit=[A<B>],implicit=[B]*/
class B {}
class C {
- /*element: C.bar:needsArgs,selectors=[Selector(call, bar, arity=1, types=1)]*/
+ /*!strong.element: C.bar:needsArgs,selectors=[Selector(call, bar, arity=1, types=1)]*/
+ /*strong.element: C.bar:explicit=[A<bar.T>],implicit=[bar.T],indirect,needsArgs,selectors=[Selector(call, bar, arity=1, types=1)]*/
A<T> bar<T>(A<T> t) => new A<T>(t.field);
}
diff --git a/tests/compiler/dart2js/rti/data/list_literal_strong.dart b/tests/compiler/dart2js/rti/data/list_literal_strong.dart
index a2db42d..c682cf3 100644
--- a/tests/compiler/dart2js/rti/data/list_literal_strong.dart
+++ b/tests/compiler/dart2js/rti/data/list_literal_strong.dart
@@ -2,8 +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: global#List:deps=[Class.m,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin],explicit=[List],implicit=[List.E],indirect,needsArgs*/
-/*class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[JSArray],implicit=[JSArray.E],indirect,needsArgs*/
+/*strong.class: global#List:deps=[Class.m,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin,makeListFixedLength],direct,explicit=[List,List.E,List<JSArray.E>,List<String>,List<makeListFixedLength.T>],implicit=[List.E],needsArgs*/
+/*omit.class: global#List:deps=[Class.m,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin],explicit=[List],implicit=[List.E],indirect,needsArgs*/
+
+/*omit.class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[JSArray],implicit=[JSArray.E],indirect,needsArgs*/
main() {
var c = new Class();
diff --git a/tests/compiler/dart2js/rti/data/list_to_set.dart b/tests/compiler/dart2js/rti/data/list_to_set.dart
index 1d86288..83762b3 100644
--- a/tests/compiler/dart2js/rti/data/list_to_set.dart
+++ b/tests/compiler/dart2js/rti/data/list_to_set.dart
@@ -4,11 +4,13 @@
/*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],explicit=[List],implicit=[List.E],indirect,needsArgs*/
-/*strong.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin],explicit=[List],implicit=[List.E],indirect,needsArgs*/
+/*strong.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin,makeListFixedLength],direct,explicit=[List,List.E,List<JSArray.E>,List<String>,List<makeListFixedLength.T>],implicit=[List.E],needsArgs*/
+/*omit.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],implicit=[JSArray.E],indirect,needsArgs*/
-/*strong.class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[JSArray],implicit=[JSArray.E],indirect,needsArgs*/
+/*strong.class: global#JSArray:deps=[ArrayIterator,EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[Iterable<JSArray.E>,JSArray,JSArray.E,JSArray<ArrayIterator.E>,List<JSArray.E>],implicit=[JSArray.E],indirect,needsArgs*/
+/*omit.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
index 9f00b07..60c98f7 100644
--- a/tests/compiler/dart2js/rti/data/list_to_set_strong.dart
+++ b/tests/compiler/dart2js/rti/data/list_to_set_strong.dart
@@ -2,8 +2,11 @@
// 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],explicit=[List],implicit=[List.E],indirect,needsArgs*/
-/*class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[JSArray],implicit=[JSArray.E],indirect,needsArgs*/
+/*strong.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin,makeListFixedLength],direct,explicit=[List,List.E,List<JSArray.E>,List<String>,List<makeListFixedLength.T>],implicit=[List.E],needsArgs*/
+/*omit.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin],explicit=[List],implicit=[List.E],indirect,needsArgs*/
+
+/*strong.class: global#JSArray:deps=[ArrayIterator,EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[Iterable<JSArray.E>,JSArray,JSArray.E,JSArray<ArrayIterator.E>,List<JSArray.E>],implicit=[JSArray.E],indirect,needsArgs*/
+/*omit.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/local_function_generic_strong.dart b/tests/compiler/dart2js/rti/data/local_function_generic_strong.dart
index 71a9566..6963dd7 100644
--- a/tests/compiler/dart2js/rti/data/local_function_generic_strong.dart
+++ b/tests/compiler/dart2js/rti/data/local_function_generic_strong.dart
@@ -5,7 +5,8 @@
import 'package:expect/expect.dart';
method1() {
- /*needsSignature*/
+ /*strong.direct,explicit=[local.T],needsArgs,needsSignature*/
+ /*omit.needsSignature*/
T local<T>(T t) => t;
return local;
}
diff --git a/tests/compiler/dart2js/rti/data/local_function_list_literal_strong.dart b/tests/compiler/dart2js/rti/data/local_function_list_literal_strong.dart
index 40f4aa7..c6f518c 100644
--- a/tests/compiler/dart2js/rti/data/local_function_list_literal_strong.dart
+++ b/tests/compiler/dart2js/rti/data/local_function_list_literal_strong.dart
@@ -4,9 +4,11 @@
import 'package:expect/expect.dart';
-/*class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SubListIterable],explicit=[JSArray],needsArgs*/
+/*strong.class: global#JSArray:deps=[ArrayIterator,EmptyIterable,List,ListIterable,SubListIterable],direct,explicit=[Iterable<JSArray.E>,JSArray,JSArray.E,JSArray<ArrayIterator.E>,List<JSArray.E>],implicit=[JSArray.E],needsArgs*/
+/*omit.class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SubListIterable],explicit=[JSArray],needsArgs*/
-/*element: method:needsArgs*/
+/*strong.element: method:implicit=[method.T],indirect,needsArgs*/
+/*omit.element: method:needsArgs*/
@NoInline()
method<T>() {
return () => <T>[];
diff --git a/tests/compiler/dart2js/rti/data/local_function_map_literal_strong.dart b/tests/compiler/dart2js/rti/data/local_function_map_literal_strong.dart
index d0d805a..30702fe 100644
--- a/tests/compiler/dart2js/rti/data/local_function_map_literal_strong.dart
+++ b/tests/compiler/dart2js/rti/data/local_function_map_literal_strong.dart
@@ -4,9 +4,11 @@
import 'package:expect/expect.dart';
-/*class: global#LinkedHashMap:deps=[Map],needsArgs*/
+/*strong.class: global#LinkedHashMap:deps=[Map],explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],indirect,needsArgs*/
+/*omit.class: global#LinkedHashMap:deps=[Map],needsArgs*/
-/*element: method:needsArgs*/
+/*strong.element: method:implicit=[method.T],indirect,needsArgs*/
+/*omit.element: method:needsArgs*/
@NoInline()
method<T>() {
return () => <T, int>{};
diff --git a/tests/compiler/dart2js/rti/data/local_function_signature2_strong.dart b/tests/compiler/dart2js/rti/data/local_function_signature2_strong.dart
index a5dd390c..afb9150 100644
--- a/tests/compiler/dart2js/rti/data/local_function_signature2_strong.dart
+++ b/tests/compiler/dart2js/rti/data/local_function_signature2_strong.dart
@@ -25,7 +25,8 @@
}
class Class2 {
- /*element: Class2.method4:needsArgs,selectors=[Selector(call, method4, arity=0, types=1)]*/
+ /*strong.element: Class2.method4:direct,explicit=[method4.T],needsArgs,selectors=[Selector(call, method4, arity=0, types=1)]*/
+ /*omit.element: Class2.method4:needsArgs,selectors=[Selector(call, method4, arity=0, types=1)]*/
method4<T>() {
/*needsSignature*/
num local(T n) => null;
@@ -43,7 +44,8 @@
}
class Class4 {
- /*element: Class4.method6:*/
+ /*strong.element: Class4.method6:direct,explicit=[method6.T],needsArgs,selectors=[Selector(call, method6, arity=0, types=1)]*/
+ /*omit.element: Class4.method6:*/
method6<T>() {
/**/
num local(num n, T t) => null;
@@ -51,7 +53,8 @@
}
}
-/*element: method7:needsArgs*/
+/*strong.element: method7:direct,explicit=[method7.T],needsArgs*/
+/*omit.element: method7:needsArgs*/
method7<T>() {
/*needsSignature*/
num local(T n) => null;
@@ -65,7 +68,8 @@
return local;
}
-/*element: method9:*/
+/*strong.element: method9:direct,explicit=[method9.T],needsArgs*/
+/*omit.element: method9:*/
method9<T>() {
/**/
num local(num n, T t) => null;
@@ -73,7 +77,8 @@
}
method10() {
- /**/
+ /*strong.direct,explicit=[local.T],needsArgs*/
+ /*omit.*/
num local<T>(T n) => null;
return local;
}
@@ -85,7 +90,8 @@
}
method12() {
- /**/
+ /*strong.direct,explicit=[local.T],needsArgs*/
+ /*omit.*/
num local<T>(num n, T t) => null;
return local;
}
diff --git a/tests/compiler/dart2js/rti/data/local_function_signatures.dart b/tests/compiler/dart2js/rti/data/local_function_signatures.dart
index cc7bc3d..5759a26 100644
--- a/tests/compiler/dart2js/rti/data/local_function_signatures.dart
+++ b/tests/compiler/dart2js/rti/data/local_function_signatures.dart
@@ -9,6 +9,7 @@
/*ast.*/
/*kernel.*/
/*strong.needsSignature*/
+ /*omit.needsSignature*/
num local(num n) => null;
return local;
}
@@ -24,7 +25,8 @@
}
}
-/*class: Class2:needsArgs*/
+/*!strong.class: Class2:needsArgs*/
+/*strong.class: Class2:direct,explicit=[Class2.T],needsArgs*/
class Class2<T> {
method4() {
/*needsSignature*/
@@ -42,7 +44,8 @@
}
}
-/*class: Class4:*/
+/*!strong.class: Class4:*/
+/*strong.class: Class4:direct,explicit=[Class4.T],needsArgs*/
class Class4<T> {
method6() {
/**/
diff --git a/tests/compiler/dart2js/rti/data/local_function_signatures_strong.dart b/tests/compiler/dart2js/rti/data/local_function_signatures_strong.dart
index 71f5374..ce07bec 100644
--- a/tests/compiler/dart2js/rti/data/local_function_signatures_strong.dart
+++ b/tests/compiler/dart2js/rti/data/local_function_signatures_strong.dart
@@ -25,7 +25,8 @@
}
class Class2 {
- /*element: Class2.method4:needsArgs,selectors=[Selector(call, method4, arity=0, types=1)]*/
+ /*strong.element: Class2.method4:direct,explicit=[method4.T],needsArgs,selectors=[Selector(call, method4, arity=0, types=1)]*/
+ /*omit.element: Class2.method4:needsArgs,selectors=[Selector(call, method4, arity=0, types=1)]*/
method4<T>() {
/*needsSignature*/
num local(T n) => null;
@@ -43,7 +44,8 @@
}
class Class4 {
- /*element: Class4.method6:*/
+ /*strong.element: Class4.method6:direct,explicit=[method6.T],needsArgs,selectors=[Selector(call, method6, arity=0, types=1)]*/
+ /*omit.element: Class4.method6:*/
method6<T>() {
/**/
num local(num n, T t) => null;
@@ -51,7 +53,8 @@
}
}
-/*element: method7:needsArgs*/
+/*strong.element: method7:direct,explicit=[method7.T],needsArgs*/
+/*omit.element: method7:needsArgs*/
method7<T>() {
/*needsSignature*/
num local(T n) => null;
@@ -65,7 +68,8 @@
return local;
}
-/*element: method9:*/
+/*strong.element: method9:direct,explicit=[method9.T],needsArgs*/
+/*omit.element: method9:*/
method9<T>() {
/**/
num local(num n, T t) => null;
@@ -73,7 +77,8 @@
}
method10() {
- /*needsSignature*/
+ /*strong.direct,explicit=[local.T],needsArgs,needsSignature*/
+ /*omit.needsSignature*/
num local<T>(T n) => null;
return local;
}
@@ -85,7 +90,8 @@
}
method12() {
- /**/
+ /*strong.direct,explicit=[local.T],needsArgs*/
+ /*omit.*/
num local<T>(num n, T t) => null;
return local;
}
@@ -97,7 +103,8 @@
}
num Function(num) method14() {
- /*needsSignature*/
+ /*strong.direct,explicit=[local.T],needsArgs,needsSignature*/
+ /*omit.needsSignature*/
num local<T>(T n) => null;
return local;
}
diff --git a/tests/compiler/dart2js/rti/data/map_literal.dart b/tests/compiler/dart2js/rti/data/map_literal.dart
index 1643414..2f04d3b 100644
--- a/tests/compiler/dart2js/rti/data/map_literal.dart
+++ b/tests/compiler/dart2js/rti/data/map_literal.dart
@@ -2,10 +2,18 @@
// 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:*/
-/*class: global#LinkedHashMap:deps=[Map]*/
-/*class: global#JsLinkedHashMap:deps=[LinkedHashMap]*/
-/*class: global#double:explicit=[double]*/
+/*!strong.class: global#Map:*/
+/*strong.class: global#Map:explicit=[Map],indirect,needsArgs*/
+
+/*!strong.class: global#LinkedHashMap:deps=[Map]*/
+/*strong.class: global#LinkedHashMap:deps=[Map],explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],indirect,needsArgs*/
+
+/*!strong.class: global#JsLinkedHashMap:deps=[LinkedHashMap]*/
+/*strong.class: global#JsLinkedHashMap:deps=[LinkedHashMap],direct,explicit=[JsLinkedHashMap.K,JsLinkedHashMap.V,void Function(JsLinkedHashMap.K,JsLinkedHashMap.V)],implicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],needsArgs*/
+
+/*!strong.class: global#double:explicit=[double]*/
+/*strong.class: global#double:explicit=[double],implicit=[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
index 1643414..4c0bf5f 100644
--- a/tests/compiler/dart2js/rti/data/map_literal_strong.dart
+++ b/tests/compiler/dart2js/rti/data/map_literal_strong.dart
@@ -2,10 +2,18 @@
// 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:*/
-/*class: global#LinkedHashMap:deps=[Map]*/
-/*class: global#JsLinkedHashMap:deps=[LinkedHashMap]*/
-/*class: global#double:explicit=[double]*/
+/*strong.class: global#Map:explicit=[Map],indirect,needsArgs*/
+/*omit.class: global#Map:*/
+
+/*strong.class: global#LinkedHashMap:deps=[Map],explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],indirect,needsArgs*/
+/*omit.class: global#LinkedHashMap:deps=[Map]*/
+
+/*strong.class: global#JsLinkedHashMap:deps=[LinkedHashMap],direct,explicit=[JsLinkedHashMap.K,JsLinkedHashMap.V,void Function(JsLinkedHashMap.K,JsLinkedHashMap.V)],implicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],needsArgs*/
+/*omit.class: global#JsLinkedHashMap:deps=[LinkedHashMap]*/
+
+/*strong.class: global#double:explicit=[double],implicit=[double]*/
+/*omit.class: global#double:explicit=[double]*/
+
/*class: global#JSDouble:*/
main() {
diff --git a/tests/compiler/dart2js/rti/data/map_to_set.dart b/tests/compiler/dart2js/rti/data/map_to_set.dart
index 4cfda0e..06d337a 100644
--- a/tests/compiler/dart2js/rti/data/map_to_set.dart
+++ b/tests/compiler/dart2js/rti/data/map_to_set.dart
@@ -2,10 +2,18 @@
// 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],needsArgs*/
-/*class: global#LinkedHashMap:deps=[Map],needsArgs*/
-/*class: global#JsLinkedHashMap:deps=[LinkedHashMap],implicit=[JsLinkedHashMap.K],needsArgs*/
-/*class: global#double:explicit=[double]*/
+/*!strong.class: global#Map:deps=[Class],needsArgs*/
+/*strong.class: global#Map:deps=[Class,JsLinkedHashMap,MapMixin],explicit=[Map,Map<JsLinkedHashMap.K,JsLinkedHashMap.V>,Map<MapMixin.K,MapMixin.V>],indirect,needsArgs*/
+
+/*!strong.class: global#LinkedHashMap:deps=[Map],needsArgs*/
+/*strong.class: global#LinkedHashMap:deps=[Map],explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],indirect,needsArgs*/
+
+/*!strong.class: global#JsLinkedHashMap:deps=[LinkedHashMap],implicit=[JsLinkedHashMap.K],needsArgs*/
+/*strong.class: global#JsLinkedHashMap:deps=[LinkedHashMap],explicit=[JsLinkedHashMap.K,JsLinkedHashMap.V,Map<JsLinkedHashMap.K,JsLinkedHashMap.V>,void Function(JsLinkedHashMap.K,JsLinkedHashMap.V)],implicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],indirect,needsArgs*/
+
+/*!strong.class: global#double:explicit=[double]*/
+/*strong.class: global#double:explicit=[double],implicit=[double]*/
+
/*class: global#JSDouble:*/
main() {
@@ -15,7 +23,8 @@
set is Set<String>;
}
-/*class: Class:needsArgs*/
+/*!strong.class: Class:needsArgs*/
+/*strong.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/map_to_set_strong.dart b/tests/compiler/dart2js/rti/data/map_to_set_strong.dart
index 4cfda0e..641baca 100644
--- a/tests/compiler/dart2js/rti/data/map_to_set_strong.dart
+++ b/tests/compiler/dart2js/rti/data/map_to_set_strong.dart
@@ -2,10 +2,18 @@
// 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],needsArgs*/
-/*class: global#LinkedHashMap:deps=[Map],needsArgs*/
-/*class: global#JsLinkedHashMap:deps=[LinkedHashMap],implicit=[JsLinkedHashMap.K],needsArgs*/
-/*class: global#double:explicit=[double]*/
+/*strong.class: global#Map:deps=[Class,JsLinkedHashMap,MapMixin],explicit=[Map,Map<JsLinkedHashMap.K,JsLinkedHashMap.V>,Map<MapMixin.K,MapMixin.V>],indirect,needsArgs*/
+/*omit.class: global#Map:deps=[Class],needsArgs*/
+
+/*strong.class: global#LinkedHashMap:deps=[Map],explicit=[LinkedHashMap<LinkedHashMap.K,LinkedHashMap.V>],implicit=[LinkedHashMap.K,LinkedHashMap.V],indirect,needsArgs*/
+/*omit.class: global#LinkedHashMap:deps=[Map],needsArgs*/
+
+/*strong.class: global#JsLinkedHashMap:deps=[LinkedHashMap],explicit=[JsLinkedHashMap.K,JsLinkedHashMap.V,Map<JsLinkedHashMap.K,JsLinkedHashMap.V>,void Function(JsLinkedHashMap.K,JsLinkedHashMap.V)],implicit=[JsLinkedHashMap.K,JsLinkedHashMap.V],indirect,needsArgs*/
+/*omit.class: global#JsLinkedHashMap:deps=[LinkedHashMap],implicit=[JsLinkedHashMap.K],needsArgs*/
+
+/*strong.class: global#double:explicit=[double],implicit=[double]*/
+/*omit.class: global#double:explicit=[double]*/
+
/*class: global#JSDouble:*/
main() {
@@ -15,7 +23,8 @@
set is Set<String>;
}
-/*class: Class:needsArgs*/
+/*strong.class: Class:implicit=[Class.S,Class.T],indirect,needsArgs*/
+/*omit.class: Class:needsArgs*/
class Class<T, S> {
m() {
return <T, S>{};
diff --git a/tests/compiler/dart2js/rti/data/method_signatures.dart b/tests/compiler/dart2js/rti/data/method_signatures.dart
index 4c4a161..7c24e036 100644
--- a/tests/compiler/dart2js/rti/data/method_signatures.dart
+++ b/tests/compiler/dart2js/rti/data/method_signatures.dart
@@ -15,7 +15,8 @@
Object method3(num n) => null;
}
-/*class: Class2:needsArgs*/
+/*!strong.class: Class2:needsArgs*/
+/*strong.class: Class2:direct,explicit=[Class2.T],needsArgs*/
class Class2<T> {
/*element: Class2.method4:needsSignature*/
num method4(T n) => null;
@@ -27,7 +28,8 @@
T method5(num n) => null;
}
-/*class: Class4:*/
+/*!strong.class: Class4:*/
+/*strong.class: Class4:direct,explicit=[Class4.T],needsArgs*/
class Class4<T> {
/*element: Class4.method6:*/
num method6(num n, T t) => null;
diff --git a/tests/compiler/dart2js/rti/data/method_signatures_strong.dart b/tests/compiler/dart2js/rti/data/method_signatures_strong.dart
index 811548f..03650b8 100644
--- a/tests/compiler/dart2js/rti/data/method_signatures_strong.dart
+++ b/tests/compiler/dart2js/rti/data/method_signatures_strong.dart
@@ -16,7 +16,8 @@
}
class Class2 {
- /*element: Class2.method4:*/
+ /*strong.element: Class2.method4:direct,explicit=[method4.T],needsArgs*/
+ /*omit.element: Class2.method4:*/
num method4<T>(T n) => null;
}
@@ -26,17 +27,20 @@
}
class Class4 {
- /*element: Class4.method6:*/
+ /*strong.element: Class4.method6:direct,explicit=[method6.T],needsArgs*/
+ /*omit.element: Class4.method6:*/
num method6<T>(num n, T t) => null;
}
-/*element: method7:*/
+/*strong.element: method7:direct,explicit=[method7.T],needsArgs*/
+/*omit.element: method7:*/
num method7<T>(T n) => null;
/*element: method8:*/
T method8<T>(num n) => null;
-/*element: method9:*/
+/*strong.element: method9:direct,explicit=[method9.T],needsArgs*/
+/*omit.element: method9:*/
num method9<T>(num n, T t) => null;
@NoInline()
diff --git a/tests/compiler/dart2js/rti/data/tear_off_generic.dart b/tests/compiler/dart2js/rti/data/tear_off_generic.dart
index 6aec20e..2579700 100644
--- a/tests/compiler/dart2js/rti/data/tear_off_generic.dart
+++ b/tests/compiler/dart2js/rti/data/tear_off_generic.dart
@@ -2,7 +2,8 @@
// 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*/
+/*!strong.class: A:needsArgs*/
+/*strong.class: A:direct,explicit=[A.T],needsArgs*/
class A<T> {
/*element: A.m:needsSignature*/
void m(T t) {}
diff --git a/tests/compiler/dart2js/rti/data/tear_off_generic_strong.dart b/tests/compiler/dart2js/rti/data/tear_off_generic_strong.dart
index 6aec20e..887e55f 100644
--- a/tests/compiler/dart2js/rti/data/tear_off_generic_strong.dart
+++ b/tests/compiler/dart2js/rti/data/tear_off_generic_strong.dart
@@ -2,7 +2,8 @@
// 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*/
+/*strong.class: A:direct,explicit=[A.T],needsArgs*/
+/*omit.class: A:needsArgs*/
class A<T> {
/*element: A.m:needsSignature*/
void m(T t) {}
diff --git a/tests/compiler/dart2js/rti/emission/jsinterop.dart b/tests/compiler/dart2js/rti/emission/jsinterop.dart
new file mode 100644
index 0000000..97b0ca6
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/jsinterop.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.
+
+@JS()
+library jsinterop;
+
+/*class: global#JavaScriptObject:checks=[$isA,$isC],instance*/
+
+import 'package:js/js.dart';
+import 'package:expect/expect.dart';
+
+/*class: A:checkedInstance,checks=[],instance*/
+@JS()
+class A {
+ external A();
+}
+
+/*class: B:checks=[],instance*/
+@JS('BClass')
+class B {
+ external B();
+}
+
+/*class: C:checkedInstance,checks=[],instance*/
+@JS()
+@anonymous
+class C {
+ external factory C();
+}
+
+/*class: D:checks=[],instance*/
+@JS()
+@anonymous
+class D {
+ external factory D();
+}
+
+/*class: E:checkedInstance,checks=[],instance*/
+class E {
+ E();
+}
+
+/*class: F:checks=[],instance*/
+class F {
+ F();
+}
+
+@NoInline()
+test(o) => o is A || o is C || o is E;
+
+main() {
+ test(new A());
+ test(new B());
+ test(new C());
+ test(new D());
+ test(new E());
+ test(new F());
+}
diff --git a/tests/compiler/dart2js/rti/emission/jsinterop_generic.dart b/tests/compiler/dart2js/rti/emission/jsinterop_generic.dart
new file mode 100644
index 0000000..aec7f0d
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/jsinterop_generic.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.
+
+// dart2jsOptions=--strong
+
+@JS()
+library foo;
+
+// TODO(johnniwinther): Avoid generating duplicate is/as function when multiple
+// jsinterop classes implement the same interface.
+/*class: global#JavaScriptObject:checks=[$asA,$asB,$asB,$isA,$isB,$isB],instance*/
+
+import 'package:expect/expect.dart';
+import 'package:js/js.dart';
+
+/*class: A:checkedInstance,checks=[],instance*/
+@JS()
+@anonymous
+class A<T> {
+ external factory A();
+}
+
+/*class: B:checkedInstance*/
+class B<T> {}
+
+/*class: C:checks=[],instance*/
+@JS()
+@anonymous
+class C implements B<int> {
+ external factory C();
+}
+
+/*class: D:checkedInstance*/
+class D<T> {}
+
+/*class: E:checks=[],instance*/
+@JS()
+@anonymous
+class E implements B<String> {
+ external factory E();
+}
+
+main() {
+ test(new A<int>());
+ test(new A<String>());
+ test(new C());
+ test(new E());
+}
+
+test(o) {
+ Expect.isTrue(o is A<int>, "Expected $o to be A<int>");
+ Expect.isTrue(o is A<String>, "Expected $o to be A<String>");
+
+ Expect.isTrue(o is B<int>, "Expected $o to be B<int>");
+ Expect.isTrue(o is B<String>, "Expected $o to be B<String>");
+
+ Expect.isFalse(o is D<int>, "Expected $o not to be D<int>");
+}
diff --git a/tests/compiler/dart2js/rti/rti_need0_test.dart b/tests/compiler/dart2js/rti/rti_need0_test.dart
new file mode 100644
index 0000000..1ffa110
--- /dev/null
+++ b/tests/compiler/dart2js/rti/rti_need0_test.dart
@@ -0,0 +1,9 @@
+// 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 'rti_need_test_helper.dart';
+
+main(List<String> args) {
+ runTests(args, 0);
+}
diff --git a/tests/compiler/dart2js/rti/rti_need1_test.dart b/tests/compiler/dart2js/rti/rti_need1_test.dart
new file mode 100644
index 0000000..a2d42f4
--- /dev/null
+++ b/tests/compiler/dart2js/rti/rti_need1_test.dart
@@ -0,0 +1,9 @@
+// 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 'rti_need_test_helper.dart';
+
+main(List<String> args) {
+ runTests(args, 1);
+}
diff --git a/tests/compiler/dart2js/rti/rti_need_test.dart b/tests/compiler/dart2js/rti/rti_need_test_helper.dart
similarity index 98%
rename from tests/compiler/dart2js/rti/rti_need_test.dart
rename to tests/compiler/dart2js/rti/rti_need_test_helper.dart
index 4768628..567e519 100644
--- a/tests/compiler/dart2js/rti/rti_need_test.dart
+++ b/tests/compiler/dart2js/rti/rti_need_test_helper.dart
@@ -7,7 +7,6 @@
import 'package:compiler/src/closure.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/common_elements.dart';
-import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/elements.dart';
@@ -28,6 +27,10 @@
import '../equivalence/id_equivalence_helper.dart';
main(List<String> args) {
+ runTests(args);
+}
+
+runTests(List<String> args, [int shardIndex]) {
cacheRtiDataForTesting = true;
asyncTest(() async {
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
@@ -35,14 +38,17 @@
dataDir, computeAstRtiMemberNeed, computeKernelRtiMemberNeed,
computeClassDataFromAst: computeAstRtiClassNeed,
computeClassDataFromKernel: computeKernelRtiClassNeed,
- options: [Flags.omitImplicitChecks], // only used in strong-mode
+ options: [],
skipForStrong: [
'map_literal_checked.dart',
// TODO(johnniwinther): Optimize local function type signature need.
'subtype_named_args.dart',
'subtype_named_args1.dart',
],
- args: args);
+ args: args,
+ testOmit: true,
+ shardIndex: shardIndex ?? 0,
+ shards: shardIndex != null ? 2 : 1);
});
}
diff --git a/tests/compiler/dart2js/rti/show.dart b/tests/compiler/dart2js/rti/show.dart
index 7eeae70..f4ab741 100644
--- a/tests/compiler/dart2js/rti/show.dart
+++ b/tests/compiler/dart2js/rti/show.dart
@@ -9,7 +9,7 @@
import '../equivalence/id_equivalence_helper.dart';
import '../equivalence/show_helper.dart';
import 'rti_emission_test.dart';
-import 'rti_need_test.dart';
+import 'rti_need_test_helper.dart';
main(List<String> args) async {
cacheRtiDataForTesting = true;
diff --git a/tests/compiler/dart2js/rti/type_representation_test.dart b/tests/compiler/dart2js/rti/type_representation_test.dart
index 36fec2a..80647d9 100644
--- a/tests/compiler/dart2js/rti/type_representation_test.dart
+++ b/tests/compiler/dart2js/rti/type_representation_test.dart
@@ -77,7 +77,9 @@
JavaScriptBackend backend = compiler.backend;
TypeRepresentationGenerator typeRepresentation =
- new TypeRepresentationGenerator(backend.namer, strongMode: strongMode);
+ new TypeRepresentationGenerator(
+ backend.namer, compiler.backendClosedWorldForTesting.nativeData,
+ strongMode: strongMode);
Expression onVariable(TypeVariableType _variable) {
TypeVariableType variable = _variable;
diff --git a/tests/compiler/dart2js_extra/32774_test.dart b/tests/compiler/dart2js_extra/32774_test.dart
new file mode 100644
index 0000000..fbf3199
--- /dev/null
+++ b/tests/compiler/dart2js_extra/32774_test.dart
@@ -0,0 +1,47 @@
+// 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.
+
+// dart2jsOptions=--strong
+
+import 'package:expect/expect.dart';
+
+T id<T>(T t) => t;
+
+class C<T> {
+ final T t;
+ final T Function(T) f;
+
+ const C(this.t, this.f);
+}
+
+class D<T> {
+ final T t;
+ final T Function(T) f;
+
+ const D(this.t, this.f);
+}
+
+const C<int> c1a = const C<int>(0, id);
+const C<int> c1b = const C<int>(0, id);
+
+const C<double> c2a = const C<double>(0.5, id);
+const C<double> c2b = const C<double>(0.5, id);
+
+const D<int> d = const D<int>(0, id);
+
+main() {
+ Expect.equals(c1a, c1b);
+ Expect.isTrue(identical(c1a, c1b));
+ Expect.equals(c1a.f, c1b.f);
+
+ Expect.equals(c2a, c2b);
+ Expect.isTrue(identical(c2a, c2b));
+ Expect.equals(c2a.f, c2b.f);
+
+ Expect.notEquals(c1a, c2a);
+ Expect.notEquals(c1a.f, c2a.f);
+
+ Expect.notEquals(c1a, d);
+ Expect.isTrue(identical(c1a.f, d.f));
+}
diff --git a/tests/compiler/dart2js_extra/32969_test.dart b/tests/compiler/dart2js_extra/32969_test.dart
new file mode 100644
index 0000000..8599b3f
--- /dev/null
+++ b/tests/compiler/dart2js_extra/32969_test.dart
@@ -0,0 +1,50 @@
+// 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.
+
+// dart2jsOptions=--strong
+
+@JS()
+library foo;
+
+import 'package:expect/expect.dart';
+import 'package:js/js.dart';
+
+@JS()
+@anonymous
+class A<T> {
+ external factory A();
+}
+
+class B<T> {}
+
+@JS()
+@anonymous
+class C implements B<int> {
+ external factory C();
+}
+
+class D<T> {}
+
+@JS()
+@anonymous
+class E implements B<String> {
+ external factory E();
+}
+
+main() {
+ test(new A<int>());
+ test(new A<String>());
+ test(new C());
+ test(new E());
+}
+
+test(o) {
+ Expect.isTrue(o is A<int>, "Expected $o to be A<int>");
+ Expect.isTrue(o is A<String>, "Expected $o to be A<String>");
+
+ Expect.isTrue(o is B<int>, "Expected $o to be B<int>");
+ Expect.isTrue(o is B<String>, "Expected $o to be B<String>");
+
+ Expect.isFalse(o is D<int>, "Expected $o not to be D<int>");
+}
diff --git a/tests/compiler/dart2js_extra/32997a_lib.dart b/tests/compiler/dart2js_extra/32997a_lib.dart
new file mode 100644
index 0000000..54e4f54
--- /dev/null
+++ b/tests/compiler/dart2js_extra/32997a_lib.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.
+
+T getFoo<T>(T v) => v;
+
+typedef dynamic G<T>(T v);
+
+m(int x, {G<int> f: getFoo}) {
+ print(f(x));
+}
diff --git a/tests/compiler/dart2js_extra/32997a_test.dart b/tests/compiler/dart2js_extra/32997a_test.dart
new file mode 100644
index 0000000..4e2b00a
--- /dev/null
+++ b/tests/compiler/dart2js_extra/32997a_test.dart
@@ -0,0 +1,12 @@
+// 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.
+
+// dart2jsOptions=--strong
+
+import '32997a_lib.dart' deferred as b;
+
+main() async {
+ await b.loadLibrary();
+ print(b.m(3));
+}
diff --git a/tests/compiler/dart2js_extra/32997b_lib.dart b/tests/compiler/dart2js_extra/32997b_lib.dart
new file mode 100644
index 0000000..62eee11
--- /dev/null
+++ b/tests/compiler/dart2js_extra/32997b_lib.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.
+
+T getFoo<T>(T v) => v;
+
+typedef dynamic G<T>(T v);
+
+m<T>(T x, {G<T> f: getFoo}) {
+ print(f);
+}
diff --git a/tests/compiler/dart2js_extra/32997b_test.dart b/tests/compiler/dart2js_extra/32997b_test.dart
new file mode 100644
index 0000000..7783285
--- /dev/null
+++ b/tests/compiler/dart2js_extra/32997b_test.dart
@@ -0,0 +1,12 @@
+// 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.
+
+// dart2jsOptions=--strong
+
+import '32997b_lib.dart' deferred as b; //# 01: compile-time error
+
+main() async {
+ await b.loadLibrary(); //# 01: continued
+ print(b.m<int>(3)); //# 01: continued
+}
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 02e2263..1dc91cd 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -58,28 +58,15 @@
[ $compiler == dart2js && $checked ]
variable_type_test/01: Fail, OK
variable_type_test/03: Fail, OK
+32997a_test: SkipByDesign # --omit-implicit-checks shouldn't be used together
+32997b_test/none: SkipByDesign # --omit-implicit-checks shouldn't be used together
+32997b_test/01: SkipByDesign # --omit-implicit-checks shouldn't be used together
[ $compiler == dart2js && $checked && $fasta ]
-deferred/default_arg_is_tearoff_test: RuntimeError
-deferred/deferred_class_test: RuntimeError
-deferred/deferred_constant2_test: RuntimeError
-deferred/deferred_constant3_test: RuntimeError
-deferred/deferred_constant4_test: RuntimeError
-deferred/deferred_function_test: RuntimeError
-deferred/deferred_metadata_test: RuntimeError
deferred/deferred_mirrors1_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
deferred/deferred_mirrors2_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
-deferred/deferred_overlapping_test: RuntimeError
-deferred/interface_type_variable_test: RuntimeError
-deferred/load_in_correct_order_test: RuntimeError
-deferred/multiple_default_arg_test: RuntimeError
deferred/reflect_multiple_annotations_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
deferred/reflect_multiple_default_arg_test: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
-deferred/shared_constant_test: RuntimeError
-deferred/uninstantiated_type_variable_test: RuntimeError
-deferred_custom_loader_test: RuntimeError
-deferred_inheritance_test: RuntimeError
-deferred_split_test: RuntimeError
dummy_compiler_test: Crash
local_signature_test: Crash
minus_zero_test/01: MissingCompileTimeError
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 9a7255e..15b1905 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -90,9 +90,7 @@
assign_static_type_test/01: Fail
assign_static_type_test/02: MissingCompileTimeError
async_return_types_test/nestedFuture: Fail # Issue 26429
-cha_deopt1_test: RuntimeError
-cha_deopt2_test: RuntimeError
-cha_deopt3_test: RuntimeError
+async_return_types_test/wrongTypeParameter: Fail # Issue 26429
closure_type_test/01: RuntimeError # Issue 12745
closure_type_test/none: RuntimeError # Issue 12745
compile_time_constant_checked2_test/01: MissingCompileTimeError
@@ -132,43 +130,11 @@
const_constructor3_test/02: MissingCompileTimeError
const_constructor3_test/04: MissingCompileTimeError
const_init2_test/02: MissingCompileTimeError
-deferred_closurize_load_library_test: RuntimeError
-deferred_constant_list_test: RuntimeError
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_constraints_type_annotation_test/new: RuntimeError
-deferred_constraints_type_annotation_test/new_before_load: RuntimeError
-deferred_constraints_type_annotation_test/new_generic1: RuntimeError
-deferred_constraints_type_annotation_test/new_generic2: RuntimeError
-deferred_constraints_type_annotation_test/new_generic3: RuntimeError
-deferred_constraints_type_annotation_test/none: RuntimeError
-deferred_constraints_type_annotation_test/static_method: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_generic2: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_generic3: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_non_deferred: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_null: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_top_level: RuntimeError
-deferred_function_type_test: RuntimeError
-deferred_global_test: RuntimeError
-deferred_inlined_test: RuntimeError
-deferred_load_constants_test/none: RuntimeError
-deferred_load_inval_code_test: RuntimeError
-deferred_mixin_test: RuntimeError
-deferred_no_such_method_test: RuntimeError
-deferred_only_constant_test: RuntimeError
-deferred_optimized_test: RuntimeError
-deferred_regression_22995_test: RuntimeError
-deferred_regression_28678_test: RuntimeError
-deferred_shadow_load_library_test: RuntimeError
-deferred_shared_and_unshared_classes_test: RuntimeError
-deferred_static_seperate_test: RuntimeError
-deferred_type_dependency_test/as: RuntimeError
-deferred_type_dependency_test/is: RuntimeError
-deferred_type_dependency_test/none: RuntimeError
-deferred_type_dependency_test/type_annotation: RuntimeError
+deferred_constraints_type_annotation_test/type_annotation_generic1: Fail # Missing dynamic type error
+deferred_constraints_type_annotation_test/type_annotation_generic4: Fail # Missing dynamic type error
+deferred_constraints_type_annotation_test/type_annotation1: Fail # Missing dynamic type error
factory_redirection_test/08: Fail
factory_redirection_test/09: Fail
factory_redirection_test/10: Fail
@@ -194,9 +160,7 @@
map_literal1_test/01: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: Fail
redirecting_factory_malbounded_test/01: Fail
-regress_22443_test: RuntimeError
regress_26133_test: RuntimeError # Issue 26429
-regress_28278_test: RuntimeError
regress_29405_test: RuntimeError # Issue 29422
stacktrace_demangle_ctors_test: RuntimeError
stacktrace_test: RuntimeError
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index edb651c..646ea75 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -303,7 +303,6 @@
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
-deferred_load_constants_test/none: RuntimeError
deferred_load_library_wrong_args_test/01: MissingRuntimeError
deferred_not_loaded_check_test: RuntimeError # Test out of date. Issue 31933
deferred_redirecting_factory_test: RuntimeError
@@ -605,9 +604,6 @@
call_method_implicit_tear_off_test/02: RuntimeError
call_method_implicit_tear_off_test/04: RuntimeError
canonical_const2_test: RuntimeError, OK # non JS number semantics
-cha_deopt1_test: RuntimeError
-cha_deopt2_test: RuntimeError
-cha_deopt3_test: RuntimeError
check_member_static_test/02: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
class_cycle_test/03: MissingCompileTimeError
@@ -649,40 +645,15 @@
cyclic_type_test/04: RuntimeError
cyclic_typedef_test/10: Crash # Crash when compiling file:///usr/local/google/home/sra/Dart/sdk/out/ReleaseX64/generated_tests/language_2/cyclic_typedef_test_10.dart,
cyclic_typedef_test/11: Crash # Crash when compiling file:///usr/local/google/home/sra/Dart/sdk/out/ReleaseX64/generated_tests/language_2/cyclic_typedef_test_11.dart,
-deferred_closurize_load_library_test: RuntimeError
-deferred_constant_list_test: RuntimeError
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/new: RuntimeError
-deferred_constraints_type_annotation_test/new_generic1: RuntimeError
-deferred_constraints_type_annotation_test/none: RuntimeError
-deferred_constraints_type_annotation_test/static_method: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_non_deferred: RuntimeError
-deferred_function_type_test: RuntimeError
-deferred_global_test: RuntimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
-deferred_inlined_test: RuntimeError
-deferred_load_constants_test/none: RuntimeError
-deferred_load_inval_code_test: RuntimeError
deferred_load_library_wrong_args_test/01: CompileTimeError
-deferred_mixin_test: RuntimeError
-deferred_no_such_method_test: RuntimeError
deferred_not_loaded_check_test: RuntimeError # Test out of date. Issue 31933
-deferred_only_constant_test: RuntimeError
-deferred_optimized_test: RuntimeError
deferred_redirecting_factory_test: RuntimeError
-deferred_regression_22995_test: RuntimeError
-deferred_regression_28678_test: RuntimeError
-deferred_shadow_load_library_test: RuntimeError
-deferred_shared_and_unshared_classes_test: RuntimeError
-deferred_static_seperate_test: RuntimeError
-deferred_type_dependency_test/as: RuntimeError
-deferred_type_dependency_test/is: RuntimeError
-deferred_type_dependency_test/none: RuntimeError
-deferred_type_dependency_test/type_annotation: RuntimeError
double_int_to_string_test: RuntimeError, OK # non JS number semantics
duplicate_export_negative_test: Fail
duplicate_implements_test/01: MissingCompileTimeError
@@ -904,13 +875,11 @@
redirecting_factory_default_values_test/01: MissingCompileTimeError
redirecting_factory_default_values_test/02: MissingCompileTimeError
redirecting_factory_reflection_test: RuntimeError
-regress_22443_test: RuntimeError
regress_23089_test: Crash # Crash when compiling file:///usr/local/google/home/sra/Dart/sdk/tests/language_2/regress_23089_test.dart,
regress_23408_test: CompileTimeError
regress_24283_test: RuntimeError # non JS number semantics
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
regress_28255_test: RuntimeError
-regress_28278_test: RuntimeError
regress_29025_test: CompileTimeError
regress_29405_test: CompileTimeError
regress_29784_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in () for j:constructor(A.ok).
@@ -1021,7 +990,6 @@
async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
async_return_types_test/nestedFuture: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart': Failed assertion: line 208 pos 18: '!(_useKernel && _strongMode && !_disableRtiOptimization) ||
-async_return_types_test/tooManyTypeParameters: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart': Failed assertion: line 208 pos 18: '!(_useKernel && _strongMode && !_disableRtiOptimization) ||
async_return_types_test/wrongReturnType: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart': Failed assertion: line 208 pos 18: '!(_useKernel && _strongMode && !_disableRtiOptimization) ||
async_star_cancel_while_paused_test: Crash # 'file:*/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart': Failed assertion: line 208 pos 18: '!(_useKernel && _strongMode && !_disableRtiOptimization) ||
async_star_test/01: RuntimeError
@@ -1045,9 +1013,6 @@
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
canonical_const2_test: RuntimeError, OK # non JS number semantics
-cha_deopt1_test: RuntimeError
-cha_deopt2_test: RuntimeError
-cha_deopt3_test: RuntimeError
check_member_static_test/01: MissingCompileTimeError
check_member_static_test/02: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
@@ -1106,40 +1071,15 @@
cyclic_typedef_test/11: Crash # Stack Overflow
default_factory2_test/01: MissingCompileTimeError
default_factory_test/01: MissingCompileTimeError
-deferred_closurize_load_library_test: RuntimeError
-deferred_constant_list_test: RuntimeError
deferred_constraints_constants_test/none: RuntimeError
deferred_constraints_constants_test/reference_after_load: RuntimeError
-deferred_constraints_type_annotation_test/new: RuntimeError
-deferred_constraints_type_annotation_test/new_generic1: RuntimeError
-deferred_constraints_type_annotation_test/none: RuntimeError
-deferred_constraints_type_annotation_test/static_method: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_non_deferred: RuntimeError
-deferred_function_type_test: RuntimeError
-deferred_global_test: RuntimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
deferred_inheritance_constraints_test/redirecting_constructor: MissingCompileTimeError
-deferred_inlined_test: RuntimeError
-deferred_load_constants_test/none: RuntimeError
-deferred_load_inval_code_test: RuntimeError
deferred_load_library_wrong_args_test/01: CompileTimeError
-deferred_mixin_test: RuntimeError
-deferred_no_such_method_test: RuntimeError
deferred_not_loaded_check_test: RuntimeError # Test out of date. Issue 31933
-deferred_only_constant_test: RuntimeError
-deferred_optimized_test: RuntimeError
deferred_redirecting_factory_test: RuntimeError
-deferred_regression_22995_test: RuntimeError
-deferred_regression_28678_test: RuntimeError
-deferred_shadow_load_library_test: RuntimeError
-deferred_shared_and_unshared_classes_test: RuntimeError
-deferred_static_seperate_test: RuntimeError
-deferred_type_dependency_test/as: RuntimeError
-deferred_type_dependency_test/is: RuntimeError
-deferred_type_dependency_test/none: RuntimeError
-deferred_type_dependency_test/type_annotation: RuntimeError
double_int_to_string_test: RuntimeError, OK # non JS number semantics
duplicate_export_negative_test: Fail
duplicate_implements_test/01: MissingCompileTimeError
@@ -1383,11 +1323,8 @@
mixin_supertype_subclass_test/03: CompileTimeError
mixin_supertype_subclass_test/04: CompileTimeError
mixin_supertype_subclass_test/none: CompileTimeError
-mixin_type_parameters_errors_test/01: MissingCompileTimeError
-mixin_type_parameters_errors_test/02: MissingCompileTimeError
mixin_type_parameters_errors_test/03: MissingCompileTimeError
mixin_type_parameters_errors_test/04: MissingCompileTimeError
-mixin_type_parameters_errors_test/05: MissingCompileTimeError
modulo_test: RuntimeError # non JS number semantics
multiline_newline_test/04: MissingCompileTimeError
multiline_newline_test/04r: MissingCompileTimeError
@@ -1451,13 +1388,11 @@
redirecting_factory_reflection_test: RuntimeError
regress_13462_1_test: RuntimeError
regress_18535_test: RuntimeError
-regress_22443_test: RuntimeError
regress_23089_test: Crash # Stack Overflow
regress_23408_test: CompileTimeError
regress_24283_test: RuntimeError # non JS number semantics
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
regress_28255_test: RuntimeError
-regress_28278_test: RuntimeError
regress_29025_test: CompileTimeError
regress_29405_test: CompileTimeError
regress_29784_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in () for j:constructor(A.ok).
@@ -1642,7 +1577,6 @@
async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
async_return_types_test/nestedFuture: Crash # Interpolated value #1 is not an Expression or List of Expressions: [VariableUse(f), Instance of 'LiteralNull', null]
-async_return_types_test/tooManyTypeParameters: Crash # Interpolated value #1 is not an Expression or List of Expressions: [VariableUse(f), Instance of 'LiteralNull', null]
async_return_types_test/wrongReturnType: Crash # Interpolated value #1 is not an Expression or List of Expressions: [VariableUse(f), Instance of 'LiteralNull', null]
async_star_cancel_while_paused_test: Crash # Interpolated value #1 is not an Expression or List of Expressions: [VariableUse(f), Instance of 'LiteralNull', null]
async_star_test/01: RuntimeError
@@ -1667,9 +1601,6 @@
call_non_method_field_test/02: MissingCompileTimeError
call_with_no_such_method_test: RuntimeError
canonical_const2_test: RuntimeError, OK # non JS number semantics
-cha_deopt1_test: RuntimeError
-cha_deopt2_test: RuntimeError
-cha_deopt3_test: RuntimeError
check_member_static_test/01: MissingCompileTimeError
check_member_static_test/02: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
@@ -1723,40 +1654,15 @@
cyclic_typedef_test/11: Crash # Stack Overflow
default_factory2_test/01: MissingCompileTimeError
default_factory_test/01: MissingCompileTimeError
-deferred_closurize_load_library_test: RuntimeError
-deferred_constant_list_test: RuntimeError
deferred_constraints_constants_test/none: RuntimeError
deferred_constraints_constants_test/reference_after_load: RuntimeError
-deferred_constraints_type_annotation_test/new: RuntimeError
-deferred_constraints_type_annotation_test/new_generic1: RuntimeError
-deferred_constraints_type_annotation_test/none: RuntimeError
-deferred_constraints_type_annotation_test/static_method: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_non_deferred: RuntimeError
-deferred_function_type_test: RuntimeError
-deferred_global_test: RuntimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
deferred_inheritance_constraints_test/redirecting_constructor: MissingCompileTimeError
-deferred_inlined_test: RuntimeError
-deferred_load_constants_test/none: RuntimeError
-deferred_load_inval_code_test: RuntimeError
deferred_load_library_wrong_args_test/01: CompileTimeError
-deferred_mixin_test: RuntimeError
-deferred_no_such_method_test: RuntimeError
deferred_not_loaded_check_test: RuntimeError # Test out of date. Issue 31933
-deferred_only_constant_test: RuntimeError
-deferred_optimized_test: RuntimeError
deferred_redirecting_factory_test: RuntimeError
-deferred_regression_22995_test: RuntimeError
-deferred_regression_28678_test: RuntimeError
-deferred_shadow_load_library_test: RuntimeError
-deferred_shared_and_unshared_classes_test: RuntimeError
-deferred_static_seperate_test: RuntimeError
-deferred_type_dependency_test/as: RuntimeError
-deferred_type_dependency_test/is: RuntimeError
-deferred_type_dependency_test/none: RuntimeError
-deferred_type_dependency_test/type_annotation: RuntimeError
double_int_to_string_test: RuntimeError, OK # non JS number semantics
duplicate_export_negative_test: Fail
duplicate_implements_test/01: MissingCompileTimeError
@@ -1999,11 +1905,8 @@
mixin_supertype_subclass_test/03: CompileTimeError
mixin_supertype_subclass_test/04: CompileTimeError
mixin_supertype_subclass_test/none: CompileTimeError
-mixin_type_parameters_errors_test/01: MissingCompileTimeError
-mixin_type_parameters_errors_test/02: MissingCompileTimeError
mixin_type_parameters_errors_test/03: MissingCompileTimeError
mixin_type_parameters_errors_test/04: MissingCompileTimeError
-mixin_type_parameters_errors_test/05: MissingCompileTimeError
mock_writable_final_field_test: RuntimeError # Issue 30847
mock_writable_final_private_field_test: RuntimeError # Issue 17526, 30847
modulo_test: RuntimeError # non JS number semantics
@@ -2067,13 +1970,11 @@
regress_13462_1_test: RuntimeError
regress_18535_test: RuntimeError
regress_21795_test: RuntimeError # Issue 12605
-regress_22443_test: RuntimeError
regress_23089_test: Crash # Stack Overflow
regress_23408_test: CompileTimeError
regress_24283_test: RuntimeError, OK # Requires 64 bit numbers.
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
regress_28255_test: RuntimeError
-regress_28278_test: RuntimeError
regress_29025_test: CompileTimeError
regress_29405_test: CompileTimeError
regress_29784_test/01: Crash # Issue 29784
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index 47cd057..c407314 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -293,7 +293,6 @@
async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
async_return_types_test/nestedFuture: MissingCompileTimeError
-async_return_types_test/tooManyTypeParameters: MissingCompileTimeError
async_return_types_test/wrongReturnType: MissingCompileTimeError
bad_override_test/01: MissingCompileTimeError
bad_override_test/02: MissingCompileTimeError
@@ -525,11 +524,8 @@
mixin_super_use_test: RuntimeError
mixin_supertype_subclass_test/02: MissingCompileTimeError
mixin_supertype_subclass_test/05: MissingCompileTimeError
-mixin_type_parameters_errors_test/01: MissingCompileTimeError
-mixin_type_parameters_errors_test/02: MissingCompileTimeError
mixin_type_parameters_errors_test/03: MissingCompileTimeError
mixin_type_parameters_errors_test/04: MissingCompileTimeError
-mixin_type_parameters_errors_test/05: MissingCompileTimeError
mock_writable_final_private_field_test: RuntimeError
multiline_newline_test/06: MissingCompileTimeError
multiline_newline_test/06r: MissingCompileTimeError
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 3e8a0a8..611f8e8 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -62,7 +62,6 @@
async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
async_return_types_test/nestedFuture: MissingCompileTimeError
-async_return_types_test/tooManyTypeParameters: MissingCompileTimeError
async_return_types_test/wrongReturnType: MissingCompileTimeError
bad_override_test/01: MissingCompileTimeError
bad_override_test/02: MissingCompileTimeError
@@ -161,11 +160,8 @@
mixin_super_bound_test/02: MissingCompileTimeError
mixin_super_constructor_named_test/01: MissingCompileTimeError # KernelVM bug: Issue 15101
mixin_super_constructor_positionals_test/01: MissingCompileTimeError # KernelVM bug: Issue 15101
-mixin_type_parameters_errors_test/01: MissingCompileTimeError
-mixin_type_parameters_errors_test/02: MissingCompileTimeError
mixin_type_parameters_errors_test/03: MissingCompileTimeError
mixin_type_parameters_errors_test/04: MissingCompileTimeError
-mixin_type_parameters_errors_test/05: MissingCompileTimeError
named_constructor_test/01: MissingCompileTimeError
named_parameters_default_eq_test/02: MissingCompileTimeError # Fasta bug: Default values are not allowed on redirecting factory constructors.
override_field_test/02: MissingCompileTimeError
@@ -175,6 +171,7 @@
override_inheritance_field_test/48: MissingCompileTimeError
override_inheritance_field_test/53: MissingCompileTimeError
override_inheritance_field_test/54: MissingCompileTimeError
+override_inheritance_mixed_test/07: MissingCompileTimeError # Issue 32613
override_inheritance_mixed_test/09: MissingCompileTimeError
partial_tearoff_instantiation_test/05: MissingCompileTimeError
partial_tearoff_instantiation_test/06: MissingCompileTimeError
@@ -1362,6 +1359,7 @@
async_congruence_method_test/01: MissingCompileTimeError
async_congruence_unnamed_test/01: MissingCompileTimeError
async_congruence_unnamed_test/02: MissingCompileTimeError
+async_return_types_test/tooManyTypeParameters: MissingCompileTimeError
async_return_types_test/wrongTypeParameter: MissingCompileTimeError
bad_named_parameters2_test/01: MissingCompileTimeError
bad_named_parameters_test/01: MissingCompileTimeError
@@ -1835,6 +1833,9 @@
mixin_type_parameter_inference_test/11: MissingCompileTimeError
mixin_type_parameter_inference_test/14: MissingCompileTimeError
mixin_type_parameter_inference_test/15: MissingCompileTimeError
+mixin_type_parameters_errors_test/01: MissingCompileTimeError
+mixin_type_parameters_errors_test/02: MissingCompileTimeError
+mixin_type_parameters_errors_test/05: MissingCompileTimeError
mixin_with_two_implicit_constructors_test: MissingCompileTimeError
multiline_newline_test/04: MissingCompileTimeError
multiline_newline_test/04r: MissingCompileTimeError
diff --git a/tests/language_2/regress_33009_lib.dart b/tests/language_2/regress_33009_lib.dart
new file mode 100644
index 0000000..28afdbb
--- /dev/null
+++ b/tests/language_2/regress_33009_lib.dart
@@ -0,0 +1,8 @@
+// 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 I<T> {
+ T get foo => _foo;
+ T _foo = null;
+}
diff --git a/tests/language_2/regress_33009_test.dart b/tests/language_2/regress_33009_test.dart
new file mode 100644
index 0000000..7291ff0
--- /dev/null
+++ b/tests/language_2/regress_33009_test.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.
+
+import 'regress_33009_lib.dart';
+
+class A implements I<dynamic> {
+ dynamic get foo => 1;
+}
+
+main() {}
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index cd95ea9..db296c2 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -21,13 +21,10 @@
mirrors/generic_bounded_test/01: MissingCompileTimeError
mirrors/generic_bounded_test/02: MissingCompileTimeError
mirrors/generic_interface_test/01: MissingCompileTimeError
-mirrors/generics_test/01: MissingCompileTimeError
mirrors/metadata_allowed_values_test/13: MissingCompileTimeError
mirrors/metadata_allowed_values_test/14: MissingCompileTimeError
-mirrors/reflected_type_classes_test/01: MissingCompileTimeError
mirrors/reflected_type_classes_test/02: MissingCompileTimeError
mirrors/reflected_type_classes_test/03: MissingCompileTimeError
-mirrors/reflected_type_test/01: MissingCompileTimeError
mirrors/reflected_type_test/02: MissingCompileTimeError
mirrors/reflected_type_test/03: MissingCompileTimeError
mirrors/variable_is_const_test/01: MissingCompileTimeError
@@ -181,11 +178,9 @@
mirrors/redirecting_factory_test/02: RuntimeError
mirrors/redirecting_factory_test/none: RuntimeError
mirrors/reflect_class_test/none: RuntimeError
-mirrors/reflected_type_classes_test/01: RuntimeError
mirrors/reflected_type_function_type_test: RuntimeError
mirrors/reflected_type_generics_test/01: RuntimeError
mirrors/reflected_type_generics_test/02: RuntimeError
-mirrors/reflected_type_test/01: RuntimeError
mirrors/reflected_type_typedefs_test: RuntimeError
mirrors/reflected_type_typevars_test: RuntimeError
mirrors/regress_26187_test: RuntimeError
@@ -348,6 +343,7 @@
[ $fasta && !$strong ]
isolate/isolate_import_test/01: MissingCompileTimeError
isolate/isolate_stress_test: CompileTimeError
+mirrors/generics_test/01: MissingCompileTimeError
mirrors/metadata_allowed_values_test/02: MissingCompileTimeError
mirrors/metadata_allowed_values_test/27: MissingCompileTimeError
mirrors/metadata_constructor_arguments_test/04: MissingCompileTimeError
@@ -355,6 +351,8 @@
mirrors/redirecting_factory_different_type_test/01: MissingCompileTimeError
mirrors/reflect_class_test/01: MissingCompileTimeError
mirrors/reflect_class_test/02: MissingCompileTimeError
+mirrors/reflected_type_classes_test/01: MissingCompileTimeError
+mirrors/reflected_type_test/01: MissingCompileTimeError
mirrors/regress_16321_test/01: MissingCompileTimeError
mirrors/top_level_accessors_test/01: MissingCompileTimeError
typed_data/float32x4_static_test: MissingCompileTimeError
diff --git a/tools/VERSION b/tools/VERSION
index 0a3d56d..9095694 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 51
+PRERELEASE 52
PRERELEASE_PATCH 0
diff --git a/tools/infra/config/cq.cfg b/tools/infra/config/cq.cfg
index cb94e5f..2bf13e2 100644
--- a/tools/infra/config/cq.cfg
+++ b/tools/infra/config/cq.cfg
@@ -19,22 +19,23 @@
try_job {
buckets {
name: "luci.dart.try"
- builders { name: "analyzer-linux-release-strong-hostchecked-try"}
- builders { name: "vm-canary-linux-debug-try"}
- builders { name: "vm-linux-release-x64-try"}
- builders { name: "vm-mac-release-x64-try"}
- builders { name: "dart2js-linux-d8-hostchecked-try"}
- builders { name: "dart2js-linux-d8-kernel-minified-try"}
- builders { name: "dart2js-linux-none-only-unittest-try"}
- builders { name: "dart2js-linux-x64-chrome-try"}
- builders { name: "pkg-linux-release-try"}
- builders { name: "ddc-linux-release-chrome-try"}
- builders { name: "vm-linux-product-x64-try"}
- builders { name: "dart-sdk-windows-try"}
- builders { name: "vm-kernel-legacy-linux-release-x64-try"}
- builders { name: "vm-kernel-mac-release-x64-try"}
- builders { name: "benchmark-linux-try"}
- builders { name: "front-end-linux-release-x64-try"}
+ builders { name: "analyzer-linux-release-strong-hostchecked-try" }
+ builders { name: "benchmark-linux-try" }
+ builders { name: "dart-sdk-windows-try" }
+ builders { name: "dart2js-linux-d8-hostchecked-try" }
+ builders { name: "dart2js-linux-d8-kernel-minified-try" }
+ builders { name: "dart2js-linux-none-only-unittest-try" }
+ builders { name: "dart2js-linux-x64-chrome-try" }
+ builders { name: "ddc-linux-release-chrome-try" }
+ builders { name: "front-end-linux-release-x64-try" }
+ builders { name: "pkg-linux-release-try" }
+ builders { name: "vm-canary-linux-debug-try" }
+ builders { name: "vm-kernel-legacy-linux-release-x64-try" }
+ builders { name: "vm-kernel-mac-release-x64-try" experiment_percentage: 100 }
+ builders { name: "vm-kernel-linux-release-x64-try" }
+ builders { name: "vm-linux-product-x64-try" }
+ builders { name: "vm-linux-release-x64-try" }
+ builders { name: "vm-mac-release-x64-try" }
}
try_job_retry_config {
try_job_retry_quota: 0
diff --git a/tools/sdks/linux/dart-sdk.tar.gz.sha1 b/tools/sdks/linux/dart-sdk.tar.gz.sha1
index 0e891a6..69598a2 100644
--- a/tools/sdks/linux/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/linux/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-2bb209191a1e2928b322636727c681cc0c3cf825
\ No newline at end of file
+7e1de2bcab2ea482aa9b4d955cab201913878c78
diff --git a/tools/sdks/mac/dart-sdk.tar.gz.sha1 b/tools/sdks/mac/dart-sdk.tar.gz.sha1
index d5aa942..60dba1a 100644
--- a/tools/sdks/mac/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/mac/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-32908822cad77ec2ea148440cc6f99d172f477dc
\ No newline at end of file
+2329404025ecfec4b51319427100e55bc14fd96f
\ No newline at end of file
diff --git a/tools/sdks/win/dart-sdk.tar.gz.sha1 b/tools/sdks/win/dart-sdk.tar.gz.sha1
index 7d2efd4..952fc08 100644
--- a/tools/sdks/win/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/win/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-e8959966bba1424ac2573d15caff499281cb7d87
\ No newline at end of file
+552657620bcb08d2c45b32af33c2b3d988494b4b
\ No newline at end of file
diff --git a/tools/testing/dart/browser_test.dart b/tools/testing/dart/browser_test.dart
index 19b39a7..4c2d536 100644
--- a/tools/testing/dart/browser_test.dart
+++ b/tools/testing/dart/browser_test.dart
@@ -40,8 +40,7 @@
/// The [testName] is the short name of the test without any subdirectory path
/// or extension, like "math_test". The [testJSDir] is the relative path to the
/// build directory where the dartdevc-generated JS file is stored.
-String dartdevcHtml(String testName, String testJSDir, String buildDir,
- {bool syncAsync}) {
+String dartdevcHtml(String testName, String testJSDir, String buildDir) {
var packagePaths = testPackages
.map((package) => ' "$package": "/root_dart/$buildDir/gen/utils/'
'dartdevc/pkg/$package",')
@@ -87,7 +86,6 @@
requirejs(["$testName", "dart_sdk", "async_helper"],
function($testName, sdk, async_helper) {
sdk.dart.ignoreWhitelistedErrors(false);
- if ($syncAsync) sdk.dart.setStartAsyncSynchronously();
// TODO(rnystrom): This uses DDC's forked version of async_helper. Unfork
// these packages when possible.
async_helper.async_helper.asyncTestInitialize(function() {});
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index 25e8a79..479c94f 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -1062,7 +1062,7 @@
// Always run with synchronous starts of `async` functions.
// If we want to make this dependent on other parameters or flags,
// this flag could be become conditional.
- content = dartdevcHtml(nameNoExt, jsDir, buildDir, syncAsync: true);
+ content = dartdevcHtml(nameNoExt, jsDir, buildDir);
}
}