Version 2.0.0-dev.26.0
Merge commit '28887cc851f7db928bd36bccca64e79c3e53b7bd' into dev
diff --git a/DEPS b/DEPS
index 94c6c45..14bad64 100644
--- a/DEPS
+++ b/DEPS
@@ -51,7 +51,7 @@
# Revisions of /third_party/* dependencies.
"args_tag": "@0.13.7",
- "async_tag": "@corelib_2_2_1",
+ "async_tag": "@2.0.4",
"barback-0.13.0_rev": "@34853",
"barback-0.14.0_rev": "@36398",
"barback-0.14.1_rev": "@38525",
@@ -142,7 +142,7 @@
"usage_tag": "@3.3.0",
"utf_tag": "@0.9.0+4",
"watcher_tag": "@0.9.7+7",
- "web_socket_channel_tag": "@corelib_2_2_1",
+ "web_socket_channel_tag": "@1.0.7",
"WebCore_rev": "@3c45690813c112373757bbef53de1602a62af609",
"yaml_tag": "@2.1.13",
"zlib_rev": "@c3d0a6190f2f8c924a05ab6cc97b8f975bddd33f",
diff --git a/docs/language/informal/generalized-void.md b/docs/language/informal/generalized-void.md
index 2c10975..90bf55f 100644
--- a/docs/language/informal/generalized-void.md
+++ b/docs/language/informal/generalized-void.md
@@ -287,6 +287,47 @@
open for the cases where the developer knows that the typing misrepresents
the actual situation.*
+We define void equivalent types inductively as follows: A type `T` is
+_void equivalent_ if `T` is `void` or `T` is a type of the form
+`FutureOr<S>` where `S` is a void equivalent type.
+
+*The subtype rules for `FutureOr` ensure that whenever `T` is a void
+equivalent type we can show `T <: void` and `void <: T`. In that sense we
+may consider void equivalent types to be "the same type". However, we will
+not necessarily treat them identically for all purposes. For instance,
+it is useful to be able to test `if (x is Future<void>) ..` in the case
+where `x` is a variable of type `FutureOr<void>`, but that is not allowed
+when `x` has type `void`.*
+
+It is a static warning (in Dart 2: a compile-time error) if a return
+statement `return e;` occurs such that the innermost enclosing function
+has return type `void` and the static type of `e` is not a void equivalent
+type.
+
+It is a static warning (in Dart 2: a compile-time error) if a function
+marked `async*`, or `sync*` has return type `void`.
+
+*Note that it is allowed for an `async` function to have return type
+`void`. This serves to indicate that said function performs a
+"fire-and-forget" operation, that is, it is not even useful for the caller
+to synchronize with the completion of that task.*
+
+It is a static warning (Dart 2: a compile-time error) for a for-in
+statement to have an iterator expression of type `T` such that
+`Iterator<void>` is the most specific instantiation of `Iterator` that is a
+superinterface of `T`, unless the iteration variable has type void.
+
+It is a static warning (Dart 2: a compile-time error) for an asynchronous
+for-in statement to have a stream expression of type `T` such that
+`Stream<void>` is the most specific instantiation of `Stream` that is a
+superinterface of `T`, unless the iteration variable has type void.
+
+*Hence, `for (Object x in <void>[]) {}` and
+`await for (int x in new Stream<void>.empty()) {}` are errors, whereas
+`for (void x in <void>[]) {...}` and `for (var x in <void>[]) {...}` are OK. The
+usage of `x` in the loop body is constrained, though, because it has type
+void.*
+
During bounds checking, it is possible that a bound of a formal type
parameter of a generic class or function is statically known to be the type
void. In this case, the bound is considered to be the built-in class
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 9fca4c5..1b6b3a6 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -661,14 +661,9 @@
applyToAnalysisOptions(analysisOptions, options);
- var analyzer = options[AnalyzerOptions.analyzer];
- if (analyzer is Map) {
+ if (analysisOptions.excludePatterns != null) {
// Set ignore patterns.
- YamlList exclude = analyzer[AnalyzerOptions.exclude];
- List<String> excludeList = toStringList(exclude);
- if (excludeList != null) {
- setIgnorePatternsForContext(info, excludeList);
- }
+ setIgnorePatternsForContext(info, analysisOptions.excludePatterns);
}
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index d33a4eb..57cf81d 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -24,6 +24,7 @@
import 'package:analysis_server/src/services/completion/dart/local_library_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/local_reference_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/named_constructor_contributor.dart';
+import 'package:analysis_server/src/services/completion/dart/override_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/static_member_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/type_member_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/uri_contributor.dart';
@@ -92,7 +93,7 @@
new LocalLibraryContributor(),
new LocalReferenceContributor(),
new NamedConstructorContributor(),
- // new OverrideContributor(),
+ new OverrideContributor(),
new StaticMemberContributor(),
new TypeMemberContributor(),
new UriContributor(),
diff --git a/pkg/analysis_server/lib/src/services/correction/assist.dart b/pkg/analysis_server/lib/src/services/correction/assist.dart
index c0bb8b1..665d092 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist.dart
@@ -105,8 +105,8 @@
'dart.assist.flutter.wrap.column', 30, "Wrap with Column");
static const FLUTTER_WRAP_GENERIC = const AssistKind(
'dart.assist.flutter.wrap.generic', 30, "Wrap with new widget");
- static const FLUTTER_WRAP_PADDING = const AssistKind(
- 'dart.assist.flutter.wrap.padding', 30, "Add widget padding");
+ static const FLUTTER_WRAP_PADDING =
+ const AssistKind('dart.assist.flutter.wrap.padding', 30, "Add padding");
static const FLUTTER_WRAP_ROW =
const AssistKind('dart.assist.flutter.wrap.row', 30, "Wrap with Row");
static const IMPORT_ADD_SHOW = const AssistKind(
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
index 44cf710..2056f5c 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
@@ -62,8 +62,6 @@
final List<Assist> assists = <Assist>[];
- Position exitPosition = null;
-
CorrectionUtils utils;
AstNode node;
@@ -2575,7 +2573,6 @@
}
// prepare statement information
Statement firstStatement = selectedStatements[0];
- Statement lastStatement = selectedStatements[selectedStatements.length - 1];
SourceRange statementsRange =
utils.getLinesRangeStatements(selectedStatements);
// prepare environment
@@ -2593,7 +2590,6 @@
utils.replaceSourceRangeIndent(
statementsRange, indentOld, indentNew));
builder.addSimpleInsertion(statementsRange.end, '$indentOld}$eol');
- exitPosition = _newPosition(lastStatement.end);
});
_addAssistFromBuilder(changeBuilder, DartAssistKind.SURROUND_WITH_BLOCK);
}
@@ -2950,10 +2946,6 @@
return utils.getRangeText(range);
}
- Position _newPosition(int offset) {
- return new Position(file, offset);
- }
-
Future<Null> _swapFlutterWidgets(
InstanceCreationExpression exprGoingDown,
InstanceCreationExpression exprGoingUp,
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index 4bff2be..ce93b73 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -115,6 +115,8 @@
'CHANGE_TYPE_ANNOTATION', 50, "Change '{0}' to '{1}' type annotation");
static const CONVERT_FLUTTER_CHILD =
const FixKind('CONVERT_FLUTTER_CHILD', 50, "Convert to children:");
+ static const CONVERT_FLUTTER_CHILDREN =
+ const FixKind('CONVERT_FLUTTER_CHILDREN', 50, "Convert to child:");
static const CREATE_CLASS =
const FixKind('CREATE_CLASS', 50, "Create class '{0}'");
static const CREATE_CONSTRUCTOR =
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index f62e51a..9bd531c 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -773,19 +773,20 @@
}
Future<Null> _addFix_convertFlutterChild() async {
- NamedExpression namedExp = flutter.findNamedExpression(node, 'child');
- if (namedExp == null) {
+ NamedExpression named = flutter.findNamedExpression(node, 'child');
+ if (named == null) {
return;
}
- InstanceCreationExpression childArg =
- flutter.getChildWidget(namedExp, false);
- if (childArg != null) {
+
+ // child: widget
+ Expression expression = named.expression;
+ if (flutter.isWidgetExpression(expression)) {
DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
flutter.convertChildToChildren2(
builder,
- childArg,
- namedExp,
+ expression,
+ named,
eol,
utils.getNodeText,
utils.getLinePrefix,
@@ -796,13 +797,15 @@
_addFixFromBuilder(changeBuilder, DartFixKind.CONVERT_FLUTTER_CHILD);
return;
}
- ListLiteral listArg = flutter.getChildList(namedExp);
- if (listArg != null) {
+
+ // child: [widget1, widget2]
+ if (expression is ListLiteral &&
+ expression.elements.every(flutter.isWidgetExpression)) {
DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
- builder.addSimpleInsertion(namedExp.offset + 'child'.length, 'ren');
- if (listArg.typeArguments == null) {
- builder.addSimpleInsertion(listArg.offset, '<Widget>');
+ builder.addSimpleReplacement(range.node(named.name), 'children:');
+ if (expression.typeArguments == null) {
+ builder.addSimpleInsertion(expression.offset, '<Widget>');
}
});
_addFixFromBuilder(changeBuilder, DartFixKind.CONVERT_FLUTTER_CHILD);
@@ -810,7 +813,31 @@
}
Future<Null> _addFix_convertFlutterChildren() async {
- // TODO(messick) Implement _addFix_convertFlutterChildren()
+ AstNode node = this.node;
+ if (node is SimpleIdentifier &&
+ node.name == 'children' &&
+ node.parent?.parent is NamedExpression) {
+ NamedExpression named = node.parent?.parent;
+ Expression expression = named.expression;
+ if (expression is ListLiteral && expression.elements.length == 1) {
+ Expression widget = expression.elements[0];
+ if (flutter.isWidgetExpression(widget)) {
+ String widgetText = utils.getNodeText(widget);
+ String indentOld = utils.getLinePrefix(widget.offset);
+ String indentNew = utils.getLinePrefix(named.offset);
+ widgetText = _replaceSourceIndent(widgetText, indentOld, indentNew);
+
+ var builder = new DartChangeBuilder(session);
+ await builder.addFileEdit(file, (builder) {
+ builder.addReplacement(range.node(named), (builder) {
+ builder.write('child: ');
+ builder.write(widgetText);
+ });
+ });
+ _addFixFromBuilder(builder, DartFixKind.CONVERT_FLUTTER_CHILDREN);
+ }
+ }
+ }
}
Future<Null> _addFix_createClass() async {
@@ -3266,6 +3293,12 @@
}
return false;
}
+
+ static String _replaceSourceIndent(
+ String source, String indentOld, String indentNew) {
+ return source.replaceAll(
+ new RegExp('^$indentOld', multiLine: true), indentNew);
+ }
}
/**
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
index 65905be20..c1ce1cb 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -472,13 +472,29 @@
unit.accept(selectionAnalyzer);
// May be a fatal error.
{
- RefactoringStatus status = selectionAnalyzer.status;
- if (status.hasFatalError) {
- return status;
+ if (selectionAnalyzer.status.hasFatalError) {
+ return selectionAnalyzer.status;
}
}
+
List<AstNode> selectedNodes = selectionAnalyzer.selectedNodes;
+ // If no selected nodes, extract the smallest covering expression.
+ if (selectedNodes.isEmpty) {
+ for (var node = selectionAnalyzer.coveringNode;
+ node != null;
+ node = node.parent) {
+ if (node is Statement) {
+ break;
+ }
+ if (node is Expression && _isExtractable(range.node(node))) {
+ selectedNodes.add(node);
+ selectionRange = range.node(node);
+ break;
+ }
+ }
+ }
+
// Check selected nodes.
if (!selectedNodes.isEmpty) {
AstNode selectedNode = selectedNodes.first;
diff --git a/pkg/analysis_server/lib/src/status/diagnostics.dart b/pkg/analysis_server/lib/src/status/diagnostics.dart
index 66796d1..4e3f981 100644
--- a/pkg/analysis_server/lib/src/status/diagnostics.dart
+++ b/pkg/analysis_server/lib/src/status/diagnostics.dart
@@ -376,8 +376,6 @@
b.write(
writeOption('Analyze function bodies', options.analyzeFunctionBodies));
- b.write(writeOption(
- 'Enable strict call checks', options.enableStrictCallChecks));
b.write(writeOption('Enable super mixins', options.enableSuperMixins));
b.write(writeOption('Generate dart2js hints', options.dart2jsHint));
b.write(writeOption(
diff --git a/pkg/analysis_server/lib/src/utilities/flutter.dart b/pkg/analysis_server/lib/src/utilities/flutter.dart
index e8d9310..c03cdff 100644
--- a/pkg/analysis_server/lib/src/utilities/flutter.dart
+++ b/pkg/analysis_server/lib/src/utilities/flutter.dart
@@ -63,7 +63,7 @@
void convertChildToChildren2(
DartFileEditBuilder builder,
- InstanceCreationExpression childArg,
+ Expression childArg,
NamedExpression namedExp,
String eol,
Function getNodeText,
@@ -159,33 +159,14 @@
return namedExp;
}
-ListLiteral getChildList(NamedExpression child) {
- if (child.expression is ListLiteral) {
- ListLiteral list = child.expression;
- if (list.elements.isEmpty ||
- list.elements.every((element) =>
- element is InstanceCreationExpression &&
- isWidgetCreation(element))) {
- return list;
- }
- }
- return null;
-}
-
/**
- * Return the Flutter instance creation expression that is the value of the
- * given [child], or null if none. If [strict] is true, require the value to
- * also have a 'child' argument.
+ * Return the expression that is a Flutter Widget that is the value of the
+ * given [child], or null if none.
*/
-InstanceCreationExpression getChildWidget(NamedExpression child,
- [bool strict = false]) {
- if (child?.expression is InstanceCreationExpression) {
- InstanceCreationExpression childNewExpr = child.expression;
- if (isWidgetCreation(childNewExpr)) {
- if (!strict || (findChildArgument(childNewExpr) != null)) {
- return childNewExpr;
- }
- }
+Expression getChildWidget(NamedExpression child) {
+ Expression expression = child?.expression;
+ if (isWidgetExpression(expression)) {
+ return expression;
}
return null;
}
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index 94a3acd..c014701 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -1831,7 +1831,7 @@
"dart:foobar": "../sdk_ext/entry.dart"
analyzer:
language:
- enableStrictCallChecks: true
+ enableSuperMixins: true
errors:
unused_local_variable: false
linter:
@@ -1846,7 +1846,7 @@
// Verify options were set.
expect(errorProcessors, hasLength(1));
expect(lints, hasLength(1));
- expect(analysisOptions.enableStrictCallChecks, isTrue);
+ expect(analysisOptions.enableSuperMixins, isTrue);
// Remove options.
deleteOptionsFile();
@@ -1855,7 +1855,7 @@
// Verify defaults restored.
expect(errorProcessors, isEmpty);
expect(lints, isEmpty);
- expect(analysisOptions.enableStrictCallChecks, isFalse);
+ expect(analysisOptions.enableSuperMixins, isFalse);
}
@failingTest
@@ -1882,7 +1882,7 @@
newFile('$projPath/$optionsFileName', content: r'''
analyzer:
language:
- enableStrictCallChecks: true
+ enableSuperMixins: true
errors:
unused_local_variable: false
linter:
@@ -1895,7 +1895,7 @@
await pumpEventQueue();
// Verify options were set.
- expect(analysisOptions.enableStrictCallChecks, isTrue);
+ expect(analysisOptions.enableSuperMixins, isTrue);
expect(analysisOptions.strongMode, isTrue);
expect(errorProcessors, hasLength(2));
expect(lints, hasLength(2));
@@ -1905,7 +1905,7 @@
await pumpEventQueue();
// Verify defaults restored.
- expect(analysisOptions.enableStrictCallChecks, isFalse);
+ expect(analysisOptions.enableSuperMixins, isFalse);
expect(lints, hasLength(1));
expect(lints.first, new isInstanceOf<AvoidAs>());
expect(errorProcessors, hasLength(1));
@@ -1927,7 +1927,7 @@
newFile('$projPath/other_options.yaml', content: r'''
analyzer:
language:
- enableStrictCallChecks: true
+ enableSuperMixins: true
errors:
unused_local_variable: false
linter:
@@ -1938,7 +1938,7 @@
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
await pumpEventQueue();
// Verify options were set.
- expect(analysisOptions.enableStrictCallChecks, isTrue);
+ expect(analysisOptions.enableSuperMixins, isTrue);
expect(errorProcessors, hasLength(1));
expect(lints, hasLength(1));
expect(lints[0].name, 'camel_case_types');
@@ -1957,7 +1957,7 @@
newFile('$booLibPosixPath/other_options.yaml', content: r'''
analyzer:
language:
- enableStrictCallChecks: true
+ enableSuperMixins: true
errors:
unused_local_variable: false
linter:
@@ -1974,7 +1974,7 @@
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
await pumpEventQueue();
// Verify options were set.
- expect(analysisOptions.enableStrictCallChecks, isTrue);
+ expect(analysisOptions.enableSuperMixins, isTrue);
expect(errorProcessors, hasLength(1));
expect(lints, hasLength(1));
expect(lints[0].name, 'camel_case_types');
@@ -2050,7 +2050,7 @@
exclude:
- 'test/**'
language:
- enableStrictCallChecks: true
+ enableSuperMixins: true
errors:
unused_local_variable: false
linter:
@@ -2072,7 +2072,7 @@
expect(analysisOptions.strongMode, isTrue);
expect(analysisOptions.enableSuperMixins, isTrue);
// * from analysis options:
- expect(analysisOptions.enableStrictCallChecks, isTrue);
+ expect(analysisOptions.enableSuperMixins, isTrue);
// * verify tests are excluded
expect(
diff --git a/pkg/analysis_server/test/services/correction/assist_test.dart b/pkg/analysis_server/test/services/correction/assist_test.dart
index a065d89..35ff0a3 100644
--- a/pkg/analysis_server/test/services/correction/assist_test.dart
+++ b/pkg/analysis_server/test/services/correction/assist_test.dart
@@ -5050,6 +5050,8 @@
// end
}
''');
+ _assertLinkedGroup(change.linkedEditGroups[0], ['condition);']);
+ _assertExitPosition('condition);');
}
test_surroundWith_for() async {
@@ -5072,6 +5074,11 @@
// end
}
''');
+ _assertLinkedGroup(change.linkedEditGroups[0], ['v =']);
+ _assertLinkedGroup(change.linkedEditGroups[1], ['init;']);
+ _assertLinkedGroup(change.linkedEditGroups[2], ['condition;']);
+ _assertLinkedGroup(change.linkedEditGroups[3], ['increment']);
+ _assertExitPosition(' }');
}
test_surroundWith_forIn() async {
@@ -5094,6 +5101,9 @@
// end
}
''');
+ _assertLinkedGroup(change.linkedEditGroups[0], ['item']);
+ _assertLinkedGroup(change.linkedEditGroups[1], ['iterable']);
+ _assertExitPosition(' }');
}
test_surroundWith_if() async {
@@ -5116,6 +5126,8 @@
// end
}
''');
+ _assertLinkedGroup(change.linkedEditGroups[0], ['condition']);
+ _assertExitPosition(' }');
}
test_surroundWith_tryCatch() async {
@@ -5140,6 +5152,10 @@
// end
}
''');
+ _assertLinkedGroup(change.linkedEditGroups[0], ['Exception']);
+ _assertLinkedGroup(change.linkedEditGroups[1], ['e) {']);
+ _assertLinkedGroup(change.linkedEditGroups[2], ['// TODO']);
+ _assertExitPosition('// TODO');
}
test_surroundWith_tryFinally() async {
@@ -5164,6 +5180,8 @@
// end
}
''');
+ _assertLinkedGroup(change.linkedEditGroups[0], ['// TODO']);
+ _assertExitPosition('// TODO');
}
test_surroundWith_while() async {
@@ -5186,6 +5204,15 @@
// end
}
''');
+ _assertLinkedGroup(change.linkedEditGroups[0], ['condition']);
+ _assertExitPosition(' }');
+ }
+
+ void _assertExitPosition(String after) {
+ Position exitPosition = change.selection;
+ expect(exitPosition, isNotNull);
+ expect(exitPosition.file, testFile);
+ expect(exitPosition.offset, resultCode.indexOf(after) + after.length);
}
/**
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index 2d378b8..4402f49 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -5439,7 +5439,7 @@
''');
}
- test_undefinedParameter_convertFlutterChild_invalidList() async {
+ test_undefinedParameter_convertFlutterChild_BAD_listNotWidget() async {
addFlutterPackage();
await resolveTestUnit('''
import 'package:flutter/widgets.dart';
@@ -5554,6 +5554,115 @@
''');
}
+ test_undefinedParameter_convertFlutterChild_OK_widgetVariable() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/material.dart';
+build() {
+ var text = new Text('foo');
+ new Row(
+ child: text,
+ );
+}
+''');
+ await assertHasFix(DartFixKind.CONVERT_FLUTTER_CHILD, '''
+import 'package:flutter/material.dart';
+build() {
+ var text = new Text('foo');
+ new Row(
+ children: <Widget>[text],
+ );
+}
+''');
+ }
+
+ test_undefinedParameter_convertFlutterChildren_BAD_notWidget() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/widgets.dart';
+build() {
+ return new Center(
+ children: [
+ new Object(),
+ ],
+ );
+}
+''');
+ await assertNoFix(DartFixKind.CONVERT_FLUTTER_CHILDREN);
+ }
+
+ test_undefinedParameter_convertFlutterChildren_OK_multiLine() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/widgets.dart';
+build() {
+ return new Center(
+ children: [
+ new Container(
+ width: 200.0,
+ height: 300.0,
+ ),
+ ],
+ );
+}
+''');
+ await assertHasFix(DartFixKind.CONVERT_FLUTTER_CHILDREN, '''
+import 'package:flutter/widgets.dart';
+build() {
+ return new Center(
+ child: new Container(
+ width: 200.0,
+ height: 300.0,
+ ),
+ );
+}
+''');
+ }
+
+ test_undefinedParameter_convertFlutterChildren_OK_singleLine() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/widgets.dart';
+build() {
+ return new Center(
+ children: [
+ new Text('foo'),
+ ],
+ );
+}
+''');
+ await assertHasFix(DartFixKind.CONVERT_FLUTTER_CHILDREN, '''
+import 'package:flutter/widgets.dart';
+build() {
+ return new Center(
+ child: new Text('foo'),
+ );
+}
+''');
+ }
+
+ test_undefinedParameter_convertFlutterChildren_OK_singleLine2() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/widgets.dart';
+build() {
+ var text = new Text('foo');
+ new Center(
+ children: [text],
+ );
+}
+''');
+ await assertHasFix(DartFixKind.CONVERT_FLUTTER_CHILDREN, '''
+import 'package:flutter/widgets.dart';
+build() {
+ var text = new Text('foo');
+ new Center(
+ child: text,
+ );
+}
+''');
+ }
+
test_undefinedSetter_useSimilar_hint() async {
await resolveTestUnit('''
class A {
diff --git a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
index a5363ec..4079387 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
@@ -1233,6 +1233,30 @@
''');
}
+ test_singleExpression_coveringExpression() async {
+ await indexTestUnit('''
+main(int n) {
+ var v = new FooBar(n);
+}
+
+class FooBar {
+ FooBar(int count);
+}
+''');
+ _createRefactoringForStringOffset('Bar(n);');
+ return _assertSuccessfulRefactoring('''
+main(int n) {
+ var v = res(n);
+}
+
+FooBar res(int n) => new FooBar(n);
+
+class FooBar {
+ FooBar(int count);
+}
+''');
+ }
+
test_singleExpression_dynamic() async {
await indexTestUnit('''
dynaFunction() {}
@@ -2867,6 +2891,15 @@
_createRefactoring(offset, length);
}
+ /**
+ * Creates a new refactoring in [refactoring] at the offset of the given
+ * [search] pattern, and with `0` length.
+ */
+ void _createRefactoringForStringOffset(String search) {
+ int offset = findOffset(search);
+ _createRefactoring(offset, 0);
+ }
+
void _createRefactoringWithSuffix(String selectionSearch, String suffix) {
int offset = findOffset(selectionSearch + suffix);
int length = selectionSearch.length;
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index b66e383..4745a4f 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,3 +1,16 @@
+## 0.31.2-alpha.0
+
+* front_end handling of callable classes (#32064)
+* Improve fasta parser error reporting.
+* Check for unresolved imports to improve handling of optional new/const (#32150).
+* Changes to front_end handling of callable classes.
+* Normalize Windows drive letters to uppercase for analysis (#32095, #32042, #28895).
+* Relax void errors: no error assigning void to void variable.
+* Keep unresolved import/export directives for task based analysis
+ (dart-lang/angular#801).
+* Promote `TOP_LEVEL_CYCLE` to an error.
+* Code cleanups.
+
## 0.31.1
* Update to reflect that `_InternalLinkedHashMap` is not a subtype of `HashMap`
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index 9102d0f..083c3f2 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -20,7 +20,6 @@
const String declarationCastsFlag = 'declaration-casts';
const String defineVariableOption = 'D';
const String enableInitializingFormalAccessFlag = 'initializing-formal-access';
-const String enableStrictCallChecksFlag = 'enable-strict-call-checks';
const String enableSuperMixinFlag = 'supermixin';
const String flutterAnalysisOptionsPath =
'package:flutter/analysis_options_user.yaml';
@@ -47,10 +46,6 @@
}
}
- if (args.wasParsed(enableStrictCallChecksFlag)) {
- options.enableStrictCallChecks = args[enableStrictCallChecksFlag];
- verbose('$enableStrictCallChecksFlag = ${options.enableStrictCallChecks}');
- }
if (args.wasParsed(enableSuperMixinFlag)) {
options.enableSuperMixins = args[enableSuperMixinFlag];
verbose('$enableSuperMixinFlag = ${options.enableSuperMixins}');
@@ -220,11 +215,6 @@
hide: ddc);
parser.addOption(sdkSummaryPathOption,
help: 'The path to the Dart SDK summary file.', hide: hide);
- parser.addFlag(enableStrictCallChecksFlag,
- help: 'Fix issue 21938.',
- defaultsTo: false,
- negatable: false,
- hide: hide);
parser.addFlag(enableInitializingFormalAccessFlag,
help:
'Enable support for allowing access to field formal parameters in a '
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index c7dc866..558a61c 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -297,8 +297,6 @@
((options is AnalysisOptionsImpl)
? this._options.implicitDynamic != options.implicitDynamic
: false) ||
- this._options.enableStrictCallChecks !=
- options.enableStrictCallChecks ||
this._options.enableSuperMixins != options.enableSuperMixins ||
!_samePatchPaths(this._options.patchPaths, options.patchPaths);
this._options.analyzeFunctionBodiesPredicate =
@@ -306,7 +304,6 @@
this._options.generateImplicitErrors = options.generateImplicitErrors;
this._options.generateSdkErrors = options.generateSdkErrors;
this._options.dart2jsHint = options.dart2jsHint;
- this._options.enableStrictCallChecks = options.enableStrictCallChecks;
this._options.enableLazyAssignmentOperators =
options.enableLazyAssignmentOperators;
this._options.enableSuperMixins = options.enableSuperMixins;
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 5c10748..57b6b01 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -11,14 +11,19 @@
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/error/error.dart';
+import 'package:analyzer/error/listener.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/src/dart/ast/token.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine;
+import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/parser.dart';
+import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart' show LineInfo, Source;
import 'package:analyzer/src/generated/utilities_dart.dart';
@@ -2745,6 +2750,37 @@
}
/**
+ * An error listener that only records whether any constant related errors have
+ * been reported.
+ */
+class ConstantAnalysisErrorListener extends AnalysisErrorListener {
+ /**
+ * A flag indicating whether any constant related errors have been reported to
+ * this listener.
+ */
+ bool hasConstError = false;
+
+ @override
+ void onError(AnalysisError error) {
+ switch (error.errorCode) {
+ case CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL:
+ case CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING:
+ case CompileTimeErrorCode.CONST_EVAL_TYPE_INT:
+ case CompileTimeErrorCode.CONST_EVAL_TYPE_NUM:
+ case CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION:
+ case CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE:
+ case CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT:
+ case CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER:
+ case CompileTimeErrorCode
+ .CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST:
+ case CompileTimeErrorCode.INVALID_CONSTANT:
+ case CompileTimeErrorCode.MISSING_CONST_IN_LIST_LITERAL:
+ hasConstError = true;
+ }
+ }
+}
+
+/**
* A constructor declaration.
*
* constructorDeclaration ::=
@@ -4151,6 +4187,9 @@
// Inside an explicitly non-`const` instance creation expression.
return false;
}
+ // We need to ask the parent because it might be `const` just because
+ // it's possible for it to be.
+ return parent.isConst;
} else if (parent is Annotation) {
// Inside an annotation.
return true;
@@ -6495,7 +6534,7 @@
if (!isImplicit) {
return keyword.keyword == Keyword.CONST;
} else {
- return inConstantContext;
+ return inConstantContext || canBeConst();
}
}
@@ -6513,6 +6552,42 @@
E accept<E>(AstVisitor<E> visitor) =>
visitor.visitInstanceCreationExpression(this);
+ /**
+ * Return `true` if it would be valid for this instance creation expression to
+ * have a keyword of `const`. It is valid if
+ *
+ * * the invoked constructor is a `const` constructor,
+ * * all of the arguments are, or could be, constant expressions, and
+ * * the evaluation of the constructor would not produce an exception.
+ *
+ * Note that this method will return `false` if the AST has not been resolved
+ * because without resolution it cannot be determined whether the constructor
+ * is a `const` constructor.
+ *
+ * Also note that this method can cause constant evaluation to occur, which
+ * can be computationally expensive.
+ */
+ bool canBeConst() {
+ ConstructorElement element = staticElement;
+ if (element == null || !element.isConst) {
+ return false;
+ }
+ Token oldKeyword = keyword;
+ ConstantAnalysisErrorListener listener =
+ new ConstantAnalysisErrorListener();
+ try {
+ keyword = new KeywordToken(Keyword.CONST, offset);
+ LibraryElement library = element.library;
+ AnalysisContext context = library.context;
+ ErrorReporter errorReporter = new ErrorReporter(listener, element.source);
+ accept(new ConstantVerifier(errorReporter, library, context.typeProvider,
+ context.declaredVariables));
+ } finally {
+ keyword = oldKeyword;
+ }
+ return !listener.hasConstError;
+ }
+
@override
void visitChildren(AstVisitor visitor) {
_constructorName?.accept(visitor);
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 9fd938e..e560552 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -34,7 +34,10 @@
Message,
codeExpectedFunctionBody,
messageDirectiveAfterDeclaration,
- messageNativeClauseShouldBeAnnotation;
+ messageIllegalAssignmentToNonAssignable,
+ messageMissingAssignableSelector,
+ messageNativeClauseShouldBeAnnotation,
+ messageStaticConstructor;
import 'package:front_end/src/fasta/kernel/kernel_builder.dart'
show Builder, KernelLibraryBuilder, Scope;
import 'package:front_end/src/fasta/quote.dart';
@@ -1340,14 +1343,30 @@
assert(operator.type.isUnaryPrefixOperator);
debugEvent("UnaryPrefixAssignmentExpression");
- push(ast.prefixExpression(operator, pop()));
+ Expression expression = pop();
+ if (!expression.isAssignable) {
+ // TODO(danrubel): The fasta parser does not have enough context to
+ // report this error. Consider moving it to the resolution phase
+ // or at least to common location that can be shared by all listeners.
+ parser.reportRecoverableError(
+ expression.endToken, messageMissingAssignableSelector);
+ }
+ push(ast.prefixExpression(operator, expression));
}
void handleUnaryPostfixAssignmentExpression(Token operator) {
assert(operator.type.isUnaryPostfixOperator);
debugEvent("UnaryPostfixAssignmentExpression");
- push(ast.postfixExpression(pop(), operator));
+ Expression expression = pop();
+ if (!expression.isAssignable) {
+ // TODO(danrubel): The fasta parser does not have enough context to
+ // report this error. Consider moving it to the resolution phase
+ // or at least to common location that can be shared by all listeners.
+ parser.reportRecoverableError(
+ operator, messageIllegalAssignmentToNonAssignable);
+ }
+ push(ast.postfixExpression(expression, operator));
}
void handleModifier(Token token) {
@@ -2088,6 +2107,13 @@
void constructor(
SimpleIdentifier returnType, Token period, SimpleIdentifier name) {
+ if (modifiers?.staticKeyword != null) {
+ // TODO(danrubel): The fasta parser does not have enough context to
+ // report this error. Consider moving it to the resolution phase
+ // or at least to common location that can be shared by all listeners.
+ parser.reportRecoverableError(
+ modifiers.staticKeyword, messageStaticConstructor);
+ }
classDeclaration.members.add(ast.constructorDeclaration(
comment,
metadata,
diff --git a/pkg/analyzer/lib/src/fasta/error_converter.dart b/pkg/analyzer/lib/src/fasta/error_converter.dart
index 383b8a3..9fd2c8f 100644
--- a/pkg/analyzer/lib/src/fasta/error_converter.dart
+++ b/pkg/analyzer/lib/src/fasta/error_converter.dart
@@ -255,6 +255,12 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.GETTER_WITH_PARAMETERS, offset, length);
return;
+ case "ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE,
+ offset,
+ length);
+ return;
case "ILLEGAL_CHARACTER":
errorReporter?.reportErrorForOffset(
ScannerErrorCode.ILLEGAL_CHARACTER, offset, length);
@@ -331,6 +337,10 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST, offset, length);
return;
+ case "MISSING_ASSIGNABLE_SELECTOR":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, offset, length);
+ return;
case "MISSING_ASSIGNMENT_IN_INITIALIZER":
errorReporter?.reportErrorForOffset(
ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, offset, length);
@@ -461,6 +471,10 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.STATIC_AFTER_VAR, offset, length);
return;
+ case "STATIC_CONSTRUCTOR":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.STATIC_CONSTRUCTOR, offset, length);
+ return;
case "STATIC_OPERATOR":
errorReporter?.reportErrorForOffset(
ParserErrorCode.STATIC_OPERATOR, offset, length);
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 5cd21d4..41a029f5 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -103,12 +103,6 @@
bool _enableHints = false;
/**
- * A flag indicating whether we should strictly follow the specification when
- * generating warnings on "call" methods (fixes dartbug.com/21938).
- */
- bool _enableStrictCallChecks = false;
-
- /**
* The type representing the type 'dynamic'.
*/
DartType _dynamicType;
@@ -142,7 +136,6 @@
this._definingLibrary = _resolver.definingLibrary;
AnalysisOptions options = _definingLibrary.context.analysisOptions;
_enableHints = options.hint;
- _enableStrictCallChecks = options.enableStrictCallChecks;
_dynamicType = _resolver.typeProvider.dynamicType;
_typeType = _resolver.typeProvider.typeType;
_subtypeManager = new SubtypeManager();
@@ -724,20 +717,20 @@
//
// Given the elements, determine the type of the function we are invoking
//
- DartType staticInvokeType = _getInvokeType(staticElement);
- methodName.staticType = staticInvokeType;
+ DartType staticType = _getInvokeType(staticElement);
+ methodName.staticType = staticType;
- DartType propagatedInvokeType = _getInvokeType(propagatedElement);
+ DartType propagatedType = _getInvokeType(propagatedElement);
methodName.propagatedType =
- _propagatedInvokeTypeIfBetter(propagatedInvokeType, staticInvokeType);
+ _propagatedInvokeTypeIfBetter(propagatedType, staticType);
//
// Instantiate generic function or method if needed.
//
- staticInvokeType = _instantiateGenericMethod(
- staticInvokeType, node.typeArguments, node.methodName);
- propagatedInvokeType = _instantiateGenericMethod(
- propagatedInvokeType, node.typeArguments, node.methodName);
+ DartType staticInvokeType = _instantiateGenericMethod(
+ staticType, node.typeArguments, node.methodName);
+ DartType propagatedInvokeType = _instantiateGenericMethod(
+ propagatedType, node.typeArguments, node.methodName);
//
// Record the results.
@@ -771,7 +764,8 @@
//
// Then check for error conditions.
//
- ErrorCode errorCode = _checkForInvocationError(target, true, staticElement);
+ ErrorCode errorCode =
+ _checkForInvocationError(target, true, staticElement, staticType);
if (errorCode != null &&
target is SimpleIdentifier &&
target.staticElement is PrefixElement) {
@@ -785,7 +779,8 @@
if (_enableHints && errorCode == null && staticElement == null) {
// The method lookup may have failed because there were multiple
// incompatible choices. In this case we don't want to generate a hint.
- errorCode = _checkForInvocationError(target, false, propagatedElement);
+ errorCode = _checkForInvocationError(
+ target, false, propagatedElement, propagatedType);
if (identical(errorCode, StaticTypeWarningCode.UNDEFINED_METHOD)) {
ClassElement classElementContext = null;
if (target == null) {
@@ -849,13 +844,9 @@
targetType = _getStaticType(target);
}
}
- if (!_enableStrictCallChecks &&
- targetType != null &&
+ if (targetType != null &&
targetType.isDartCoreFunction &&
methodName.name == FunctionElement.CALL_METHOD_NAME) {
- // TODO(brianwilkerson) Can we ever resolve the function being
- // invoked?
-// resolveArgumentsToParameters(node.getArgumentList(), invokedFunction);
return null;
}
if (!node.isCascaded) {
@@ -1305,8 +1296,8 @@
* was no target. The flag [useStaticContext] should be `true` if the
* invocation is in a static constant (does not have access to instance state).
*/
- ErrorCode _checkForInvocationError(
- Expression target, bool useStaticContext, Element element) {
+ ErrorCode _checkForInvocationError(Expression target, bool useStaticContext,
+ Element element, DartType type) {
// Prefix is not declared, instead "prefix.id" are declared.
if (element is PrefixElement) {
return CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT;
@@ -1343,8 +1334,7 @@
return _getErrorCodeForExecuting(returnType);
}
} else if (element is VariableElement) {
- DartType variableType = element.type;
- return _getErrorCodeForExecuting(variableType);
+ return _getErrorCodeForExecuting(type);
} else {
if (target == null) {
ClassElement enclosingClass = _resolver.enclosingClass;
@@ -1526,6 +1516,21 @@
}
/**
+ * Return an error if the [type], which is presumably being invoked, is not a
+ * function. The errors for non functions may be broken up by type; currently,
+ * it returns a special value for when the type is `void`.
+ */
+ ErrorCode _getErrorCodeForExecuting(DartType type) {
+ if (_isExecutableType(type)) {
+ return null;
+ }
+
+ return type.isVoid
+ ? StaticWarningCode.USE_OF_VOID_RESULT
+ : StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
+ }
+
+ /**
* Assuming that the given [identifier] is a prefix for a deferred import,
* return the library that is being imported.
*/
@@ -1741,8 +1746,13 @@
classElement = elt;
}
} else {
- LibraryElementImpl libraryElementImpl = _getImportedLibrary(node.target);
- classElement = libraryElementImpl.getType(node.methodName.name);
+ LibraryElementImpl libraryElement = _getImportedLibrary(node.target);
+ if (libraryElement == null) {
+ // We cannot resolve the import to find the library, so we won't be able
+ // to find the class to see whether the method is actually a constructor.
+ return null;
+ }
+ classElement = libraryElement.getType(node.methodName.name);
}
// Before any ASTs are created, look up ConstructorElement to see if we
@@ -1887,21 +1897,6 @@
}
/**
- * Return an error if the [type], which is presumably being invoked, is not a
- * function. The errors for non functions may be broken up by type; currently,
- * it returns a special value for when the type is `void`.
- */
- ErrorCode _getErrorCodeForExecuting(DartType type) {
- if (_isExecutableType(type)) {
- return null;
- }
-
- return type.isVoid
- ? StaticWarningCode.USE_OF_VOID_RESULT
- : StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
- }
-
- /**
* Return `true` if the given [type] represents an object that could be
* invoked using the call operator '()'.
*/
@@ -1909,8 +1904,7 @@
type = type?.resolveToBound(_resolver.typeProvider.objectType);
if (type.isDynamic || type is FunctionType) {
return true;
- } else if (!_enableStrictCallChecks &&
- (type.isDartCoreFunction || type.isObject)) {
+ } else if (type.isDartCoreFunction) {
return true;
} else if (type is InterfaceType) {
ClassElement classElement = type.element;
@@ -2643,13 +2637,9 @@
if (!isStaticProperty &&
staticOrPropagatedEnclosingElt is ClassElement) {
InterfaceType targetType = staticOrPropagatedEnclosingElt.type;
- if (!_enableStrictCallChecks &&
- targetType != null &&
+ if (targetType != null &&
targetType.isDartCoreFunction &&
propertyName.name == FunctionElement.CALL_METHOD_NAME) {
- // TODO(brianwilkerson) Can we ever resolve the function being
- // invoked?
-// resolveArgumentsToParameters(node.getArgumentList(), invokedFunction);
return;
} else if (staticOrPropagatedEnclosingElt.isEnum &&
propertyName.name == "_name") {
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 6d835b7..3ee9fc1 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1223,12 +1223,6 @@
bool get enableLazyAssignmentOperators;
/**
- * Return `true` to strictly follow the specification when generating
- * warnings on "call" methods (fixes dartbug.com/21938).
- */
- bool get enableStrictCallChecks;
-
- /**
* Return `true` if mixins are allowed to inherit from types other than
* Object, and are allowed to reference `super`.
*/
@@ -1408,9 +1402,6 @@
bool enableLazyAssignmentOperators = false;
@override
- bool enableStrictCallChecks = false;
-
- @override
bool enableSuperMixins = false;
@override
@@ -1516,7 +1507,6 @@
analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate;
dart2jsHint = options.dart2jsHint;
enabledPluginNames = options.enabledPluginNames;
- enableStrictCallChecks = options.enableStrictCallChecks;
enableLazyAssignmentOperators = options.enableLazyAssignmentOperators;
enableSuperMixins = options.enableSuperMixins;
enableTiming = options.enableTiming;
@@ -1658,7 +1648,6 @@
// Append boolean flags.
buffer.addBool(declarationCasts);
buffer.addBool(enableLazyAssignmentOperators);
- buffer.addBool(enableStrictCallChecks);
buffer.addBool(enableSuperMixins);
buffer.addBool(enableUriInPartOf);
buffer.addBool(implicitCasts);
@@ -1699,7 +1688,6 @@
disableCacheFlushing = false;
enabledPluginNames = const <String>[];
enableLazyAssignmentOperators = false;
- enableStrictCallChecks = false;
enableSuperMixins = false;
enableTiming = false;
enableUriInPartOf = true;
@@ -1724,7 +1712,6 @@
@override
void setCrossContextOptionsFrom(AnalysisOptions options) {
enableLazyAssignmentOperators = options.enableLazyAssignmentOperators;
- enableStrictCallChecks = options.enableStrictCallChecks;
enableSuperMixins = options.enableSuperMixins;
strongMode = options.strongMode;
if (options is AnalysisOptionsImpl) {
diff --git a/pkg/analyzer/lib/src/task/options.dart b/pkg/analyzer/lib/src/task/options.dart
index aed9461..4fae935 100644
--- a/pkg/analyzer/lib/src/task/options.dart
+++ b/pkg/analyzer/lib/src/task/options.dart
@@ -46,7 +46,6 @@
static const String enableGenericMethods = 'enableGenericMethods';
static const String enableInitializingFormalAccess =
'enableInitializingFormalAccess';
- static const String enableStrictCallChecks = 'enableStrictCallChecks';
static const String enableSuperMixins = 'enableSuperMixins';
static const String enablePreviewDart2 = 'enablePreviewDart2';
@@ -88,7 +87,6 @@
static const List<String> languageOptions = const [
enableAsync,
enableGenericMethods,
- enableStrictCallChecks,
enableSuperMixins,
enablePreviewDart2
];
@@ -537,13 +535,13 @@
List<String> pluginNames = <String>[];
if (names is String) {
pluginNames.add(names);
- } else if (names is YamlList) {
+ } else if (names is List) {
for (var element in names) {
if (element is String) {
pluginNames.add(element);
}
}
- } else if (names is YamlMap) {
+ } else if (names is Map) {
for (var key in names.keys) {
if (key is String) {
pluginNames.add(key);
@@ -564,7 +562,7 @@
}
void _applyExcludes(AnalysisOptionsImpl options, Object excludes) {
- if (excludes is YamlList) {
+ if (excludes is List) {
List<String> excludeList = toStringList(excludes);
if (excludeList != null) {
options.excludePatterns = excludeList;
@@ -576,9 +574,7 @@
AnalysisOptionsImpl options, Object feature, Object value) {
bool boolValue = toBool(value);
if (boolValue != null) {
- if (feature == AnalyzerOptions.enableStrictCallChecks) {
- options.enableStrictCallChecks = boolValue;
- } else if (feature == AnalyzerOptions.enableSuperMixins) {
+ if (feature == AnalyzerOptions.enableSuperMixins) {
options.enableSuperMixins = boolValue;
} else if (feature == AnalyzerOptions.enablePreviewDart2) {
options.previewDart2 = boolValue;
diff --git a/pkg/analyzer/lib/src/util/yaml.dart b/pkg/analyzer/lib/src/util/yaml.dart
index aa988e6..06308c7 100644
--- a/pkg/analyzer/lib/src/util/yaml.dart
+++ b/pkg/analyzer/lib/src/util/yaml.dart
@@ -6,11 +6,9 @@
import 'dart:collection';
-import 'package:yaml/yaml.dart';
-
/// If all of the elements of [list] are strings, return a list of strings
/// containing the same elements. Otherwise, return `null`.
-List<String> toStringList(YamlList list) {
+List<String> toStringList(List list) {
if (list == null) {
return null;
}
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index d858c1a..edbda6c 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 0.31.1
+version: 0.31.2-alpha.0
author: Dart Team <misc@dartlang.org>
description: Static analyzer for Dart.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/analyzer
@@ -11,11 +11,11 @@
collection: ^1.10.1
convert: ^2.0.0
crypto: '>=1.1.1 <3.0.0'
- front_end: 0.1.0-alpha.9
+ front_end: 0.1.0-alpha.10
glob: ^1.0.3
html: '>=0.12.0 <1.14.0'
isolate: '>=0.2.2 <2.0.0'
- kernel: 0.3.0-alpha.9
+ kernel: 0.3.0-alpha.10
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/generated/analysis_context_factory.dart b/pkg/analyzer/test/generated/analysis_context_factory.dart
index 20382a2..d608785 100644
--- a/pkg/analyzer/test/generated/analysis_context_factory.dart
+++ b/pkg/analyzer/test/generated/analysis_context_factory.dart
@@ -451,8 +451,7 @@
currentOptions.generateSdkErrors != options.generateSdkErrors ||
currentOptions.dart2jsHint != options.dart2jsHint ||
(currentOptions.hint && !options.hint) ||
- currentOptions.preserveComments != options.preserveComments ||
- currentOptions.enableStrictCallChecks != options.enableStrictCallChecks;
+ currentOptions.preserveComments != options.preserveComments;
if (needsRecompute) {
fail(
"Cannot set options that cause the sources to be reanalyzed in a test context");
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
index f25776f..5795f7b 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
@@ -1723,17 +1723,6 @@
@override
@failingTest
- test_mixinInference_matchingClass() =>
- super.test_mixinInference_matchingClass();
-
- @override
- @failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/32091')
- test_mixinInference_matchingClass_inPreviousMixin() =>
- super.test_mixinInference_matchingClass_inPreviousMixin();
-
- @override
- @failingTest
test_mixinInference_noMatchingClass() =>
super.test_mixinInference_noMatchingClass();
diff --git a/pkg/analyzer/test/generated/engine_test.dart b/pkg/analyzer/test/generated/engine_test.dart
index 3ec9e0b..f2196eb 100644
--- a/pkg/analyzer/test/generated/engine_test.dart
+++ b/pkg/analyzer/test/generated/engine_test.dart
@@ -42,7 +42,6 @@
modifiedOptions.disableCacheFlushing = true;
modifiedOptions.enabledPluginNames = ['somePackage'];
modifiedOptions.enableLazyAssignmentOperators = true;
- modifiedOptions.enableStrictCallChecks = true;
modifiedOptions.enableSuperMixins = true;
modifiedOptions.enableTiming = true;
modifiedOptions.enableUriInPartOf = true;
@@ -68,8 +67,6 @@
expect(modifiedOptions.enabledPluginNames, isEmpty);
expect(modifiedOptions.enableLazyAssignmentOperators,
defaultOptions.enableLazyAssignmentOperators);
- expect(modifiedOptions.enableStrictCallChecks,
- defaultOptions.enableStrictCallChecks);
expect(modifiedOptions.enableSuperMixins, defaultOptions.enableSuperMixins);
expect(modifiedOptions.enableTiming, defaultOptions.enableTiming);
expect(modifiedOptions.enableUriInPartOf, defaultOptions.enableUriInPartOf);
diff --git a/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart b/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart
index f7270d3..1268f80 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart
@@ -43,13 +43,6 @@
@override
@failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/31758')
- test_argumentTypeNotAssignable_classWithCall_Function() async {
- return super.test_argumentTypeNotAssignable_classWithCall_Function();
- }
-
- @override
- @failingTest
@notForDart2
test_async_return_flattens_futures() async {
// Only FutureOr is flattened.
@@ -198,11 +191,6 @@
@override
@failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/31984')
- test_infer_mixin() => super.test_infer_mixin();
-
- @override
- @failingTest
@potentialAnalyzerProblem
test_integerLiteralOutOfRange_negative_valid() async {
return super.test_integerLiteralOutOfRange_negative_valid();
@@ -218,34 +206,6 @@
@override
@failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31758')
- test_invalidAssignment_implicitlyImplementFunctionViaCall_1() async {
- return super.test_invalidAssignment_implicitlyImplementFunctionViaCall_1();
- }
-
- @override
- @failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/31758')
- test_invalidAssignment_implicitlyImplementFunctionViaCall_2() async {
- return super.test_invalidAssignment_implicitlyImplementFunctionViaCall_2();
- }
-
- @override
- @failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/31758')
- test_invalidAssignment_implicitlyImplementFunctionViaCall_3() async {
- return super.test_invalidAssignment_implicitlyImplementFunctionViaCall_3();
- }
-
- @override
- @failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/31758')
- test_invalidAssignment_implicitlyImplementFunctionViaCall_4() async {
- return super.test_invalidAssignment_implicitlyImplementFunctionViaCall_4();
- }
-
- @override
- @failingTest
- @FastaProblem('https://github.com/dart-lang/sdk/issues/31758')
test_invocationOfNonFunction_Object() async {
return super.test_invocationOfNonFunction_Object();
}
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index d24b269..23fd626 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -3494,7 +3494,7 @@
v();
}''');
await computeAnalysisResult(source);
- assertNoErrors(source);
+ assertErrors(source, [StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
verify([source]);
}
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index c5ecd70..713cc7a 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -400,39 +400,6 @@
@override
@failingTest
- void test_illegalAssignmentToNonAssignable_postfix_minusMinus_literal() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, found 0
- super.test_illegalAssignmentToNonAssignable_postfix_minusMinus_literal();
- }
-
- @override
- @failingTest
- void test_illegalAssignmentToNonAssignable_postfix_plusPlus_literal() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, found 0
- super.test_illegalAssignmentToNonAssignable_postfix_plusPlus_literal();
- }
-
- @override
- @failingTest
- void test_illegalAssignmentToNonAssignable_postfix_plusPlus_parenthesized() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, found 0
- super
- .test_illegalAssignmentToNonAssignable_postfix_plusPlus_parenthesized();
- }
-
- @override
- @failingTest
- void test_illegalAssignmentToNonAssignable_primarySelectorPostfix() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, found 0
- super.test_illegalAssignmentToNonAssignable_primarySelectorPostfix();
- }
-
- @override
- @failingTest
void test_illegalAssignmentToNonAssignable_superAssigned() {
// TODO(brianwilkerson) Does not recover.
// Expected: true
@@ -927,22 +894,6 @@
@override
@failingTest
- void test_missingAssignableSelector_prefix_minusMinus_literal() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, found 0
- super.test_missingAssignableSelector_prefix_minusMinus_literal();
- }
-
- @override
- @failingTest
- void test_missingAssignableSelector_prefix_plusPlus_literal() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, found 0
- super.test_missingAssignableSelector_prefix_plusPlus_literal();
- }
-
- @override
- @failingTest
void test_missingAssignableSelector_superPrimaryExpression() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, found 0
@@ -1195,42 +1146,6 @@
@override
@failingTest
- void test_nonIdentifierLibraryName_partOf() {
- // TODO(brianwilkerson) Does not recover.
- // type 'IntegerLiteralImpl' is not a subtype of type 'List<SimpleIdentifier>' of 'components' where
- // IntegerLiteralImpl is from package:analyzer/src/dart/ast/ast.dart
- // List is from dart:core
- // SimpleIdentifier is from package:analyzer/dart/ast/ast.dart
- //
- // package:analyzer/src/dart/ast/ast_factory.dart 665:62 AstFactoryImpl.libraryIdentifier
- // package:analyzer/src/fasta/ast_builder.dart 1451:18 AstBuilder.endPartOf
- // package:front_end/src/fasta/parser/parser.dart 499:14 Parser.parsePartOf
- // package:front_end/src/fasta/parser/parser.dart 467:14 Parser.parsePartOrPartOf
- // package:front_end/src/fasta/parser/parser.dart 296:14 Parser._parseTopLevelDeclaration
- // package:front_end/src/fasta/parser/parser.dart 263:13 Parser.parseTopLevelDeclaration
- // package:front_end/src/fasta/parser/parser.dart 252:15 Parser.parseUnit
- // package:analyzer/src/generated/parser_fasta.dart 77:33 _Parser2.parseCompilationUnit2
- // package:analyzer/src/generated/parser_fasta.dart 72:12 _Parser2.parseCompilationUnit
- // test/generated/parser_fasta_test.dart 3125:35 FastaParserTestCase.parseCompilationUnit
- super.test_nonIdentifierLibraryName_partOf();
- }
-
- @override
- @failingTest
- void test_parseCascadeSection_missingIdentifier() {
- // TODO(brianwilkerson) Testing at too low a level.
- super.test_parseCascadeSection_missingIdentifier();
- }
-
- @override
- @failingTest
- void test_parseCascadeSection_missingIdentifier_typeArguments() {
- // TODO(brianwilkerson) Testing at too low a level.
- super.test_parseCascadeSection_missingIdentifier_typeArguments();
- }
-
- @override
- @failingTest
void test_setterInFunction_block() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.SETTER_IN_FUNCTION, found 0
@@ -1247,35 +1162,6 @@
@override
@failingTest
- void test_staticConstructor() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.STATIC_CONSTRUCTOR, found 0
- super.test_staticConstructor();
- }
-
- @override
- @failingTest
- void test_topLevelVariable_withMetadata() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, found 0;
- // 1 errors of type ParserErrorCode.EXPECTED_TOKEN, found 0;
- // 1 errors of type ParserErrorCode.MISSING_IDENTIFIER, found 0;
- // 0 errors of type ParserErrorCode.EXTRANEOUS_MODIFIER, found 1 (8)
- super.test_topLevelVariable_withMetadata();
- }
-
- @override
- @failingTest
- void test_typedef_incomplete() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.UNEXPECTED_TOKEN, found 0;
- // 1 errors of type ParserErrorCode.EXPECTED_TOKEN, found 0;
- // 1 errors of type ParserErrorCode.EXPECTED_EXECUTABLE, found 0
- super.test_typedef_incomplete();
- }
-
- @override
- @failingTest
void test_unexpectedToken_endOfFieldDeclarationStatement() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.UNEXPECTED_TOKEN, found 0
@@ -1283,35 +1169,6 @@
}
@override
- @failingTest
- void test_unexpectedToken_invalidPostfixExpression() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.UNEXPECTED_TOKEN, found 0
- super.test_unexpectedToken_invalidPostfixExpression();
- }
-
- @override
- @failingTest
- void test_unexpectedToken_returnInExpressionFunctionBody() {
- // TODO(brianwilkerson) Does not recover.
- // type 'FormalParameterListImpl' is not a subtype of type 'Token' of 'asyncKeyword' where
- // FormalParameterListImpl is from package:analyzer/src/dart/ast/ast.dart
- // Token is from package:front_end/src/scanner/token.dart
- //
- // package:analyzer/src/fasta/ast_builder.dart 380:26 AstBuilder.handleExpressionFunctionBody
- // package:front_end/src/fasta/parser/parser.dart 2621:18 Parser.parseFunctionBody
- // package:front_end/src/fasta/parser/parser.dart 1737:13 Parser.parseTopLevelMethod
- // package:front_end/src/fasta/parser/parser.dart 1646:11 Parser.parseTopLevelMember
- // package:front_end/src/fasta/parser/parser.dart 298:14 Parser._parseTopLevelDeclaration
- // package:front_end/src/fasta/parser/parser.dart 263:13 Parser.parseTopLevelDeclaration
- // package:front_end/src/fasta/parser/parser.dart 252:15 Parser.parseUnit
- // package:analyzer/src/generated/parser_fasta.dart 77:33 _Parser2.parseCompilationUnit2
- // package:analyzer/src/generated/parser_fasta.dart 72:12 _Parser2.parseCompilationUnit
- // test/generated/parser_fasta_test.dart 3371:35 FastaParserTestCase.parseCompilationUnit
- super.test_unexpectedToken_returnInExpressionFunctionBody();
- }
-
- @override
// @failingTest
void test_voidVariable_parseClassMember_initializer() {
// TODO(brianwilkerson) Passes, but ought to fail.
@@ -2212,13 +2069,6 @@
class RecoveryParserTest_Fasta extends FastaParserTestCase
with RecoveryParserTestMixin {
@override
- @failingTest
- void test_classTypeAlias_withBody() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_classTypeAlias_withBody();
- }
-
- @override
void test_equalityExpression_precedence_relational_right() {
// Fasta recovers differently. It takes the `is` to be an identifier and
// assumes that it is the right operand of the `==`.
@@ -2239,13 +2089,6 @@
@override
@failingTest
- void test_functionExpression_in_ConstructorFieldInitializer() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_functionExpression_in_ConstructorFieldInitializer();
- }
-
- @override
- @failingTest
void test_functionExpression_named() {
// TODO(brianwilkerson) Unhandled compile-time error:
// A function expression can't have a name.
@@ -2254,13 +2097,6 @@
@override
@failingTest
- void test_incomplete_returnType() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incomplete_returnType();
- }
-
- @override
- @failingTest
void test_incompleteLocalVariable_beforeIdentifier() {
// TODO(brianwilkerson) reportUnrecoverableErrorWithToken
super.test_incompleteLocalVariable_beforeIdentifier();
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index c0be389..bee7666 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -4699,10 +4699,19 @@
}
void test_nonIdentifierLibraryName_partOf() {
- CompilationUnit unit = parseCompilationUnit("part of 3;", errors: [
- expectedError(ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE, 8, 1),
- expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 8, 1)
- ]);
+ CompilationUnit unit = parseCompilationUnit("part of 3;",
+ errors: usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.EXPECTED_STRING_LITERAL, 8, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1),
+ expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 8, 1),
+ expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 9, 1)
+ ]
+ : [
+ expectedError(
+ ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE, 8, 1),
+ expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 8, 1)
+ ]);
expect(unit, isNotNull);
}
@@ -4758,8 +4767,11 @@
void test_parseCascadeSection_missingIdentifier() {
MethodInvocation methodInvocation = parseCascadeSection('..()');
expectNotNullIfNoErrors(methodInvocation);
- listener.assertErrors(
- [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 2, 1)]);
+ listener.assertErrors([
+ // Cascade section is preceeded by `null` in this test
+ // and error is reported on '('.
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 6, 1)
+ ]);
expect(methodInvocation.target, isNull);
expect(methodInvocation.methodName.name, "");
expect(methodInvocation.typeArguments, isNull);
@@ -4769,8 +4781,11 @@
void test_parseCascadeSection_missingIdentifier_typeArguments() {
MethodInvocation methodInvocation = parseCascadeSection('..<E>()');
expectNotNullIfNoErrors(methodInvocation);
- listener.assertErrors(
- [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 2, 1)]);
+ listener.assertErrors([
+ // Cascade section is preceeded by `null` in this test
+ // and error is reported on '<'.
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 6, 1)
+ ]);
expect(methodInvocation.target, isNull);
expect(methodInvocation.methodName.name, "");
expect(methodInvocation.typeArguments, isNotNull);
@@ -5110,11 +5125,18 @@
}
void test_topLevelVariable_withMetadata() {
- parseCompilationUnit("String @A string;", codes: [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE
- ]);
+ parseCompilationUnit("String @A string;",
+ codes: usingFastaParser
+ ? [
+ ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE
+ ]
+ : [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE
+ ]);
}
void test_typedef_incomplete() {
@@ -5128,11 +5150,17 @@
main() {
Function<
}
-''', errors: [
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 51, 1),
- expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 51, 1),
- expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 55, 8)
- ]);
+''',
+ errors: usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 51, 1),
+ expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 51, 1),
+ ]
+ : [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 51, 1),
+ expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 51, 1),
+ expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 55, 8)
+ ]);
}
void test_typedef_namedFunction() {
@@ -5193,17 +5221,29 @@
.assertErrors([expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 17, 1)]);
}
- @failingTest
void test_unexpectedToken_invalidPostfixExpression() {
- // Note: this might not be the right error to produce, but some error should
- // be produced
- parseExpression("f()++",
- errors: [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 3, 2)]);
+ parseExpression("f()++", errors: [
+ expectedError(ParserErrorCode.ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, 3, 2)
+ ]);
+ }
+
+ void test_unexpectedToken_invalidPrefixExpression() {
+ parseExpression("++f()", errors: [
+ expectedError(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, 4, 1)
+ ]);
}
void test_unexpectedToken_returnInExpressionFunctionBody() {
parseCompilationUnit("f() => return null;",
- errors: [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 7, 6)]);
+ errors: usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 7, 6),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 14, 4),
+ expectedError(
+ ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 14, 4),
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 14, 4)
+ ]
+ : [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 7, 6)]);
}
void test_unexpectedToken_semicolonBetweenClassMembers() {
@@ -10327,7 +10367,15 @@
void test_classTypeAlias_withBody() {
parseCompilationUnit(r'''
class A {}
-class B = Object with A {}''', codes: [ParserErrorCode.EXPECTED_TOKEN]);
+class B = Object with A {}''',
+ codes: usingFastaParser
+ // TODO(danrubel): Consolidate and improve error message.
+ ? [
+ ParserErrorCode.EXPECTED_EXECUTABLE,
+ ParserErrorCode.EXPECTED_EXECUTABLE,
+ ParserErrorCode.EXPECTED_TOKEN
+ ]
+ : [ParserErrorCode.EXPECTED_TOKEN]);
}
void test_combinator_missingIdentifier() {
@@ -10492,7 +10540,9 @@
CompilationUnit unit =
parseCompilationUnit("class A { A() : a = (){}; var v; }", codes: [
ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.UNEXPECTED_TOKEN
+ usingFastaParser
+ ? ParserErrorCode.EXPECTED_CLASS_MEMBER
+ : ParserErrorCode.UNEXPECTED_TOKEN
]);
// Make sure we recovered and parsed "var v" correctly
ClassDeclaration declaration = unit.declarations[0] as ClassDeclaration;
@@ -10653,9 +10703,9 @@
}
}
- @failingTest
void test_incomplete_returnType() {
- parseCompilationUnit(r'''
+ if (usingFastaParser) {
+ parseCompilationUnit(r'''
Map<Symbol, convertStringToSymbolMap(Map<String, dynamic> map) {
if (map == null) return null;
Map<Symbol, dynamic> result = new Map<Symbol, dynamic>();
@@ -10663,7 +10713,8 @@
result[new Symbol(name)] = value;
});
return result;
-}''');
+}''', errors: [expectedError(ParserErrorCode.EXPECTED_TOKEN, 36, 1)]);
+ }
}
void test_incomplete_topLevelFunction() {
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart
index 689dda8..b829db5 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart
@@ -282,13 +282,6 @@
@override
@failingTest
- test_invocationOfNonFunction_localGenericFunction() async {
- // Expected 1 errors of type StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, found 0
- await super.test_invocationOfNonFunction_localGenericFunction();
- }
-
- @override
- @failingTest
test_invocationOfNonFunction_localObject() async {
// Expected 1 errors of type StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, found 0
await super.test_invocationOfNonFunction_localObject();
@@ -709,13 +702,6 @@
@override
@failingTest
- test_undefinedGetter_generic_function_call() async {
- // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
- await super.test_undefinedGetter_generic_function_call();
- }
-
- @override
- @failingTest
test_undefinedGetter_static() async {
// Bad state: No reference information for A at 19
await super.test_undefinedGetter_static();
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
index b405734..bff9300 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -746,23 +746,16 @@
}
test_invocationOfNonFunction_localGenericFunction() async {
- // Objects having a specific function type may be invoked, but objects
- // having type Function may not, because type Function lacks a call method
- // (this is because it is impossible to know what signature the call should
- // have).
- AnalysisOptionsImpl options = new AnalysisOptionsImpl();
- options.enableStrictCallChecks = true;
- resetWith(options: options);
+ // Invoking `.call` on a `Function` type works similarly to invoking it on
+ // `dynamic`--the invocation is accepted at compile time, and all type
+ // checking is deferred until runtime.
await assertErrorsInCode('''
f(Function f) {
return f();
-}''', [StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
+}''', []);
}
test_invocationOfNonFunction_localObject() async {
- AnalysisOptionsImpl options = new AnalysisOptionsImpl();
- options.enableStrictCallChecks = true;
- resetWith(options: options);
await assertErrorsInCode('''
f(Object o) {
return o();
@@ -1484,23 +1477,17 @@
}
test_undefinedGetter_generic_function_call() async {
- // Objects having a specific function type have a call() method, but
- // objects having type Function do not (this is because it is impossible to
- // know what signature the call should have).
- AnalysisOptionsImpl options = new AnalysisOptionsImpl();
- options.enableStrictCallChecks = true;
- resetWith(options: options);
+ // Referencing `.call` on a `Function` type works similarly to referencing
+ // it on `dynamic`--the reference is accepted at compile time, and all type
+ // checking is deferred until runtime.
await assertErrorsInUnverifiedCode('''
f(Function f) {
return f.call;
}
-''', [StaticTypeWarningCode.UNDEFINED_GETTER]);
+''', []);
}
test_undefinedGetter_object_call() async {
- AnalysisOptionsImpl options = new AnalysisOptionsImpl();
- options.enableStrictCallChecks = true;
- resetWith(options: options);
await assertErrorsInUnverifiedCode('''
f(Object o) {
return o.call;
@@ -1597,17 +1584,14 @@
}
test_undefinedMethod_generic_function_call() async {
- // Objects having a specific function type have a call() method, but
- // objects having type Function do not (this is because it is impossible to
- // know what signature the call should have).
- AnalysisOptionsImpl options = new AnalysisOptionsImpl();
- options.enableStrictCallChecks = true;
- resetWith(options: options);
+ // Invoking `.call` on a `Function` type works similarly to invoking it on
+ // `dynamic`--the invocation is accepted at compile time, and all type
+ // checking is deferred until runtime.
await assertErrorsInCode('''
f(Function f) {
f.call();
}
-''', [StaticTypeWarningCode.UNDEFINED_METHOD]);
+''', []);
}
test_undefinedMethod_ignoreTypePropagation() async {
@@ -1630,9 +1614,6 @@
}
test_undefinedMethod_object_call() async {
- AnalysisOptionsImpl options = new AnalysisOptionsImpl();
- options.enableStrictCallChecks = true;
- resetWith(options: options);
await assertErrorsInCode('''
f(Object o) {
o.call();
diff --git a/pkg/analyzer/test/src/command_line/arguments_test.dart b/pkg/analyzer/test/src/command_line/arguments_test.dart
index e2e9131a..8ecdfeb 100644
--- a/pkg/analyzer/test/src/command_line/arguments_test.dart
+++ b/pkg/analyzer/test/src/command_line/arguments_test.dart
@@ -34,7 +34,6 @@
'--dart-sdk-summary=$dartSdkSummaryPath',
'-Dfoo=1',
'-Dbar=2',
- '--enable-strict-call-checks',
'--no-declaration-casts',
'--no-implicit-casts',
'--no-implicit-dynamic',
@@ -58,7 +57,6 @@
expect(options.defaultPackagesDirectoryPath, defaultPackagesDirectoryPath);
AnalysisOptionsImpl defaultOptions = options.defaultOptions;
expect(defaultOptions, isNotNull);
- expect(defaultOptions.enableStrictCallChecks, true);
expect(defaultOptions.strongMode, true);
expect(defaultOptions.declarationCasts, false);
expect(defaultOptions.implicitCasts, false);
@@ -80,7 +78,6 @@
expect(options.defaultPackagesDirectoryPath, isNull);
AnalysisOptionsImpl defaultOptions = options.defaultOptions;
expect(defaultOptions, isNotNull);
- expect(defaultOptions.enableStrictCallChecks, false);
expect(defaultOptions.strongMode, false);
expect(defaultOptions.declarationCasts, true);
expect(defaultOptions.implicitCasts, true);
@@ -157,7 +154,7 @@
void test_defineAnalysisArguments() {
ArgParser parser = new ArgParser();
defineAnalysisArguments(parser);
- expect(parser.options, hasLength(15));
+ expect(parser.options, hasLength(14));
}
void test_extractDefinedVariables() {
diff --git a/pkg/analyzer/test/src/context/builder_test.dart b/pkg/analyzer/test/src/context/builder_test.dart
index 0c75315..b8c378a 100644
--- a/pkg/analyzer/test/src/context/builder_test.dart
+++ b/pkg/analyzer/test/src/context/builder_test.dart
@@ -245,13 +245,13 @@
void test_cmdline_options_override_options_file() {
ArgParser argParser = new ArgParser();
defineAnalysisArguments(argParser);
- ArgResults argResults = argParser.parse(['--$enableStrictCallChecksFlag']);
+ ArgResults argResults = argParser.parse(['--$enableSuperMixinFlag']);
var builder = new ContextBuilder(resourceProvider, sdkManager, contentCache,
options: createContextBuilderOptions(argResults));
AnalysisOptionsImpl expected = new AnalysisOptionsImpl();
expected.enableSuperMixins = true;
- expected.enableStrictCallChecks = true;
+ expected.previewDart2 = true;
String path = resourceProvider.convertPath('/some/directory/path');
String filePath =
@@ -259,8 +259,7 @@
resourceProvider.newFile(filePath, '''
analyzer:
language:
- enableSuperMixins : true
- enableStrictCallChecks : false
+ enablePreviewDart2: true
''');
AnalysisOptions options = builder.getAnalysisOptions(path);
@@ -300,8 +299,6 @@
defaultOptions.dart2jsHint = !defaultOptions.dart2jsHint;
defaultOptions.enableLazyAssignmentOperators =
!defaultOptions.enableLazyAssignmentOperators;
- defaultOptions.enableStrictCallChecks =
- !defaultOptions.enableStrictCallChecks;
defaultOptions.enableSuperMixins = !defaultOptions.enableSuperMixins;
builderOptions.defaultOptions = defaultOptions;
AnalysisOptions options = builder.createDefaultOptions();
@@ -1000,7 +997,6 @@
expect(actual.dart2jsHint, expected.dart2jsHint);
expect(actual.enableLazyAssignmentOperators,
expected.enableLazyAssignmentOperators);
- expect(actual.enableStrictCallChecks, expected.enableStrictCallChecks);
expect(actual.enableSuperMixins, expected.enableSuperMixins);
expect(actual.enableTiming, expected.enableTiming);
expect(actual.generateImplicitErrors, expected.generateImplicitErrors);
diff --git a/pkg/analyzer/test/src/dart/ast/ast_test.dart b/pkg/analyzer/test/src/dart/ast/ast_test.dart
index 92d0663..60e2002 100644
--- a/pkg/analyzer/test/src/dart/ast/ast_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/ast_test.dart
@@ -4,14 +4,17 @@
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
+import 'package:analyzer/src/generated/engine.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../../../generated/parser_test.dart';
+import '../../../generated/resolver_test_case.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ExpressionImplTest);
+ defineReflectiveTests(InstanceCreationExpressionImplTest);
defineReflectiveTests(IntegerLiteralImplTest);
});
}
@@ -46,6 +49,16 @@
assertInContext("C(0", true);
}
+ test_inConstantContext_instanceCreation_functionLiteral() {
+ parse('''
+const V = () => C();
+class C {
+ const C();
+}
+''');
+ assertInContext("C()", false);
+ }
+
test_inConstantContext_instanceCreation_initializer_false() {
parse('''
var c = C();
@@ -213,6 +226,16 @@
assertInContext("[]", true);
}
+ test_inConstantContext_listLiteral_functionLiteral() {
+ parse('''
+const V = () => [];
+class C {
+ const C();
+}
+''');
+ assertInContext("[]", false);
+ }
+
test_inConstantContext_listLiteral_initializer_false() {
parse('''
var c = [];
@@ -313,6 +336,16 @@
assertInContext("{}", true);
}
+ test_inConstantContext_mapLiteral_functionLiteral() {
+ parse('''
+const V = () => {};
+class C {
+ const C();
+}
+''');
+ assertInContext("{}", false);
+ }
+
test_inConstantContext_mapLiteral_initializer_false() {
parse('''
var c = {};
@@ -405,6 +438,68 @@
}
@reflectiveTest
+class InstanceCreationExpressionImplTest extends ResolverTestCase {
+ String testSource;
+ CompilationUnitImpl testUnit;
+
+ void assertInContext(String snippet, bool isConst) {
+ int index = testSource.indexOf(snippet);
+ expect(index >= 0, isTrue);
+ NodeLocator visitor = new NodeLocator(index);
+ AstNodeImpl node = visitor.searchWithin(testUnit);
+ node = node.getAncestor((node) => node is InstanceCreationExpressionImpl);
+ expect(node, isNotNull);
+ expect((node as InstanceCreationExpressionImpl).isConst,
+ isConst ? isTrue : isFalse);
+ }
+
+ void enablePreviewDart2() {
+ resetWith(options: new AnalysisOptionsImpl()..previewDart2 = true);
+ }
+
+ void resolve(String source) async {
+ testSource = source;
+ testUnit = await resolveSource2('/test.dart', source);
+ }
+
+ void test_isConst_instanceCreation_notExplicit_notInContext() async {
+ enablePreviewDart2();
+ await resolve('''
+f() => <Object>[C()];
+class C {
+ const C();
+}
+''');
+ assertInContext("C()", true);
+ }
+
+ void
+ test_isConst_instanceCreation_notExplicit_notInContext_nonConstConstructor() async {
+ enablePreviewDart2();
+ await resolve('''
+f() => <Object>[C()];
+class C {
+ C();
+}
+''');
+ assertInContext("C()", false);
+ }
+
+ void
+ test_isConst_instanceCreation_notExplicit_notInContext_nonConstParam() async {
+ enablePreviewDart2();
+ await resolve('''
+f(int i) => <Object>[C(i)];
+class C {
+ final int f;
+ const C(this.f);
+}
+''');
+ assertInContext("C(i)", false);
+ }
+}
+
+@reflectiveTest
class IntegerLiteralImplTest {
test_isValidLiteral_dec_negative_equalMax() {
expect(
diff --git a/pkg/analyzer/test/src/fasta/recovery/extra_code_test.dart b/pkg/analyzer/test/src/fasta/recovery/extra_code_test.dart
index 898773e..f7fa146 100644
--- a/pkg/analyzer/test/src/fasta/recovery/extra_code_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/extra_code_test.dart
@@ -50,12 +50,16 @@
*/
@reflectiveTest
class MiscellaneousTest extends AbstractRecoveryTest {
- @failingTest
void test_classTypeAlias_withBody() {
- // Parser crashes
testRecovery('''
class B = Object with A {}
-''', [ParserErrorCode.EXPECTED_TOKEN], '''
+''',
+ // TODO(danrubel): Consolidate and improve error message.
+ [
+ ParserErrorCode.EXPECTED_EXECUTABLE,
+ ParserErrorCode.EXPECTED_EXECUTABLE,
+ ParserErrorCode.EXPECTED_TOKEN
+ ], '''
class B = Object with A;
''');
}
diff --git a/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart b/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart
index 58ab4ff..1531a12 100644
--- a/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart
@@ -526,57 +526,51 @@
''');
}
- @failingTest
void test_incorrectlyTerminatedGroup_named_none() {
testRecovery('''
f({a: 0) {}
-''', [ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP], '''
+''', [ScannerErrorCode.EXPECTED_TOKEN], '''
f({a: 0}) {}
''');
}
- @failingTest
void test_incorrectlyTerminatedGroup_named_positional() {
testRecovery('''
f({a: 0]) {}
-''', [ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP], '''
+''', [ScannerErrorCode.EXPECTED_TOKEN, ParserErrorCode.EXPECTED_TOKEN], '''
f({a: 0}) {}
''');
}
- @failingTest
void test_incorrectlyTerminatedGroup_none_named() {
testRecovery('''
f(a}) {}
-''', [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP], '''
+''', [ParserErrorCode.EXPECTED_TOKEN], '''
f(a) {}
''');
}
- @failingTest
void test_incorrectlyTerminatedGroup_none_positional() {
testRecovery('''
f(a]) {}
-''', [ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP], '''
+''', [ParserErrorCode.EXPECTED_TOKEN], '''
f(a) {}
''');
}
- @failingTest
void test_incorrectlyTerminatedGroup_positional_named() {
testRecovery('''
f([a = 0}) {}
-''', [ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP], '''
+''', [ScannerErrorCode.EXPECTED_TOKEN, ParserErrorCode.EXPECTED_TOKEN], '''
f([a = 0]) {}
''');
}
- @failingTest
void test_incorrectlyTerminatedGroup_positional_none() {
// Maybe put in paired_tokens_test.dart.
testRecovery('''
f([a = 0) {}
-''', [ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP], '''
+''', [ScannerErrorCode.EXPECTED_TOKEN], '''
f([a = 0]) {}
''');
}
@@ -628,12 +622,11 @@
''');
}
- @failingTest
void test_multipleGroups_mixed() {
// TODO(brianwilkerson) Figure out the best way to recover from this.
testRecovery('''
f([a = 0], {b: 1}) {}
-''', [ParserErrorCode.MIXED_PARAMETER_GROUPS], '''
+''', [ParserErrorCode.EXPECTED_TOKEN], '''
f([a = 0]) {}
''');
}
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/field_declaration_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/field_declaration_test.dart
index 5c42722..d3a1af6 100644
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/field_declaration_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/field_declaration_test.dart
@@ -31,9 +31,13 @@
new TestDescriptor(
'const_noName',
'const',
- [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
+ ],
'const _s_;',
- allFailing: true,
+ failing: allExceptEof,
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
@@ -41,9 +45,12 @@
new TestDescriptor(
'const_name',
'const f',
- [ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
+ ],
'const f;',
- allFailing: true,
+ failing: ['methodNonVoid', 'getter', 'setter'],
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
@@ -159,9 +166,13 @@
new TestDescriptor(
'static_const_noName',
'static const',
- [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
+ ],
'static const _s_;',
- allFailing: true,
+ failing: allExceptEof,
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
@@ -169,9 +180,12 @@
new TestDescriptor(
'static_const_name',
'static const f',
- [ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
+ ],
'static const f;',
- allFailing: true,
+ failing: ['methodNonVoid', 'getter', 'setter'],
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/top_level_variable_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/top_level_variable_test.dart
index 17a1456..cc08a8b 100644
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/top_level_variable_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/top_level_variable_test.dart
@@ -32,10 +32,11 @@
'const',
[
ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
"const _s_;",
- allFailing: true,
+ failing: allExceptEof,
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
@@ -43,9 +44,12 @@
new TestDescriptor(
'constName',
'const a',
- [ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
+ ],
"const a;",
- allFailing: true,
+ failing: ['typedef', 'functionNonVoid', 'getter', 'setter'],
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
@@ -53,9 +57,11 @@
new TestDescriptor(
'constTypeName',
'const int a',
- [ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
+ ],
"const int a;",
- allFailing: true,
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
@@ -65,10 +71,18 @@
'const a,',
[
ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
"const a, _s_;",
- allFailing: true,
+ failing: [
+ 'typedef',
+ 'functionVoid',
+ 'functionNonVoid',
+ 'getter',
+ 'setter'
+ ],
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED,
CompileTimeErrorCode.CONST_NOT_INITIALIZED
@@ -79,10 +93,18 @@
'const int a,',
[
ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
"const int a, _s_;",
- allFailing: true,
+ failing: [
+ 'typedef',
+ 'functionVoid',
+ 'functionNonVoid',
+ 'getter',
+ 'setter'
+ ],
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED,
CompileTimeErrorCode.CONST_NOT_INITIALIZED
@@ -91,9 +113,12 @@
new TestDescriptor(
'constNameCommaName',
'const a, b',
- [ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
+ ],
"const a, b;",
- allFailing: true,
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED,
CompileTimeErrorCode.CONST_NOT_INITIALIZED
@@ -102,9 +127,12 @@
new TestDescriptor(
'constTypeNameCommaName',
'const int a, b',
- [ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED,
+ CompileTimeErrorCode.CONST_NOT_INITIALIZED
+ ],
"const int a, b;",
- allFailing: true,
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED,
CompileTimeErrorCode.CONST_NOT_INITIALIZED
@@ -115,10 +143,11 @@
'final',
[
ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN
+ ParserErrorCode.EXPECTED_TOKEN,
+ StaticWarningCode.FINAL_NOT_INITIALIZED
],
"final _s_;",
- allFailing: true,
+ failing: allExceptEof,
expectedErrorsInValidCode: [
StaticWarningCode.FINAL_NOT_INITIALIZED
],
@@ -126,9 +155,12 @@
new TestDescriptor(
'finalName',
'final a',
- [ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ StaticWarningCode.FINAL_NOT_INITIALIZED
+ ],
"final a;",
- allFailing: true,
+ failing: ['typedef', 'functionNonVoid', 'getter', 'setter'],
expectedErrorsInValidCode: [
StaticWarningCode.FINAL_NOT_INITIALIZED
],
@@ -136,9 +168,11 @@
new TestDescriptor(
'finalTypeName',
'final int a',
- [ParserErrorCode.EXPECTED_TOKEN],
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ StaticWarningCode.FINAL_NOT_INITIALIZED
+ ],
"final int a;",
- allFailing: true,
expectedErrorsInValidCode: [
StaticWarningCode.FINAL_NOT_INITIALIZED
],
diff --git a/pkg/analyzer/test/src/task/options_test.dart b/pkg/analyzer/test/src/task/options_test.dart
index 6713e90..0f45305 100644
--- a/pkg/analyzer/test/src/task/options_test.dart
+++ b/pkg/analyzer/test/src/task/options_test.dart
@@ -7,6 +7,8 @@
import 'dart:mirrors';
import 'package:analyzer/analyzer.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/source/analysis_options_provider.dart';
import 'package:analyzer/source/error_processor.dart';
import 'package:analyzer/src/generated/engine.dart';
@@ -22,6 +24,7 @@
import '../../generated/test_support.dart';
import '../context/abstract_context.dart';
+import '../../resource_utils.dart';
main() {
defineReflectiveSuite(() {
@@ -30,6 +33,7 @@
defineReflectiveTests(GenerateNewOptionsErrorsTaskTest);
defineReflectiveTests(GenerateOldOptionsErrorsTaskTest);
defineReflectiveTests(OptionsFileValidatorTest);
+ defineReflectiveTests(OptionsProviderTest);
});
}
@@ -56,25 +60,6 @@
expect(analysisOptions.strongMode, false);
}
- test_configure_enableLazyAssignmentOperators() {
- expect(analysisOptions.enableStrictCallChecks, false);
- configureContext('''
-analyzer:
- language:
- enableStrictCallChecks: true
-''');
- expect(analysisOptions.enableStrictCallChecks, true);
- }
-
- test_configure_enableStrictCallChecks() {
- configureContext('''
-analyzer:
- language:
- enableStrictCallChecks: true
-''');
- expect(analysisOptions.enableStrictCallChecks, true);
- }
-
test_configure_enableSuperMixins() {
configureContext('''
analyzer:
@@ -630,6 +615,106 @@
}
}
+@reflectiveTest
+class OptionsProviderTest {
+ TestPathTranslator pathTranslator;
+ ResourceProvider resourceProvider;
+
+ AnalysisOptionsProvider provider;
+
+ String get optionsFilePath => '/analysis_options.yaml';
+
+ void setUp() {
+ var rawProvider = new MemoryResourceProvider();
+ resourceProvider = new TestResourceProvider(rawProvider);
+ pathTranslator = new TestPathTranslator(rawProvider);
+ provider = new AnalysisOptionsProvider(new SourceFactory([
+ new ResourceUriResolver(rawProvider),
+ ]));
+ }
+
+ test_perform_include_merge() {
+ pathTranslator.newFile('/other_options.yaml', '''
+analyzer:
+ exclude:
+ - toplevelexclude.dart
+ plugins:
+ toplevelplugin:
+ enabled: true
+ errors:
+ toplevelerror: warning
+linter:
+ rules:
+ - toplevellint
+''');
+ String code = r'''
+include: other_options.yaml
+analyzer:
+ exclude:
+ - lowlevelexclude.dart
+ plugins:
+ lowlevelplugin:
+ enabled: true
+ errors:
+ lowlevelerror: warning
+linter:
+ rules:
+ - lowlevellint
+''';
+ pathTranslator.newFile(optionsFilePath, code);
+
+ final lowlevellint = new TestRule.withName('lowlevellint');
+ final toplevellint = new TestRule.withName('toplevellint');
+ Registry.ruleRegistry.register(lowlevellint);
+ Registry.ruleRegistry.register(toplevellint);
+ final options = _getOptionsObject('/');
+
+ expect(options.lintRules, unorderedEquals([toplevellint, lowlevellint]));
+ expect(options.enabledPluginNames,
+ unorderedEquals(['toplevelplugin', 'lowlevelplugin']));
+ expect(options.excludePatterns,
+ unorderedEquals(['toplevelexclude.dart', 'lowlevelexclude.dart']));
+ expect(
+ options.errorProcessors,
+ unorderedMatches([
+ new ErrorProcessorMatcher(
+ new ErrorProcessor('toplevelerror', ErrorSeverity.WARNING)),
+ new ErrorProcessorMatcher(
+ new ErrorProcessor('lowlevelerror', ErrorSeverity.WARNING))
+ ]));
+ }
+
+ Map<String, YamlNode> _getOptions(String posixPath, {bool crawlUp: false}) {
+ Resource resource = pathTranslator.getResource(posixPath);
+ return provider.getOptions(resource, crawlUp: crawlUp);
+ }
+
+ AnalysisOptions _getOptionsObject(String posixPath, {bool crawlUp: false}) {
+ final map = _getOptions(posixPath, crawlUp: crawlUp);
+ final options = new AnalysisOptionsImpl();
+ applyToAnalysisOptions(options, map);
+ return options;
+ }
+}
+
+class ErrorProcessorMatcher extends Matcher {
+ final ErrorProcessor required;
+
+ ErrorProcessorMatcher(this.required);
+
+ @override
+ Description describe(Description desc) => desc
+ ..add("an ErrorProcessor setting ${required.code} to ${required.severity}");
+
+ @override
+ bool matches(dynamic o, Map<dynamic, dynamic> options) {
+ return o is ErrorProcessor &&
+ o.code.toUpperCase() == required.code.toUpperCase() &&
+ o.severity == required.severity;
+ }
+}
+
class TestRule extends LintRule {
TestRule() : super(name: 'fantastic_test_rule');
+ TestRule.withName(String name) : super(name: name);
}
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index 13bcfa4..a2ecdf1 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -27,10 +27,12 @@
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/generated/utilities_general.dart'
show PerformanceTag;
+import 'package:analyzer/src/pubspec/pubspec_validator.dart';
import 'package:analyzer/src/source/source_resource.dart';
import 'package:analyzer/src/summary/idl.dart';
import 'package:analyzer/src/summary/package_bundle_reader.dart';
import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk;
+import 'package:analyzer/src/task/options.dart';
import 'package:analyzer_cli/src/analyzer_impl.dart';
import 'package:analyzer_cli/src/batch_mode.dart';
import 'package:analyzer_cli/src/build_mode.dart';
@@ -318,16 +320,52 @@
}
for (Source source in sourcesToAnalyze) {
- SourceKind sourceKind = analysisDriver != null
- ? await analysisDriver.getSourceKind(source.fullName)
- : context.computeKindOf(source);
- if (sourceKind == SourceKind.PART) {
- partSources.add(source);
- continue;
+ if (analysisDriver != null &&
+ (source.shortName == AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE ||
+ source.shortName == AnalysisEngine.ANALYSIS_OPTIONS_FILE)) {
+ file_system.File file = resourceProvider.getFile(source.fullName);
+ String content = file.readAsStringSync();
+ LineInfo lineInfo = new LineInfo.fromContent(content);
+ List<AnalysisError> errors =
+ GenerateOptionsErrorsTask.analyzeAnalysisOptions(
+ file.createSource(), content, analysisDriver.sourceFactory);
+ formatter.formatErrors([new AnalysisErrorInfoImpl(errors, lineInfo)]);
+ for (AnalysisError error in errors) {
+ allResult = allResult.max(determineProcessedSeverity(
+ error, options, _context.analysisOptions));
+ }
+ } else if (source.shortName == AnalysisEngine.PUBSPEC_YAML_FILE) {
+ try {
+ file_system.File file = resourceProvider.getFile(source.fullName);
+ String content = file.readAsStringSync();
+ YamlNode node = loadYamlNode(content);
+ if (node is YamlMap) {
+ PubspecValidator validator =
+ new PubspecValidator(resourceProvider, file.createSource());
+ LineInfo lineInfo = new LineInfo.fromContent(content);
+ List<AnalysisError> errors = validator.validate(node.nodes);
+ formatter
+ .formatErrors([new AnalysisErrorInfoImpl(errors, lineInfo)]);
+ for (AnalysisError error in errors) {
+ allResult = allResult.max(determineProcessedSeverity(
+ error, options, _context.analysisOptions));
+ }
+ }
+ } catch (exception) {
+ // If the file cannot be analyzed, ignore it.
+ }
+ } else {
+ SourceKind sourceKind = analysisDriver != null
+ ? await analysisDriver.getSourceKind(source.fullName)
+ : context.computeKindOf(source);
+ if (sourceKind == SourceKind.PART) {
+ partSources.add(source);
+ continue;
+ }
+ ErrorSeverity status = await _runAnalyzer(source, options, formatter);
+ allResult = allResult.max(status);
+ libUris.add(source.uri);
}
- ErrorSeverity status = await _runAnalyzer(source, options, formatter);
- allResult = allResult.max(status);
- libUris.add(source.uri);
}
formatter.flush();
@@ -689,8 +727,7 @@
/// Return whether [a] and [b] options are equal for the purpose of
/// command line analysis.
bool _equalAnalysisOptions(AnalysisOptionsImpl a, AnalysisOptions b) {
- return a.enableStrictCallChecks == b.enableStrictCallChecks &&
- a.enableLazyAssignmentOperators == b.enableLazyAssignmentOperators &&
+ return a.enableLazyAssignmentOperators == b.enableLazyAssignmentOperators &&
a.enableSuperMixins == b.enableSuperMixins &&
a.enableTiming == b.enableTiming &&
a.generateImplicitErrors == b.generateImplicitErrors &&
@@ -914,9 +951,6 @@
if (newOptions.disableHints != previous.disableHints) {
return false;
}
- if (newOptions.enableStrictCallChecks != previous.enableStrictCallChecks) {
- return false;
- }
if (newOptions.showPackageWarnings != previous.showPackageWarnings) {
return false;
}
diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart
index cfa64ec..831841b 100644
--- a/pkg/analyzer_cli/lib/src/options.dart
+++ b/pkg/analyzer_cli/lib/src/options.dart
@@ -218,11 +218,6 @@
Map<String, String> get definedVariables =>
contextBuilderOptions.declaredVariables;
- /// Whether to strictly follow the specification when generating warnings on
- /// "call" methods (fixes dartbug.com/21938).
- bool get enableStrictCallChecks =>
- contextBuilderOptions.defaultOptions.enableStrictCallChecks;
-
/// Whether to relax restrictions on mixins (DEP 34).
bool get enableSuperMixins =>
contextBuilderOptions.defaultOptions.enableSuperMixins;
diff --git a/pkg/analyzer_cli/pubspec.yaml b/pkg/analyzer_cli/pubspec.yaml
index 8de598f..0db8c4a 100644
--- a/pkg/analyzer_cli/pubspec.yaml
+++ b/pkg/analyzer_cli/pubspec.yaml
@@ -14,7 +14,7 @@
linter: ^0.1.16
package_config: '>=0.1.5 <2.0.0'
plugin: '>=0.1.0 <0.3.0'
- protobuf: ^0.5.0
+ protobuf: ^0.7.0
telemetry: ^0.0.1
yaml: ^2.1.2
dev_dependencies:
diff --git a/pkg/analyzer_cli/test/data/flutter_analysis_options/somepkgs/flutter/lib/analysis_options_user.yaml b/pkg/analyzer_cli/test/data/flutter_analysis_options/somepkgs/flutter/lib/analysis_options_user.yaml
index 30dba35..26ed067 100644
--- a/pkg/analyzer_cli/test/data/flutter_analysis_options/somepkgs/flutter/lib/analysis_options_user.yaml
+++ b/pkg/analyzer_cli/test/data/flutter_analysis_options/somepkgs/flutter/lib/analysis_options_user.yaml
@@ -1,6 +1,5 @@
analyzer:
language:
- enableStrictCallChecks: true
enableSuperMixins: true
strong-mode: true
errors:
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index cead0b7..2dbafe6 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -35,6 +35,7 @@
defineReflectiveTests(LinterTest);
defineReflectiveTests(LinterTest_PreviewDart2);
defineReflectiveTests(LinterTest_UseCFE);
+ defineReflectiveTests(NonDartFilesTest);
defineReflectiveTests(OptionsTest);
defineReflectiveTests(OptionsTest_PreviewDart2);
defineReflectiveTests(OptionsTest_UseCFE);
@@ -779,6 +780,44 @@
}
@reflectiveTest
+class NonDartFilesTest extends BaseTest {
+ test_analysisOptionsYaml() async {
+ await withTempDirAsync((tempDir) async {
+ String filePath =
+ path.join(tempDir, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
+ new File(filePath).writeAsStringSync('''
+analyzer:
+ string-mode: true
+''');
+ await drive(filePath);
+ expect(
+ bulletToDash(outSink),
+ contains(
+ "warning - The option 'string-mode' isn't supported by 'analyzer'"));
+ expect(exitCode, 0);
+ });
+ }
+
+ test_pubspecYaml() async {
+ await withTempDirAsync((tempDir) async {
+ String filePath = path.join(tempDir, AnalysisEngine.PUBSPEC_YAML_FILE);
+ new File(filePath).writeAsStringSync('''
+name: foo
+flutter:
+ assets:
+ doesNotExist.gif
+''');
+ await drive(filePath);
+ expect(
+ bulletToDash(outSink),
+ contains(
+ "warning - The value of the 'asset' field is expected to be a list of relative file paths"));
+ expect(exitCode, 0);
+ });
+ }
+}
+
+@reflectiveTest
class OptionsTest extends BaseTest {
String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE;
diff --git a/pkg/analyzer_cli/test/options_test.dart b/pkg/analyzer_cli/test/options_test.dart
index 71a1673..a9e07f4 100644
--- a/pkg/analyzer_cli/test/options_test.dart
+++ b/pkg/analyzer_cli/test/options_test.dart
@@ -60,7 +60,6 @@
expect(options.disableHints, isFalse);
expect(options.lints, isFalse);
expect(options.displayVersion, isFalse);
- expect(options.enableStrictCallChecks, isFalse);
expect(options.enableSuperMixins, isFalse);
expect(options.enableTypeChecks, isFalse);
expect(options.infosAreFatal, isFalse);
@@ -98,12 +97,6 @@
expect(options.disableCacheFlushing, isTrue);
});
- test('enable strict call checks', () {
- CommandLineOptions options = CommandLineOptions.parse(
- ['--dart-sdk', '.', '--enable-strict-call-checks', 'foo.dart']);
- expect(options.enableStrictCallChecks, isTrue);
- });
-
test('enable super mixins', () {
CommandLineOptions options = CommandLineOptions
.parse(['--dart-sdk', '.', '--supermixin', 'foo.dart']);
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
index e2ef187..2bca691 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
+import 'dart:collection';
import 'dart:math' as math;
import 'package:analyzer/src/generated/source.dart';
@@ -31,6 +32,12 @@
<String, LinkedEditGroup>{};
/**
+ * The set of [Position]s that belong to the current [EditBuilderImpl] and
+ * should not be updated in result of inserting this builder.
+ */
+ final Set<Position> _lockedPositions = new HashSet<Position>.identity();
+
+ /**
* Initialize a newly created change builder.
*/
ChangeBuilderImpl();
@@ -86,7 +93,7 @@
*/
void _updatePositions(int offset, int delta) {
void _updatePosition(Position position) {
- if (position.offset >= offset) {
+ if (position.offset >= offset && !_lockedPositions.contains(position)) {
position.offset = position.offset + delta;
}
}
@@ -165,6 +172,7 @@
int end = offset + _buffer.length;
int length = end - start;
Position position = new Position(fileEditBuilder.fileEdit.file, start);
+ fileEditBuilder.changeBuilder._lockedPositions.add(position);
LinkedEditGroup group =
fileEditBuilder.changeBuilder.getLinkedEditGroup(groupName);
group.addPosition(position, length);
@@ -315,6 +323,7 @@
fileEdit.add(edit);
int delta = _editDelta(edit);
changeBuilder._updatePositions(edit.offset + math.max(0, delta), delta);
+ changeBuilder._lockedPositions.clear();
_captureSelection(builder, edit);
}
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 e2925d5..bddf997 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
@@ -50,7 +50,7 @@
@override
Future<DartFileEditBuilderImpl> createFileEditBuilder(String path) async {
ResolveResult result = await session.getResolvedAst(path);
- ResultState state = result.state;
+ ResultState state = result?.state ?? ResultState.INVALID_FILE_TYPE;
if (state == ResultState.INVALID_FILE_TYPE) {
throw new AnalysisException('Cannot analyze "$path"');
}
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 9d40fe0..dc37dc7 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -1140,6 +1140,10 @@
_closedWorld.commonMasks.boolType)
..sourceInformation = node.sourceInformation;
}
+ } else if (element == commonElements.setRuntimeTypeInfo) {
+ if (node.inputs.length == 2) {
+ return handleArrayTypeInfo(node);
+ }
} else if (element == commonElements.checkConcurrentModificationError) {
if (node.inputs.length == 2) {
HInstruction firstArgument = node.inputs[0];
@@ -1167,6 +1171,39 @@
return node;
}
+ HInstruction handleArrayTypeInfo(HInvokeStatic node) {
+ // If type information is not needed, use the raw Array.
+ HInstruction source = node.inputs[0];
+ if (source.usedBy.length != 1) return node;
+ if (!source.isArray(_closedWorld)) return node;
+ for (HInstruction user in node.usedBy) {
+ if (user is HGetLength) continue;
+ if (user is HIndex) continue;
+ // Bounds check escapes the array, but we don't care.
+ if (user is HBoundsCheck) continue;
+ // Interceptor only escapes the Array if array passed to an intercepted
+ // method.
+ if (user is HInterceptor) continue;
+ if (user is HInvokeStatic) {
+ MemberEntity element = user.element;
+ if (element == commonElements.checkConcurrentModificationError) {
+ // CME check escapes the array, but we don't care.
+ continue;
+ }
+ }
+ if (user is HInvokeDynamicGetter) {
+ String name = user.selector.name;
+ // These getters don't use the Array type.
+ if (name == 'last') continue;
+ if (name == 'first') continue;
+ }
+ // TODO(sra): Implement a more general algorithm - many methods don't use
+ // the element type.
+ return node;
+ }
+ return source;
+ }
+
HInstruction visitStringConcat(HStringConcat node) {
// Simplify string concat:
//
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index d3591d3..e4f8248 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -2383,7 +2383,7 @@
cls.element, className, superCall?.staticElement, superCallArgs);
if (jsSuper != null) body.add(jsSuper..sourceInformation = superCall);
- body.add(_visitStatement(node.body));
+ body.add(_emitFunctionScopedBody(node.body, node.element));
return new JS.Block(body)..sourceInformation = node;
}
@@ -2840,25 +2840,35 @@
_currentFunction = body;
var initArgs = _emitArgumentInitializers(element, parameters);
- var block = body.accept(this) as JS.Block;
+ var block = _emitFunctionScopedBody(body, element);
if (initArgs != null) block = new JS.Block([initArgs, block]);
- if (body is BlockFunctionBody) {
- var params = element.parameters.map((e) => e.name).toSet();
- bool shadowsParam = body.block.statements.any((s) =>
- s is VariableDeclarationStatement &&
- s.variables.variables.any((v) => params.contains(v.name.name)));
-
- if (shadowsParam) {
- block = new JS.Block([
- new JS.Block([block], isScope: true)
- ]);
- }
- }
-
_currentFunction = savedFunction;
+ if (block.isScope) {
+ // TODO(jmesserly: JS AST printer does not understand the need to emit a
+ // nested scoped block in a JS function. So we need to add a non-scoped
+ // wrapper to ensure it gets printed.
+ block = new JS.Block([block]);
+ }
+ return block;
+ }
+
+ JS.Block _emitFunctionScopedBody(
+ FunctionBody body, ExecutableElement element) {
+ var block = body.accept(this) as JS.Block;
+ if (!body.isAsynchronous && !body.isGenerator) {
+ // Handle shadowing of parameters by local varaibles, which is allowed in
+ // Dart but not in JS.
+ //
+ // We only handle this for normal (sync) functions. Generator-based
+ // functions (sync*, async, and async*) have their bodies placed
+ // in an inner function scope that is a separate scope from the
+ // parameters, so they avoid this problem.
+ var parameterNames = element.parameters.map((e) => e.name).toSet();
+ return block.toScopedBlock(parameterNames);
+ }
return block;
}
@@ -5479,23 +5489,31 @@
var body = <JS.Statement>[];
var savedCatch = _catchParameter;
+ var vars = new HashSet<String>();
if (node.catchKeyword != null) {
var name = node.exceptionParameter;
- if (name != null && name != _catchParameter) {
+ if (name == _catchParameter) {
+ vars.add(name.name);
+ } else if (name != null) {
+ vars.add(name.name);
body.add(js.statement('let # = #;', [
_emitSimpleIdentifier(name),
_emitSimpleIdentifier(_catchParameter)
]));
_catchParameter = name;
}
- if (node.stackTraceParameter != null) {
- var stackVar = node.stackTraceParameter.name;
- body.add(js.statement('let # = #.stackTrace(#);',
- [stackVar, _runtimeModule, _emitSimpleIdentifier(name)]));
+ var stackVar = node.stackTraceParameter;
+ if (stackVar != null) {
+ vars.add(stackVar.name);
+ body.add(js.statement('let # = #.stackTrace(#);', [
+ _emitSimpleIdentifier(stackVar),
+ _runtimeModule,
+ _emitSimpleIdentifier(name)
+ ]));
}
}
- body.add(new JS.Block(_visitStatementList(node.body.statements)));
+ body.add(_visitStatement(node.body).toScopedBlock(vars));
_catchParameter = savedCatch;
return JS.Statement.from(body);
}
diff --git a/pkg/dev_compiler/lib/src/js_ast/nodes.dart b/pkg/dev_compiler/lib/src/js_ast/nodes.dart
index ef79d4c..01649b7 100644
--- a/pkg/dev_compiler/lib/src/js_ast/nodes.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/nodes.dart
@@ -336,6 +336,12 @@
/// JavaScript syntax error due to a redeclared identifier.
bool shadows(Set<String> names) => false;
+ /// If this statement [shadows] any name from [names], this will wrap it in a
+ /// new scoped [Block].
+ Statement toScopedBlock(Set<String> names) {
+ return shadows(names) ? new Block([this], isScope: true) : this;
+ }
+
Statement toStatement() => this;
Statement toReturn() => new Block([this, new Return()]);
@@ -358,6 +364,18 @@
@override
Block toBlock() => this;
+ @override
+ bool shadows(Set<String> names) =>
+ !isScope && statements.any((s) => s.shadows(names));
+
+ @override
+ Statement toScopedBlock(Set<String> names) {
+ var scoped = statements.any((s) => s.shadows(names));
+ if (scoped == isScope) return this;
+ return new Block(statements, isScope: scoped)
+ ..sourceInformation = sourceInformation;
+ }
+
accept(NodeVisitor visitor) => visitor.visitBlock(this);
void visitChildren(NodeVisitor visitor) {
for (Statement statement in statements) statement.accept(visitor);
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index 3d16a4c..a0477ec 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -1324,7 +1324,8 @@
// nice to do them first.
// Also for const constructors we need to ensure default values are
// available for use by top-level constant initializers.
- var body = _emitArgumentInitializers(node.function);
+ var fn = node.function;
+ var body = _emitArgumentInitializers(fn);
// Redirecting constructors: these are not allowed to have initializers,
// and the redirecting ctor invocation runs before field initializers.
@@ -1351,8 +1352,7 @@
var jsSuper = _emitSuperConstructorCallIfNeeded(cls, className, superCall);
if (jsSuper != null) body.add(jsSuper..sourceInformation = superCall);
- var jsBody = _visitStatement(node.function.body);
- if (jsBody != null) body.add(jsBody);
+ body.add(_emitFunctionScopedBody(fn));
return body;
}
@@ -2868,26 +2868,10 @@
JS.Block _emitFunctionBody(FunctionNode f) {
var block = _withCurrentFunction(f, () {
var block = _emitArgumentInitializers(f);
- var jsBody = _visitStatement(f.body);
- if (jsBody != null) block.add(jsBody);
+ block.add(_emitFunctionScopedBody(f));
return block;
});
- if (f.asyncMarker == AsyncMarker.Sync) {
- // It is a JS syntax error to use let or const to bind two variables with
- // the same name in the same scope. If the let- and const- bound
- // variables in the block shadow any of the parameters, wrap the body in
- // an extra block. (sync*, async, and async* function bodies are placed
- // in an inner function that is a separate scope from the parameters.)
- var parameterNames = new Set<String>()
- ..addAll(f.positionalParameters.map((p) => p.name))
- ..addAll(f.namedParameters.map((p) => p.name));
-
- if (block.any((s) => s.shadows(parameterNames))) {
- block = [new JS.Block(block, isScope: true)];
- }
- }
-
return new JS.Block(block);
}
@@ -3048,6 +3032,25 @@
return result;
}
+ JS.Statement _emitFunctionScopedBody(FunctionNode f) {
+ var jsBody = _visitStatement(f.body);
+ if (f.asyncMarker == AsyncMarker.Sync) {
+ // Handle shadowing of parameters by local varaibles, which is allowed in
+ // Dart but not in JS.
+ //
+ // We only handle this for normal (sync) functions. Generator-based
+ // functions (sync*, async, and async*) have their bodies placed
+ // in an inner function scope that is a separate scope from the
+ // parameters, so they avoid this problem.
+ var parameterNames = new HashSet<String>()
+ ..addAll(f.positionalParameters.map((p) => p.name))
+ ..addAll(f.namedParameters.map((p) => p.name));
+
+ return jsBody.toScopedBlock(parameterNames);
+ }
+ return jsBody;
+ }
+
/// Visits [nodes] with [_visitExpression].
List<JS.Expression> _visitExpressionList(Iterable<Expression> nodes) {
return nodes?.map(_visitAndMarkExpression)?.toList();
@@ -3476,25 +3479,33 @@
var body = <JS.Statement>[];
var savedCatch = _catchParameter;
+ var vars = new HashSet<String>();
if (node.exception != null) {
var name = node.exception;
- if (name != null && name != _catchParameter) {
+ if (name == _catchParameter) {
+ vars.add(name.name);
+ } else if (name != null) {
+ vars.add(name.name);
body.add(js.statement('let # = #;',
[_emitVariableRef(name), _emitVariableRef(_catchParameter)])
..sourceInformation = name);
_catchParameter = name;
}
- if (node.stackTrace != null) {
- var stackVar = _emitVariableRef(node.stackTrace);
- body.add(js.statement('let # = #.stackTrace(#);',
- [stackVar, _runtimeModule, _emitVariableRef(name)])
- ..sourceInformation = node.stackTrace);
+ var stackTrace = node.stackTrace;
+ if (stackTrace != null) {
+ vars.add(stackTrace.name);
+ body.add(js.statement('let # = #.stackTrace(#);', [
+ _emitVariableRef(stackTrace),
+ _runtimeModule,
+ _emitVariableRef(name)
+ ])
+ ..sourceInformation = stackTrace);
}
}
- body.add(_visitStatement(node.body));
+ body.add(_visitStatement(node.body).toScopedBlock(vars));
_catchParameter = savedCatch;
- var then = JS.Statement.from(body);
+ var then = new JS.Block(body);
if (types.isTop(node.guard)) return then;
diff --git a/pkg/dev_compiler/test/options/options_test.dart b/pkg/dev_compiler/test/options/options_test.dart
index 56a6d20..73da211 100644
--- a/pkg/dev_compiler/test/options/options_test.dart
+++ b/pkg/dev_compiler/test/options/options_test.dart
@@ -69,17 +69,6 @@
expect(processors[0].code, CompileTimeErrorCode.DUPLICATE_DEFINITION.name);
});
- test('fromArgs options flag', () {
- var args = <String>['--$enableStrictCallChecksFlag'];
- //TODO(danrubel) remove sdkSummaryArgs once all SDKs have summary file
- args.addAll(sdkSummaryArgs);
- var argResults = ddcArgParser().parse(args);
- var options = new AnalyzerOptions.fromArguments(argResults);
- var compiler = new ModuleCompiler(options, analysisRoot: optionsDir);
- var analysisOptions = compiler.context.analysisOptions;
- expect(analysisOptions.enableStrictCallChecks, isTrue);
- });
-
test('custom module name for summary', () {
var args = <String>[
'-snormal',
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
index c15d282..17423eb 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
@@ -923,7 +923,7 @@
while (i < source.length) {
chunk = 0;
- for (int j = 0; j < 4; j++) {
+ for (int j = 0; j < hexDigitsPerChunk; j++) {
var digitValue = _codeUnitToRadixValue(source.codeUnitAt(i++));
if (digitValue >= 16) return null;
chunk = chunk * 16 + digitValue;
@@ -1049,29 +1049,28 @@
factory _BigIntImpl._fromInt(int value) {
bool isNegative = value < 0;
+ assert(_digitBits == 16);
if (isNegative) {
// Handle the min 64-bit value differently, since its negation is not
// positive.
- // TODO(floitsch): we should use min.minValue or 0x8000000000000000 here.
- const int minInt64 = -9223372036854775807 - 1;
+ const int minInt64 = -0x80000000 * 0x100000000;
if (value == minInt64) {
var digits = new Uint16List(4);
digits[3] = 0x8000;
- return new _BigIntImpl._(true, digits.length, digits);
+ return new _BigIntImpl._(true, 4, digits);
}
value = -value;
}
- assert(_digitBits == 16);
if (value < _digitBase) {
var digits = new Uint16List(1);
digits[0] = value;
- return new _BigIntImpl._(isNegative, digits.length, digits);
+ return new _BigIntImpl._(isNegative, 1, digits);
}
if (value <= 0xFFFFFFFF) {
var digits = new Uint16List(2);
digits[0] = value & _digitMask;
digits[1] = value >> _digitBits;
- return new _BigIntImpl._(isNegative, digits.length, digits);
+ return new _BigIntImpl._(isNegative, 2, digits);
}
var bits = value.bitLength;
@@ -1858,7 +1857,7 @@
Uint16List resultDigits;
int resultUsed;
// Normalized positive divisor.
- // The normalized divisor has the most-significant bit of it's most
+ // The normalized divisor has the most-significant bit of its most
// significant digit set.
// This makes estimating the quotient easier.
Uint16List yDigits;
@@ -2535,13 +2534,8 @@
return (this & (signMask - one)) - (this & signMask);
}
- // TODO(floitsch): implement `isValidInt`.
- // Remove the comment in [BigInt.isValidInt] when done.
- bool get isValidInt => true;
+ bool get isValidInt => this == new _BigIntImpl._fromInt(toInt());
- // TODO(floitsch): implement the clamping. It behaves differently on dart2js
- // and the VM.
- // Remove the comment in [BigInt.isValidInt] when done.
int toInt() {
var result = 0;
for (int i = _used - 1; i >= 0; i--) {
diff --git a/pkg/front_end/lib/src/fasta/dill/built_type_builder.dart b/pkg/front_end/lib/src/fasta/dill/built_type_builder.dart
index 80e256a..3b170eb 100644
--- a/pkg/front_end/lib/src/fasta/dill/built_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/dill/built_type_builder.dart
@@ -23,6 +23,11 @@
return unimplemented("buildSupertype", -1, null);
}
+ Supertype buildMixedInType(
+ LibraryBuilder library, int charOffset, Uri fileUri) {
+ return unimplemented("buildMixedInType", -1, null);
+ }
+
buildInvalidType(int charOffset, Uri fileUri) {
return unimplemented("buildInvalidType", -1, null);
}
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index 5f95770..ccddabe 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -1,11 +1,11 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS 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.
// NOTE: THIS FILE IS GENERATED. DO NOT EDIT.
//
// Instead modify 'pkg/front_end/messages.yaml' and run
-// 'pkg/front_end/tool/_fasta/generate_messages.dart' to update.
+// 'pkg/front_end/tool/fasta generate-messages' to update.
part of fasta.codes;
@@ -2129,6 +2129,17 @@
tip: r"""Try removing '(...)'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeIllegalAssignmentToNonAssignable =
+ messageIllegalAssignmentToNonAssignable;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageIllegalAssignmentToNonAssignable = const MessageCode(
+ "IllegalAssignmentToNonAssignable",
+ analyzerCode: "ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE",
+ dart2jsCode: "*fatal*",
+ message: r"""Illegal assignment to non-assignable expression.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name, String name2)>
templateIllegalMethodName =
const Template<Message Function(String name, String name2)>(
@@ -3218,6 +3229,18 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeMissingAssignableSelector =
+ messageMissingAssignableSelector;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageMissingAssignableSelector = const MessageCode(
+ "MissingAssignableSelector",
+ analyzerCode: "MISSING_ASSIGNABLE_SELECTOR",
+ dart2jsCode: "*fatal*",
+ message: r"""Missing selector such as '.<identifier>' or '[0]'.""",
+ tip: r"""Try adding a selector.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeMissingAssignmentInInitializer =
messageMissingAssignmentInInitializer;
@@ -3355,6 +3378,41 @@
tip: r"""Try adding a parameter list to the typedef.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ String name,
+ String name2,
+ DartType
+ _type)> templateMixinInferenceNoMatchingClass = const Template<
+ Message Function(String name, String name2, DartType _type)>(
+ messageTemplate:
+ r"""Type parameters could not be inferred for the mixin '#name' because
+'#name2' does not implement the mixin's supertype constraint '#type'.""",
+ withArguments: _withArgumentsMixinInferenceNoMatchingClass);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name, String name2, DartType _type)>
+ codeMixinInferenceNoMatchingClass =
+ const Code<Message Function(String name, String name2, DartType _type)>(
+ "MixinInferenceNoMatchingClass", templateMixinInferenceNoMatchingClass,
+ severity: Severity.error);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsMixinInferenceNoMatchingClass(
+ String name, String name2, DartType _type) {
+ NameSystem nameSystem = new NameSystem();
+ StringBuffer buffer = new StringBuffer();
+ new Printer(buffer, syntheticNames: nameSystem).writeNode(_type);
+ String type = '$buffer';
+
+ return new Message(codeMixinInferenceNoMatchingClass,
+ message:
+ """Type parameters could not be inferred for the mixin '$name' because
+'$name2' does not implement the mixin's supertype constraint '$type'.""",
+ arguments: {'name': name, 'name2': name2, 'type': _type});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeMultipleExtends = messageMultipleExtends;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -4521,6 +4579,17 @@
tip: r"""Try re-ordering the modifiers.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeStaticConstructor = messageStaticConstructor;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageStaticConstructor = const MessageCode(
+ "StaticConstructor",
+ analyzerCode: "STATIC_CONSTRUCTOR",
+ dart2jsCode: "*fatal*",
+ message: r"""Constructors can't be static.""",
+ tip: r"""Try removing the keyword 'static'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeStaticOperator = messageStaticOperator;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 740e940..f5ad752 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -79,6 +79,7 @@
import 'redirecting_factory_body.dart'
show
RedirectingFactoryBody,
+ RedirectionTarget,
getRedirectingFactoryBody,
getRedirectionTarget;
@@ -2370,6 +2371,7 @@
{bool isConst: false,
int charOffset: -1,
Member initialTarget,
+ List<DartType> targetTypeArguments,
String prefixName,
int targetOffset: -1,
Class targetClass}) {
@@ -2390,7 +2392,7 @@
"Not a const constructor.", charOffset);
}
return new ShadowConstructorInvocation(
- prefixName, target, initialTarget, arguments,
+ prefixName, target, targetTypeArguments, initialTarget, arguments,
isConst: isConst)
..fileOffset = charOffset;
} else {
@@ -2400,7 +2402,7 @@
"Not a const factory.", charOffset);
} else if (procedure.isFactory) {
return new ShadowFactoryConstructorInvocation(
- prefixName, target, initialTarget, arguments,
+ prefixName, target, targetTypeArguments, initialTarget, arguments,
isConst: isConst)
..fileOffset = charOffset;
} else {
@@ -2561,6 +2563,7 @@
Builder b = type.findConstructorOrFactory(name, charOffset, uri, library);
Member target;
Member initialTarget;
+ List<DartType> targetTypeArguments;
if (b == null) {
// Not found. Reported below.
} else if (b.isConstructor) {
@@ -2578,7 +2581,11 @@
}
} else if (b.isFactory) {
initialTarget = b.target;
- target = getRedirectionTarget(initialTarget);
+ RedirectionTarget redirectionTarget = getRedirectionTarget(
+ initialTarget,
+ strongMode: library.loader.target.strongMode);
+ target = redirectionTarget?.target;
+ targetTypeArguments = redirectionTarget?.typeArguments;
if (target == null) {
return deprecated_buildCompileTimeError(
"Cyclic definition of factory '${name}'.", nameToken.charOffset);
@@ -2608,7 +2615,8 @@
isConst: isConst,
charOffset: nameToken.charOffset,
prefixName: prefixName,
- initialTarget: initialTarget);
+ initialTarget: initialTarget,
+ targetTypeArguments: targetTypeArguments);
} else {
errorName ??= debugName(type.name, name);
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_builder.dart
index 3f5fddd..e9f65f3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_builder.dart
@@ -28,6 +28,7 @@
show
KernelConstructorBuilder,
KernelFunctionBuilder,
+ KernelRedirectingFactoryBuilder,
KernelProcedureBuilder;
export 'kernel_type_builder.dart' show KernelTypeBuilder;
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 785f889..4bcc0c7 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
@@ -4,12 +4,12 @@
library fasta.kernel_class_builder;
-import 'package:front_end/src/fasta/fasta_codes.dart';
import 'package:kernel/ast.dart'
show
Class,
Constructor,
DartType,
+ DynamicType,
Expression,
Field,
FunctionNode,
@@ -35,6 +35,7 @@
import '../fasta_codes.dart'
show
+ Message,
messagePatchClassOrigin,
messagePatchClassTypeVariablesMismatch,
messagePatchDeclarationMismatch,
@@ -51,6 +52,8 @@
import '../problems.dart' show unexpected, unhandled, unimplemented;
+import '../type_inference/type_schema.dart' show UnknownType;
+
import 'kernel_builder.dart'
show
Builder,
@@ -58,6 +61,7 @@
ConstructorReferenceBuilder,
KernelLibraryBuilder,
KernelProcedureBuilder,
+ KernelRedirectingFactoryBuilder,
KernelTypeBuilder,
KernelTypeVariableBuilder,
LibraryBuilder,
@@ -143,6 +147,19 @@
}
}
+ Supertype buildMixedInType(
+ LibraryBuilder library, List<KernelTypeBuilder> arguments) {
+ Class cls = isPatch ? origin.target : this.cls;
+ if (arguments != null) {
+ return new Supertype(cls, buildTypeArguments(library, arguments));
+ } else {
+ return new Supertype(
+ cls,
+ new List<DartType>.filled(
+ cls.typeParameters.length, const UnknownType()));
+ }
+ }
+
@override
int resolveConstructors(LibraryBuilder library) {
int count = super.resolveConstructors(library);
@@ -156,7 +173,7 @@
unexpected(
"$fileUri", "${builder.parent.fileUri}", charOffset, fileUri);
}
- if (builder is KernelProcedureBuilder && builder.isFactory) {
+ if (builder is KernelRedirectingFactoryBuilder) {
// Compute the immediate redirection target, not the effective.
ConstructorReferenceBuilder redirectionTarget =
builder.redirectionTarget;
@@ -164,9 +181,29 @@
Builder targetBuilder = redirectionTarget.target;
addRedirectingConstructor(builder, library);
if (targetBuilder is ProcedureBuilder) {
- builder.setRedirectingFactoryBody(targetBuilder.target);
+ List<DartType> typeArguments = builder.typeArguments;
+ if (typeArguments == null) {
+ // TODO(32049) If type arguments aren't specified, they should
+ // be inferred. Currently, the inference is not performed.
+ // The code below is a workaround.
+ typeArguments = new List.filled(
+ targetBuilder.target.enclosingClass.typeParameters.length,
+ const DynamicType());
+ }
+ builder.setRedirectingFactoryBody(
+ targetBuilder.target, typeArguments);
} else if (targetBuilder is DillMemberBuilder) {
- builder.setRedirectingFactoryBody(targetBuilder.member);
+ List<DartType> typeArguments = builder.typeArguments;
+ if (typeArguments == null) {
+ // TODO(32049) If type arguments aren't specified, they should
+ // be inferred. Currently, the inference is not performed.
+ // The code below is a workaround.
+ typeArguments = new List.filled(
+ targetBuilder.target.enclosingClass.typeParameters.length,
+ const DynamicType());
+ }
+ builder.setRedirectingFactoryBody(
+ targetBuilder.member, typeArguments);
} else {
var message = templateRedirectionTargetNotFound
.withArguments(redirectionTarget.fullNameForErrors);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
index 0f119bf..a3424b3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
@@ -80,6 +80,11 @@
return null;
}
+ Supertype buildMixedInType(
+ LibraryBuilder library, int charOffset, Uri fileUri) {
+ return buildSupertype(library, charOffset, fileUri);
+ }
+
@override
buildInvalidType(int charOffset, Uri fileUri) {
return unsupported("buildInvalidType", charOffset, fileUri);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 102d448..8dade32 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -65,6 +65,7 @@
KernelMixinApplicationBuilder,
KernelNamedTypeBuilder,
KernelProcedureBuilder,
+ KernelRedirectingFactoryBuilder,
KernelTypeBuilder,
KernelTypeVariableBuilder,
LibraryBuilder,
@@ -674,22 +675,40 @@
}
assert(constructorNameReference.suffix == null);
- KernelProcedureBuilder procedure = new KernelProcedureBuilder(
- metadata,
- staticMask | modifiers,
- returnType,
- procedureName,
- copyTypeVariables(
- currentDeclaration.typeVariables ?? <TypeVariableBuilder>[],
- factoryDeclaration),
- formals,
- ProcedureKind.Factory,
- this,
- charOffset,
- charOpenParenOffset,
- charEndOffset,
- nativeMethodName,
- redirectionTarget);
+ KernelProcedureBuilder procedure;
+ if (redirectionTarget != null) {
+ procedure = new KernelRedirectingFactoryBuilder(
+ metadata,
+ staticMask | modifiers,
+ returnType,
+ procedureName,
+ copyTypeVariables(
+ currentDeclaration.typeVariables ?? <TypeVariableBuilder>[],
+ factoryDeclaration),
+ formals,
+ this,
+ charOffset,
+ charOpenParenOffset,
+ charEndOffset,
+ nativeMethodName,
+ redirectionTarget);
+ } else {
+ procedure = new KernelProcedureBuilder(
+ metadata,
+ staticMask | modifiers,
+ returnType,
+ procedureName,
+ copyTypeVariables(
+ currentDeclaration.typeVariables ?? <TypeVariableBuilder>[],
+ factoryDeclaration),
+ formals,
+ ProcedureKind.Factory,
+ this,
+ charOffset,
+ charOpenParenOffset,
+ charEndOffset,
+ nativeMethodName);
+ }
var metadataCollector = loader.target.metadataCollector;
metadataCollector?.setDocumentationComment(
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart
index 47306fd..3237dc1 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart
@@ -41,6 +41,12 @@
}
@override
+ Supertype buildMixedInType(
+ LibraryBuilder library, int charOffset, Uri fileUri) {
+ return unsupported("buildMixedInType", charOffset, fileUri);
+ }
+
+ @override
buildInvalidType(int charOffset, Uri fileUri) {
return unsupported("buildInvalidType", charOffset, fileUri);
}
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 dd6bbd1..ced686f 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
@@ -55,6 +55,16 @@
}
}
+ Supertype buildMixedInType(
+ LibraryBuilder library, int charOffset, Uri fileUri) {
+ if (builder is KernelClassBuilder) {
+ KernelClassBuilder builder = this.builder;
+ return builder.buildMixedInType(library, arguments);
+ } else {
+ return handleInvalidSupertype(library, charOffset, fileUri);
+ }
+ }
+
TypeBuilder subst(Map<TypeVariableBuilder, TypeBuilder> substitution) {
TypeBuilder result = substitution[builder];
if (result != null) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
index 31fc317..fabb3ee 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
@@ -128,7 +128,7 @@
}
}
- void setRedirectingFactoryBody(Member target) {
+ void setRedirectingFactoryBody(Member target, List<DartType> typeArguments) {
if (actualBody != null) {
unexpected("null", "${actualBody.runtimeType}", charOffset, fileUri);
}
@@ -136,7 +136,7 @@
function.body = actualBody;
actualBody?.parent = function;
if (isPatch) {
- actualOrigin.setRedirectingFactoryBody(target);
+ actualOrigin.setRedirectingFactoryBody(target, typeArguments);
}
}
@@ -259,8 +259,6 @@
AsyncMarker actualAsyncModifier = AsyncMarker.Sync;
- final ConstructorReferenceBuilder redirectionTarget;
-
@override
KernelProcedureBuilder actualOrigin;
@@ -276,8 +274,7 @@
int charOffset,
this.charOpenParenOffset,
int charEndOffset,
- [String nativeMethodName,
- this.redirectionTarget])
+ [String nativeMethodName])
: procedure = new ShadowProcedure(null, kind, null, returnType == null,
fileUri: compilationUnit?.fileUri)
..fileOffset = charOffset
@@ -293,10 +290,7 @@
AsyncMarker get asyncModifier => actualAsyncModifier;
Statement get body {
- if (actualBody == null &&
- redirectionTarget == null &&
- !isAbstract &&
- !isExternal) {
+ if (actualBody == null && !isAbstract && !isExternal) {
actualBody = new EmptyStatement();
}
return actualBody;
@@ -573,3 +567,78 @@
}
}
}
+
+class KernelRedirectingFactoryBuilder extends KernelProcedureBuilder {
+ final ConstructorReferenceBuilder redirectionTarget;
+ List<DartType> typeArguments;
+
+ KernelRedirectingFactoryBuilder(
+ List<MetadataBuilder> metadata,
+ int modifiers,
+ KernelTypeBuilder returnType,
+ String name,
+ List<TypeVariableBuilder> typeVariables,
+ List<FormalParameterBuilder> formals,
+ KernelLibraryBuilder compilationUnit,
+ int charOffset,
+ int charOpenParenOffset,
+ int charEndOffset,
+ [String nativeMethodName,
+ this.redirectionTarget])
+ : super(
+ metadata,
+ modifiers,
+ returnType,
+ name,
+ typeVariables,
+ formals,
+ ProcedureKind.Factory,
+ compilationUnit,
+ charOffset,
+ charOpenParenOffset,
+ charEndOffset,
+ nativeMethodName);
+
+ @override
+ Statement get body => actualBody;
+
+ @override
+ void setRedirectingFactoryBody(Member target, List<DartType> typeArguments) {
+ if (actualBody != null) {
+ unexpected("null", "${actualBody.runtimeType}", charOffset, fileUri);
+ }
+ actualBody = new RedirectingFactoryBody(target, typeArguments);
+ function.body = actualBody;
+ actualBody?.parent = function;
+ if (isPatch) {
+ actualOrigin.setRedirectingFactoryBody(target, typeArguments);
+ }
+ }
+
+ @override
+ Procedure build(SourceLibraryBuilder library) {
+ Procedure result = super.build(library);
+ if (redirectionTarget.typeArguments != null) {
+ typeArguments =
+ new List<DartType>(redirectionTarget.typeArguments.length);
+ for (int i = 0; i < typeArguments.length; i++) {
+ typeArguments[i] = redirectionTarget.typeArguments[i].build(library);
+ }
+ }
+ return result;
+ }
+
+ @override
+ int finishPatch() {
+ if (!isPatch) return 0;
+
+ super.finishPatch();
+
+ if (origin is KernelRedirectingFactoryBuilder) {
+ KernelRedirectingFactoryBuilder redirectingOrigin = origin;
+ redirectingOrigin.typeArguments = typeArguments;
+ }
+
+ return 1;
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index b1f8d42..eb6157c 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -569,8 +569,24 @@
final Member _initialTarget;
+ /// If the constructor invocation points to a redirected constructor, the type
+ /// arguments to be supplied to redirected constructor, in terms of those
+ /// supplied to the original constructor.
+ ///
+ /// For example, in the code below:
+ ///
+ /// class C<T> {
+ /// C() = D<List<T>>;
+ /// }
+ /// main() {
+ /// new C<int>();
+ /// }
+ ///
+ /// [targetTypeArguments] is a list containing the type `List<T>`.
+ final List<DartType> targetTypeArguments;
+
ShadowConstructorInvocation(this._prefixName, Constructor target,
- this._initialTarget, Arguments arguments,
+ this.targetTypeArguments, this._initialTarget, Arguments arguments,
{bool isConst: false})
: super(target, arguments, isConst: isConst);
@@ -595,6 +611,31 @@
.message);
}
inferrer.listener.constructorInvocationExit(this, inferredType);
+
+ if (isRedirected(this)) {
+ InterfaceType returnType = inferredType;
+ List<DartType> initialTypeArguments;
+ if (inferrer.strongMode) {
+ initialTypeArguments = returnType.typeArguments;
+ } else {
+ int requiredTypeArgumentsCount = returnType.typeArguments.length;
+ int suppliedTypeArgumentsCount = arguments.types.length;
+ initialTypeArguments = arguments.types.toList(growable: true)
+ ..length = requiredTypeArgumentsCount;
+ for (int i = suppliedTypeArgumentsCount;
+ i < requiredTypeArgumentsCount;
+ i++) {
+ initialTypeArguments[i] = const DynamicType();
+ }
+ }
+ Substitution substitution = Substitution.fromPairs(
+ _initialTarget.function.typeParameters, initialTypeArguments);
+ arguments.types.clear();
+ for (DartType argument in targetTypeArguments) {
+ arguments.types.add(substitution.substituteType(argument));
+ }
+ }
+
return inferredType;
}
@@ -700,8 +741,24 @@
final Member _initialTarget;
+ /// If the factory invocation points to a redirected factory, the type
+ /// arguments to be supplied to redirected constructor, in terms of those
+ /// supplied to the original constructor.
+ ///
+ /// For example, in the code below:
+ ///
+ /// class C<T> {
+ /// C() = D<List<T>>;
+ /// }
+ /// main() {
+ /// new C<int>();
+ /// }
+ ///
+ /// [targetTypeArguments] is a list containing the type `List<T>`.
+ final List<DartType> targetTypeArguments;
+
ShadowFactoryConstructorInvocation(this._prefixName, Procedure target,
- this._initialTarget, Arguments arguments,
+ this.targetTypeArguments, this._initialTarget, Arguments arguments,
{bool isConst: false})
: super(target, arguments, isConst: isConst);
@@ -716,8 +773,42 @@
computeConstructorReturnType(_initialTarget),
arguments);
inferrer.listener.constructorInvocationExit(this, inferredType);
+
+ if (isRedirected(this)) {
+ InterfaceType returnType = inferredType;
+ List<DartType> initialTypeArguments;
+ if (inferrer.strongMode) {
+ initialTypeArguments = returnType.typeArguments;
+ } else {
+ int requiredTypeArgumentsCount = returnType.typeArguments.length;
+ int suppliedTypeArgumentsCount = arguments.types.length;
+ initialTypeArguments = arguments.types.toList(growable: true)
+ ..length = requiredTypeArgumentsCount;
+ for (int i = suppliedTypeArgumentsCount;
+ i < requiredTypeArgumentsCount;
+ i++) {
+ initialTypeArguments[i] = const DynamicType();
+ }
+ }
+ Substitution substitution = Substitution.fromPairs(
+ _initialTarget.function.typeParameters, initialTypeArguments);
+ arguments.types.clear();
+ for (DartType argument in targetTypeArguments) {
+ arguments.types.add(substitution.substituteType(argument));
+ }
+ }
+
return inferredType;
}
+
+ /// Determines whether the given [ShadowConstructorInvocation] represents an
+ /// invocation of a redirected factory constructor.
+ ///
+ /// This is static to avoid introducing a method that would be visible to the
+ /// kernel.
+ static bool isRedirected(ShadowFactoryConstructorInvocation expression) {
+ return !identical(expression._initialTarget, expression.target);
+ }
}
/// Concrete shadow object representing a field in kernel form.
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 0fff6fa..9ae28c9 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -391,7 +391,7 @@
..bind(objectClassBuilder);
}
if (builder.isMixinApplication) {
- cls.mixedInType = builder.mixedInType.buildSupertype(
+ cls.mixedInType = builder.mixedInType.buildMixedInType(
library, builder.charOffset, builder.fileUri);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_type_builder.dart
index 44fc100..3a22f6f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_type_builder.dart
@@ -14,4 +14,7 @@
DartType build(LibraryBuilder library);
Supertype buildSupertype(LibraryBuilder library, int charOffset, Uri fileUri);
+
+ Supertype buildMixedInType(
+ LibraryBuilder library, int charOffset, Uri fileUri);
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/redirecting_factory_body.dart b/pkg/front_end/lib/src/fasta/kernel/redirecting_factory_body.dart
index cdc332b..6b31ff1 100644
--- a/pkg/front_end/lib/src/fasta/kernel/redirecting_factory_body.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/redirecting_factory_body.dart
@@ -6,25 +6,33 @@
import 'package:kernel/ast.dart'
show
+ DartType,
+ DynamicType,
Expression,
ExpressionStatement,
FunctionNode,
InvalidExpression,
Let,
Member,
+ NullLiteral,
Procedure,
StaticGet,
StringLiteral,
+ TypeParameterType,
VariableDeclaration;
+import 'package:kernel/type_algebra.dart' show Substitution;
+
const String letName = "#redirecting_factory";
class RedirectingFactoryBody extends ExpressionStatement {
- RedirectingFactoryBody.internal(Expression value)
+ RedirectingFactoryBody.internal(Expression value,
+ [List<DartType> typeArguments])
: super(new Let(new VariableDeclaration(letName, initializer: value),
- new InvalidExpression(null)));
+ encodeTypeArguments(typeArguments)));
- RedirectingFactoryBody(Member target) : this.internal(new StaticGet(target));
+ RedirectingFactoryBody(Member target, [List<DartType> typeArguments])
+ : this.internal(new StaticGet(target), typeArguments);
RedirectingFactoryBody.unresolved(String name)
: this.internal(new StringLiteral(name));
@@ -41,6 +49,16 @@
bool get isUnresolved => unresolvedName != null;
+ List<DartType> get typeArguments {
+ if (expression is Let) {
+ Let bodyExpression = expression;
+ if (bodyExpression.variable.name == letName) {
+ return decodeTypeArguments(bodyExpression.body);
+ }
+ }
+ return null;
+ }
+
static getValue(Expression expression) {
if (expression is Let) {
VariableDeclaration variable = expression.variable;
@@ -57,9 +75,42 @@
// [kernel_class_builder.dart](kernel_class_builder.dart).
FunctionNode function = factory.function;
ExpressionStatement statement = function.body;
- function.body =
- new RedirectingFactoryBody.internal(getValue(statement.expression))
- ..parent = function;
+ List<DartType> typeArguments;
+ if (statement.expression is Let) {
+ Let expression = statement.expression;
+ typeArguments = decodeTypeArguments(expression.body);
+ }
+ function.body = new RedirectingFactoryBody.internal(
+ getValue(statement.expression), typeArguments)
+ ..parent = function;
+ }
+
+ static Expression encodeTypeArguments(List<DartType> typeArguments) {
+ String varNamePrefix = "#typeArg";
+ Expression result = new InvalidExpression(null);
+ if (typeArguments == null) {
+ return result;
+ }
+ for (int i = typeArguments.length - 1; i >= 0; i--) {
+ result = new Let(
+ new VariableDeclaration("$varNamePrefix$i",
+ type: typeArguments[i], initializer: new NullLiteral()),
+ result);
+ }
+ return result;
+ }
+
+ static List<DartType> decodeTypeArguments(Expression encoded) {
+ if (encoded is InvalidExpression) {
+ return null;
+ }
+ List<DartType> result = <DartType>[];
+ while (encoded is Let) {
+ Let head = encoded;
+ result.add(head.variable.type);
+ encoded = head.body;
+ }
+ return result;
}
}
@@ -69,7 +120,20 @@
: null;
}
-Member getRedirectionTarget(Procedure member) {
+class RedirectionTarget {
+ final Member target;
+ final List<DartType> typeArguments;
+
+ RedirectionTarget(this.target, this.typeArguments);
+}
+
+RedirectionTarget getRedirectionTarget(Procedure member, {bool strongMode}) {
+ List<DartType> typeArguments = <DartType>[]..length =
+ member.function.typeParameters.length;
+ for (int i = 0; i < typeArguments.length; i++) {
+ typeArguments[i] = new TypeParameterType(member.function.typeParameters[i]);
+ }
+
// We use the [tortoise and hare algorithm]
// (https://en.wikipedia.org/wiki/Cycle_detection#Tortoise_and_hare) to
// handle cycles.
@@ -78,8 +142,34 @@
Member hare = tortoiseBody?.target;
RedirectingFactoryBody hareBody = getRedirectingFactoryBody(hare);
while (tortoise != hare) {
- if (tortoiseBody?.isUnresolved ?? true) return tortoise;
- tortoise = tortoiseBody.target;
+ if (tortoiseBody?.isUnresolved ?? true)
+ return new RedirectionTarget(tortoise, typeArguments);
+ Member nextTortoise = tortoiseBody.target;
+ List<DartType> nextTypeArguments = tortoiseBody.typeArguments;
+ if (strongMode && nextTypeArguments == null) {
+ nextTypeArguments = <DartType>[];
+ }
+
+ if (strongMode || nextTypeArguments != null) {
+ Substitution sub = Substitution.fromPairs(
+ tortoise.function.typeParameters, typeArguments);
+ typeArguments = <DartType>[]..length = nextTypeArguments.length;
+ for (int i = 0; i < typeArguments.length; i++) {
+ typeArguments[i] = sub.substituteType(nextTypeArguments[i]);
+ }
+ } else {
+ // In Dart 1, we need to throw away the extra type arguments and use
+ // `dynamic` in place of the missing ones.
+ int typeArgumentCount = typeArguments.length;
+ int nextTypeArgumentCount =
+ nextTortoise.enclosingClass.typeParameters.length;
+ typeArguments.length = nextTypeArgumentCount;
+ for (int i = typeArgumentCount; i < nextTypeArgumentCount; i++) {
+ typeArguments[i] = const DynamicType();
+ }
+ }
+
+ tortoise = nextTortoise;
tortoiseBody = getRedirectingFactoryBody(tortoise);
hare = getRedirectingFactoryBody(hareBody?.target)?.target;
hareBody = getRedirectingFactoryBody(hare);
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 9f07a92..cc3f267 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -1026,8 +1026,21 @@
token =
parseFormalParametersRequiredOpt(token, MemberKind.FunctionTypeAlias);
}
- token = ensureSemicolon(token);
- listener.endFunctionTypeAlias(typedefKeyword, equals, token);
+ Token semicolon = token.next;
+ if (optional(';', semicolon)) {
+ token = semicolon;
+ } else {
+ // Recovery
+ token = semicolon = ensureSemicolon(token);
+ if (optional('{', token.next) && token.next.endGroup != null) {
+ // Looks like a typedef and function declaration collided.
+ // TODO(danrubel) Consider better error message and recovery.
+ reportRecoverableErrorWithToken(
+ token.next, fasta.templateExpectedDeclaration);
+ token = token.next.endGroup;
+ }
+ }
+ listener.endFunctionTypeAlias(typedefKeyword, equals, semicolon);
return token;
}
@@ -4249,6 +4262,12 @@
Token begin = token;
token = parseExpression(token);
if (!ofFunctionExpression) {
+ // TODO(danrubel): Improve recovery and error message for `=> return`
+ // If the token is `return` and
+ // begin.next --> synthetic_id.next --> `return`
+ // then discard the synthetic identifier and associated events (how?),
+ // report an error on and skip the `return`,
+ // and call parseExpression again.
token = ensureSemicolon(token);
listener.handleExpressionFunctionBody(begin, token);
} else {
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index 76f5e9d..7886eff 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -133,7 +133,7 @@
actualCls.supertype =
supertype?.buildSupertype(library, charOffset, fileUri);
actualCls.mixedInType =
- mixedInType?.buildSupertype(library, charOffset, fileUri);
+ mixedInType?.buildMixedInType(library, charOffset, fileUri);
// TODO(ahe): If `cls.supertype` is null, and this isn't Object, report a
// compile-time error.
cls.isAbstract = isAbstract;
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index ce6ba35..0eded02 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -8,9 +8,6 @@
import 'dart:typed_data' show Uint8List;
-import 'package:front_end/src/fasta/type_inference/interface_resolver.dart'
- show InterfaceResolver;
-
import 'package:kernel/ast.dart'
show
Arguments,
@@ -43,8 +40,6 @@
import '../deprecated_problems.dart' show deprecated_inputError;
-import '../problems.dart' show internalProblem;
-
import '../export.dart' show Export;
import '../fasta_codes.dart'
@@ -74,12 +69,19 @@
import '../parser/class_member_parser.dart' show ClassMemberParser;
+import '../problems.dart' show internalProblem;
+
import '../scanner.dart' show ErrorToken, ScannerResult, Token, scan;
import '../severity.dart' show Severity;
+import '../type_inference/interface_resolver.dart' show InterfaceResolver;
+
import '../type_inference/type_inference_engine.dart' show TypeInferenceEngine;
+import '../type_inference/type_inferrer.dart'
+ show LegacyModeMixinInferrer, StrongModeMixinInferrer;
+
import 'diet_listener.dart' show DietListener;
import 'diet_parser.dart' show DietParser;
@@ -574,7 +576,10 @@
if (ambiguousTypesRecords != null) {
ambiguousTypesRecords.add([cls, a, b]);
}
- });
+ },
+ mixinInferrer: target.strongMode
+ ? new StrongModeMixinInferrer(this)
+ : new LegacyModeMixinInferrer());
for (List record in ambiguousTypesRecords) {
handleAmbiguousSupertypes(record[0], record[1], record[2]);
}
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 3cb2b70..55cfd14 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
@@ -2,20 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE.md file.
-import 'package:front_end/src/base/instrumentation.dart';
-import 'package:front_end/src/fasta/fasta_codes.dart';
-import 'package:front_end/src/fasta/kernel/fasta_accessors.dart';
-import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart';
-import 'package:front_end/src/fasta/names.dart' show callName;
-import 'package:front_end/src/fasta/problems.dart' show unhandled;
-import 'package:front_end/src/fasta/source/source_library_builder.dart';
-import 'package:front_end/src/fasta/type_inference/interface_resolver.dart';
-import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart';
-import 'package:front_end/src/fasta/type_inference/type_inference_listener.dart';
-import 'package:front_end/src/fasta/type_inference/type_promotion.dart';
-import 'package:front_end/src/fasta/type_inference/type_schema.dart';
-import 'package:front_end/src/fasta/type_inference/type_schema_elimination.dart';
-import 'package:front_end/src/fasta/type_inference/type_schema_environment.dart';
import 'package:kernel/ast.dart'
show
Arguments,
@@ -51,15 +37,71 @@
SuperMethodInvocation,
SuperPropertyGet,
SuperPropertySet,
+ Supertype,
ThisExpression,
TypeParameter,
TypeParameterType,
VariableDeclaration,
VariableGet,
VoidType;
-import 'package:kernel/class_hierarchy.dart';
-import 'package:kernel/core_types.dart';
-import 'package:kernel/type_algebra.dart';
+
+import 'package:kernel/class_hierarchy.dart' show ClassHierarchy, MixinInferrer;
+
+import 'package:kernel/core_types.dart' show CoreTypes;
+
+import 'package:kernel/type_algebra.dart'
+ show calculateBounds, getFreshTypeParameters, Substitution;
+
+import '../../base/instrumentation.dart'
+ show
+ Instrumentation,
+ InstrumentationValueForMember,
+ InstrumentationValueForType,
+ InstrumentationValueForTypeArgs,
+ InstrumentationValueLiteral;
+
+import '../fasta_codes.dart';
+
+import '../kernel/fasta_accessors.dart' show BuilderHelper;
+
+import '../kernel/kernel_shadow_ast.dart'
+ show
+ getExplicitTypeArguments,
+ ShadowClass,
+ ShadowConstructorInvocation,
+ ShadowField,
+ ShadowMember,
+ ShadowNullLiteral,
+ ShadowVariableDeclaration;
+
+import '../names.dart' show callName;
+
+import '../problems.dart' show unhandled;
+
+import '../source/source_library_builder.dart' show SourceLibraryBuilder;
+
+import '../source/source_loader.dart' show SourceLoader;
+
+import 'interface_resolver.dart' show ForwardingNode, SyntheticAccessor;
+
+import 'type_constraint_gatherer.dart' show TypeConstraintGatherer;
+
+import 'type_inference_engine.dart' show TypeInferenceEngineImpl;
+
+import 'type_inference_listener.dart' show TypeInferenceListener;
+
+import 'type_promotion.dart' show TypePromoter, TypePromoterDisabled;
+
+import 'type_schema.dart' show isKnown, UnknownType;
+
+import 'type_schema_elimination.dart' show greatestClosure;
+
+import 'type_schema_environment.dart'
+ show
+ getNamedParameterType,
+ getPositionalParameterType,
+ TypeVariableEliminator,
+ TypeSchemaEnvironment;
/// Given a [FunctionNode], gets the named parameter identified by [name], or
/// `null` if there is no parameter with the given name.
@@ -403,44 +445,58 @@
// is inferred (the kernel code is discarded).
if (isTopLevel) return null;
+ // This logic is strong mode only; in legacy mode anything goes.
+ if (!strongMode) return null;
+
+ // If an interface type is being assigned to a function type, see if we
+ // should tear off `.call`.
+ // TODO(paulberry): use resolveTypeParameter. See findInterfaceMember.
+ if (actualType is InterfaceType) {
+ var classNode = (actualType as InterfaceType).classNode;
+ var callMember = classHierarchy.getInterfaceMember(classNode, callName);
+ if (callMember != null) {
+ if (_shouldTearOffCall(expectedType, actualType)) {
+ var parent = expression.parent;
+ var tearOff = new PropertyGet(expression, callName, callMember)
+ ..fileOffset = fileOffset;
+ parent?.replaceChild(expression, tearOff);
+ expression = tearOff;
+ actualType = getCalleeType(callMember, actualType);
+ }
+ }
+ }
+
if (expectedType == null ||
typeSchemaEnvironment.isSubtypeOf(actualType, expectedType)) {
// Types are compatible.
return null;
+ }
+
+ if (!typeSchemaEnvironment.isSubtypeOf(expectedType, actualType)) {
+ // Error: not assignable. Perform error recovery.
+ var parent = expression.parent;
+ var errorNode = helper.wrapInCompileTimeError(expression,
+ templateInvalidAssignment.withArguments(actualType, expectedType));
+ parent?.replaceChild(expression, errorNode);
+ return errorNode;
} else {
- if (strongMode) {
- if (!isTopLevel &&
- !typeSchemaEnvironment.isSubtypeOf(expectedType, actualType)) {
- // Error: not assignable. Perform error recovery.
- var parent = expression.parent;
- var errorNode = helper.wrapInCompileTimeError(
- expression,
- templateInvalidAssignment.withArguments(
- actualType, expectedType));
- parent?.replaceChild(expression, errorNode);
- return errorNode;
- } else {
- var template = _getPreciseTypeErrorTemplate(expression);
- if (template != null) {
- // The type of the expression is known precisely, so an implicit
- // downcast is guaranteed to fail. Insert a compile-time error.
- var parent = expression.parent;
- var errorNode = helper.wrapInCompileTimeError(
- expression, template.withArguments(actualType, expectedType));
- parent?.replaceChild(expression, errorNode);
- return errorNode;
- } else {
- // Insert an implicit downcast.
- var parent = expression.parent;
- var typeCheck = new AsExpression(expression, expectedType)
- ..isTypeError = true
- ..fileOffset = fileOffset;
- parent?.replaceChild(expression, typeCheck);
- return typeCheck;
- }
- }
+ var template = _getPreciseTypeErrorTemplate(expression);
+ if (template != null) {
+ // The type of the expression is known precisely, so an implicit
+ // downcast is guaranteed to fail. Insert a compile-time error.
+ var parent = expression.parent;
+ var errorNode = helper.wrapInCompileTimeError(
+ expression, template.withArguments(actualType, expectedType));
+ parent?.replaceChild(expression, errorNode);
+ return errorNode;
} else {
- return null;
+ // Insert an implicit downcast.
+ var parent = expression.parent;
+ var typeCheck = new AsExpression(expression, expectedType)
+ ..isTypeError = true
+ ..fileOffset = fileOffset;
+ parent?.replaceChild(expression, typeCheck);
+ return typeCheck;
}
}
}
@@ -1534,4 +1590,145 @@
}
return null;
}
+
+ bool _shouldTearOffCall(DartType expectedType, DartType actualType) {
+ if (expectedType is InterfaceType &&
+ expectedType.classNode == typeSchemaEnvironment.futureOrClass) {
+ expectedType = (expectedType as InterfaceType).typeArguments[0];
+ }
+ if (expectedType is FunctionType) return true;
+ if (expectedType == typeSchemaEnvironment.rawFunctionType) {
+ if (!typeSchemaEnvironment.isSubtypeOf(actualType, expectedType)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+class LegacyModeMixinInferrer implements MixinInferrer {
+ void infer(ClassHierarchy hierarchy, Class classNode) {
+ Supertype mixedInType = classNode.mixedInType;
+ if (mixedInType.typeArguments.isNotEmpty &&
+ mixedInType.typeArguments.first == const UnknownType()) {
+ assert(mixedInType.typeArguments.every((t) => t == const UnknownType()));
+ for (int i = 0; i < mixedInType.typeArguments.length; ++i) {
+ mixedInType.typeArguments[i] = const DynamicType();
+ }
+ }
+ }
+}
+
+class StrongModeMixinInferrer implements MixinInferrer {
+ final CoreTypes coreTypes;
+ final SourceLoader loader;
+ TypeConstraintGatherer gatherer;
+
+ StrongModeMixinInferrer(this.loader) : coreTypes = loader.coreTypes;
+
+ void generateConstraints(ClassHierarchy hierarchy, Class mixinClass,
+ Supertype baseType, Supertype mixinSupertype) {
+ if (mixinSupertype.typeArguments.isEmpty) {
+ // The supertype constraint isn't generic; it doesn't constrain anything.
+ } else if (mixinSupertype.classNode.isSyntheticMixinImplementation) {
+ // We had a mixin M<X0, ..., Xn> with a superclass constraint of the form
+ // S0 with M0 where S0 and M0 each possibly have type arguments. That has
+ // been compiled a named mixin application class of the form
+ //
+ // class S0&M0<...> = S0 with M0;
+ // class M<X0, ..., Xn> extends S0&M0<...>
+ //
+ // where the type parameters of S0&M0 are the X0, ..., Xn that occured
+ // free in S0 and M0. Treat S0 and M0 as separate supertype constraints
+ // by recursively calling this algorithm.
+ var substitution = Substitution.fromSupertype(mixinSupertype);
+ var s0 =
+ substitution.substituteSupertype(mixinSupertype.classNode.supertype);
+ var m0 = substitution
+ .substituteSupertype(mixinSupertype.classNode.mixedInType);
+ generateConstraints(hierarchy, mixinClass, baseType, s0);
+ generateConstraints(hierarchy, mixinClass, baseType, m0);
+ } else {
+ // Find the type U0 which is baseType as an instance of mixinSupertype's
+ // class.
+ Supertype supertype =
+ hierarchy.asInstantiationOf(baseType, mixinSupertype.classNode);
+ if (supertype == null) {
+ loader.addProblem(
+ templateMixinInferenceNoMatchingClass.withArguments(mixinClass.name,
+ baseType.classNode.name, mixinSupertype.asInterfaceType),
+ mixinClass.fileOffset,
+ mixinClass.fileUri);
+ return;
+ }
+ InterfaceType u0 = Substitution
+ .fromSupertype(baseType)
+ .substituteSupertype(supertype)
+ .asInterfaceType;
+ // We want to solve U0 = S0 where S0 is mixinSupertype, but we only have
+ // a subtype constraints. Solve for equality by solving
+ // both U0 <: S0 and S0 <: U0.
+ InterfaceType s0 = mixinSupertype.asInterfaceType;
+ gatherer.trySubtypeMatch(u0, s0);
+ gatherer.trySubtypeMatch(s0, u0);
+ }
+ }
+
+ void infer(ClassHierarchy hierarchy, Class classNode) {
+ Supertype mixedInType = classNode.mixedInType;
+ if (mixedInType.typeArguments.isNotEmpty &&
+ mixedInType.typeArguments.first == const UnknownType()) {
+ assert(mixedInType.typeArguments.every((t) => t == const UnknownType()));
+ // Note that we have no anonymous mixin applications, they have all
+ // been named. Note also that mixin composition has been translated
+ // so that we only have mixin applications of the form `S with M`.
+ Supertype baseType = classNode.supertype;
+ Class mixinClass = mixedInType.classNode;
+ Supertype mixinSupertype = mixinClass.supertype;
+ gatherer = new TypeConstraintGatherer(
+ new TypeSchemaEnvironment(loader.coreTypes, hierarchy, true),
+ mixinClass.typeParameters);
+ // Generate constraints based on the mixin's supertype.
+ generateConstraints(hierarchy, mixinClass, baseType, mixinSupertype);
+ // Solve them to get a map from type parameters to upper and lower
+ // bounds.
+ var result = gatherer.computeConstraints();
+ // Generate new type parameters with the solution as bounds.
+ List<TypeParameter> parameters = mixinClass.typeParameters.map((p) {
+ var constraint = result[p];
+ // Because we solved for equality, a valid solution has a parameter
+ // either unconstrained or else with identical upper and lower bounds.
+ if (constraint != null && constraint.upper != constraint.lower) {
+ loader.addProblem(
+ templateMixinInferenceNoMatchingClass.withArguments(
+ mixinClass.name,
+ baseType.classNode.name,
+ mixinSupertype.asInterfaceType),
+ mixinClass.fileOffset,
+ mixinClass.fileUri);
+ return p;
+ }
+ assert(constraint == null || constraint.upper == constraint.lower);
+ return new TypeParameter(
+ p.name,
+ constraint == null || constraint.upper == const UnknownType()
+ ? p.bound
+ : constraint.upper);
+ }).toList();
+ // Bounds might mention the mixin class's type parameters so we have to
+ // substitute them before calling instantiate to bounds.
+ var substitution = Substitution.fromPairs(mixinClass.typeParameters,
+ parameters.map((p) => new TypeParameterType(p)).toList());
+ for (var p in parameters) {
+ p.bound = substitution.substituteType(p.bound);
+ }
+ // Use instantiate to bounds.
+ List<DartType> bounds =
+ calculateBounds(parameters, loader.coreTypes.objectClass);
+ for (int i = 0; i < mixedInType.typeArguments.length; ++i) {
+ mixedInType.typeArguments[i] = bounds[i];
+ }
+ gatherer = null;
+ }
+ }
}
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index c6e9652..5d2fa20 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -557,6 +557,15 @@
script:
- "class C { var static f; }"
+StaticConstructor:
+ template: "Constructors can't be static."
+ tip: "Try removing the keyword 'static'."
+ analyzerCode: STATIC_CONSTRUCTOR
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { static C() {} }"
+ - "class C { static C.m() {} }"
+
StaticOperator:
template: "Operators can't be static."
tip: "Try removing the keyword 'static'."
@@ -1688,6 +1697,21 @@
NotAnLvalue:
template: "Can't assign to this."
+IllegalAssignmentToNonAssignable:
+ template: "Illegal assignment to non-assignable expression."
+ analyzerCode: ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE
+ dart2jsCode: "*fatal*"
+ script:
+ - "main(){ f()++; }"
+
+MissingAssignableSelector:
+ template: "Missing selector such as '.<identifier>' or '[0]'."
+ tip: "Try adding a selector."
+ analyzerCode: MISSING_ASSIGNABLE_SELECTOR
+ dart2jsCode: "*fatal*"
+ script:
+ - "main(){ ++f(); }"
+
CannotReadPackagesFile:
template: "Unable to read '.packages' file:\n #string."
@@ -1879,3 +1903,9 @@
template: "Can't use a super-bounded type for instance creation. Got '#type'."
tip: "Specify a regular-bounded type instead of the super-bounded type. Note that the latter may be due to type inference."
severity: ERROR
+
+MixinInferenceNoMatchingClass:
+ template: |
+ Type parameters could not be inferred for the mixin '#name' because
+ '#name2' does not implement the mixin's supertype constraint '#type'.
+ severity: ERROR
diff --git a/pkg/front_end/pubspec.yaml b/pkg/front_end/pubspec.yaml
index 25ed266..0644769 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.9
+version: 0.1.0-alpha.10
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.9
+ kernel: 0.3.0-alpha.10
meta: '^1.1.1'
package_config: '^1.0.1'
path: '^1.3.9'
diff --git a/pkg/front_end/testcases/ast_builder.status b/pkg/front_end/testcases/ast_builder.status
index d236b72..6d175ad 100644
--- a/pkg/front_end/testcases/ast_builder.status
+++ b/pkg/front_end/testcases/ast_builder.status
@@ -130,6 +130,9 @@
rasta/unresolved_constructor: Crash
rasta/unresolved_for_in: Crash
rasta/unresolved_recovery: Crash
+redirection_chain_type_arguments: Crash
+redirection_chain_type_arguments_subst: Crash
+redirection_type_arguments: Crash
regress/issue_29937: Crash
regress/issue_29941: Crash
regress/issue_29942: Crash
@@ -150,6 +153,8 @@
regress/issue_31299: Crash
regress/issue_31766: Crash
reorder_super: Crash
+runtime_checks/call_method_implicit_tear_off: Crash
+runtime_checks/call_method_implicit_tear_off_future_or: Crash
runtime_checks/implicit_downcast_assert_initializer: Crash
runtime_checks/implicit_downcast_constructor_initializer: Crash
runtime_checks_new/for_in_call_kinds: Crash
diff --git a/pkg/front_end/testcases/compile.status b/pkg/front_end/testcases/compile.status
index a25981a..31b8193 100644
--- a/pkg/front_end/testcases/compile.status
+++ b/pkg/front_end/testcases/compile.status
@@ -23,6 +23,8 @@
redirecting_factory_typeargs_test: Fail # Missing support for RedirectingFactoryConstructor.
redirecting_factory_typeparam_test: Fail # Missing support for RedirectingFactoryConstructor.
redirecting_factory_typeparambounds_test: Fail # Missing support for RedirectingFactoryConstructor.
+redirection_chain_type_arguments: Fail # Issue 32130
+redirection_chain_type_arguments_subst: Fail # Issue 32130
statements: Fail # Make async tranformer optional for golden file testing.
type_variable_as_super: Fail
uninitialized_fields: Fail # Fasta and dartk disagree on static initializers
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.direct.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.direct.expect
index 25143c3..d2fa30a 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.direct.expect
@@ -7,7 +7,7 @@
abstract get t() → self::C::T;
abstract set t(self::C::T x) → void;
static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T>
- let dynamic #redirecting_factory = self::CImpl::• in invalid-expression;
+ let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object> extends core::Object implements self::C<self::CImpl::T> {
field self::CImpl::T t;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.expect
index 32c9742..309c800 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.expect
@@ -7,7 +7,7 @@
abstract get t() → self::C::T;
abstract set t(generic-covariant-impl generic-covariant-interface self::C::T x) → void;
static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T>
- let dynamic #redirecting_factory = self::CImpl::• in invalid-expression;
+ let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object> extends core::Object implements self::C<self::CImpl::T> {
generic-covariant-impl generic-covariant-interface field self::CImpl::T t;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.direct.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.direct.expect
index c5984a0..1975274 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.direct.expect
@@ -7,7 +7,7 @@
abstract get t() → self::C::T;
abstract set t(self::C::T x) → void;
static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T>
- let dynamic #redirecting_factory = self::CImpl::• in invalid-expression;
+ let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object> extends core::Object implements self::C<self::CImpl::T> {
field self::CImpl::T t;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.outline.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.outline.expect
index 144b7aa..37113f5 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.outline.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.outline.expect
@@ -7,7 +7,7 @@
abstract get t() → self::C::T;
abstract set t(self::C::T x) → void;
static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T>
- let dynamic #redirecting_factory = self::CImpl::• in invalid-expression;
+ let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object> extends core::Object implements self::C<self::CImpl::T> {
field self::CImpl::T t;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.expect
index dfb058f..5e10461 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.expect
@@ -7,7 +7,7 @@
abstract get t() → self::C::T;
abstract set t(generic-covariant-impl generic-covariant-interface self::C::T x) → void;
static factory •<T extends core::Object>(self::C::•::T t) → self::C<self::C::•::T>
- let dynamic #redirecting_factory = self::CImpl::• in invalid-expression;
+ let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object> extends core::Object implements self::C<self::CImpl::T> {
generic-covariant-impl generic-covariant-interface field self::CImpl::T t;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart
new file mode 100644
index 0000000..5e2e3e8
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart
@@ -0,0 +1,14 @@
+// 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<X> {}
+
+class M0<X, Y extends String> extends I<X> {}
+
+class M1 implements I<int> {}
+
+// M0 is inferred as M0<int, String>
+class A extends M1 with M0 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart.direct.expect
new file mode 100644
index 0000000..58666dc
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart.direct.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<X extends core::Object, Y extends core::String> extends self::I<self::M0::X> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _M1&M0 = self::M1 with self::M0<dynamic, dynamic> {
+}
+class A extends self::_M1&M0 {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart.outline.expect
new file mode 100644
index 0000000..43cd31c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart.outline.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<X extends core::Object, Y extends core::String> extends self::I<self::M0::X> {
+ synthetic constructor •() → void
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _M1&M0 = self::M1 with self::M0<dynamic, dynamic> {
+}
+class A extends self::_M1&M0 {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart.strong.expect
new file mode 100644
index 0000000..c6be946
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_1.dart.strong.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<X extends core::Object, Y extends core::String> extends self::I<self::M0::X> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _M1&M0 = self::M1 with self::M0<core::int, core::String> {
+}
+class A extends self::_M1&M0 {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart
new file mode 100644
index 0000000..31c4d88
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart
@@ -0,0 +1,14 @@
+// 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<X> {}
+
+class M0<X, Y extends X> extends I<X> {}
+
+class M1 implements I<int> {}
+
+// M0 is inferred as M0<int, int>
+class A extends M1 with M0 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart.direct.expect
new file mode 100644
index 0000000..91adf7b
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart.direct.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<X extends core::Object, Y extends self::M0::X> extends self::I<self::M0::X> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _M1&M0 = self::M1 with self::M0<dynamic, dynamic> {
+}
+class A extends self::_M1&M0 {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart.outline.expect
new file mode 100644
index 0000000..bd994a1
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart.outline.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<X extends core::Object, Y extends self::M0::X> extends self::I<self::M0::X> {
+ synthetic constructor •() → void
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _M1&M0 = self::M1 with self::M0<dynamic, dynamic> {
+}
+class A extends self::_M1&M0 {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart.strong.expect
new file mode 100644
index 0000000..c455b6c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_2.dart.strong.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<X extends core::Object, Y extends self::M0::X> extends self::I<self::M0::X> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _M1&M0 = self::M1 with self::M0<core::int, core::int> {
+}
+class A extends self::_M1&M0 {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart
new file mode 100644
index 0000000..e82cec5
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.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.
+
+class I<X> {}
+
+class M0<X, Y extends Comparable<Y>> extends I<X> {}
+
+class M1 implements I<int> {}
+
+// M0 is inferred as M0<int, Comparable<dynamic>>
+// Error since super-bounded type not allowed
+class A extends M1 with M0 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart.direct.expect
new file mode 100644
index 0000000..55f52e1
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart.direct.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<X extends core::Object, Y extends core::Comparable<self::M0::Y>> extends self::I<self::M0::X> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _M1&M0 = self::M1 with self::M0<dynamic, dynamic> {
+}
+class A extends self::_M1&M0 {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart.outline.expect
new file mode 100644
index 0000000..2271436
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart.outline.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<X extends core::Object, Y extends core::Comparable<self::M0::Y>> extends self::I<self::M0::X> {
+ synthetic constructor •() → void
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _M1&M0 = self::M1 with self::M0<dynamic, dynamic> {
+}
+class A extends self::_M1&M0 {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart.strong.expect
new file mode 100644
index 0000000..7256dd1
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_instantiate_to_bounds_3.dart.strong.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<X extends core::Object, Y extends core::Comparable<self::M0::Y>> extends self::I<self::M0::X> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _M1&M0 = self::M1 with self::M0<core::int, core::Comparable<dynamic>> {
+}
+class A extends self::_M1&M0 {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart b/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart
new file mode 100644
index 0000000..a156947
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class I<X> {}
+
+class J<X> {}
+
+class M0<X, Y> extends I<X> with J<Y> {}
+
+class M1 implements I<int> {}
+
+class M2 extends M1 implements J<double> {}
+
+// M0 is inferred as M0<int, double>
+class A extends M2 with M0 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart.direct.expect
new file mode 100644
index 0000000..3ac06e1
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart.direct.expect
@@ -0,0 +1,39 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class J<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _I&J^#T0^#T1<#T0 extends core::Object, #T1 extends core::Object> = self::I<self::_I&J^#T0^#T1::#T0> with self::J<self::_I&J^#T0^#T1::#T1> {
+}
+class M0<X extends core::Object, Y extends core::Object> extends self::_I&J^#T0^#T1<self::M0::X, self::M0::Y> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M2 extends self::M1 implements self::J<core::double> {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+abstract class _M2&M0 = self::M2 with self::M0<dynamic, dynamic> {
+}
+class A extends self::_M2&M0 {
+ synthetic constructor •() → void
+ : super self::M2::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart.outline.expect
new file mode 100644
index 0000000..57ed82e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart.outline.expect
@@ -0,0 +1,34 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class J<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _I&J^#T0^#T1<#T0 extends core::Object, #T1 extends core::Object> = self::I<self::_I&J^#T0^#T1::#T0> with self::J<self::_I&J^#T0^#T1::#T1> {
+}
+class M0<X extends core::Object, Y extends core::Object> extends self::_I&J^#T0^#T1<self::M0::X, self::M0::Y> {
+ synthetic constructor •() → void
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+class M2 extends self::M1 implements self::J<core::double> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _M2&M0 = self::M2 with self::M0<dynamic, dynamic> {
+}
+class A extends self::_M2&M0 {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart.strong.expect
new file mode 100644
index 0000000..420f505
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_multiple_constraints.dart.strong.expect
@@ -0,0 +1,39 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class J<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _I&J^#T0^#T1<#T0 extends core::Object, #T1 extends core::Object> = self::I<self::_I&J^#T0^#T1::#T0> with self::J<self::_I&J^#T0^#T1::#T1> {
+}
+class M0<X extends core::Object, Y extends core::Object> extends self::_I&J^#T0^#T1<self::M0::X, self::M0::Y> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1 extends core::Object implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M2 extends self::M1 implements self::J<core::double> {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+abstract class _M2&M0 = self::M2 with self::M0<core::int, core::double> {
+}
+class A extends self::_M2&M0 {
+ synthetic constructor •() → void
+ : super self::M2::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart b/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart
new file mode 100644
index 0000000..04db533
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class I<X> {}
+
+class M0<T> extends I<List<T>> {}
+
+class M1<T> extends I<List<T>> {}
+
+class M2<T> extends M1<Map<T, T>> {}
+
+// M0 is inferred as M0<Map<int, int>>
+class A extends M2<int> with M0 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart.direct.expect
new file mode 100644
index 0000000..e1b1656
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart.direct.expect
@@ -0,0 +1,32 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends self::I<core::List<self::M0::T>> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<core::List<self::M1::T>> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M2<T extends core::Object> extends self::M1<core::Map<self::M2::T, self::M2::T>> {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+abstract class _M2&M0^#U0^<#U0 extends core::Object> = self::M2<self::_M2&M0^#U0^::#U0> with self::M0<dynamic> {
+}
+class A extends self::_M2&M0^#U0^<core::int> {
+ synthetic constructor •() → void
+ : super self::M2::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart.outline.expect
new file mode 100644
index 0000000..130fe8c8
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart.outline.expect
@@ -0,0 +1,28 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<T extends core::Object> extends self::I<core::List<self::M0::T>> {
+ synthetic constructor •() → void
+ ;
+}
+class M1<T extends core::Object> extends self::I<core::List<self::M1::T>> {
+ synthetic constructor •() → void
+ ;
+}
+class M2<T extends core::Object> extends self::M1<core::Map<self::M2::T, self::M2::T>> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _M2&M0^#U0^<#U0 extends core::Object> = self::M2<self::_M2&M0^#U0^::#U0> with self::M0<dynamic> {
+}
+class A extends self::_M2&M0^#U0^<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart.strong.expect
new file mode 100644
index 0000000..07bb906
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_non_trivial_constraints.dart.strong.expect
@@ -0,0 +1,32 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends self::I<core::List<self::M0::T>> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<core::List<self::M1::T>> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M2<T extends core::Object> extends self::M1<core::Map<self::M2::T, self::M2::T>> {
+ synthetic constructor •() → void
+ : super self::M1::•()
+ ;
+}
+abstract class _M2&M0^#U0^<#U0 extends core::Object> = self::M2<self::_M2&M0^#U0^::#U0> with self::M0<core::Map<self::_M2&M0^#U0^::#U0, self::_M2&M0^#U0^::#U0>> {
+}
+class A extends self::_M2&M0^#U0^<core::int> {
+ synthetic constructor •() → void
+ : super self::M2::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart b/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart
new file mode 100644
index 0000000..41b6e88
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart
@@ -0,0 +1,14 @@
+// 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<X> {}
+
+class M0<T> extends I<T> {}
+
+class M1<T> extends I<T> {}
+
+// M1 is inferred as M1<int>
+class A extends M0<int> with M1 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart.direct.expect
new file mode 100644
index 0000000..a445dca
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart.direct.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends self::I<self::M0::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+abstract class _M0&M1^#U0^<#U0 extends core::Object> = self::M0<self::_M0&M1^#U0^::#U0> with self::M1<dynamic> {
+}
+class A extends self::_M0&M1^#U0^<core::int> {
+ synthetic constructor •() → void
+ : super self::M0::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart.outline.expect
new file mode 100644
index 0000000..185c73d
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart.outline.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<T extends core::Object> extends self::I<self::M0::T> {
+ synthetic constructor •() → void
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _M0&M1^#U0^<#U0 extends core::Object> = self::M0<self::_M0&M1^#U0^::#U0> with self::M1<dynamic> {
+}
+class A extends self::_M0&M1^#U0^<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart.strong.expect
new file mode 100644
index 0000000..046015f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_1.dart.strong.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends self::I<self::M0::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+abstract class _M0&M1^#U0^<#U0 extends core::Object> = self::M0<self::_M0&M1^#U0^::#U0> with self::M1<self::_M0&M1^#U0^::#U0> {
+}
+class A extends self::_M0&M1^#U0^<core::int> {
+ synthetic constructor •() → void
+ : super self::M0::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart b/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart
new file mode 100644
index 0000000..8ac7436
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class I<X> {}
+
+class M0<T> extends I<T> {}
+
+class M1<T> extends I<T> {}
+
+class M2<T> extends I<T> {}
+
+// M1 is inferred as M1<int>
+// M2 is inferred as M1<int>
+class A extends M0<int> with M1, M2 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart.direct.expect
new file mode 100644
index 0000000..51ca970
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart.direct.expect
@@ -0,0 +1,34 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends self::I<self::M0::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M2<T extends core::Object> extends self::I<self::M2::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+abstract class _M0&M1^#U0^<#U0 extends core::Object> = self::M0<self::_M0&M1^#U0^::#U0> with self::M1<dynamic> {
+}
+abstract class __M0&M1&M2^#U0^^<#U0 extends core::Object> = self::_M0&M1^#U0^<self::__M0&M1&M2^#U0^^::#U0> with self::M2<dynamic> {
+}
+class A extends self::__M0&M1&M2^#U0^^<core::int> {
+ synthetic constructor •() → void
+ : super self::M0::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart.outline.expect
new file mode 100644
index 0000000..453336f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart.outline.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<T extends core::Object> extends self::I<self::M0::T> {
+ synthetic constructor •() → void
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ ;
+}
+class M2<T extends core::Object> extends self::I<self::M2::T> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _M0&M1^#U0^<#U0 extends core::Object> = self::M0<self::_M0&M1^#U0^::#U0> with self::M1<dynamic> {
+}
+abstract class __M0&M1&M2^#U0^^<#U0 extends core::Object> = self::_M0&M1^#U0^<self::__M0&M1&M2^#U0^^::#U0> with self::M2<dynamic> {
+}
+class A extends self::__M0&M1&M2^#U0^^<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart.strong.expect
new file mode 100644
index 0000000..6cc9bf5
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_2.dart.strong.expect
@@ -0,0 +1,34 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends self::I<self::M0::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+class M2<T extends core::Object> extends self::I<self::M2::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+abstract class _M0&M1^#U0^<#U0 extends core::Object> = self::M0<self::_M0&M1^#U0^::#U0> with self::M1<self::_M0&M1^#U0^::#U0> {
+}
+abstract class __M0&M1&M2^#U0^^<#U0 extends core::Object> = self::_M0&M1^#U0^<self::__M0&M1&M2^#U0^^::#U0> with self::M2<self::__M0&M1&M2^#U0^^::#U0> {
+}
+class A extends self::__M0&M1&M2^#U0^^<core::int> {
+ synthetic constructor •() → void
+ : super self::M0::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart b/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart
new file mode 100644
index 0000000..bfa0a72
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=error*/
+
+class I<X> {}
+
+class M0<T> extends Object implements I<T> {}
+
+class M1<T> extends I<T> {}
+
+// M0 is inferred as M0<dynamic>
+// Error since class hierarchy is inconsistent
+class /*@error=AmbiguousSupertypes*/ A extends Object with M0, M1<int> {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart.direct.expect
new file mode 100644
index 0000000..e7f862e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart.direct.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1^^^#U0<#U0 extends core::Object> = self::_Object&M0 with self::M1<self::__Object&M0&M1^^^#U0::#U0> {
+}
+class A extends self::__Object&M0&M1^^^#U0<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:38: Error: 'A' can't implement both '#lib1::I<dynamic>' and '#lib1::I<dart.core::int>'\nclass /*@error=AmbiguousSupertypes*/ A extends Object with M0, M1<int> {}\n ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart.outline.expect
new file mode 100644
index 0000000..299bf73
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart.outline.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T> {
+ synthetic constructor •() → void
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1^^^#U0<#U0 extends core::Object> = self::_Object&M0 with self::M1<self::__Object&M0&M1^^^#U0::#U0> {
+}
+class A extends self::__Object&M0&M1^^^#U0<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart.strong.expect
new file mode 100644
index 0000000..e7f862e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart.strong.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1^^^#U0<#U0 extends core::Object> = self::_Object&M0 with self::M1<self::__Object&M0&M1^^^#U0::#U0> {
+}
+class A extends self::__Object&M0&M1^^^#U0<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/mixin_inference_outwards_3.dart:15:38: Error: 'A' can't implement both '#lib1::I<dynamic>' and '#lib1::I<dart.core::int>'\nclass /*@error=AmbiguousSupertypes*/ A extends Object with M0, M1<int> {}\n ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart b/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart
new file mode 100644
index 0000000..73f13f6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=error*/
+
+class I<X> {}
+
+class M0<T> extends Object implements I<T> {}
+
+class M1<T> extends I<T> {}
+
+// M0 is inferred as M0<dynamic> (unconstrained)
+// M1 is inferred as M1<dynamic> (constrained by inferred argument to M0)
+// Error since class hierarchy is inconsistent
+class /*@error=AmbiguousSupertypes*/ A extends Object
+ with M0, M1
+ implements I<int> {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart.direct.expect
new file mode 100644
index 0000000..f0f0486
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart.direct.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1 = self::_Object&M0 with self::M1<dynamic> {
+}
+class A extends self::__Object&M0&M1 implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:16:38: Error: 'A' can't implement both '#lib1::I<dynamic>' and '#lib1::I<dart.core::int>'\nclass /*@error=AmbiguousSupertypes*/ A extends Object\n ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart.outline.expect
new file mode 100644
index 0000000..75c5146
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart.outline.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T> {
+ synthetic constructor •() → void
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1 = self::_Object&M0 with self::M1<dynamic> {
+}
+class A extends self::__Object&M0&M1 implements self::I<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart.strong.expect
new file mode 100644
index 0000000..f0f0486
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart.strong.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M1<T extends core::Object> extends self::I<self::M1::T> {
+ synthetic constructor •() → void
+ : super self::I::•()
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1 = self::_Object&M0 with self::M1<dynamic> {
+}
+class A extends self::__Object&M0&M1 implements self::I<core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/mixin_inference_outwards_4.dart:16:38: Error: 'A' can't implement both '#lib1::I<dynamic>' and '#lib1::I<dart.core::int>'\nclass /*@error=AmbiguousSupertypes*/ A extends Object\n ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart b/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart
new file mode 100644
index 0000000..b733915
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=error*/
+
+class I<X, Y> {}
+
+class M0<T> implements I<T, int> {}
+
+class M1<T> implements I<String, T> {}
+
+// M0 inferred as M0<String>
+// M1 inferred as M1<int>
+class /*@error=AmbiguousSupertypes*/ A extends Object with M0, M1 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart.direct.expect
new file mode 100644
index 0000000..eb6188f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart.direct.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T, core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M1<T extends core::Object> extends core::Object implements self::I<core::String, self::M1::T> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1 = self::_Object&M0 with self::M1<dynamic> {
+}
+class A extends self::__Object&M0&M1 {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:38: Error: 'A' can't implement both '#lib1::I<dynamic, dart.core::int>' and '#lib1::I<dart.core::String, dynamic>'\nclass /*@error=AmbiguousSupertypes*/ A extends Object with M0, M1 {}\n ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart.outline.expect
new file mode 100644
index 0000000..43277d0
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart.outline.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T, core::int> {
+ synthetic constructor •() → void
+ ;
+}
+class M1<T extends core::Object> extends core::Object implements self::I<core::String, self::M1::T> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1 = self::_Object&M0 with self::M1<dynamic> {
+}
+class A extends self::__Object&M0&M1 {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart.strong.expect
new file mode 100644
index 0000000..eb6188f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_unification_1.dart.strong.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T, core::int> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M1<T extends core::Object> extends core::Object implements self::I<core::String, self::M1::T> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1 = self::_Object&M0 with self::M1<dynamic> {
+}
+class A extends self::__Object&M0&M1 {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/mixin_inference_unification_1.dart:15:38: Error: 'A' can't implement both '#lib1::I<dynamic, dart.core::int>' and '#lib1::I<dart.core::String, dynamic>'\nclass /*@error=AmbiguousSupertypes*/ A extends Object with M0, M1 {}\n ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart b/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart
new file mode 100644
index 0000000..0c7aa07
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=error*/
+
+class I<X, Y> {}
+
+class M0<T> implements I<T, List<T>> {}
+
+class M1<T> implements I<List<T>, T> {}
+
+// No solution, even with unification, since solution
+// requires that I<List<U0>, U0> == I<U1, List<U1>>
+// for some U0, U1, and hence that:
+// U0 = List<U1>
+// U1 = List<U0>
+// which has no finite solution
+class /*@error=AmbiguousSupertypes*/ A extends Object with M0, M1 {}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart.direct.expect b/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart.direct.expect
new file mode 100644
index 0000000..fa0b39f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart.direct.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T, core::List<self::M0::T>> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M1<T extends core::Object> extends core::Object implements self::I<core::List<self::M1::T>, self::M1::T> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1 = self::_Object&M0 with self::M1<dynamic> {
+}
+class A extends self::__Object&M0&M1 {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:38: Error: 'A' can't implement both '#lib1::I<dynamic, dart.core::List<dynamic>>' and '#lib1::I<dart.core::List<dynamic>, dynamic>'\nclass /*@error=AmbiguousSupertypes*/ A extends Object with M0, M1 {}\n ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart.outline.expect b/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart.outline.expect
new file mode 100644
index 0000000..7a9af6b
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart.outline.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T, core::List<self::M0::T>> {
+ synthetic constructor •() → void
+ ;
+}
+class M1<T extends core::Object> extends core::Object implements self::I<core::List<self::M1::T>, self::M1::T> {
+ synthetic constructor •() → void
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1 = self::_Object&M0 with self::M1<dynamic> {
+}
+class A extends self::__Object&M0&M1 {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart.strong.expect b/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart.strong.expect
new file mode 100644
index 0000000..fa0b39f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/mixin_inference_unification_2.dart.strong.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class I<X extends core::Object, Y extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M0<T extends core::Object> extends core::Object implements self::I<self::M0::T, core::List<self::M0::T>> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class M1<T extends core::Object> extends core::Object implements self::I<core::List<self::M1::T>, self::M1::T> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class _Object&M0 = core::Object with self::M0<dynamic> {
+}
+abstract class __Object&M0&M1 = self::_Object&M0 with self::M1<dynamic> {
+}
+class A extends self::__Object&M0&M1 {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/mixin_inference_unification_2.dart:19:38: Error: 'A' can't implement both '#lib1::I<dynamic, dart.core::List<dynamic>>' and '#lib1::I<dart.core::List<dynamic>, dynamic>'\nclass /*@error=AmbiguousSupertypes*/ A extends Object with M0, M1 {}\n ^"]/* from null */;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/qualified.dart.direct.expect b/pkg/front_end/testcases/qualified.dart.direct.expect
index e114c24..79c595d 100644
--- a/pkg/front_end/testcases/qualified.dart.direct.expect
+++ b/pkg/front_end/testcases/qualified.dart.direct.expect
@@ -23,7 +23,7 @@
: super core::Object::•()
;
static factory b<T extends core::Object>() → self::C<self::C::b::T>
- let dynamic #redirecting_factory = lib::C::b in invalid-expression;
+ 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.\nclass Bad extends lib.Missing {\n ^"]/* from null */;
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/qualified.dart.outline.expect b/pkg/front_end/testcases/qualified.dart.outline.expect
index 8d87bf0..16d0055 100644
--- a/pkg/front_end/testcases/qualified.dart.outline.expect
+++ b/pkg/front_end/testcases/qualified.dart.outline.expect
@@ -22,7 +22,7 @@
constructor a() → void
;
static factory b<T extends core::Object>() → self::C<self::C::b::T>
- let dynamic #redirecting_factory = lib::C::b in invalid-expression;
+ let dynamic #redirecting_factory = lib::C::b in let self::C::b::T #typeArg0 = null in invalid-expression;
}
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/qualified.dart.strong.expect b/pkg/front_end/testcases/qualified.dart.strong.expect
index 571f727..6f5c8a1 100644
--- a/pkg/front_end/testcases/qualified.dart.strong.expect
+++ b/pkg/front_end/testcases/qualified.dart.strong.expect
@@ -23,7 +23,7 @@
: super core::Object::•()
;
static factory b<T extends core::Object>() → self::C<self::C::b::T>
- let dynamic #redirecting_factory = lib::C::b in invalid-expression;
+ 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:12:3: Error: Type 'lib.Missing' not found.\n lib.Missing method() {}\n ^", "pkg/front_end/testcases/qualified.dart:11:7: Error: The type 'lib.Missing' can't be used as supertype.\nclass Bad extends lib.Missing {\n ^", "pkg/front_end/testcases/qualified.dart: Error: Couldn't find constructor 'WrongName'."]/* from null */;
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/rasta/generic_factory.dart.outline.expect b/pkg/front_end/testcases/rasta/generic_factory.dart.outline.expect
index a0a9f8c..b03c5e3 100644
--- a/pkg/front_end/testcases/rasta/generic_factory.dart.outline.expect
+++ b/pkg/front_end/testcases/rasta/generic_factory.dart.outline.expect
@@ -19,9 +19,9 @@
constructor internal() → void
;
static factory a<T extends core::Object>() → self::A<self::A::a::T>
- let dynamic #redirecting_factory = self::B::a in invalid-expression;
+ let dynamic #redirecting_factory = self::B::a in let self::A::a::T #typeArg0 = null in invalid-expression;
static factory b<T extends core::Object>() → self::A<self::A::b::T>
- let dynamic #redirecting_factory = self::B::a in invalid-expression;
+ let dynamic #redirecting_factory = self::B::a in let self::C1 #typeArg0 = null in invalid-expression;
static factory c<T extends core::Object>() → self::A<self::A::c::T>
let dynamic #redirecting_factory = "Missing" in invalid-expression;
}
@@ -30,9 +30,9 @@
constructor internal() → void
;
static factory a<S extends core::Object>() → self::B<self::B::a::S>
- let dynamic #redirecting_factory = self::C::• in invalid-expression;
+ let dynamic #redirecting_factory = self::C::• in let self::B::a::S #typeArg0 = null in invalid-expression;
static factory b<S extends core::Object>() → self::B<self::B::b::S>
- let dynamic #redirecting_factory = self::C::• in invalid-expression;
+ let dynamic #redirecting_factory = self::C::• in let self::C2 #typeArg0 = null in invalid-expression;
}
class C<U extends core::Object> extends self::B<self::C::U> {
constructor •() → void
diff --git a/pkg/front_end/testcases/redirecting_factory.dart.outline.expect b/pkg/front_end/testcases/redirecting_factory.dart.outline.expect
index ae9d4d5..4a460e9 100644
--- a/pkg/front_end/testcases/redirecting_factory.dart.outline.expect
+++ b/pkg/front_end/testcases/redirecting_factory.dart.outline.expect
@@ -6,12 +6,12 @@
static field dynamic _redirecting# = <dynamic>[self::FooBase::•];
abstract get x() → core::int;
static factory •<Tf extends core::Object>(core::int x) → self::FooBase<self::FooBase::•::Tf>
- let dynamic #redirecting_factory = self::Foo::• in invalid-expression;
+ let dynamic #redirecting_factory = self::Foo::• in let self::FooBase::•::Tf #typeArg0 = null in invalid-expression;
}
abstract class Foo<T extends core::Object> extends core::Object implements self::FooBase<dynamic> {
static field dynamic _redirecting# = <dynamic>[self::Foo::•];
static factory •<T extends core::Object>(core::int x) → self::Foo<self::Foo::•::T>
- let dynamic #redirecting_factory = self::Bar::• in invalid-expression;
+ let dynamic #redirecting_factory = self::Bar::• in let core::String #typeArg0 = null in let self::Foo::•::T #typeArg1 = null in invalid-expression;
}
class Bar<Sb extends core::Object, Tb extends core::Object> extends core::Object implements self::Foo<self::Bar::Tb> {
field core::int x;
@@ -27,12 +27,12 @@
class SimpleCase<A extends core::Object, B extends core::Object> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::SimpleCase::•];
static factory •<A extends core::Object, B extends core::Object>() → self::SimpleCase<self::SimpleCase::•::A, self::SimpleCase::•::B>
- let dynamic #redirecting_factory = self::SimpleCaseImpl::• in invalid-expression;
+ let dynamic #redirecting_factory = self::SimpleCaseImpl::• in let self::SimpleCase::•::A #typeArg0 = null in let self::SimpleCase::•::B #typeArg1 = null in invalid-expression;
}
class SimpleCaseImpl<Ai extends core::Object, Bi extends core::Object> extends core::Object implements self::SimpleCase<self::SimpleCaseImpl::Ai, self::SimpleCaseImpl::Bi> {
static field dynamic _redirecting# = <dynamic>[self::SimpleCaseImpl::•];
static factory •<Ai extends core::Object, Bi extends core::Object>() → self::SimpleCaseImpl<self::SimpleCaseImpl::•::Ai, self::SimpleCaseImpl::•::Bi>
- let dynamic #redirecting_factory = self::SimpleCaseImpl2::• in invalid-expression;
+ let dynamic #redirecting_factory = self::SimpleCaseImpl2::• in let self::SimpleCaseImpl::•::Ai #typeArg0 = null in let self::SimpleCaseImpl::•::Bi #typeArg1 = null in invalid-expression;
}
class SimpleCaseImpl2<Ai2 extends core::Object, Bi2 extends core::Object> extends core::Object implements self::SimpleCaseImpl<self::SimpleCaseImpl2::Ai2, self::SimpleCaseImpl2::Bi2> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/redirection_chain_type_arguments.dart b/pkg/front_end/testcases/redirection_chain_type_arguments.dart
new file mode 100644
index 0000000..57d54c1
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_chain_type_arguments.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+// The test checks that type arguments of the target of redirection factory
+// constructors are preserved throughout the chain of redirections.
+
+import 'package:expect/expect.dart';
+
+class A<T> {
+ factory A() = B<T, num>;
+ A.empty();
+}
+
+class B<U, W> extends A<U> {
+ factory B() = C<U, W, String>;
+ B.empty() : super.empty();
+}
+
+class C<V, S, R> extends B<V, S> {
+ C() : super.empty();
+ toString() => "${V},${S},${R}";
+}
+
+main() {
+ Expect.equals("${new A<int>()}", "int,num,String");
+}
diff --git a/pkg/front_end/testcases/redirection_chain_type_arguments.dart.direct.expect b/pkg/front_end/testcases/redirection_chain_type_arguments.dart.direct.expect
new file mode 100644
index 0000000..610a217
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_chain_type_arguments.dart.direct.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+class A<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::A::•];
+ constructor empty() → void
+ : super core::Object::•()
+ ;
+ static factory •<T extends core::Object>() → self::A<self::A::•::T>
+ let dynamic #redirecting_factory = self::B::• in let self::A::•::T #typeArg0 = null in let core::num #typeArg1 = null in invalid-expression;
+}
+class B<U extends core::Object, W extends core::Object> extends self::A<self::B::U> {
+ static field dynamic _redirecting# = <dynamic>[self::B::•];
+ constructor empty() → void
+ : super self::A::empty()
+ ;
+ static factory •<U extends core::Object, W extends core::Object>() → self::B<self::B::•::U, self::B::•::W>
+ let dynamic #redirecting_factory = self::C::• in let self::B::•::U #typeArg0 = null in let self::B::•::W #typeArg1 = null in let core::String #typeArg2 = null in invalid-expression;
+}
+class C<V extends core::Object, S extends core::Object, R extends core::Object> extends self::B<self::C::V, self::C::S> {
+ constructor •() → void
+ : super self::B::empty()
+ ;
+ method toString() → dynamic
+ return "${self::C::V},${self::C::S},${self::C::R}";
+}
+static method main() → dynamic {
+ exp::Expect::equals("${new self::C::•<core::int, core::num, core::String>()}", "int,num,String");
+}
diff --git a/pkg/front_end/testcases/redirection_chain_type_arguments.dart.outline.expect b/pkg/front_end/testcases/redirection_chain_type_arguments.dart.outline.expect
new file mode 100644
index 0000000..1b274eb
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_chain_type_arguments.dart.outline.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::A::•];
+ constructor empty() → void
+ ;
+ static factory •<T extends core::Object>() → self::A<self::A::•::T>
+ let dynamic #redirecting_factory = self::B::• in let self::A::•::T #typeArg0 = null in let core::num #typeArg1 = null in invalid-expression;
+}
+class B<U extends core::Object, W extends core::Object> extends self::A<self::B::U> {
+ static field dynamic _redirecting# = <dynamic>[self::B::•];
+ constructor empty() → void
+ ;
+ static factory •<U extends core::Object, W extends core::Object>() → self::B<self::B::•::U, self::B::•::W>
+ let dynamic #redirecting_factory = self::C::• in let self::B::•::U #typeArg0 = null in let self::B::•::W #typeArg1 = null in let core::String #typeArg2 = null in invalid-expression;
+}
+class C<V extends core::Object, S extends core::Object, R extends core::Object> extends self::B<self::C::V, self::C::S> {
+ constructor •() → void
+ ;
+ method toString() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/redirection_chain_type_arguments.dart.strong.expect b/pkg/front_end/testcases/redirection_chain_type_arguments.dart.strong.expect
new file mode 100644
index 0000000..bf12ef7
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_chain_type_arguments.dart.strong.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+class A<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::A::•];
+ constructor empty() → void
+ : super core::Object::•()
+ ;
+ static factory •<T extends core::Object>() → self::A<self::A::•::T>
+ let dynamic #redirecting_factory = self::B::• in let self::A::•::T #typeArg0 = null in let core::num #typeArg1 = null in invalid-expression;
+}
+class B<U extends core::Object, W extends core::Object> extends self::A<self::B::U> {
+ static field dynamic _redirecting# = <dynamic>[self::B::•];
+ constructor empty() → void
+ : super self::A::empty()
+ ;
+ static factory •<U extends core::Object, W extends core::Object>() → self::B<self::B::•::U, self::B::•::W>
+ let dynamic #redirecting_factory = self::C::• in let self::B::•::U #typeArg0 = null in let self::B::•::W #typeArg1 = null in let core::String #typeArg2 = null in invalid-expression;
+}
+class C<V extends core::Object, S extends core::Object, R extends core::Object> extends self::B<self::C::V, self::C::S> {
+ constructor •() → void
+ : super self::B::empty()
+ ;
+ method toString() → core::String
+ return "${self::C::V},${self::C::S},${self::C::R}";
+}
+static method main() → dynamic {
+ exp::Expect::equals("${new self::C::•<core::int, core::num, core::String>()}", "int,num,String");
+}
diff --git a/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart b/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart
new file mode 100644
index 0000000..9389f2f
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+// The test checks that dependencies of type arguments of targets of redirecting
+// factories on type parameters of the corresponding classes are respected in
+// the resulting type arguments of redirecting factories invocations.
+
+import 'package:expect/expect.dart';
+
+abstract class A<T> {
+ factory A() = B<T, List<T>>;
+ A.empty();
+}
+
+abstract class B<U, W> extends A<U> {
+ factory B() = C<U, W, Map<U, W>>;
+ B.empty() : super.empty();
+}
+
+class C<V, S, R> extends B<V, S> {
+ C() : super.empty();
+ toString() => "${V},${S},${R}";
+}
+
+main() {
+ Expect.equals("${new A<int>()}", "int,List<int>,Map<int, List<int>>");
+}
diff --git a/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart.direct.expect b/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart.direct.expect
new file mode 100644
index 0000000..4c2bb71
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart.direct.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+abstract class A<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::A::•];
+ constructor empty() → void
+ : super core::Object::•()
+ ;
+ static factory •<T extends core::Object>() → self::A<self::A::•::T>
+ let dynamic #redirecting_factory = self::B::• in let self::A::•::T #typeArg0 = null in let core::List<self::A::•::T> #typeArg1 = null in invalid-expression;
+}
+abstract class B<U extends core::Object, W extends core::Object> extends self::A<self::B::U> {
+ static field dynamic _redirecting# = <dynamic>[self::B::•];
+ constructor empty() → void
+ : super self::A::empty()
+ ;
+ static factory •<U extends core::Object, W extends core::Object>() → self::B<self::B::•::U, self::B::•::W>
+ let dynamic #redirecting_factory = self::C::• in let self::B::•::U #typeArg0 = null in let self::B::•::W #typeArg1 = null in let core::Map<self::B::•::U, self::B::•::W> #typeArg2 = null in invalid-expression;
+}
+class C<V extends core::Object, S extends core::Object, R extends core::Object> extends self::B<self::C::V, self::C::S> {
+ constructor •() → void
+ : super self::B::empty()
+ ;
+ method toString() → dynamic
+ return "${self::C::V},${self::C::S},${self::C::R}";
+}
+static method main() → dynamic {
+ exp::Expect::equals("${new self::C::•<core::int, core::List<core::int>, core::Map<core::int, core::List<core::int>>>()}", "int,List<int>,Map<int, List<int>>");
+}
diff --git a/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart.outline.expect b/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart.outline.expect
new file mode 100644
index 0000000..7e4faab
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart.outline.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class A<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::A::•];
+ constructor empty() → void
+ ;
+ static factory •<T extends core::Object>() → self::A<self::A::•::T>
+ let dynamic #redirecting_factory = self::B::• in let self::A::•::T #typeArg0 = null in let core::List<self::A::•::T> #typeArg1 = null in invalid-expression;
+}
+abstract class B<U extends core::Object, W extends core::Object> extends self::A<self::B::U> {
+ static field dynamic _redirecting# = <dynamic>[self::B::•];
+ constructor empty() → void
+ ;
+ static factory •<U extends core::Object, W extends core::Object>() → self::B<self::B::•::U, self::B::•::W>
+ let dynamic #redirecting_factory = self::C::• in let self::B::•::U #typeArg0 = null in let self::B::•::W #typeArg1 = null in let core::Map<self::B::•::U, self::B::•::W> #typeArg2 = null in invalid-expression;
+}
+class C<V extends core::Object, S extends core::Object, R extends core::Object> extends self::B<self::C::V, self::C::S> {
+ constructor •() → void
+ ;
+ method toString() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart.strong.expect b/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart.strong.expect
new file mode 100644
index 0000000..a08282c
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_chain_type_arguments_subst.dart.strong.expect
@@ -0,0 +1,31 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+abstract class A<T extends core::Object> extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::A::•];
+ constructor empty() → void
+ : super core::Object::•()
+ ;
+ static factory •<T extends core::Object>() → self::A<self::A::•::T>
+ let dynamic #redirecting_factory = self::B::• in let self::A::•::T #typeArg0 = null in let core::List<self::A::•::T> #typeArg1 = null in invalid-expression;
+}
+abstract class B<U extends core::Object, W extends core::Object> extends self::A<self::B::U> {
+ static field dynamic _redirecting# = <dynamic>[self::B::•];
+ constructor empty() → void
+ : super self::A::empty()
+ ;
+ static factory •<U extends core::Object, W extends core::Object>() → self::B<self::B::•::U, self::B::•::W>
+ let dynamic #redirecting_factory = self::C::• in let self::B::•::U #typeArg0 = null in let self::B::•::W #typeArg1 = null in let core::Map<self::B::•::U, self::B::•::W> #typeArg2 = null in invalid-expression;
+}
+class C<V extends core::Object, S extends core::Object, R extends core::Object> extends self::B<self::C::V, self::C::S> {
+ constructor •() → void
+ : super self::B::empty()
+ ;
+ method toString() → core::String
+ return "${self::C::V},${self::C::S},${self::C::R}";
+}
+static method main() → dynamic {
+ exp::Expect::equals("${new self::C::•<core::int, core::List<core::int>, core::Map<core::int, core::List<core::int>>>()}", "int,List<int>,Map<int, List<int>>");
+}
diff --git a/pkg/front_end/testcases/redirection_type_arguments.dart b/pkg/front_end/testcases/redirection_type_arguments.dart
new file mode 100644
index 0000000..043daa1
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_type_arguments.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+// The test checks that type arguments of the target of redirection factory
+// constructors are preserved.
+
+import 'package:expect/expect.dart';
+
+class A {
+ const factory A() = B<String>;
+ const A.empty();
+}
+
+class B<T> extends A {
+ const B() : super.empty();
+
+ toString() => '${T}';
+}
+
+void main() {
+ Expect.equals("${const A()}", "String");
+}
diff --git a/pkg/front_end/testcases/redirection_type_arguments.dart.direct.expect b/pkg/front_end/testcases/redirection_type_arguments.dart.direct.expect
new file mode 100644
index 0000000..8a13842
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_type_arguments.dart.direct.expect
@@ -0,0 +1,23 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+class A extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::A::•];
+ const constructor empty() → void
+ : super core::Object::•()
+ ;
+ static factory •() → self::A
+ let dynamic #redirecting_factory = self::B::• in let core::String #typeArg0 = null in invalid-expression;
+}
+class B<T extends core::Object> extends self::A {
+ const constructor •() → void
+ : super self::A::empty()
+ ;
+ method toString() → dynamic
+ return "${self::B::T}";
+}
+static method main() → void {
+ exp::Expect::equals("${const self::B::•<core::String>()}", "String");
+}
diff --git a/pkg/front_end/testcases/redirection_type_arguments.dart.outline.expect b/pkg/front_end/testcases/redirection_type_arguments.dart.outline.expect
new file mode 100644
index 0000000..3d5f4a4
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_type_arguments.dart.outline.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::A::•];
+ const constructor empty() → void
+ ;
+ static factory •() → self::A
+ let dynamic #redirecting_factory = self::B::• in let core::String #typeArg0 = null in invalid-expression;
+}
+class B<T extends core::Object> extends self::A {
+ const constructor •() → void
+ ;
+ method toString() → dynamic
+ ;
+}
+static method main() → void
+ ;
diff --git a/pkg/front_end/testcases/redirection_type_arguments.dart.strong.expect b/pkg/front_end/testcases/redirection_type_arguments.dart.strong.expect
new file mode 100644
index 0000000..1ded566
--- /dev/null
+++ b/pkg/front_end/testcases/redirection_type_arguments.dart.strong.expect
@@ -0,0 +1,23 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+class A extends core::Object {
+ static field dynamic _redirecting# = <dynamic>[self::A::•];
+ const constructor empty() → void
+ : super core::Object::•()
+ ;
+ static factory •() → self::A
+ let dynamic #redirecting_factory = self::B::• in let core::String #typeArg0 = null in invalid-expression;
+}
+class B<T extends core::Object> extends self::A {
+ const constructor •() → void
+ : super self::A::empty()
+ ;
+ method toString() → core::String
+ return "${self::B::T}";
+}
+static method main() → void {
+ exp::Expect::equals("${const self::B::•<core::String>()}", "String");
+}
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart
new file mode 100644
index 0000000..1ea9483
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=checks*/
+library test;
+
+class C {
+ void call() {}
+}
+
+main() {
+ void Function() x = new C();
+}
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.direct.expect b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.direct.expect
new file mode 100644
index 0000000..7108626
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.direct.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call() → void {}
+}
+static method main() → dynamic {
+ () → void x = new self::C::•();
+}
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.outline.expect b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.outline.expect
new file mode 100644
index 0000000..544b511
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.outline.expect
@@ -0,0 +1,12 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method call() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.strong.expect
new file mode 100644
index 0000000..c90556c
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.strong.expect
@@ -0,0 +1,13 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call() → void {}
+}
+static method main() → dynamic {
+ () → void x = new self::C::•().{self::C::call};
+}
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart
new file mode 100644
index 0000000..b2320f9
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=checks*/
+library test;
+
+import 'dart:async';
+
+class C {
+ void call() {}
+}
+
+main() {
+ FutureOr<void Function()> x = new C();
+}
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.direct.expect b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.direct.expect
new file mode 100644
index 0000000..3c40128
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.direct.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call() → void {}
+}
+static method main() → dynamic {
+ asy::FutureOr<() → void> x = new self::C::•();
+}
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.outline.expect b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.outline.expect
new file mode 100644
index 0000000..544b511
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.outline.expect
@@ -0,0 +1,12 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method call() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.strong.expect
new file mode 100644
index 0000000..6dceb86
--- /dev/null
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.strong.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call() → void {}
+}
+static method main() → dynamic {
+ asy::FutureOr<() → void> x = new self::C::•().{self::C::call};
+}
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index cf9ddc8..91b818e 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -56,6 +56,8 @@
redirecting_factory_typeargs_test: Fail # Missing support for RedirectingFactoryConstructor.
redirecting_factory_typeparam_test: Fail # Missing support for RedirectingFactoryConstructor.
redirecting_factory_typeparambounds_test: Fail # Missing support for RedirectingFactoryConstructor.
+redirection_chain_type_arguments: Fail # Issue 32130
+redirection_chain_type_arguments_subst: Fail # Issue 32130
statements: Fail
stringliteral: Fail
super_rasta_copy: TypeCheckError
@@ -99,6 +101,10 @@
inference/infer_types_on_generic_instantiations_infer: TypeCheckError
inference/instantiate_tearoff_of_call: Fail # Issue #31746
inference/instantiate_to_bounds_generic_has_bound_defined_after transform: RuntimeError
+inference/mixin_inference_outwards_3: TypeCheckError
+inference/mixin_inference_outwards_4: TypeCheckError
+inference/mixin_inference_unification_1: TypeCheckError
+inference/mixin_inference_unification_2: TypeCheckError
inference/unresolved_super: TypeCheckError
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1: Fail # Issue #25824
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2: Fail # Issue #25824
diff --git a/pkg/front_end/tool/_fasta/generate_messages.dart b/pkg/front_end/tool/_fasta/generate_messages.dart
index f7977c4..485eaf5 100644
--- a/pkg/front_end/tool/_fasta/generate_messages.dart
+++ b/pkg/front_end/tool/_fasta/generate_messages.dart
@@ -25,14 +25,14 @@
StringBuffer sb = new StringBuffer();
sb.writeln("""
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS 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.
// NOTE: THIS FILE IS GENERATED. DO NOT EDIT.
//
// Instead modify 'pkg/front_end/messages.yaml' and run
-// 'pkg/front_end/tool/_fasta/generate_messages.dart' to update.
+// 'pkg/front_end/tool/fasta generate-messages' to update.
part of fasta.codes;
""");
diff --git a/pkg/kernel/lib/class_hierarchy.dart b/pkg/kernel/lib/class_hierarchy.dart
index 53ec37b..0df34ed 100644
--- a/pkg/kernel/lib/class_hierarchy.dart
+++ b/pkg/kernel/lib/class_hierarchy.dart
@@ -14,12 +14,17 @@
typedef HandleAmbiguousSupertypes = void Function(Class, Supertype, Supertype);
+abstract class MixinInferrer {
+ void infer(ClassHierarchy hierarchy, Class classNode);
+}
+
/// Interface for answering various subclassing queries.
/// TODO(scheglov) Several methods are not used, or used only in tests.
/// Check if these methods are not useful and should be removed .
abstract class ClassHierarchy {
factory ClassHierarchy(Program program,
- {HandleAmbiguousSupertypes onAmbiguousSupertypes}) {
+ {HandleAmbiguousSupertypes onAmbiguousSupertypes,
+ MixinInferrer mixinInferrer}) {
int numberOfClasses = 0;
for (var library in program.libraries) {
numberOfClasses += library.classes.length;
@@ -32,7 +37,7 @@
};
return new ClosedWorldClassHierarchy._internal(
program, numberOfClasses, onAmbiguousSupertypes)
- .._initialize();
+ .._initialize(mixinInferrer);
}
/// Use [ClassHierarchy] factory instead.
@@ -90,6 +95,11 @@
/// or `null` if [type] does not implement [superclass] at all.
InterfaceType getTypeAsInstanceOf(InterfaceType type, Class superclass);
+ /// Returns the instantiation of [superclass] that is implemented by [type],
+ /// or `null` if [type] does not implement [superclass]. [superclass] must
+ /// be a generic class.
+ Supertype asInstantiationOf(Supertype type, Class superclass);
+
/// Returns the instance member that would respond to a dynamic dispatch of
/// [name] to an instance of [class_], or `null` if no such member exists.
///
@@ -682,11 +692,25 @@
onAmbiguousSupertypes: _onAmbiguousSupertypes);
}
- void _initialize() {
+ @override
+ Supertype asInstantiationOf(Supertype type, Class superclass) {
+ // This is similar to getTypeAsInstanceOf, except that it assumes that
+ // superclass is a generic class. It thus does not rely on being able
+ // to answer isSubtypeOf queries and so can be used before we have built
+ // the intervals needed for those queries.
+ assert(superclass.typeParameters.isNotEmpty);
+ if (type.classNode == superclass) {
+ return superclass.asThisSupertype;
+ }
+ var map = _infoFor[type.classNode]?.genericSuperTypes;
+ return map == null ? null : map[superclass]?.first;
+ }
+
+ void _initialize(MixinInferrer mixinInferrer) {
// Build the class ordering based on a topological sort.
for (var library in _program.libraries) {
for (var classNode in library.classes) {
- _topologicalSortVisit(classNode);
+ _topologicalSortVisit(classNode, mixinInferrer);
}
}
@@ -741,7 +765,7 @@
/// Returns the depth of the visited class (the number of steps in the longest
/// inheritance path to the root class).
int _topSortIndex = 0;
- int _topologicalSortVisit(Class classNode) {
+ int _topologicalSortVisit(Class classNode, MixinInferrer mixinInferrer) {
var info = _infoFor[classNode];
if (info != null) {
if (info.isBeingVisited) {
@@ -753,17 +777,21 @@
_infoFor[classNode] = info = new _ClassInfo(classNode);
info.isBeingVisited = true;
if (classNode.supertype != null) {
- superDepth =
- max(superDepth, _topologicalSortVisit(classNode.supertype.classNode));
+ superDepth = max(superDepth,
+ _topologicalSortVisit(classNode.supertype.classNode, mixinInferrer));
_recordSuperTypes(info, classNode.supertype);
}
if (classNode.mixedInType != null) {
superDepth = max(
- superDepth, _topologicalSortVisit(classNode.mixedInType.classNode));
+ superDepth,
+ _topologicalSortVisit(
+ classNode.mixedInType.classNode, mixinInferrer));
+ if (mixinInferrer != null) mixinInferrer.infer(this, classNode);
_recordSuperTypes(info, classNode.mixedInType);
}
for (var supertype in classNode.implementedTypes) {
- superDepth = max(superDepth, _topologicalSortVisit(supertype.classNode));
+ superDepth = max(superDepth,
+ _topologicalSortVisit(supertype.classNode, mixinInferrer));
_recordSuperTypes(info, supertype);
}
_buildDeclaredMembers(classNode, info);
diff --git a/pkg/kernel/lib/error_formatter.dart b/pkg/kernel/lib/error_formatter.dart
index 6b1e5dc..cdddaba 100644
--- a/pkg/kernel/lib/error_formatter.dart
+++ b/pkg/kernel/lib/error_formatter.dart
@@ -30,7 +30,9 @@
@override
void reportFailure(TreeNode where, String message) {
- final context = _findEnclosingMember(where);
+ final dynamic context = where is Class || where is Library
+ ? where
+ : _findEnclosingMember(where);
String sourceLocation = '<unknown source>';
String sourceLine = null;
@@ -57,12 +59,13 @@
// Find the name of the enclosing member.
var name = "", body = context;
- if (context is Procedure || context is Constructor) {
+ if (context is Class || context is Library) {
+ name = context.name;
+ } else if (context is Procedure || context is Constructor) {
final parent = context.parent;
final parentName =
parent is Class ? parent.name : (parent as Library).name;
name = "${parentName}::${context.name.name}";
- body = context;
} else {
final field = context as Field;
if (where is Field) {
@@ -95,18 +98,8 @@
failures.add(failure);
}
- static Uri _fileUriOf(Member context) {
- if (context is Procedure) {
- return context.fileUri;
- } else if (context is Field) {
- return context.fileUri;
- } else {
- final klass = context.enclosingClass;
- if (klass != null) {
- return klass.fileUri;
- }
- return context.enclosingLibrary.fileUri;
- }
+ static Uri _fileUriOf(FileUriNode node) {
+ return node.fileUri;
}
static String _realign(String str, [String prefix = '| ']) =>
@@ -157,7 +150,6 @@
/// representation of the [highlight] node.
static String stringifyContainingLines(Node node, Node highlight) {
if (node == highlight) {
- assert(node is Member);
final firstLine = debugNodeToString(node).split('\n').first;
return "${kHighlightStart}${firstLine}${kHighlightEnd}";
}
diff --git a/pkg/kernel/lib/naive_type_checker.dart b/pkg/kernel/lib/naive_type_checker.dart
index c1716e4..4450bc5f 100644
--- a/pkg/kernel/lib/naive_type_checker.dart
+++ b/pkg/kernel/lib/naive_type_checker.dart
@@ -19,7 +19,14 @@
StrongModeTypeChecker(FailureListener failures, Program program,
{bool ignoreSdk: false})
- : this._(failures, new CoreTypes(program), new ClassHierarchy(program),
+ : this._(
+ failures,
+ new CoreTypes(program),
+ new ClassHierarchy(program,
+ onAmbiguousSupertypes: (Class cls, Supertype s0, Supertype s1) {
+ failures.reportFailure(
+ cls, "$cls can't implement both $s1 and $s1");
+ }),
ignoreSdk);
StrongModeTypeChecker._(this.failures, CoreTypes coreTypes,
diff --git a/pkg/kernel/lib/src/incremental_class_hierarchy.dart b/pkg/kernel/lib/src/incremental_class_hierarchy.dart
index 76c26da..ba22bce 100644
--- a/pkg/kernel/lib/src/incremental_class_hierarchy.dart
+++ b/pkg/kernel/lib/src/incremental_class_hierarchy.dart
@@ -226,6 +226,11 @@
}
@override
+ Supertype asInstantiationOf(Supertype type, Class superclass) {
+ throw new UnimplementedError();
+ }
+
+ @override
InterfaceType getTypeAsInstanceOf(InterfaceType type, Class superclass) {
Supertype castedType = getClassAsInstanceOf(type.classNode, superclass);
if (castedType == null) return null;
diff --git a/pkg/kernel/pubspec.yaml b/pkg/kernel/pubspec.yaml
index c3ca880..f4f5728 100644
--- a/pkg/kernel/pubspec.yaml
+++ b/pkg/kernel/pubspec.yaml
@@ -1,5 +1,5 @@
name: kernel
-version: 0.3.0-alpha.9
+version: 0.3.0-alpha.10
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.9
+ front_end: 0.1.0-alpha.10
test: ^0.12.15+6
stack_trace: ^1.6.6
ansicolor: ^0.0.9
diff --git a/pkg/vm/lib/transformations/no_dynamic_invocations_annotator.dart b/pkg/vm/lib/transformations/no_dynamic_invocations_annotator.dart
index a5db2e7..27d9a4b 100644
--- a/pkg/vm/lib/transformations/no_dynamic_invocations_annotator.dart
+++ b/pkg/vm/lib/transformations/no_dynamic_invocations_annotator.dart
@@ -24,6 +24,10 @@
Selector(this.action, this.target);
+ Selector.invoke(Name target) : this(Action.invoke, target);
+ Selector.get(Name target) : this(Action.get, target);
+ Selector.set(Name target) : this(Action.set, target);
+
bool operator ==(other) {
return other is Selector &&
other.action == this.action &&
@@ -46,7 +50,7 @@
}
}
-class NoDynamicInvocationsAnnotator extends RecursiveVisitor<Null> {
+class NoDynamicInvocationsAnnotator {
final Set<Selector> _dynamicSelectors;
final ProcedureAttributesMetadataRepository _metadata;
@@ -56,7 +60,35 @@
program.addMetadataRepository(_metadata);
}
- @override
+ visitProgram(Program program) {
+ for (var library in program.libraries) {
+ for (var klass in library.classes) {
+ visitClass(klass);
+ }
+ }
+ }
+
+ visitClass(Class node) {
+ for (var member in node.members) {
+ if (member is Procedure) {
+ visitProcedure(member);
+ } else if (member is Field) {
+ visitField(member);
+ }
+ }
+ }
+
+ visitField(Field node) {
+ if (node.isStatic || node.name.name == 'call') {
+ return;
+ }
+
+ if (!_dynamicSelectors.contains(new Selector.set(node.name))) {
+ _metadata.mapping[node] =
+ const ProcedureAttributesMetadata.noDynamicInvocations();
+ }
+ }
+
visitProcedure(Procedure node) {
if (node.isStatic || node.name.name == 'call') {
return;
@@ -64,9 +96,9 @@
Selector selector;
if (node.kind == ProcedureKind.Method) {
- selector = new Selector(Action.invoke, node.name);
+ selector = new Selector.invoke(node.name);
} else if (node.kind == ProcedureKind.Setter) {
- selector = new Selector(Action.set, node.name);
+ selector = new Selector.set(node.name);
} else {
return;
}
@@ -92,7 +124,7 @@
super.visitMethodInvocation(node);
if (node.dispatchCategory == DispatchCategory.dynamicDispatch) {
- dynamicSelectors.add(new Selector(Action.invoke, node.name));
+ dynamicSelectors.add(new Selector.invoke(node.name));
}
}
@@ -101,7 +133,7 @@
super.visitPropertyGet(node);
if (node.dispatchCategory == DispatchCategory.dynamicDispatch) {
- dynamicSelectors.add(new Selector(Action.get, node.name));
+ dynamicSelectors.add(new Selector.get(node.name));
}
}
@@ -110,7 +142,7 @@
super.visitPropertySet(node);
if (node.dispatchCategory == DispatchCategory.dynamicDispatch) {
- dynamicSelectors.add(new Selector(Action.set, node.name));
+ dynamicSelectors.add(new Selector.set(node.name));
}
}
}
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 0b31bf7..08fad5f 100644
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -1030,6 +1030,18 @@
intptr_t* script_snapshot_size);
/**
+ * Returns true if snapshot_buffer contains a Dart2 snapshot.
+ *
+ * \param snapshot_buffer Pointer to a buffer that contains the snapshot
+ * that needs to be checked.
+ * \param snapshot_size Size of the buffer.
+ *
+ * \returns true if the snapshot is a Dart2 snapshot, false otherwise.
+ */
+DART_EXPORT bool Dart_IsDart2Snapshot(uint8_t* snapshot_buffer,
+ intptr_t snapshot_size);
+
+/**
* Schedules an interrupt for the specified isolate.
*
* When the isolate is interrupted, the isolate interrupt callback
diff --git a/runtime/lib/bigint_patch.dart b/runtime/lib/bigint_patch.dart
index 0eab071..05b37a1 100644
--- a/runtime/lib/bigint_patch.dart
+++ b/runtime/lib/bigint_patch.dart
@@ -68,24 +68,30 @@
*/
class _BigIntImpl implements BigInt {
// Bits per digit.
- static const int _digitBits = 16;
+ static const int _digitBits = 32;
static const int _digitBase = 1 << _digitBits;
static const int _digitMask = (1 << _digitBits) - 1;
+ // Bits per half digit.
+ static const int _halfDigitBits = _digitBits >> 1;
+ static const int _halfDigitMask = (1 << _halfDigitBits) - 1;
+
static final _BigIntImpl zero = new _BigIntImpl._fromInt(0);
static final _BigIntImpl one = new _BigIntImpl._fromInt(1);
static final _BigIntImpl two = new _BigIntImpl._fromInt(2);
static final _BigIntImpl _minusOne = -one;
- static final _BigIntImpl _bigInt10000 = new _BigIntImpl._fromInt(10000);
+ static final _BigIntImpl _oneBillion = new _BigIntImpl._fromInt(1000000000);
+ static const int _minInt = -0x8000000000000000;
+ static const int _maxInt = 0x7fffffffffffffff;
// Result cache for last _divRem call.
// Result cache for last _divRem call.
- static Uint16List _lastDividendDigits;
+ static Uint32List _lastDividendDigits;
static int _lastDividendUsed;
- static Uint16List _lastDivisorDigits;
+ static Uint32List _lastDivisorDigits;
static int _lastDivisorUsed;
- static Uint16List _lastQuoRemDigits;
+ static Uint32List _lastQuoRemDigits;
static int _lastQuoRemUsed;
static int _lastRemUsed;
static int _lastRem_nsh;
@@ -98,11 +104,11 @@
/// The least significant digit is in slot 0.
/// The list may have more digits than needed. That is, `_digits.length` may
/// be strictly greater than `_used`.
- final Uint16List _digits;
+ final Uint32List _digits;
/// The number of used entries in [_digits].
///
- /// To avoid reallocating [Uint16List]s, lists that are too big are not
+ /// To avoid reallocating [Uint32List]s, lists that are too big are not
/// replaced.
final int _used;
@@ -145,15 +151,15 @@
int part = 0;
_BigIntImpl result = zero;
- // Read in the source 4 digits at a time.
+ // Read in the source 9 digits at a time.
// The first part may have a few leading virtual '0's to make the remaining
- // parts all have exactly 4 digits.
- int digitInPartCount = 4 - source.length.remainder(4);
- if (digitInPartCount == 4) digitInPartCount = 0;
+ // parts all have exactly 9 digits.
+ int digitInPartCount = 9 - source.length.remainder(9);
+ if (digitInPartCount == 9) digitInPartCount = 0;
for (int i = 0; i < source.length; i++) {
part = part * 10 + source.codeUnitAt(i) - _0;
- if (++digitInPartCount == 4) {
- result = result * _bigInt10000 + new _BigIntImpl._fromInt(part);
+ if (++digitInPartCount == 9) {
+ result = result * _oneBillion + new _BigIntImpl._fromInt(part);
part = 0;
digitInPartCount = 0;
}
@@ -193,8 +199,9 @@
static _BigIntImpl _parseHex(String source, int startPos, bool isNegative) {
int hexDigitsPerChunk = _digitBits ~/ 4;
int sourceLength = source.length - startPos;
- int chunkCount = (sourceLength / hexDigitsPerChunk).ceil();
- var digits = new Uint16List(chunkCount);
+ int chunkCount =
+ (sourceLength + hexDigitsPerChunk - 1) ~/ hexDigitsPerChunk;
+ var digits = new Uint32List(chunkCount);
int lastDigitLength = sourceLength - (chunkCount - 1) * hexDigitsPerChunk;
int digitIndex = digits.length - 1;
@@ -209,7 +216,7 @@
while (i < source.length) {
chunk = 0;
- for (int j = 0; j < 4; j++) {
+ for (int j = 0; j < hexDigitsPerChunk; j++) {
var digitValue = _codeUnitToRadixValue(source.codeUnitAt(i++));
if (digitValue >= 16) return null;
chunk = chunk * 16 + digitValue;
@@ -289,7 +296,7 @@
}
/// Finds the amount significant digits in the provided [digits] array.
- static int _normalize(int used, Uint16List digits) {
+ static int _normalize(int used, Uint32List digits) {
while (used > 0 && digits[used - 1] == 0) used--;
return used;
}
@@ -297,7 +304,7 @@
/// Factory returning an instance initialized with the given field values.
/// If the [digits] array contains leading 0s, the [used] value is adjusted
/// accordingly. The [digits] array is not modified.
- _BigIntImpl._(bool isNegative, int used, Uint16List digits)
+ _BigIntImpl._(bool isNegative, int used, Uint32List digits)
: this._normalized(isNegative, _normalize(used, digits), digits);
_BigIntImpl._normalized(bool isNegative, this._used, this._digits)
@@ -309,9 +316,9 @@
/// Allocates an array of the given [length] and copies the [digits] in the
/// range [from] to [to-1], starting at index 0, followed by leading zero
/// digits.
- static Uint16List _cloneDigits(
- Uint16List digits, int from, int to, int length) {
- var resultDigits = new Uint16List(length);
+ static Uint32List _cloneDigits(
+ Uint32List digits, int from, int to, int length) {
+ var resultDigits = new Uint32List(length);
var n = to - from;
for (var i = 0; i < n; i++) {
resultDigits[i] = digits[from + i];
@@ -325,8 +332,6 @@
if (value == 1) return one;
if (value == 2) return two;
- // Given this order dart2js will use the `_fromInt` for smaller value and
- // then use the bit-manipulating `_fromDouble` for all other values.
if (value.abs() < 0x100000000)
return new _BigIntImpl._fromInt(value.toInt());
if (value is double) return new _BigIntImpl._fromDouble(value);
@@ -335,39 +340,26 @@
factory _BigIntImpl._fromInt(int value) {
bool isNegative = value < 0;
+ assert(_digitBits == 32);
if (isNegative) {
// Handle the min 64-bit value differently, since its negation is not
// positive.
- // TODO(floitsch): we should use min.minValue or 0x8000000000000000 here.
- const int minInt64 = -9223372036854775807 - 1;
- if (value == minInt64) {
- var digits = new Uint16List(4);
- digits[3] = 0x8000;
- return new _BigIntImpl._(true, digits.length, digits);
+ if (value == _minInt) {
+ var digits = new Uint32List(2);
+ digits[1] = 0x80000000;
+ return new _BigIntImpl._(true, 2, digits);
}
value = -value;
}
- assert(_digitBits == 16);
if (value < _digitBase) {
- var digits = new Uint16List(1);
+ var digits = new Uint32List(1);
digits[0] = value;
- return new _BigIntImpl._(isNegative, digits.length, digits);
+ return new _BigIntImpl._(isNegative, 1, digits);
}
- if (value <= 0xFFFFFFFF) {
- var digits = new Uint16List(2);
- digits[0] = value & _digitMask;
- digits[1] = value >> _digitBits;
- return new _BigIntImpl._(isNegative, digits.length, digits);
- }
-
- var bits = value.bitLength;
- var digits = new Uint16List((bits - 1) ~/ _digitBits + 1);
- var i = 0;
- while (value != 0) {
- digits[i++] = value & _digitMask;
- value = value ~/ _digitBase;
- }
- return new _BigIntImpl._(isNegative, digits.length, digits);
+ var digits = new Uint32List(2);
+ digits[0] = value & _digitMask;
+ digits[1] = value >> _digitBits;
+ return new _BigIntImpl._(isNegative, 2, digits);
}
/// An 8-byte Uint8List we can reuse for [_fromDouble] to avoid generating
@@ -395,16 +387,16 @@
var biasedExponent = (bits[7] << 4) + (bits[6] >> 4);
var exponent = biasedExponent - exponentBias;
- assert(_digitBits == 16);
+ assert(_digitBits == 32);
// The significant bits are in 0 .. 52.
- var unshiftedDigits = new Uint16List(4);
- unshiftedDigits[0] = (bits[1] << 8) + bits[0];
- unshiftedDigits[1] = (bits[3] << 8) + bits[2];
- unshiftedDigits[2] = (bits[5] << 8) + bits[4];
+ var unshiftedDigits = new Uint32List(2);
+ unshiftedDigits[0] =
+ (bits[3] << 24) + (bits[2] << 16) + (bits[1] << 8) + bits[0];
// Don't forget to add the hidden bit.
- unshiftedDigits[3] = 0x10 | (bits[6] & 0xF);
+ unshiftedDigits[1] =
+ ((0x10 | (bits[6] & 0xF)) << 16) + (bits[5] << 8) + bits[4];
- var unshiftedBig = new _BigIntImpl._normalized(false, 4, unshiftedDigits);
+ var unshiftedBig = new _BigIntImpl._normalized(false, 2, unshiftedDigits);
_BigIntImpl absResult;
if (exponent < 0) {
absResult = unshiftedBig >> -exponent;
@@ -441,7 +433,7 @@
}
final resultUsed = used + n;
final digits = _digits;
- final resultDigits = new Uint16List(resultUsed);
+ final resultDigits = new Uint32List(resultUsed);
for (int i = used - 1; i >= 0; i--) {
resultDigits[i + n] = digits[i];
}
@@ -454,7 +446,7 @@
///
/// `resultDigits[0..resultUsed-1] = xDigits[0..xUsed-1] << n*_DIGIT_BITS`.
static int _dlShiftDigits(
- Uint16List xDigits, int xUsed, int n, Uint16List resultDigits) {
+ Uint32List xDigits, int xUsed, int n, Uint32List resultDigits) {
if (xUsed == 0) {
return 0;
}
@@ -482,7 +474,7 @@
return _isNegative ? _minusOne : zero;
}
final digits = _digits;
- final resultDigits = new Uint16List(resultUsed);
+ final resultDigits = new Uint32List(resultUsed);
for (var i = n; i < used; i++) {
resultDigits[i - n] = digits[i];
}
@@ -505,7 +497,7 @@
///
/// Does *not* clear digits below ds.
static void _lsh(
- Uint16List xDigits, int xUsed, int n, Uint16List resultDigits) {
+ Uint32List xDigits, int xUsed, int n, Uint32List resultDigits) {
final digitShift = n ~/ _digitBits;
final bitShift = n % _digitBits;
final carryBitShift = _digitBits - bitShift;
@@ -541,7 +533,7 @@
return _dlShift(digitShift);
}
var resultUsed = _used + digitShift + 1;
- var resultDigits = new Uint16List(resultUsed);
+ var resultDigits = new Uint32List(resultUsed);
_lsh(_digits, _used, shiftAmount, resultDigits);
return new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
}
@@ -549,7 +541,7 @@
// resultDigits[0..resultUsed-1] = xDigits[0..xUsed-1] << n.
// Returns resultUsed.
static int _lShiftDigits(
- Uint16List xDigits, int xUsed, int n, Uint16List resultDigits) {
+ Uint32List xDigits, int xUsed, int n, Uint32List resultDigits) {
final digitsShift = n ~/ _digitBits;
final bitShift = n % _digitBits;
if (bitShift == 0) {
@@ -569,7 +561,7 @@
// resultDigits[0..resultUsed-1] = xDigits[0..xUsed-1] >> n.
static void _rsh(
- Uint16List xDigits, int xUsed, int n, Uint16List resultDigits) {
+ Uint32List xDigits, int xUsed, int n, Uint32List resultDigits) {
final digitsShift = n ~/ _digitBits;
final bitShift = n % _digitBits;
final carryBitShift = _digitBits - bitShift;
@@ -608,7 +600,7 @@
return _isNegative ? _minusOne : zero;
}
final digits = _digits;
- final resultDigits = new Uint16List(resultUsed);
+ final resultDigits = new Uint32List(resultUsed);
_rsh(digits, used, shiftAmount, resultDigits);
final result = new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
if (_isNegative) {
@@ -655,7 +647,7 @@
/// Returns 0 if equal; a positive number if larger;
/// and a negative number if smaller.
static int _compareDigits(
- Uint16List digits, int used, Uint16List otherDigits, int otherUsed) {
+ Uint32List digits, int used, Uint32List otherDigits, int otherUsed) {
var result = used - otherUsed;
if (result == 0) {
for (int i = used - 1; i >= 0; i--) {
@@ -668,8 +660,8 @@
// resultDigits[0..used] = digits[0..used-1] + otherDigits[0..otherUsed-1].
// used >= otherUsed > 0.
- static void _absAdd(Uint16List digits, int used, Uint16List otherDigits,
- int otherUsed, Uint16List resultDigits) {
+ static void _absAdd(Uint32List digits, int used, Uint32List otherDigits,
+ int otherUsed, Uint32List resultDigits) {
assert(used >= otherUsed && otherUsed > 0);
var carry = 0;
for (var i = 0; i < otherUsed; i++) {
@@ -687,24 +679,20 @@
// resultDigits[0..used-1] = digits[0..used-1] - otherDigits[0..otherUsed-1].
// used >= otherUsed > 0.
- static void _absSub(Uint16List digits, int used, Uint16List otherDigits,
- int otherUsed, Uint16List resultDigits) {
+ static void _absSub(Uint32List digits, int used, Uint32List otherDigits,
+ int otherUsed, Uint32List resultDigits) {
assert(used >= otherUsed && otherUsed > 0);
var carry = 0;
for (var i = 0; i < otherUsed; i++) {
carry += digits[i] - otherDigits[i];
resultDigits[i] = carry & _digitMask;
- // Dart2js only supports unsigned shifts.
- // Since the carry can only be -1 or 0 use this hack.
- carry = 0 - ((carry >> _digitBits) & 1);
+ carry >>= _digitBits;
}
for (var i = otherUsed; i < used; i++) {
carry += digits[i];
resultDigits[i] = carry & _digitMask;
- // Dart2js only supports unsigned shifts.
- // Since the carry can only be -1 or 0 use this hack.
- carry = 0 - ((carry >> _digitBits) & 1);
+ carry >>= _digitBits;
}
}
@@ -723,7 +711,7 @@
return _isNegative == isNegative ? this : -this;
}
var resultUsed = used + 1;
- var resultDigits = new Uint16List(resultUsed);
+ var resultDigits = new Uint32List(resultUsed);
_absAdd(_digits, used, other._digits, otherUsed, resultDigits);
return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
}
@@ -742,7 +730,7 @@
if (otherUsed == 0) {
return _isNegative == isNegative ? this : -this;
}
- var resultDigits = new Uint16List(used);
+ var resultDigits = new Uint32List(used);
_absSub(_digits, used, other._digits, otherUsed, resultDigits);
return new _BigIntImpl._(isNegative, used, resultDigits);
}
@@ -752,7 +740,7 @@
var resultUsed = _min(_used, other._used);
var digits = _digits;
var otherDigits = other._digits;
- var resultDigits = new Uint16List(resultUsed);
+ var resultDigits = new Uint32List(resultUsed);
for (var i = 0; i < resultUsed; i++) {
resultDigits[i] = digits[i] & otherDigits[i];
}
@@ -764,7 +752,7 @@
var resultUsed = _used;
var digits = _digits;
var otherDigits = other._digits;
- var resultDigits = new Uint16List(resultUsed);
+ var resultDigits = new Uint32List(resultUsed);
var m = _min(resultUsed, other._used);
for (var i = 0; i < m; i++) {
resultDigits[i] = digits[i] & ~otherDigits[i];
@@ -782,7 +770,7 @@
var resultUsed = _max(used, otherUsed);
var digits = _digits;
var otherDigits = other._digits;
- var resultDigits = new Uint16List(resultUsed);
+ var resultDigits = new Uint32List(resultUsed);
var l, m;
if (used < otherUsed) {
l = other;
@@ -808,7 +796,7 @@
var resultUsed = _max(used, otherUsed);
var digits = _digits;
var otherDigits = other._digits;
- var resultDigits = new Uint16List(resultUsed);
+ var resultDigits = new Uint32List(resultUsed);
var l, m;
if (used < otherUsed) {
l = other;
@@ -1007,25 +995,30 @@
/// Adds the result of the multiplicand-digits * [x] to the accumulator.
///
/// Concretely: `accumulatorDigits[j..j+n] += x * m_digits[i..i+n-1]`.
- static void _mulAdd(int x, Uint16List multiplicandDigits, int i,
- Uint16List accumulatorDigits, int j, int n) {
+ static void _mulAdd(int x, Uint32List multiplicandDigits, int i,
+ Uint32List accumulatorDigits, int j, int n) {
if (x == 0) {
// No-op if x is 0.
return;
}
- int c = 0;
+ int carry = 0;
+ int xl = x & _halfDigitMask;
+ int xh = x >> _halfDigitBits;
while (--n >= 0) {
- int product = x * multiplicandDigits[i++];
- int combined = product + accumulatorDigits[j] + c;
- accumulatorDigits[j++] = combined & _digitMask;
- // Note that this works with 53 bits, as the division will not lose
- // bits.
- c = combined ~/ _digitBase;
+ int ml = multiplicandDigits[i] & _halfDigitMask;
+ int mh = multiplicandDigits[i++] >> _halfDigitBits;
+ int ph = xh * ml + mh * xl;
+ int pl = xl * ml +
+ ((ph & _halfDigitMask) << _halfDigitBits) +
+ accumulatorDigits[j] +
+ carry;
+ carry = (pl >> _digitBits) + (ph >> _halfDigitBits) + xh * mh;
+ accumulatorDigits[j++] = pl & _digitMask;
}
- while (c != 0) {
- int l = accumulatorDigits[j] + c;
+ while (carry != 0) {
+ int l = accumulatorDigits[j] + carry;
+ carry = l >> _digitBits;
accumulatorDigits[j++] = l & _digitMask;
- c = l ~/ _digitBase;
}
}
@@ -1040,7 +1033,7 @@
var resultUsed = used + otherUsed;
var digits = _digits;
var otherDigits = other._digits;
- var resultDigits = new Uint16List(resultUsed);
+ var resultDigits = new Uint32List(resultUsed);
var i = 0;
while (i < otherUsed) {
_mulAdd(otherDigits[i], digits, 0, resultDigits, i, used);
@@ -1052,8 +1045,8 @@
// r_digits[0..rUsed-1] = xDigits[0..xUsed-1]*otherDigits[0..otherUsed-1].
// Return resultUsed = xUsed + otherUsed.
- static int _mulDigits(Uint16List xDigits, int xUsed, Uint16List otherDigits,
- int otherUsed, Uint16List resultDigits) {
+ static int _mulDigits(Uint32List xDigits, int xUsed, Uint32List otherDigits,
+ int otherUsed, Uint32List resultDigits) {
var resultUsed = xUsed + otherUsed;
var i = resultUsed;
assert(resultDigits.length >= i);
@@ -1070,10 +1063,12 @@
/// Returns an estimate of `digits[i-1..i] ~/ topDigitDivisor`.
static int _estimateQuotientDigit(
- int topDigitDivisor, Uint16List digits, int i) {
+ int topDigitDivisor, Uint32List digits, int i) {
if (digits[i] == topDigitDivisor) return _digitMask;
+ // Chop off one bit, since a Mint cannot hold 2 digits.
var quotientDigit =
- (digits[i] << _digitBits | digits[i - 1]) ~/ topDigitDivisor;
+ ((digits[i] << (_digitBits - 1)) | (digits[i - 1] >> 1)) ~/
+ (topDigitDivisor >> 1);
if (quotientDigit > _digitMask) return _digitMask;
return quotientDigit;
}
@@ -1141,18 +1136,18 @@
var nsh = _digitBits - other._digits[other._used - 1].bitLength;
// Concatenated positive quotient and normalized positive remainder.
// The resultDigits can have at most one more digit than the dividend.
- Uint16List resultDigits;
+ Uint32List resultDigits;
int resultUsed;
// Normalized positive divisor.
- // The normalized divisor has the most-significant bit of it's most
+ // The normalized divisor has the most-significant bit of its most
// significant digit set.
// This makes estimating the quotient easier.
- Uint16List yDigits;
+ Uint32List yDigits;
int yUsed;
if (nsh > 0) {
- yDigits = new Uint16List(other._used + 5);
+ yDigits = new Uint32List(other._used + 5);
yUsed = _lShiftDigits(other._digits, other._used, nsh, yDigits);
- resultDigits = new Uint16List(_used + 5);
+ resultDigits = new Uint32List(_used + 5);
resultUsed = _lShiftDigits(_digits, _used, nsh, resultDigits);
} else {
yDigits = other._digits;
@@ -1164,7 +1159,7 @@
var i = resultUsed;
var j = i - yUsed;
// tmpDigits is a temporary array of i (resultUsed) digits.
- var tmpDigits = new Uint16List(i);
+ var tmpDigits = new Uint32List(i);
var tmpUsed = _dlShiftDigits(yDigits, yUsed, j, tmpDigits);
// Explicit first division step in case normalized dividend is larger or
// equal to shifted normalized divisor.
@@ -1179,7 +1174,7 @@
}
// Negate y so we can later use _mulAdd instead of non-existent _mulSub.
- var nyDigits = new Uint16List(yUsed + 2);
+ var nyDigits = new Uint32List(yUsed + 2);
nyDigits[yUsed] = 1;
_absSub(nyDigits, yUsed + 1, yDigits, yUsed, nyDigits);
// nyDigits is read-only and has yUsed digits (possibly including several
@@ -1429,9 +1424,9 @@
final exponentBitlen = exponent.bitLength;
if (exponentBitlen <= 0) return one;
_BigIntReduction z = new _BigIntClassic(modulus);
- var resultDigits = new Uint16List(modulusUsed2p4);
- var result2Digits = new Uint16List(modulusUsed2p4);
- var gDigits = new Uint16List(modulusUsed);
+ var resultDigits = new Uint32List(modulusUsed2p4);
+ var result2Digits = new Uint32List(modulusUsed2p4);
+ var gDigits = new Uint32List(modulusUsed);
var gUsed = z.convert(this, gDigits);
// Initialize result with g.
// Copy leading zero if any.
@@ -1517,15 +1512,15 @@
var aDigits, bDigits, cDigits, dDigits;
bool aIsNegative, bIsNegative, cIsNegative, dIsNegative;
if (ac) {
- aDigits = new Uint16List(abcdLen);
+ aDigits = new Uint32List(abcdLen);
aIsNegative = false;
aDigits[0] = 1;
- cDigits = new Uint16List(abcdLen);
+ cDigits = new Uint32List(abcdLen);
cIsNegative = false;
}
- bDigits = new Uint16List(abcdLen);
+ bDigits = new Uint32List(abcdLen);
bIsNegative = false;
- dDigits = new Uint16List(abcdLen);
+ dDigits = new Uint32List(abcdLen);
dIsNegative = false;
dDigits[0] = 1;
@@ -1821,19 +1816,23 @@
return (this & (signMask - one)) - (this & signMask);
}
- // TODO(floitsch): implement `isValidInt`.
- // Remove the comment in [BigInt.isValidInt] when done.
- bool get isValidInt => true;
+ bool get isValidInt {
+ assert(_digitBits == 32);
+ return _used < 2 ||
+ (_used == 2 &&
+ (_digits[1] < 0x80000000 ||
+ (_isNegative && _digits[1] == 0x80000000 && _digits[0] == 0)));
+ }
- // TODO(floitsch): implement the clamping. It behaves differently on dart2js
- // and the VM.
- // Remove the comment in [BigInt.isValidInt] when done.
int toInt() {
- var result = 0;
- for (int i = _used - 1; i >= 0; i--) {
- result = result * _digitBase + _digits[i];
+ assert(_digitBits == 32);
+ if (_used == 0) return 0;
+ if (_used == 1) return _isNegative ? -_digits[0] : _digits[0];
+ if (_used == 2 && _digits[1] < 0x80000000) {
+ var result = (_digits[1] << _digitBits) | _digits[0];
+ return _isNegative ? -result : result;
}
- return _isNegative ? -result : result;
+ return _isNegative ? _minInt : _maxInt;
}
/**
@@ -1952,17 +1951,30 @@
return _digits[0].toString();
}
- // Generate in chunks of 4 digits.
+ // Generate in chunks of 9 digits.
// The chunks are in reversed order.
var decimalDigitChunks = <String>[];
var rest = isNegative ? -this : this;
while (rest._used > 1) {
- var digits4 = rest.remainder(_bigInt10000).toString();
- decimalDigitChunks.add(digits4);
- if (digits4.length == 1) decimalDigitChunks.add("000");
- if (digits4.length == 2) decimalDigitChunks.add("00");
- if (digits4.length == 3) decimalDigitChunks.add("0");
- rest = rest ~/ _bigInt10000;
+ var digits9 = rest.remainder(_oneBillion).toString();
+ decimalDigitChunks.add(digits9);
+ var zeros = 9 - digits9.length;
+ if (zeros == 8) {
+ decimalDigitChunks.add("00000000");
+ } else {
+ if (zeros >= 4) {
+ zeros -= 4;
+ decimalDigitChunks.add("0000");
+ }
+ if (zeros >= 2) {
+ zeros -= 2;
+ decimalDigitChunks.add("00");
+ }
+ if (zeros >= 1) {
+ decimalDigitChunks.add("0");
+ }
+ }
+ rest = rest ~/ _oneBillion;
}
decimalDigitChunks.add(rest._digits[0].toString());
if (_isNegative) decimalDigitChunks.add("-");
@@ -2035,13 +2047,13 @@
// Interface for modular reduction.
abstract class _BigIntReduction {
// Return the number of digits used by r_digits.
- int convert(_BigIntImpl x, Uint16List r_digits);
- int mul(Uint16List xDigits, int xUsed, Uint16List yDigits, int yUsed,
- Uint16List resultDigits);
- int sqr(Uint16List xDigits, int xUsed, Uint16List resultDigits);
+ int convert(_BigIntImpl x, Uint32List r_digits);
+ int mul(Uint32List xDigits, int xUsed, Uint32List yDigits, int yUsed,
+ Uint32List resultDigits);
+ int sqr(Uint32List xDigits, int xUsed, Uint32List resultDigits);
// Return x reverted to _BigIntImpl.
- _BigIntImpl revert(Uint16List xDigits, int xUsed);
+ _BigIntImpl revert(Uint32List xDigits, int xUsed);
}
// Modular reduction using "classic" algorithm.
@@ -2054,7 +2066,7 @@
(_BigIntImpl._digitBits -
_modulus._digits[_modulus._used - 1].bitLength);
- int convert(_BigIntImpl x, Uint16List resultDigits) {
+ int convert(_BigIntImpl x, Uint32List resultDigits) {
var digits;
var used;
if (x._isNegative || x.compareTo(_modulus) >= 0) {
@@ -2076,11 +2088,11 @@
return used;
}
- _BigIntImpl revert(Uint16List xDigits, int xUsed) {
+ _BigIntImpl revert(Uint32List xDigits, int xUsed) {
return new _BigIntImpl._(false, xUsed, xDigits);
}
- int _reduce(Uint16List xDigits, int xUsed) {
+ int _reduce(Uint32List xDigits, int xUsed) {
if (xUsed < _modulus._used) {
return xUsed;
}
@@ -2089,7 +2101,7 @@
return convert(rem, xDigits);
}
- int sqr(Uint16List xDigits, int xUsed, Uint16List resultDigits) {
+ int sqr(Uint32List xDigits, int xUsed, Uint32List resultDigits) {
var b = new _BigIntImpl._(false, xUsed, xDigits);
var b2 = b * b;
for (int i = 0; i < b2._used; i++) {
@@ -2101,8 +2113,8 @@
return _reduce(resultDigits, 2 * xUsed);
}
- int mul(Uint16List xDigits, int xUsed, Uint16List yDigits, int yUsed,
- Uint16List resultDigits) {
+ int mul(Uint32List xDigits, int xUsed, Uint32List yDigits, int yUsed,
+ Uint32List resultDigits) {
var resultUsed =
_BigIntImpl._mulDigits(xDigits, xUsed, yDigits, yUsed, resultDigits);
return _reduce(resultDigits, resultUsed);
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index 8908498..43ff9094 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -25,17 +25,6 @@
namespace dart {
-static uint8_t* malloc_allocator(uint8_t* ptr,
- intptr_t old_size,
- intptr_t new_size) {
- void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
- return reinterpret_cast<uint8_t*>(new_ptr);
-}
-
-static void malloc_deallocator(uint8_t* ptr) {
- free(reinterpret_cast<void*>(ptr));
-}
-
DEFINE_NATIVE_ENTRY(CapabilityImpl_factory, 1) {
ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull());
uint64_t id = isolate->random()->NextUInt64();
@@ -106,15 +95,10 @@
PortMap::PostMessage(
new Message(destination_port_id, obj.raw(), Message::kNormalPriority));
} else {
- uint8_t* data = NULL;
- MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator,
- can_send_any_object);
- writer.WriteMessage(obj);
-
+ MessageWriter writer(can_send_any_object);
// TODO(turnidge): Throw an exception when the return value is false?
- PortMap::PostMessage(new Message(destination_port_id, data,
- writer.BytesWritten(),
- Message::kNormalPriority));
+ PortMap::PostMessage(writer.WriteMessage(obj, destination_port_id,
+ Message::kNormalPriority));
}
return Object::null();
}
@@ -228,11 +212,9 @@
// serializable this will throw an exception.
SerializedObjectBuffer message_buffer;
{
- MessageWriter writer(message_buffer.data_buffer(), &malloc_allocator,
- &malloc_deallocator,
- /* can_send_any_object = */ true,
- message_buffer.data_length());
- writer.WriteMessage(message);
+ MessageWriter writer(/* can_send_any_object = */ true);
+ message_buffer.set_message(writer.WriteMessage(
+ message, ILLEGAL_PORT, Message::kNormalPriority));
}
const char* utf8_package_root =
@@ -341,16 +323,14 @@
SerializedObjectBuffer arguments_buffer;
SerializedObjectBuffer message_buffer;
{
- MessageWriter writer(
- arguments_buffer.data_buffer(), &malloc_allocator, &malloc_deallocator,
- /* can_send_any_object = */ false, arguments_buffer.data_length());
- writer.WriteMessage(args);
+ MessageWriter writer(/* can_send_any_object = */ false);
+ arguments_buffer.set_message(
+ writer.WriteMessage(args, ILLEGAL_PORT, Message::kNormalPriority));
}
{
- MessageWriter writer(
- message_buffer.data_buffer(), &malloc_allocator, &malloc_deallocator,
- /* can_send_any_object = */ false, message_buffer.data_length());
- writer.WriteMessage(message);
+ MessageWriter writer(/* can_send_any_object = */ false);
+ message_buffer.set_message(
+ writer.WriteMessage(message, ILLEGAL_PORT, Message::kNormalPriority));
}
// Canonicalize the uri with respect to the current isolate.
@@ -420,12 +400,9 @@
// Make sure to route this request to the isolate library OOB mesage handler.
msg.SetAt(0, Smi::Handle(Smi::New(Message::kIsolateLibOOBMsg)));
- uint8_t* data = NULL;
- MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
- writer.WriteMessage(msg);
-
- PortMap::PostMessage(new Message(port.Id(), data, writer.BytesWritten(),
- Message::kOOBPriority));
+ MessageWriter writer(false);
+ PortMap::PostMessage(
+ writer.WriteMessage(msg, port.Id(), Message::kOOBPriority));
// Drain interrupts before running so any IMMEDIATE operations on the current
// isolate happen synchronously.
diff --git a/runtime/lib/vmservice.cc b/runtime/lib/vmservice.cc
index df44862..eeeeb50 100644
--- a/runtime/lib/vmservice.cc
+++ b/runtime/lib/vmservice.cc
@@ -23,17 +23,6 @@
DECLARE_FLAG(bool, trace_service);
DECLARE_FLAG(bool, show_kernel_isolate);
-static uint8_t* malloc_allocator(uint8_t* ptr,
- intptr_t old_size,
- intptr_t new_size) {
- void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
- return reinterpret_cast<uint8_t*>(new_ptr);
-}
-
-static void malloc_deallocator(uint8_t* ptr) {
- free(reinterpret_cast<void*>(ptr));
-}
-
#ifndef PRODUCT
class RegisterRunningIsolatesVisitor : public IsolateVisitor {
public:
@@ -107,13 +96,10 @@
Smi::Handle(thread->zone(), Smi::New(Message::kServiceOOBMsg)));
// Serialize message.
- uint8_t* data = NULL;
- MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
- writer.WriteMessage(message);
-
+ MessageWriter writer(false);
// TODO(turnidge): Throw an exception when the return value is false?
bool result = PortMap::PostMessage(
- new Message(sp.Id(), data, writer.BytesWritten(), Message::kOOBPriority));
+ writer.WriteMessage(message, sp.Id(), Message::kOOBPriority));
return Bool::Get(result).raw();
}
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index 2618858..df449a1 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -44,16 +44,18 @@
external_service_disappear_test: Crash # Issue 31587
[ $compiler == dartk && $system == windows ]
+break_on_default_constructor_test: Skip # Issues 32137 and 32138.
coverage_leaf_function_test: RuntimeError
coverage_optimized_function_test: Skip # Timeout
get_source_report_test: RuntimeError
get_vm_timeline_rpc_test: Pass, Timeout # Issue 32137.
-issue_25465_test: Pass, Timeout # Issue 32137.
-issue_30555_test: Pass, RuntimeError, Timeout # Issue 32137.
+issue_25465_test: Skip # Issues 32137 and 32138.
+issue_30555_test: Skip # Issues 32137 and 32138.
next_through_assign_call_test: Skip # Issues 32137 and 32138.
next_through_assign_int_test: Skip # Issues 32137 and 32138.
-next_through_call_on_field_in_class_test: Pass, Timeout # Issue 32137.
+next_through_call_on_field_in_class_test: Skip # Issues 32137 and 32138.
next_through_call_on_field_test: Skip # Issues 32137 and 32138.
+next_through_catch_test: Skip # Issues 32137 and 32138.
next_through_create_list_and_map_test: Skip # Issues 32137 and 32138.
next_through_function_expression_test: Skip # Issues 32137 and 32138.
next_through_is_and_as_test: Skip # Issues 32137 and 32138.
@@ -63,15 +65,17 @@
next_through_simple_linear_test: Skip # Issues 32137 and 32138.
pause_idle_isolate_test: Skip # Issues 32137 and 32138.
pause_on_start_and_exit_test: Pass, RuntimeError # Issue 32137.
+pause_on_start_and_exit_test: Skip # Issues 32137 and 32138.
regress_28443_test: Pass, Timeout
regress_28980_test: Skip # Issues 32137 and 32138.
reload_sources_test: RuntimeError
set_vm_name_rpc_test: Pass, Timeout # Issue 32137.
-step_test: Pass, Slow
+step_test: Skip # Issues 32137 and 32138.
step_through_constructor_test: Pass, Slow
-step_through_function_2_test: Pass, Timeout # Issue 32137.
+step_through_function_2_test: Skip # Issues 32137 and 32138.
step_through_function_test: Skip # Issues 32137 and 32138.
step_through_property_get_test: Pass, Timeout # Issue 32137.
+step_through_setter_test: Skip # Issues 32137 and 32138.
step_through_switch_test: Pass, Timeout # Issue 32137.
step_through_switch_with_continue_test: Pass, Timeout # Issue 32137.
@@ -93,7 +97,6 @@
field_script_test: Skip # Timeout
get_object_rpc_test: RuntimeError
get_stack_rpc_test: RuntimeError
-next_through_catch_test: Skip # Timeout
next_through_for_loop_with_break_and_continue_test: Skip # Timeout
next_through_simple_async_test: Skip # Timeout
step_test: Skip # Timeout
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index e0764a2..c29a144 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -482,10 +482,6 @@
return reinterpret_cast<uint8_t*>(realloc(ptr, new_size));
}
-static void malloc_deallocator(uint8_t* ptr) {
- free(ptr);
-}
-
BENCHMARK_SIZE(CoreSnapshotSize) {
const char* kScriptChars =
"import 'dart:async';\n"
@@ -597,31 +593,22 @@
benchmark->set_score(elapsed_time);
}
-static uint8_t message_buffer[64];
-static uint8_t* message_allocator(uint8_t* ptr,
- intptr_t old_size,
- intptr_t new_size) {
- return message_buffer;
-}
-static void message_deallocator(uint8_t* ptr) {}
-
BENCHMARK(SerializeNull) {
TransitionNativeToVM transition(thread);
const Object& null_object = Object::Handle();
const intptr_t kLoopCount = 1000000;
- uint8_t* buffer;
Timer timer(true, "Serialize Null");
timer.Start();
for (intptr_t i = 0; i < kLoopCount; i++) {
StackZone zone(thread);
- MessageWriter writer(&buffer, &message_allocator, &message_deallocator,
- true);
- writer.WriteMessage(null_object);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message = writer.WriteMessage(null_object, ILLEGAL_PORT,
+ Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
reader.ReadObject();
+ delete message;
}
timer.Stop();
int64_t elapsed_time = timer.TotalElapsedTime();
@@ -632,19 +619,18 @@
TransitionNativeToVM transition(thread);
const Integer& smi_object = Integer::Handle(Smi::New(42));
const intptr_t kLoopCount = 1000000;
- uint8_t* buffer;
Timer timer(true, "Serialize Smi");
timer.Start();
for (intptr_t i = 0; i < kLoopCount; i++) {
StackZone zone(thread);
- MessageWriter writer(&buffer, &message_allocator, &message_deallocator,
- true);
- writer.WriteMessage(smi_object);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(smi_object, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
reader.ReadObject();
+ delete message;
}
timer.Stop();
int64_t elapsed_time = timer.TotalElapsedTime();
@@ -657,19 +643,18 @@
array_object.SetAt(0, Integer::Handle(Smi::New(42)));
array_object.SetAt(1, Object::Handle());
const intptr_t kLoopCount = 1000000;
- uint8_t* buffer;
Timer timer(true, "Simple Message");
timer.Start();
for (intptr_t i = 0; i < kLoopCount; i++) {
StackZone zone(thread);
- MessageWriter writer(&buffer, &malloc_allocator, &malloc_deallocator, true);
- writer.WriteMessage(array_object);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message = writer.WriteMessage(array_object, ILLEGAL_PORT,
+ Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
reader.ReadObject();
- free(buffer);
+ delete message;
}
timer.Stop();
int64_t elapsed_time = timer.TotalElapsedTime();
@@ -690,19 +675,18 @@
Instance& map = Instance::Handle();
map ^= Api::UnwrapHandle(h_result);
const intptr_t kLoopCount = 100;
- uint8_t* buffer;
Timer timer(true, "Large Map");
timer.Start();
for (intptr_t i = 0; i < kLoopCount; i++) {
StackZone zone(thread);
- MessageWriter writer(&buffer, &malloc_allocator, &malloc_deallocator, true);
- writer.WriteMessage(map);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(map, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
reader.ReadObject();
- free(buffer);
+ delete message;
}
timer.Stop();
int64_t elapsed_time = timer.TotalElapsedTime();
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 4708321..0ad0be6 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -3537,20 +3537,16 @@
NOT_IN_PRODUCT(TimelineDurationScope tds(
Thread::Current(), Timeline::GetIsolateStream(), "PostLoadMint"));
- const GrowableObjectArray& new_constants =
- GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
+ const Class& mint_cls =
+ Class::Handle(zone, Isolate::Current()->object_store()->mint_class());
+ mint_cls.set_constants(Object::empty_array());
Object& number = Object::Handle(zone);
for (intptr_t i = start_index_; i < stop_index_; i++) {
number = refs.At(i);
if (number.IsMint() && number.IsCanonical()) {
- new_constants.Add(number);
+ mint_cls.InsertCanonicalMint(zone, Mint::Cast(number));
}
}
- const Array& constants_array =
- Array::Handle(zone, Array::MakeFixedLength(new_constants));
- const Class& mint_cls =
- Class::Handle(zone, Isolate::Current()->object_store()->mint_class());
- mint_cls.set_constants(constants_array);
}
};
@@ -4850,14 +4846,14 @@
}
#endif // SNAPSHOT_BACKTRACE
-void Serializer::WriteVersionAndFeatures() {
+void Serializer::WriteVersionAndFeatures(bool is_vm_snapshot) {
const char* expected_version = Version::SnapshotString();
ASSERT(expected_version != NULL);
const intptr_t version_len = strlen(expected_version);
WriteBytes(reinterpret_cast<const uint8_t*>(expected_version), version_len);
const char* expected_features =
- Dart::FeaturesString(Isolate::Current(), kind_);
+ Dart::FeaturesString(Isolate::Current(), is_vm_snapshot, kind_);
ASSERT(expected_features != NULL);
const intptr_t features_len = strlen(expected_features);
WriteBytes(reinterpret_cast<const uint8_t*>(expected_features),
@@ -5307,7 +5303,8 @@
}
Advance(version_len);
- const char* expected_features = Dart::FeaturesString(isolate, kind_);
+ const char* expected_features =
+ Dart::FeaturesString(isolate, (isolate == NULL), kind_);
ASSERT(expected_features != NULL);
const intptr_t expected_len = strlen(expected_features);
@@ -5721,7 +5718,7 @@
kInitialSize, vm_image_writer_);
serializer.ReserveHeader();
- serializer.WriteVersionAndFeatures();
+ serializer.WriteVersionAndFeatures(true);
// VM snapshot roots are:
// - the symbol table
// - all the token streams
@@ -5753,7 +5750,7 @@
ASSERT(object_store != NULL);
serializer.ReserveHeader();
- serializer.WriteVersionAndFeatures();
+ serializer.WriteVersionAndFeatures(false);
// Isolate snapshot roots are:
// - the object store
serializer.WriteIsolateSnapshot(num_base_objects, object_store);
diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h
index 45a2a2b..63725d5 100644
--- a/runtime/vm/clustered_snapshot.h
+++ b/runtime/vm/clustered_snapshot.h
@@ -195,7 +195,7 @@
data[Snapshot::kSnapshotFlagIndex] = kind;
}
- void WriteVersionAndFeatures();
+ void WriteVersionAndFeatures(bool is_vm_snapshot);
void Serialize();
WriteStream* stream() { return &stream_; }
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index c311538..b08c085 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -1979,23 +1979,30 @@
}
}
intptr_t cid = cls.id();
- if ((cid == kMintCid) || (cid == kBigintCid)) {
+ if (cid == kBigintCid) {
// Constants stored as a plain list, no rehashing needed.
constants = Array::MakeFixedLength(retained_constants);
cls.set_constants(constants);
+ } else if (cid == kDoubleCid) {
+ // Rehash.
+ cls.set_constants(Object::empty_array());
+ for (intptr_t j = 0; j < retained_constants.Length(); j++) {
+ constant ^= retained_constants.At(j);
+ cls.InsertCanonicalDouble(Z, Double::Cast(constant));
+ }
+ } else if (cid == kMintCid) {
+ // Rehash.
+ cls.set_constants(Object::empty_array());
+ for (intptr_t j = 0; j < retained_constants.Length(); j++) {
+ constant ^= retained_constants.At(j);
+ cls.InsertCanonicalMint(Z, Mint::Cast(constant));
+ }
} else {
// Rehash.
cls.set_constants(Object::empty_array());
- if (cid == kDoubleCid) {
- for (intptr_t j = 0; j < retained_constants.Length(); j++) {
- constant ^= retained_constants.At(j);
- cls.InsertCanonicalDouble(Z, Double::Cast(constant));
- }
- } else {
- for (intptr_t j = 0; j < retained_constants.Length(); j++) {
- constant ^= retained_constants.At(j);
- cls.InsertCanonicalConstant(Z, constant);
- }
+ for (intptr_t j = 0; j < retained_constants.Length(); j++) {
+ constant ^= retained_constants.At(j);
+ cls.InsertCanonicalConstant(Z, constant);
}
}
diff --git a/runtime/vm/compiler/frontend/flow_graph_builder.cc b/runtime/vm/compiler/frontend/flow_graph_builder.cc
index 628bd55..0de502c 100644
--- a/runtime/vm/compiler/frontend/flow_graph_builder.cc
+++ b/runtime/vm/compiler/frontend/flow_graph_builder.cc
@@ -1078,7 +1078,7 @@
return_value = Bind(BuildLoadLocal(*temp, node->token_pos()));
}
- if (Isolate::Current()->type_checks()) {
+ if (Isolate::Current()->argument_type_checks()) {
const bool is_implicit_dynamic_getter =
(!function.is_static() &&
((function.kind() == RawFunction::kImplicitGetter) ||
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index cf07b3e..eb100c3 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -1007,8 +1007,8 @@
VisitNode();
break;
}
- bool is_setter = function.IsImplicitSetterFunction();
- bool is_method = !function.IsStaticFunction();
+ const bool is_setter = function.IsImplicitSetterFunction();
+ const bool is_method = !function.IsStaticFunction();
intptr_t pos = 0;
if (is_method) {
Class& klass = Class::Handle(Z, function.Owner());
@@ -1025,6 +1025,16 @@
Symbols::Value(),
AbstractType::ZoneHandle(Z, function.ParameterTypeAt(pos)));
scope_->InsertParameterAt(pos++, result_->setter_value);
+
+ if (is_method && !attrs.has_dynamic_invocations) {
+ FieldHelper field_helper(builder_);
+ field_helper.ReadUntilIncluding(FieldHelper::kFlags);
+
+ if (!field_helper.IsGenericCovariantImpl()) {
+ result_->setter_value->set_type_check_mode(
+ LocalVariable::kTypeCheckedByCaller);
+ }
+ }
}
break;
}
@@ -5842,9 +5852,9 @@
ICData::RebindRule rebind_rule,
const InferredTypeMetadata* result_type,
intptr_t type_args_count) {
- return flow_graph_builder_->StaticCall(
- position, target, argument_count, argument_names, rebind_rule,
- result_type, type_args_count);
+ return flow_graph_builder_->StaticCall(position, target, argument_count,
+ argument_names, rebind_rule,
+ result_type, type_args_count);
}
Fragment StreamingFlowGraphBuilder::InstanceCall(
@@ -6928,7 +6938,7 @@
Fragment StreamingFlowGraphBuilder::BuildDirectMethodInvocation(
TokenPosition* p) {
const intptr_t offset = ReaderOffset() - 1; // Include the tag.
- TokenPosition position = ReadPosition(); // read offset.
+ TokenPosition position = ReadPosition(); // read offset.
if (p != NULL) *p = position;
const InferredTypeMetadata result_type =
@@ -6991,9 +7001,9 @@
&positional_argument_count); // read arguments.
++argument_count;
- return instructions +
- StaticCall(position, target, argument_count, argument_names,
- ICData::kNoRebind, &result_type, type_args_len);
+ return instructions + StaticCall(position, target, argument_count,
+ argument_names, ICData::kNoRebind,
+ &result_type, type_args_len);
}
Fragment StreamingFlowGraphBuilder::BuildSuperMethodInvocation(
@@ -7143,7 +7153,7 @@
Fragment StreamingFlowGraphBuilder::BuildStaticInvocation(bool is_const,
TokenPosition* p) {
const intptr_t offset = ReaderOffset() - 1; // Include the tag.
- TokenPosition position = ReadPosition(); // read position.
+ TokenPosition position = ReadPosition(); // read position.
if (p != NULL) *p = position;
const InferredTypeMetadata result_type =
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index 5bef7e4..330dfe7 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -174,6 +174,7 @@
kFinal = 1 << 0,
kConst = 1 << 1,
kStatic = 1 << 2,
+ kIsGenericCovariantImpl = 1 << 6,
kIsGenericCovariantInterface = 1 << 7
};
@@ -197,6 +198,9 @@
bool IsConst() { return (flags_ & kConst) != 0; }
bool IsFinal() { return (flags_ & kFinal) != 0; }
bool IsStatic() { return (flags_ & kStatic) != 0; }
+ bool IsGenericCovariantImpl() {
+ return (flags_ & kIsGenericCovariantImpl) != 0;
+ }
bool IsGenericCovariantInterface() {
return (flags_ & kIsGenericCovariantInterface) != 0;
}
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index a3c0dd1..1c75fa7 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -1426,13 +1426,19 @@
Fragment FlowGraphBuilder::Return(TokenPosition position) {
Fragment instructions;
+ const Function& function = parsed_function_->function();
- instructions += CheckReturnTypeInCheckedMode();
+ // Emit a type check of the return type in checked mode for all functions
+ // and in strong mode for native functions.
+ if (I->type_checks() || (function.is_native() && I->strong())) {
+ const AbstractType& return_type =
+ AbstractType::Handle(Z, function.result_type());
+ instructions += CheckAssignable(return_type, Symbols::FunctionResult());
+ }
Value* value = Pop();
ASSERT(stack_ == NULL);
- const Function& function = parsed_function_->function();
if (NeedsDebugStepCheck(function, position)) {
instructions += DebugStepCheck(position);
}
@@ -1505,6 +1511,35 @@
return FactoryRecognizer::ResultCid(function);
}
+void FlowGraphBuilder::SetResultTypeForStaticCall(
+ StaticCallInstr* call,
+ const Function& target,
+ intptr_t argument_count,
+ const InferredTypeMetadata* result_type) {
+ const intptr_t list_cid =
+ GetResultCidOfListFactory(Z, target, argument_count);
+ if (list_cid != kDynamicCid) {
+ ASSERT((result_type == NULL) || (result_type->cid == kDynamicCid) ||
+ (result_type->cid == list_cid));
+ call->SetResultType(Z, CompileType::FromCid(list_cid));
+ call->set_is_known_list_constructor(true);
+ return;
+ }
+ if (target.recognized_kind() != MethodRecognizer::kUnknown) {
+ intptr_t recognized_cid = MethodRecognizer::ResultCid(target);
+ if (recognized_cid != kDynamicCid) {
+ ASSERT((result_type == NULL) || (result_type->cid == kDynamicCid) ||
+ (result_type->cid == recognized_cid));
+ call->SetResultType(Z, CompileType::FromCid(recognized_cid));
+ return;
+ }
+ }
+ if ((result_type != NULL) && !result_type->IsTrivial()) {
+ call->SetResultType(Z, CompileType::CreateNullable(result_type->nullable,
+ result_type->cid));
+ }
+}
+
Fragment FlowGraphBuilder::StaticCall(TokenPosition position,
const Function& target,
intptr_t argument_count,
@@ -1517,22 +1552,7 @@
StaticCallInstr* call = new (Z)
StaticCallInstr(position, target, type_args_count, argument_names,
arguments, ic_data_array_, GetNextDeoptId(), rebind_rule);
- const intptr_t list_cid =
- GetResultCidOfListFactory(Z, target, argument_count);
- if (list_cid != kDynamicCid) {
- ASSERT((result_type == NULL) || (result_type->cid == kDynamicCid) ||
- (result_type->cid == list_cid));
- call->SetResultType(Z, CompileType::FromCid(list_cid));
- call->set_is_known_list_constructor(true);
- } else if (target.recognized_kind() != MethodRecognizer::kUnknown) {
- intptr_t recognized_cid = MethodRecognizer::ResultCid(target);
- ASSERT((result_type == NULL) || (result_type->cid == kDynamicCid) ||
- (result_type->cid == recognized_cid));
- call->SetResultType(Z, CompileType::FromCid(recognized_cid));
- } else if ((result_type != NULL) && !result_type->IsTrivial()) {
- call->SetResultType(Z, CompileType::CreateNullable(result_type->nullable,
- result_type->cid));
- }
+ SetResultTypeForStaticCall(call, target, argument_count, result_type);
Push(call);
return Fragment(call);
}
@@ -2150,15 +2170,6 @@
ICData::kStatic);
}
-Fragment FlowGraphBuilder::CheckReturnTypeInCheckedMode() {
- if (I->type_checks()) {
- const AbstractType& return_type =
- AbstractType::Handle(Z, parsed_function_->function().result_type());
- return CheckAssignable(return_type, Symbols::FunctionResult());
- }
- return Fragment();
-}
-
Fragment FlowGraphBuilder::CheckBooleanInCheckedMode() {
Fragment instructions;
if (I->type_checks()) {
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.h b/runtime/vm/compiler/frontend/kernel_to_il.h
index 13df421..79254c6 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.h
+++ b/runtime/vm/compiler/frontend/kernel_to_il.h
@@ -719,6 +719,10 @@
Fragment NativeCall(const String* name, const Function* function);
Fragment Return(TokenPosition position);
Fragment CheckNull(TokenPosition position, LocalVariable* receiver);
+ void SetResultTypeForStaticCall(StaticCallInstr* call,
+ const Function& target,
+ intptr_t argument_count,
+ const InferredTypeMetadata* result_type);
Fragment StaticCall(TokenPosition position,
const Function& target,
intptr_t argument_count,
@@ -751,7 +755,6 @@
Fragment GuardFieldClass(const Field& field, intptr_t deopt_id);
Fragment EvaluateAssertion();
- Fragment CheckReturnTypeInCheckedMode();
Fragment CheckVariableTypeInCheckedMode(const AbstractType& dst_type,
const String& name_symbol);
Fragment CheckBooleanInCheckedMode();
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 990ce17..c003966 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -636,7 +636,9 @@
return Error::null();
}
-const char* Dart::FeaturesString(Isolate* isolate, Snapshot::Kind kind) {
+const char* Dart::FeaturesString(Isolate* isolate,
+ bool is_vm_isolate,
+ Snapshot::Kind kind) {
TextBuffer buffer(64);
// Different fields are included for DEBUG/RELEASE/PRODUCT.
@@ -648,16 +650,24 @@
buffer.AddString("release");
#endif
- if (Snapshot::IncludesCode(kind)) {
-// Checked mode affects deopt ids.
#define ADD_FLAG(name, isolate_flag, flag) \
do { \
const bool name = (isolate != NULL) ? isolate->name() : flag; \
buffer.AddString(name ? (" " #name) : (" no-" #name)); \
} while (0);
+
+ // We don't write the strong flag into the features list for the VM isolate
+ // snapshot as the implementation is in an intermediate state where the VM
+ // isolate is always initialized from a vm_snapshot generated in non strong
+ // mode.
+ if (!is_vm_isolate) {
+ ADD_FLAG(strong, strong, FLAG_strong);
+ }
+
+ if (Snapshot::IncludesCode(kind)) {
+ // Checked mode affects deopt ids.
ADD_FLAG(type_checks, enable_type_checks, FLAG_enable_type_checks);
ADD_FLAG(asserts, enable_asserts, FLAG_enable_asserts);
- ADD_FLAG(strong, strong, FLAG_strong);
ADD_FLAG(error_on_bad_type, enable_error_on_bad_type,
FLAG_error_on_bad_type);
ADD_FLAG(error_on_bad_override, enable_error_on_bad_override,
@@ -666,7 +676,6 @@
ADD_FLAG(use_field_guards, use_field_guards, FLAG_use_field_guards);
ADD_FLAG(use_osr, use_osr, FLAG_use_osr);
}
-#undef ADD_FLAG
// Generated code must match the host architecture and ABI.
#if defined(TARGET_ARCH_ARM)
@@ -697,6 +706,7 @@
if (FLAG_precompiled_mode && FLAG_dwarf_stack_traces) {
buffer.AddString(" dwarf-stack-traces");
}
+#undef ADD_FLAG
return buffer.Steal();
}
diff --git a/runtime/vm/dart.h b/runtime/vm/dart.h
index 03f05cb..5c8177c 100644
--- a/runtime/vm/dart.h
+++ b/runtime/vm/dart.h
@@ -74,7 +74,9 @@
static uword AllocateReadOnlyHandle();
static bool IsReadOnlyHandle(uword address);
- static const char* FeaturesString(Isolate* isolate, Snapshot::Kind kind);
+ static const char* FeaturesString(Isolate* isolate,
+ bool is_vm_snapshot,
+ Snapshot::Kind kind);
static Snapshot::Kind vm_snapshot_kind() { return vm_snapshot_kind_; }
static const uint8_t* vm_snapshot_instructions() {
return vm_snapshot_instructions_;
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 6ee6b79..1877043 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1544,12 +1544,44 @@
}
#endif // #if defined(DEBUG)
- ScriptSnapshotWriter writer(script_snapshot_buffer, ApiReallocate);
+ ScriptSnapshotWriter writer(ApiReallocate);
writer.WriteScriptSnapshot(lib);
+ *script_snapshot_buffer = writer.buffer();
*script_snapshot_size = writer.BytesWritten();
return Api::Success();
}
+DART_EXPORT bool Dart_IsDart2Snapshot(uint8_t* snapshot_buffer,
+ intptr_t snapshot_size) {
+ const char* expected_version = Version::SnapshotString();
+ ASSERT(expected_version != NULL);
+ const intptr_t version_len = strlen(expected_version);
+ if (snapshot_size < version_len) {
+ return false;
+ }
+
+ const char* version = reinterpret_cast<const char*>(snapshot_buffer);
+ ASSERT(version != NULL);
+ if (strncmp(version, expected_version, version_len)) {
+ return false;
+ }
+ const char* features =
+ reinterpret_cast<const char*>(snapshot_buffer) + version_len;
+ ASSERT(features != NULL);
+ intptr_t pending_len = snapshot_size - version_len;
+ intptr_t buffer_len = OS::StrNLen(features, pending_len);
+ // if buffer_len is less than pending_len it means we have a null terminated
+ // string and we can safely execute 'strstr' on it.
+ if ((buffer_len < pending_len)) {
+ if (strstr(features, "no-strong")) {
+ return false;
+ } else if (strstr(features, "strong")) {
+ return true;
+ }
+ }
+ return false;
+}
+
DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) {
if (isolate == NULL) {
FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
@@ -1759,17 +1791,6 @@
return isolate->message_handler()->HasLivePorts();
}
-static uint8_t* malloc_allocator(uint8_t* ptr,
- intptr_t old_size,
- intptr_t new_size) {
- void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
- return reinterpret_cast<uint8_t*>(new_ptr);
-}
-
-static void malloc_deallocator(uint8_t* ptr) {
- free(reinterpret_cast<void*>(ptr));
-}
-
DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) {
DARTSCOPE(Thread::Current());
API_TIMELINE_DURATION;
@@ -1786,12 +1807,9 @@
}
const Object& object = Object::Handle(Z, raw_obj);
- uint8_t* data = NULL;
- MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
- writer.WriteMessage(object);
- intptr_t len = writer.BytesWritten();
+ MessageWriter writer(false);
return PortMap::PostMessage(
- new Message(port_id, data, len, Message::kNormalPriority));
+ writer.WriteMessage(object, port_id, Message::kNormalPriority));
}
DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) {
diff --git a/runtime/vm/dart_api_message.cc b/runtime/vm/dart_api_message.cc
index a8ba9dc..0951659 100644
--- a/runtime/vm/dart_api_message.cc
+++ b/runtime/vm/dart_api_message.cc
@@ -12,13 +12,6 @@
static const int kNumInitialReferences = 4;
-ApiMessageReader::ApiMessageReader(const uint8_t* buffer, intptr_t length)
- : BaseReader(buffer, length),
- zone_(NULL),
- backward_references_(kNumInitialReferences),
- vm_isolate_references_(kNumInitialReferences),
- vm_symbol_references_(NULL) {}
-
ApiMessageReader::ApiMessageReader(Message* msg)
: BaseReader(msg->IsRaw() ? reinterpret_cast<uint8_t*>(msg->raw_obj())
: msg->data(),
@@ -857,24 +850,24 @@
return NULL;
}
-void ApiMessageWriter::WriteMessage(intptr_t field_count, intptr_t* data) {
- // Write out the serialization header value for this object.
- WriteInlinedObjectHeader(kMaxPredefinedObjectIds);
+static uint8_t* malloc_allocator(uint8_t* ptr,
+ intptr_t old_size,
+ intptr_t new_size) {
+ void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
+ return reinterpret_cast<uint8_t*>(new_ptr);
+}
- // Write out the class and tags information.
- WriteIndexedObject(kArrayCid);
- WriteTags(0);
+ApiMessageWriter::ApiMessageWriter()
+ : BaseWriter(malloc_allocator, NULL, kInitialSize),
+ object_id_(0),
+ forward_list_(NULL),
+ forward_list_length_(0),
+ forward_id_(0) {
+ ASSERT(kDartCObjectTypeMask >= Dart_CObject_kNumberOfTypes - 1);
+}
- // Write out the length field.
- Write<RawObject*>(Smi::New(field_count));
-
- // Write out the type arguments.
- WriteNullObject();
-
- // Write out the individual Smis.
- for (int i = 0; i < field_count; i++) {
- Write<RawObject*>(Integer::New(data[i]));
- }
+ApiMessageWriter::~ApiMessageWriter() {
+ ::free(forward_list_);
}
void ApiMessageWriter::MarkCObject(Dart_CObject* object, intptr_t object_id) {
@@ -1253,11 +1246,14 @@
return true;
}
-bool ApiMessageWriter::WriteCMessage(Dart_CObject* object) {
+Message* ApiMessageWriter::WriteCMessage(Dart_CObject* object,
+ Dart_Port dest_port,
+ Message::Priority priority) {
bool success = WriteCObject(object);
if (!success) {
UnmarkAllCObjects(object);
- return false;
+ free(buffer());
+ return NULL;
}
// Write out all objects that were added to the forward list and have
// not been serialized yet. These would typically be fields of arrays.
@@ -1266,11 +1262,12 @@
success = WriteForwardedCObject(forward_list_[i]);
if (!success) {
UnmarkAllCObjects(object);
- return false;
+ free(buffer());
+ return NULL;
}
}
UnmarkAllCObjects(object);
- return true;
+ return new Message(dest_port, buffer(), BytesWritten(), priority);
}
} // namespace dart
diff --git a/runtime/vm/dart_api_message.h b/runtime/vm/dart_api_message.h
index d2a84e2..349ab5f 100644
--- a/runtime/vm/dart_api_message.h
+++ b/runtime/vm/dart_api_message.h
@@ -47,7 +47,6 @@
// The ApiMessageReader object must be enclosed by an ApiNativeScope.
// Allocation of all C Heap objects is done in the zone associated with
// the enclosing ApiNativeScope.
- ApiMessageReader(const uint8_t* buffer, intptr_t length);
explicit ApiMessageReader(Message* message);
~ApiMessageReader() {}
@@ -155,21 +154,13 @@
class ApiMessageWriter : public BaseWriter {
public:
static const intptr_t kInitialSize = 512;
- ApiMessageWriter(uint8_t** buffer, ReAlloc alloc)
- : BaseWriter(buffer, alloc, NULL, kInitialSize),
- object_id_(0),
- forward_list_(NULL),
- forward_list_length_(0),
- forward_id_(0) {
- ASSERT(kDartCObjectTypeMask >= Dart_CObject_kNumberOfTypes - 1);
- }
- ~ApiMessageWriter() { ::free(forward_list_); }
-
- // Writes a message of integers.
- void WriteMessage(intptr_t field_count, intptr_t* data);
+ ApiMessageWriter();
+ ~ApiMessageWriter();
// Writes a message with a single object.
- bool WriteCMessage(Dart_CObject* object);
+ Message* WriteCMessage(Dart_CObject* object,
+ Dart_Port dest_port,
+ Message::Priority priority);
private:
static const intptr_t kDartCObjectTypeBits = 4;
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index e67f6e1..0e1f65a2 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -117,36 +117,13 @@
};
#endif
-static uint8_t* malloc_allocator(uint8_t* ptr,
- intptr_t old_size,
- intptr_t new_size) {
- void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
- return reinterpret_cast<uint8_t*>(new_ptr);
-}
-
-static void malloc_deallocator(uint8_t* ptr) {
- free(reinterpret_cast<void*>(ptr));
-}
-
-static void SerializeObject(const Instance& obj,
- uint8_t** obj_data,
- intptr_t* obj_len,
- bool allow_any_object) {
- MessageWriter writer(obj_data, &malloc_allocator, &malloc_deallocator,
- allow_any_object);
- writer.WriteMessage(obj);
- *obj_len = writer.BytesWritten();
-}
-
// TODO(zra): Allocation of Message objects should be centralized.
static Message* SerializeMessage(Dart_Port dest_port, const Instance& obj) {
if (ApiObjectConverter::CanConvert(obj.raw())) {
return new Message(dest_port, obj.raw(), Message::kNormalPriority);
} else {
- uint8_t* obj_data;
- intptr_t obj_len;
- SerializeObject(obj, &obj_data, &obj_len, false);
- return new Message(dest_port, obj_data, obj_len, Message::kNormalPriority);
+ MessageWriter writer(false);
+ return writer.WriteMessage(obj, dest_port, Message::kNormalPriority);
}
}
@@ -248,12 +225,9 @@
element = Capability::New(capability);
msg.SetAt(2, element);
- uint8_t* data = NULL;
- MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
- writer.WriteMessage(msg);
-
- PortMap::PostMessage(new Message(main_port(), data, writer.BytesWritten(),
- Message::kOOBPriority));
+ MessageWriter writer(false);
+ PortMap::PostMessage(
+ writer.WriteMessage(msg, main_port(), Message::kOOBPriority));
}
class IsolateMessageHandler : public MessageHandler {
@@ -538,7 +512,7 @@
// We should only be sending RawObjects that can be converted to CObjects.
ASSERT(ApiObjectConverter::CanConvert(msg_obj.raw()));
} else {
- MessageSnapshotReader reader(message->data(), message->len(), thread);
+ MessageSnapshotReader reader(message, thread);
msg_obj = reader.ReadObject();
}
if (msg_obj.IsError()) {
@@ -2624,14 +2598,13 @@
list_values[3] = &imm;
{
- uint8_t* buffer = NULL;
- ApiMessageWriter writer(&buffer, &malloc_allocator);
- bool success = writer.WriteCMessage(&kill_msg);
- ASSERT(success);
+ ApiMessageWriter writer;
+ Message* message =
+ writer.WriteCMessage(&kill_msg, main_port(), Message::kOOBPriority);
+ ASSERT(message != NULL);
// Post the message at the given port.
- success = PortMap::PostMessage(new Message(
- main_port(), buffer, writer.BytesWritten(), Message::kOOBPriority));
+ bool success = PortMap::PostMessage(message);
ASSERT(success);
}
}
@@ -2798,13 +2771,11 @@
thread_registry()->ReturnThreadLocked(is_mutator, thread);
}
-static RawInstance* DeserializeObject(Thread* thread,
- uint8_t* obj_data,
- intptr_t obj_len) {
- if (obj_data == NULL) {
+static RawInstance* DeserializeObject(Thread* thread, Message* message) {
+ if (message == NULL) {
return Instance::null();
}
- MessageSnapshotReader reader(obj_data, obj_len, thread);
+ MessageSnapshotReader reader(message, thread);
Zone* zone = thread->zone();
const Object& obj = Object::Handle(zone, reader.ReadObject());
ASSERT(!obj.IsError());
@@ -2847,9 +2818,7 @@
class_name_(NULL),
function_name_(NULL),
serialized_args_(NULL),
- serialized_args_len_(0),
- serialized_message_(NULL),
- serialized_message_len_(0),
+ serialized_message_(message_buffer->StealMessage()),
spawn_count_monitor_(spawn_count_monitor),
spawn_count_(spawn_count),
paused_(paused),
@@ -2867,7 +2836,6 @@
const String& class_name = String::Handle(cls.Name());
class_name_ = NewConstChar(class_name.ToCString());
}
- message_buffer->StealBuffer(&serialized_message_, &serialized_message_len_);
// Inherit flags from spawning isolate.
Isolate::Current()->FlagsCopyTo(isolate_flags());
@@ -2898,18 +2866,14 @@
library_url_(NULL),
class_name_(NULL),
function_name_(NULL),
- serialized_args_(NULL),
- serialized_args_len_(0),
- serialized_message_(NULL),
- serialized_message_len_(0),
+ serialized_args_(args_buffer->StealMessage()),
+ serialized_message_(message_buffer->StealMessage()),
spawn_count_monitor_(spawn_count_monitor),
spawn_count_(spawn_count),
isolate_flags_(),
paused_(paused),
errors_are_fatal_(errors_are_fatal) {
function_name_ = NewConstChar("main");
- args_buffer->StealBuffer(&serialized_args_, &serialized_args_len_);
- message_buffer->StealBuffer(&serialized_message_, &serialized_message_len_);
// By default inherit flags from spawning isolate. These can be overridden
// from the calling code.
@@ -2923,8 +2887,8 @@
delete[] library_url_;
delete[] class_name_;
delete[] function_name_;
- free(serialized_args_);
- free(serialized_message_);
+ delete serialized_args_;
+ delete serialized_message_;
}
RawObject* IsolateSpawnState::ResolveFunction() {
@@ -3005,12 +2969,11 @@
}
RawInstance* IsolateSpawnState::BuildArgs(Thread* thread) {
- return DeserializeObject(thread, serialized_args_, serialized_args_len_);
+ return DeserializeObject(thread, serialized_args_);
}
RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) {
- return DeserializeObject(thread, serialized_message_,
- serialized_message_len_);
+ return DeserializeObject(thread, serialized_message_);
}
void IsolateSpawnState::DecrementSpawnCount() {
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index aef8f40..2794d13 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -42,6 +42,7 @@
class IsolateReloadContext;
class IsolateSpawnState;
class Log;
+class Message;
class MessageHandler;
class Mutex;
class Object;
@@ -1125,10 +1126,8 @@
const char* library_url_;
const char* class_name_;
const char* function_name_;
- uint8_t* serialized_args_;
- intptr_t serialized_args_len_;
- uint8_t* serialized_message_;
- intptr_t serialized_message_len_;
+ Message* serialized_args_;
+ Message* serialized_message_;
// This counter tracks the number of outstanding calls to spawn by the parent
// isolate.
diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc
index 4f8ae5b..eaa2ce6 100644
--- a/runtime/vm/kernel_binary.cc
+++ b/runtime/vm/kernel_binary.cc
@@ -76,7 +76,8 @@
TransitionVMToNative transition(thread);
Api::Scope api_scope(thread);
Dart_Handle retval = (thread->isolate()->library_tag_handler())(
- Dart_kKernelTag, NULL, Api::NewHandle(thread, String::New(script_uri)));
+ Dart_kKernelTag, Api::Null(),
+ Api::NewHandle(thread, String::New(script_uri)));
if (!Dart_IsError(retval)) {
uint64_t data;
intptr_t data_len = 0;
diff --git a/runtime/vm/message.cc b/runtime/vm/message.cc
index 305b4eb..6fa77d8 100644
--- a/runtime/vm/message.cc
+++ b/runtime/vm/message.cc
@@ -11,6 +11,43 @@
namespace dart {
+Message::Message(Dart_Port dest_port,
+ uint8_t* data,
+ intptr_t len,
+ Priority priority,
+ Dart_Port delivery_failure_port)
+ : next_(NULL),
+ dest_port_(dest_port),
+ delivery_failure_port_(delivery_failure_port),
+ data_(data),
+ len_(len),
+ priority_(priority) {
+ ASSERT((priority == kNormalPriority) ||
+ (delivery_failure_port == kIllegalPort));
+}
+
+Message::Message(Dart_Port dest_port,
+ RawObject* raw_obj,
+ Priority priority,
+ Dart_Port delivery_failure_port)
+ : next_(NULL),
+ dest_port_(dest_port),
+ delivery_failure_port_(delivery_failure_port),
+ data_(reinterpret_cast<uint8_t*>(raw_obj)),
+ len_(0),
+ priority_(priority) {
+ ASSERT(!raw_obj->IsHeapObject() || raw_obj->IsVMHeapObject());
+ ASSERT((priority == kNormalPriority) ||
+ (delivery_failure_port == kIllegalPort));
+}
+
+Message::~Message() {
+ ASSERT(delivery_failure_port_ == kIllegalPort);
+ if (len_ > 0) {
+ free(data_);
+ }
+}
+
bool Message::RedirectToDeliveryFailurePort() {
if (delivery_failure_port_ == kIllegalPort) {
return false;
diff --git a/runtime/vm/message.h b/runtime/vm/message.h
index 4765ef2..db46955 100644
--- a/runtime/vm/message.h
+++ b/runtime/vm/message.h
@@ -8,7 +8,6 @@
#include "platform/assert.h"
#include "vm/allocation.h"
#include "vm/globals.h"
-#include "vm/raw_object.h"
// Duplicated from dart_api.h to avoid including the whole header.
typedef int64_t Dart_Port;
@@ -16,6 +15,7 @@
namespace dart {
class JSONStream;
+class RawObject;
class Message {
public:
@@ -48,39 +48,15 @@
uint8_t* data,
intptr_t len,
Priority priority,
- Dart_Port delivery_failure_port = kIllegalPort)
- : next_(NULL),
- dest_port_(dest_port),
- delivery_failure_port_(delivery_failure_port),
- data_(data),
- len_(len),
- priority_(priority) {
- ASSERT((priority == kNormalPriority) ||
- (delivery_failure_port == kIllegalPort));
- }
+ Dart_Port delivery_failure_port = kIllegalPort);
// Message objects can also carry RawObject pointers for Smis and objects in
// the VM heap. This is indicated by setting the len_ field to 0.
Message(Dart_Port dest_port,
RawObject* raw_obj,
Priority priority,
- Dart_Port delivery_failure_port = kIllegalPort)
- : next_(NULL),
- dest_port_(dest_port),
- delivery_failure_port_(delivery_failure_port),
- data_(reinterpret_cast<uint8_t*>(raw_obj)),
- len_(0),
- priority_(priority) {
- ASSERT(!raw_obj->IsHeapObject() || raw_obj->IsVMHeapObject());
- ASSERT((priority == kNormalPriority) ||
- (delivery_failure_port == kIllegalPort));
- }
- ~Message() {
- ASSERT(delivery_failure_port_ == kIllegalPort);
- if (len_ > 0) {
- free(data_);
- }
- }
+ Dart_Port delivery_failure_port = kIllegalPort);
+ ~Message();
Dart_Port dest_port() const { return dest_port_; }
uint8_t* data() const {
diff --git a/runtime/vm/native_api_impl.cc b/runtime/vm/native_api_impl.cc
index 49db21a..2f52f30 100644
--- a/runtime/vm/native_api_impl.cc
+++ b/runtime/vm/native_api_impl.cc
@@ -16,13 +16,6 @@
// --- Message sending/receiving from native code ---
-static uint8_t* malloc_allocator(uint8_t* ptr,
- intptr_t old_size,
- intptr_t new_size) {
- void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
- return reinterpret_cast<uint8_t*>(new_ptr);
-}
-
class IsolateSaver {
public:
explicit IsolateSaver(Isolate* current_isolate)
@@ -46,18 +39,16 @@
};
static bool PostCObjectHelper(Dart_Port port_id, Dart_CObject* message) {
- uint8_t* buffer = NULL;
- ApiMessageWriter writer(&buffer, malloc_allocator);
- bool success = writer.WriteCMessage(message);
+ ApiMessageWriter writer;
+ Message* msg =
+ writer.WriteCMessage(message, port_id, Message::kNormalPriority);
- if (!success) {
- free(buffer);
- return success;
+ if (msg == NULL) {
+ return false;
}
// Post the message at the given port.
- return PortMap::PostMessage(new Message(
- port_id, buffer, writer.BytesWritten(), Message::kNormalPriority));
+ return PortMap::PostMessage(msg);
}
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message) {
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 9a8cf11..a2d7cfe 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3910,7 +3910,8 @@
from_index, num_type_params, bound_error,
bound_trail, space);
}
- if (other.IsDartFunctionClass()) {
+ // In strong mode, subtyping rules of callable instances are restricted.
+ if (!isolate->strong() && other.IsDartFunctionClass()) {
// Check if type S has a call() method.
const Function& call_function =
Function::Handle(zone, this_class.LookupCallFunctionForTypeTest());
@@ -4403,29 +4404,30 @@
patch_prefix, class_name);
}
+// Thomas Wang, Integer Hash Functions.
+// https://gist.github.com/badboy/6267743
+// "64 bit to 32 bit Hash Functions"
+static uword Hash64To32(uint64_t v) {
+ v = ~v + (v << 18);
+ v = v ^ (v >> 31);
+ v = v * 21;
+ v = v ^ (v >> 11);
+ v = v + (v << 6);
+ v = v ^ (v >> 22);
+ return static_cast<uint32_t>(v);
+}
+
class CanonicalDoubleKey {
public:
explicit CanonicalDoubleKey(const Double& key)
: key_(&key), value_(key.value()) {}
explicit CanonicalDoubleKey(const double value) : key_(NULL), value_(value) {}
-
bool Matches(const Double& obj) const {
return obj.BitwiseEqualsToDouble(value_);
}
uword Hash() const { return Hash(value_); }
-
- // Thomas Wang, Integer Hash Functions.
- // https://gist.github.com/badboy/6267743
- // "64 bit to 32 bit Hash Functions"
static uword Hash(double value) {
- uint64_t v = bit_cast<uint64_t>(value);
- v = ~v + (v << 18);
- v = v ^ (v >> 31);
- v = v * 21;
- v = v ^ (v >> 11);
- v = v + (v << 6);
- v = v ^ (v >> 22);
- return static_cast<uint32_t>(v);
+ return Hash64To32(bit_cast<uint64_t>(value));
}
const Double* key_;
@@ -4435,25 +4437,43 @@
DISALLOW_ALLOCATION();
};
-// Traits for looking up Canonical Instances based on a hash of the fields.
-class CanonicalDoubleTraits {
+class CanonicalMintKey {
public:
- static const char* Name() { return "CanonicalDoubleTraits"; }
+ explicit CanonicalMintKey(const Mint& key)
+ : key_(&key), value_(key.value()) {}
+ explicit CanonicalMintKey(const int64_t value) : key_(NULL), value_(value) {}
+ bool Matches(const Mint& obj) const { return obj.value() == value_; }
+ uword Hash() const { return Hash(value_); }
+ static uword Hash(int64_t value) {
+ return Hash64To32(bit_cast<uint64_t>(value));
+ }
+
+ const Mint* key_;
+ const int64_t value_;
+
+ private:
+ DISALLOW_ALLOCATION();
+};
+
+// Traits for looking up Canonical numbers based on a hash of the value.
+template <typename ObjectType, typename KeyType>
+class CanonicalNumberTraits {
+ public:
+ static const char* Name() { return "CanonicalNumberTraits"; }
static bool ReportStats() { return false; }
// Called when growing the table.
static bool IsMatch(const Object& a, const Object& b) {
return a.raw() == b.raw();
}
- static bool IsMatch(const CanonicalDoubleKey& a, const Object& b) {
- return a.Matches(Double::Cast(b));
+ static bool IsMatch(const KeyType& a, const Object& b) {
+ return a.Matches(ObjectType::Cast(b));
}
static uword Hash(const Object& key) {
- ASSERT(key.IsDouble());
- return CanonicalDoubleKey::Hash(Double::Cast(key).value());
+ return KeyType::Hash(ObjectType::Cast(key).value());
}
- static uword Hash(const CanonicalDoubleKey& key) { return key.Hash(); }
- static RawObject* NewKey(const CanonicalDoubleKey& obj) {
+ static uword Hash(const KeyType& key) { return key.Hash(); }
+ static RawObject* NewKey(const KeyType& obj) {
if (obj.key_ != NULL) {
return obj.key_->raw();
} else {
@@ -4462,7 +4482,10 @@
}
}
};
-typedef UnorderedHashSet<CanonicalDoubleTraits> CanonicalDoubleSet;
+typedef UnorderedHashSet<CanonicalNumberTraits<Double, CanonicalDoubleKey> >
+ CanonicalDoubleSet;
+typedef UnorderedHashSet<CanonicalNumberTraits<Mint, CanonicalMintKey> >
+ CanonicalMintSet;
// Returns an instance of Double or Double::null().
RawDouble* Class::LookupCanonicalDouble(Zone* zone, double value) const {
@@ -4476,27 +4499,16 @@
return canonical_value.raw();
}
-RawMint* Class::LookupCanonicalMint(Zone* zone,
- int64_t value,
- intptr_t* index) const {
+// Returns an instance of Mint or Mint::null().
+RawMint* Class::LookupCanonicalMint(Zone* zone, int64_t value) const {
ASSERT(this->raw() == Isolate::Current()->object_store()->mint_class());
- const Array& constants = Array::Handle(zone, this->constants());
- const intptr_t constants_len = constants.Length();
- // Linear search to see whether this value is already present in the
- // list of canonicalized constants.
+ if (this->constants() == Object::empty_array().raw()) return Mint::null();
+
Mint& canonical_value = Mint::Handle(zone);
- while (*index < constants_len) {
- canonical_value ^= constants.At(*index);
- if (canonical_value.IsNull()) {
- break;
- }
- if (canonical_value.value() == value) {
- ASSERT(canonical_value.IsCanonical());
- return canonical_value.raw();
- }
- *index = *index + 1;
- }
- return Mint::null();
+ CanonicalMintSet constants(zone, this->constants());
+ canonical_value ^= constants.GetOrNull(CanonicalMintKey(value));
+ this->set_constants(constants.Release());
+ return canonical_value.raw();
}
RawBigint* Class::LookupCanonicalBigint(Zone* zone,
@@ -4610,9 +4622,19 @@
this->set_constants(constants.Release());
}
-void Class::InsertCanonicalInt(Zone* zone,
- intptr_t index,
- const Number& constant) const {
+void Class::InsertCanonicalMint(Zone* zone, const Mint& constant) const {
+ if (this->constants() == Object::empty_array().raw()) {
+ this->set_constants(Array::Handle(
+ zone, HashTables::New<CanonicalMintSet>(128, Heap::kOld)));
+ }
+ CanonicalMintSet constants(zone, this->constants());
+ constants.InsertNewOrGet(CanonicalMintKey(constant));
+ this->set_constants(constants.Release());
+}
+
+void Class::InsertCanonicalBigint(Zone* zone,
+ intptr_t index,
+ const Bigint& constant) const {
// The constant needs to be added to the list. Grow the list if it is full.
Array& canonical_list = Array::Handle(zone, constants());
const intptr_t list_len = canonical_list.Length();
@@ -15905,7 +15927,9 @@
}
other_type_arguments = instantiated_other.arguments();
const bool other_is_dart_function = instantiated_other.IsDartFunctionType();
- if (other_is_dart_function || instantiated_other.IsFunctionType()) {
+ // In strong mode, subtyping rules of callable instances are restricted.
+ if (!isolate->strong() &&
+ (other_is_dart_function || instantiated_other.IsFunctionType())) {
// Check if this instance understands a call() method of a compatible type.
Function& sig_fun =
Function::Handle(zone, cls.LookupCallFunctionForTypeTest());
@@ -16774,22 +16798,26 @@
return fun.TypeTest(test_kind, other_fun, bound_error, bound_trail,
space);
}
- // Check if type S has a call() method of function type T.
- const Function& call_function =
- Function::Handle(zone, type_cls.LookupCallFunctionForTypeTest());
- if (!call_function.IsNull()) {
- if (other_is_dart_function_type) {
- return true;
- }
- // Shortcut the test involving the call function if the
- // pair <this, other> is already in the trail.
- if (TestAndAddBuddyToTrail(&bound_trail, other)) {
- return true;
- }
- if (call_function.TypeTest(
- test_kind, Function::Handle(zone, Type::Cast(other).signature()),
- bound_error, bound_trail, space)) {
- return true;
+ // In strong mode, subtyping rules of callable instances are restricted.
+ if (!isolate->strong()) {
+ // Check if type S has a call() method of function type T.
+ const Function& call_function =
+ Function::Handle(zone, type_cls.LookupCallFunctionForTypeTest());
+ if (!call_function.IsNull()) {
+ if (other_is_dart_function_type) {
+ return true;
+ }
+ // Shortcut the test involving the call function if the
+ // pair <this, other> is already in the trail.
+ if (TestAndAddBuddyToTrail(&bound_trail, other)) {
+ return true;
+ }
+ if (call_function.TypeTest(
+ test_kind,
+ Function::Handle(zone, Type::Cast(other).signature()),
+ bound_error, bound_trail, space)) {
+ return true;
+ }
}
}
}
@@ -18642,7 +18670,7 @@
}
ASSERT(result.IsOld());
result.SetCanonical();
- cls.InsertCanonicalInt(zone, index, result);
+ cls.InsertCanonicalBigint(zone, index, result);
return result.raw();
}
}
@@ -18663,7 +18691,7 @@
return true;
case kMintCid: {
Mint& result = Mint::Handle(zone);
- result ^= cls.LookupCanonicalMint(zone, Mint::Cast(*this).value(), &idx);
+ result ^= cls.LookupCanonicalMint(zone, Mint::Cast(*this).value());
return (result.raw() == this->raw());
}
case kDoubleCid: {
@@ -19150,8 +19178,7 @@
Isolate* isolate = thread->isolate();
const Class& cls = Class::Handle(zone, isolate->object_store()->mint_class());
Mint& canonical_value = Mint::Handle(zone);
- intptr_t index = 0;
- canonical_value ^= cls.LookupCanonicalMint(zone, value, &index);
+ canonical_value ^= cls.LookupCanonicalMint(zone, value);
if (!canonical_value.IsNull()) {
return canonical_value.raw();
}
@@ -19159,7 +19186,7 @@
SafepointMutexLocker ml(isolate->constant_canonicalization_mutex());
// Retry lookup.
{
- canonical_value ^= cls.LookupCanonicalMint(zone, value, &index);
+ canonical_value ^= cls.LookupCanonicalMint(zone, value);
if (!canonical_value.IsNull()) {
return canonical_value.raw();
}
@@ -19168,7 +19195,7 @@
canonical_value.SetCanonical();
// The value needs to be added to the constants list. Grow the list if
// it is full.
- cls.InsertCanonicalInt(zone, index, canonical_value);
+ cls.InsertCanonicalMint(zone, canonical_value);
return canonical_value.raw();
}
}
@@ -19600,7 +19627,7 @@
value.SetCanonical();
// The value needs to be added to the constants list. Grow the list if
// it is full.
- cls.InsertCanonicalInt(zone, index, value);
+ cls.InsertCanonicalBigint(zone, index, value);
return value.raw();
}
}
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 1c15efe..31a980b 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1211,13 +1211,12 @@
RawLibraryPrefix* LookupLibraryPrefix(const String& name) const;
RawDouble* LookupCanonicalDouble(Zone* zone, double value) const;
- // Returns an instance of Mint or Mint::null().
+ RawMint* LookupCanonicalMint(Zone* zone, int64_t value) const;
+
+ // Returns an instance of Bigint or Bigint::null().
// 'index' points to either:
// - constants_list_ position of found element, or
// - constants_list_ position where new canonical can be inserted.
- RawMint* LookupCanonicalMint(Zone* zone,
- int64_t value,
- intptr_t* index) const;
RawBigint* LookupCanonicalBigint(Zone* zone,
const Bigint& value,
intptr_t* index) const;
@@ -1227,9 +1226,10 @@
RawInstance* InsertCanonicalConstant(Zone* zone,
const Instance& constant) const;
void InsertCanonicalDouble(Zone* zone, const Double& constant) const;
- void InsertCanonicalInt(Zone* zone,
- intptr_t index,
- const Number& constant) const;
+ void InsertCanonicalMint(Zone* zone, const Mint& constant) const;
+ void InsertCanonicalBigint(Zone* zone,
+ intptr_t index,
+ const Bigint& constant) const;
void RehashConstants(Zone* zone) const;
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index f5dd5b8..82fef8b 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1830,7 +1830,7 @@
return Object::sentinel().raw();
}
if (message->len() > 0) {
- MessageSnapshotReader reader(message->data(), message->len(), thread);
+ MessageSnapshotReader reader(message, thread);
return reader.ReadObject();
} else {
return message->raw_obj();
diff --git a/runtime/vm/service_isolate.cc b/runtime/vm/service_isolate.cc
index 2c42ec5..96acbe5 100644
--- a/runtime/vm/service_isolate.cc
+++ b/runtime/vm/service_isolate.cc
@@ -6,6 +6,7 @@
#include "vm/compiler/jit/compiler.h"
#include "vm/dart_api_impl.h"
+#include "vm/dart_api_message.h"
#include "vm/dart_entry.h"
#include "vm/isolate.h"
#include "vm/lockers.h"
@@ -35,17 +36,6 @@
false,
"Provide extra service tracing information.");
-static uint8_t* malloc_allocator(uint8_t* ptr,
- intptr_t old_size,
- intptr_t new_size) {
- void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
- return reinterpret_cast<uint8_t*>(new_ptr);
-}
-
-static void malloc_deallocator(uint8_t* ptr) {
- free(reinterpret_cast<void*>(ptr));
-}
-
// These must be kept in sync with service/constants.dart
#define VM_SERVICE_ISOLATE_EXIT_MESSAGE_ID 0
#define VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID 1
@@ -80,23 +70,12 @@
return list.raw();
}
-static RawArray* MakeServiceExitMessage() {
- const Array& list = Array::Handle(Array::New(1));
- ASSERT(!list.IsNull());
- const intptr_t code = VM_SERVICE_ISOLATE_EXIT_MESSAGE_ID;
- const Integer& code_int = Integer::Handle(Integer::New(code));
- list.SetAt(0, code_int);
- return list.raw();
-}
-
const char* ServiceIsolate::kName = "vm-service";
Isolate* ServiceIsolate::isolate_ = NULL;
Dart_Port ServiceIsolate::port_ = ILLEGAL_PORT;
Dart_Port ServiceIsolate::load_port_ = ILLEGAL_PORT;
Dart_Port ServiceIsolate::origin_ = ILLEGAL_PORT;
Dart_IsolateCreateCallback ServiceIsolate::create_callback_ = NULL;
-uint8_t* ServiceIsolate::exit_message_ = NULL;
-intptr_t ServiceIsolate::exit_message_length_ = 0;
Monitor* ServiceIsolate::monitor_ = new Monitor();
bool ServiceIsolate::initializing_ = true;
bool ServiceIsolate::shutting_down_ = false;
@@ -106,22 +85,18 @@
const Array& message = Array::Handle(MakeServerControlMessage(
sp, VM_SERVICE_SERVER_INFO_MESSAGE_ID, false /* ignored */));
ASSERT(!message.IsNull());
- uint8_t* data = NULL;
- MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
- writer.WriteMessage(message);
- intptr_t len = writer.BytesWritten();
- PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority));
+ MessageWriter writer(false);
+ PortMap::PostMessage(
+ writer.WriteMessage(message, port_, Message::kNormalPriority));
}
void ServiceIsolate::ControlWebServer(const SendPort& sp, bool enable) {
const Array& message = Array::Handle(MakeServerControlMessage(
sp, VM_SERVICE_WEB_SERVER_CONTROL_MESSAGE_ID, enable));
ASSERT(!message.IsNull());
- uint8_t* data = NULL;
- MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
- writer.WriteMessage(message);
- intptr_t len = writer.BytesWritten();
- PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority));
+ MessageWriter writer(false);
+ PortMap::PostMessage(
+ writer.WriteMessage(message, port_, Message::kNormalPriority));
}
void ServiceIsolate::SetServerAddress(const char* address) {
@@ -194,16 +169,13 @@
const Array& list = Array::Handle(MakeServiceControlMessage(
Dart_GetMainPortId(), VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID, name));
ASSERT(!list.IsNull());
- uint8_t* data = NULL;
- MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
- writer.WriteMessage(list);
- intptr_t len = writer.BytesWritten();
+ MessageWriter writer(false);
if (FLAG_trace_service) {
OS::PrintErr("vm-service: Isolate %s %" Pd64 " registered.\n",
name.ToCString(), Dart_GetMainPortId());
}
return PortMap::PostMessage(
- new Message(port_, data, len, Message::kNormalPriority));
+ writer.WriteMessage(list, port_, Message::kNormalPriority));
}
bool ServiceIsolate::SendIsolateShutdownMessage() {
@@ -222,30 +194,36 @@
const Array& list = Array::Handle(MakeServiceControlMessage(
Dart_GetMainPortId(), VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID, name));
ASSERT(!list.IsNull());
- uint8_t* data = NULL;
- MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
- writer.WriteMessage(list);
- intptr_t len = writer.BytesWritten();
+ MessageWriter writer(false);
if (FLAG_trace_service) {
OS::PrintErr("vm-service: Isolate %s %" Pd64 " deregistered.\n",
name.ToCString(), Dart_GetMainPortId());
}
return PortMap::PostMessage(
- new Message(port_, data, len, Message::kNormalPriority));
+ writer.WriteMessage(list, port_, Message::kNormalPriority));
}
void ServiceIsolate::SendServiceExitMessage() {
if (!IsRunning()) {
return;
}
- if ((exit_message_ == NULL) || (exit_message_length_ == 0)) {
- return;
- }
if (FLAG_trace_service) {
OS::PrintErr("vm-service: sending service exit message.\n");
}
- PortMap::PostMessage(new Message(port_, exit_message_, exit_message_length_,
- Message::kNormalPriority));
+
+ Dart_CObject code;
+ code.type = Dart_CObject_kInt32;
+ code.value.as_int32 = VM_SERVICE_ISOLATE_EXIT_MESSAGE_ID;
+ Dart_CObject* values[1] = {&code};
+
+ Dart_CObject message;
+ message.type = Dart_CObject_kArray;
+ message.value.as_array.length = 1;
+ message.value.as_array.values = values;
+
+ ApiMessageWriter writer;
+ PortMap::PostMessage(
+ writer.WriteCMessage(&message, port_, Message::kNormalPriority));
}
void ServiceIsolate::SetServicePort(Dart_Port port) {
@@ -283,26 +261,6 @@
SetServiceIsolate(I);
}
-void ServiceIsolate::ConstructExitMessageAndCache(Isolate* I) {
- // Construct and cache exit message here so we can send it without needing an
- // isolate.
- Thread* T = Thread::Current();
- ASSERT(I == T->isolate());
- ASSERT(I != NULL);
- StackZone zone(T);
- HANDLESCOPE(T);
- ASSERT(exit_message_ == NULL);
- ASSERT(exit_message_length_ == 0);
- const Array& list = Array::Handle(Z, MakeServiceExitMessage());
- ASSERT(!list.IsNull());
- MessageWriter writer(&exit_message_, &malloc_allocator, &malloc_deallocator,
- false);
- writer.WriteMessage(list);
- exit_message_length_ = writer.BytesWritten();
- ASSERT(exit_message_ != NULL);
- ASSERT(exit_message_length_ != 0);
-}
-
void ServiceIsolate::FinishedExiting() {
MonitorLocker ml(monitor_);
shutting_down_ = false;
@@ -348,7 +306,6 @@
{
ASSERT(Isolate::Current() == NULL);
StartIsolateScope start_scope(isolate);
- ServiceIsolate::ConstructExitMessageAndCache(isolate);
got_unwind = RunMain(isolate);
}
diff --git a/runtime/vm/service_isolate.h b/runtime/vm/service_isolate.h
index 9060301..d371e8e 100644
--- a/runtime/vm/service_isolate.h
+++ b/runtime/vm/service_isolate.h
@@ -54,7 +54,6 @@
static void SetServicePort(Dart_Port port);
static void SetServiceIsolate(Isolate* isolate);
static void SetLoadPort(Dart_Port port);
- static void ConstructExitMessageAndCache(Isolate* isolate);
static void FinishedExiting();
static void FinishedInitializing();
static void MaybeMakeServiceIsolate(Isolate* isolate);
@@ -63,8 +62,6 @@
}
static Dart_IsolateCreateCallback create_callback_;
- static uint8_t* exit_message_;
- static intptr_t exit_message_length_;
static Monitor* monitor_;
static bool initializing_;
static bool shutting_down_;
diff --git a/runtime/vm/service_test.cc b/runtime/vm/service_test.cc
index 78f6a0c..c0aec6d 100644
--- a/runtime/vm/service_test.cc
+++ b/runtime/vm/service_test.cc
@@ -44,7 +44,7 @@
response_obj = message->raw_obj();
} else {
Thread* thread = Thread::Current();
- MessageSnapshotReader reader(message->data(), message->len(), thread);
+ MessageSnapshotReader reader(message, thread);
response_obj = reader.ReadObject();
}
if (response_obj.IsString()) {
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index d801e19..5c0f36ed 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -662,7 +662,7 @@
}
Advance(version_len);
- const char* expected_features = Dart::FeaturesString(isolate, kind_);
+ const char* expected_features = Dart::FeaturesString(isolate, false, kind_);
ASSERT(expected_features != NULL);
const intptr_t expected_len = strlen(expected_features);
@@ -918,11 +918,9 @@
ResetBackwardReferenceTable();
}
-MessageSnapshotReader::MessageSnapshotReader(const uint8_t* buffer,
- intptr_t size,
- Thread* thread)
- : SnapshotReader(buffer,
- size,
+MessageSnapshotReader::MessageSnapshotReader(Message* message, Thread* thread)
+ : SnapshotReader(message->data(),
+ message->len(),
Snapshot::kMessage,
new ZoneGrowableArray<BackRefNode>(kNumInitialReferences),
thread) {}
@@ -933,13 +931,12 @@
SnapshotWriter::SnapshotWriter(Thread* thread,
Snapshot::Kind kind,
- uint8_t** buffer,
ReAlloc alloc,
DeAlloc dealloc,
intptr_t initial_size,
ForwardList* forward_list,
bool can_send_any_object)
- : BaseWriter(buffer, alloc, dealloc, initial_size),
+ : BaseWriter(alloc, dealloc, initial_size),
thread_(thread),
kind_(kind),
object_store_(isolate()->object_store()),
@@ -1538,7 +1535,7 @@
WriteBytes(reinterpret_cast<const uint8_t*>(expected_version), version_len);
const char* expected_features =
- Dart::FeaturesString(Isolate::Current(), kind_);
+ Dart::FeaturesString(Isolate::Current(), false, kind_);
ASSERT(expected_features != NULL);
const intptr_t features_len = strlen(expected_features);
WriteBytes(reinterpret_cast<const uint8_t*>(expected_features),
@@ -1546,17 +1543,15 @@
free(const_cast<char*>(expected_features));
}
-ScriptSnapshotWriter::ScriptSnapshotWriter(uint8_t** buffer, ReAlloc alloc)
+ScriptSnapshotWriter::ScriptSnapshotWriter(ReAlloc alloc)
: SnapshotWriter(Thread::Current(),
Snapshot::kScript,
- buffer,
alloc,
NULL,
kInitialSize,
&forward_list_,
true /* can_send_any_object */),
forward_list_(thread(), kMaxPredefinedObjectIds) {
- ASSERT(buffer != NULL);
ASSERT(alloc != NULL);
}
@@ -1598,26 +1593,30 @@
}
}
-MessageWriter::MessageWriter(uint8_t** buffer,
- ReAlloc alloc,
- DeAlloc dealloc,
- bool can_send_any_object,
- intptr_t* buffer_len)
+static uint8_t* malloc_allocator(uint8_t* ptr,
+ intptr_t old_size,
+ intptr_t new_size) {
+ void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
+ return reinterpret_cast<uint8_t*>(new_ptr);
+}
+
+static void malloc_deallocator(uint8_t* ptr) {
+ free(reinterpret_cast<void*>(ptr));
+}
+
+MessageWriter::MessageWriter(bool can_send_any_object)
: SnapshotWriter(Thread::Current(),
Snapshot::kMessage,
- buffer,
- alloc,
- dealloc,
+ malloc_allocator,
+ malloc_deallocator,
kInitialSize,
&forward_list_,
can_send_any_object),
- forward_list_(thread(), kMaxPredefinedObjectIds),
- buffer_len_(buffer_len) {
- ASSERT(buffer != NULL);
- ASSERT(alloc != NULL);
-}
+ forward_list_(thread(), kMaxPredefinedObjectIds) {}
-void MessageWriter::WriteMessage(const Object& obj) {
+Message* MessageWriter::WriteMessage(const Object& obj,
+ Dart_Port dest_port,
+ Message::Priority priority) {
ASSERT(kind() == Snapshot::kMessage);
ASSERT(isolate() != NULL);
@@ -1627,13 +1626,12 @@
if (setjmp(*jump.Set()) == 0) {
NoSafepointScope no_safepoint;
WriteObject(obj.raw());
- if (buffer_len_ != NULL) {
- *buffer_len_ = BytesWritten();
- }
} else {
FreeBuffer();
ThrowException(exception_type(), exception_msg());
}
+
+ return new Message(dest_port, buffer(), BytesWritten(), priority);
}
} // namespace dart
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index dd7551d..576b501 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -12,6 +12,7 @@
#include "vm/globals.h"
#include "vm/growable_array.h"
#include "vm/isolate.h"
+#include "vm/message.h"
#include "vm/visitor.h"
namespace dart {
@@ -489,7 +490,7 @@
class MessageSnapshotReader : public SnapshotReader {
public:
- MessageSnapshotReader(const uint8_t* buffer, intptr_t size, Thread* thread);
+ MessageSnapshotReader(Message* message, Thread* thread);
~MessageSnapshotReader();
private:
@@ -498,7 +499,7 @@
class BaseWriter : public StackResource {
public:
- // Size of the snapshot.
+ uint8_t* buffer() { return stream_.buffer(); }
intptr_t BytesWritten() const { return stream_.bytes_written(); }
// Writes raw data to the stream (basic type).
@@ -556,14 +557,11 @@
}
protected:
- BaseWriter(uint8_t** buffer,
- ReAlloc alloc,
- DeAlloc dealloc,
- intptr_t initial_size)
+ BaseWriter(ReAlloc alloc, DeAlloc dealloc, intptr_t initial_size)
: StackResource(Thread::Current()),
- stream_(buffer, alloc, initial_size),
+ buffer_(NULL),
+ stream_(&buffer_, alloc, initial_size),
dealloc_(dealloc) {
- ASSERT(buffer != NULL);
ASSERT(alloc != NULL);
}
~BaseWriter() {}
@@ -585,6 +583,7 @@
}
private:
+ uint8_t* buffer_;
WriteStream stream_;
DeAlloc dealloc_;
@@ -649,7 +648,6 @@
protected:
SnapshotWriter(Thread* thread,
Snapshot::Kind kind,
- uint8_t** buffer,
ReAlloc alloc,
DeAlloc dealloc,
intptr_t initial_size,
@@ -766,7 +764,7 @@
class ScriptSnapshotWriter : public SnapshotWriter {
public:
static const intptr_t kInitialSize = 64 * KB;
- ScriptSnapshotWriter(uint8_t** buffer, ReAlloc alloc);
+ explicit ScriptSnapshotWriter(ReAlloc alloc);
~ScriptSnapshotWriter() {}
// Writes a partial snapshot of the script.
@@ -780,44 +778,36 @@
class SerializedObjectBuffer : public StackResource {
public:
- SerializedObjectBuffer()
- : StackResource(Thread::Current()),
- object_data_(NULL),
- object_length_(0) {}
+ SerializedObjectBuffer() : StackResource(Thread::Current()), message_(NULL) {}
- virtual ~SerializedObjectBuffer() { free(object_data_); }
+ virtual ~SerializedObjectBuffer() { delete message_; }
- void StealBuffer(uint8_t** out_data, intptr_t* out_length) {
- *out_data = object_data_;
- *out_length = object_length_;
-
- object_data_ = NULL;
- object_length_ = 0;
+ void set_message(Message* message) {
+ ASSERT(message_ == NULL);
+ message_ = message;
+ }
+ Message* StealMessage() {
+ Message* result = message_;
+ message_ = NULL;
+ return result;
}
- uint8_t** data_buffer() { return &object_data_; }
- intptr_t* data_length() { return &object_length_; }
-
private:
- uint8_t* object_data_;
- intptr_t object_length_;
+ Message* message_;
};
class MessageWriter : public SnapshotWriter {
public:
static const intptr_t kInitialSize = 512;
- MessageWriter(uint8_t** buffer,
- ReAlloc alloc,
- DeAlloc dealloc,
- bool can_send_any_object,
- intptr_t* buffer_len = NULL);
+ explicit MessageWriter(bool can_send_any_object);
~MessageWriter() {}
- void WriteMessage(const Object& obj);
+ Message* WriteMessage(const Object& obj,
+ Dart_Port dest_port,
+ Message::Priority priority);
private:
ForwardList forward_list_;
- intptr_t* buffer_len_;
DISALLOW_COPY_AND_ASSIGN(MessageWriter);
};
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index 6e51b38..00ae83a 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -57,19 +57,6 @@
return reinterpret_cast<uint8_t*>(realloc(ptr, new_size));
}
-static void malloc_deallocator(uint8_t* ptr) {
- free(ptr);
-}
-
-static uint8_t* zone_allocator(uint8_t* ptr,
- intptr_t old_size,
- intptr_t new_size) {
- Zone* zone = Thread::Current()->zone();
- return zone->Realloc<uint8_t>(ptr, old_size, new_size);
-}
-
-static void zone_deallocator(uint8_t* ptr) {}
-
// Compare two Dart_CObject object graphs rooted in first and
// second. The second graph will be destroyed by this operation no matter
// whether the graphs are equal or not.
@@ -134,25 +121,23 @@
static void CheckEncodeDecodeMessage(Dart_CObject* root) {
// Encode and decode the message.
- uint8_t* buffer = NULL;
- ApiMessageWriter writer(&buffer, &malloc_allocator);
- writer.WriteCMessage(root);
+ ApiMessageWriter writer;
+ Message* message =
+ writer.WriteCMessage(root, ILLEGAL_PORT, Message::kNormalPriority);
- ApiMessageReader api_reader(buffer, writer.BytesWritten());
+ ApiMessageReader api_reader(message);
Dart_CObject* new_root = api_reader.ReadMessage();
+ delete message;
// Check that the two messages are the same.
CompareDartCObjects(root, new_root);
-
- free(buffer);
}
static void ExpectEncodeFail(Dart_CObject* root) {
- uint8_t* buffer = NULL;
- ApiMessageWriter writer(&buffer, &malloc_allocator);
- const bool result = writer.WriteCMessage(root);
- EXPECT_EQ(false, result);
- free(buffer);
+ ApiMessageWriter writer;
+ Message* message =
+ writer.WriteCMessage(root, ILLEGAL_PORT, Message::kNormalPriority);
+ EXPECT(message == NULL);
}
TEST_CASE(SerializeNull) {
@@ -160,23 +145,24 @@
// Write snapshot with object content.
const Object& null_object = Object::Handle();
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(null_object);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(null_object, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(null_object, serialized_object));
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kNull, root->type);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
TEST_CASE(SerializeSmi1) {
@@ -184,24 +170,25 @@
// Write snapshot with object content.
const Smi& smi = Smi::Handle(Smi::New(124));
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(smi);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(smi, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(smi, serialized_object));
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kInt32, root->type);
EXPECT_EQ(smi.Value(), root->value.as_int32);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
TEST_CASE(SerializeSmi2) {
@@ -209,48 +196,49 @@
// Write snapshot with object content.
const Smi& smi = Smi::Handle(Smi::New(-1));
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(smi);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(smi, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(smi, serialized_object));
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kInt32, root->type);
EXPECT_EQ(smi.Value(), root->value.as_int32);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
Dart_CObject* SerializeAndDeserializeMint(const Mint& mint) {
// Write snapshot with object content.
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(mint);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(mint, ILLEGAL_PORT, Message::kNormalPriority);
{
// Switch to a regular zone, where VM handle allocation is allowed.
Thread* thread = Thread::Current();
StackZone zone(thread);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(serialized_object.IsMint());
}
// Read object back from the snapshot into a C structure.
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
CheckEncodeDecodeMessage(root);
+ delete message;
return root;
}
@@ -303,24 +291,25 @@
// Write snapshot with object content.
const Double& dbl = Double::Handle(Double::New(101.29));
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(dbl);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(dbl, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(dbl, serialized_object));
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kDouble, root->type);
EXPECT_EQ(dbl.value(), root->value.as_double);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
TEST_CASE(SerializeTrue) {
@@ -328,13 +317,12 @@
// Write snapshot with true object.
const Bool& bl = Bool::True();
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(bl);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(bl, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
const Object& serialized_object = Object::Handle(reader.ReadObject());
fprintf(stderr, "%s / %s\n", bl.ToCString(), serialized_object.ToCString());
@@ -342,12 +330,14 @@
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kBool, root->type);
EXPECT_EQ(true, root->value.as_bool);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
TEST_CASE(SerializeFalse) {
@@ -355,36 +345,36 @@
// Write snapshot with false object.
const Bool& bl = Bool::False();
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(bl);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(bl, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
const Object& serialized_object = Object::Handle(reader.ReadObject());
EXPECT(Equals(bl, serialized_object));
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kBool, root->type);
EXPECT_EQ(false, root->value.as_bool);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
TEST_CASE(SerializeCapability) {
// Write snapshot with object content.
const Capability& capability = Capability::Handle(Capability::New(12345));
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(capability);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(capability, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
Capability& obj = Capability::Handle();
obj ^= reader.ReadObject();
@@ -392,13 +382,14 @@
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kCapability, root->type);
int64_t id = root->value.as_capability.id;
EXPECT_EQ(12345, id);
CheckEncodeDecodeMessage(root);
+ delete message;
}
TEST_CASE(SerializeBigint) {
@@ -410,13 +401,12 @@
const String& str = String::Handle(String::New(cstr));
Bigint& bigint = Bigint::Handle();
bigint ^= Integer::NewCanonical(str);
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(bigint);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(bigint, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
Bigint& obj = Bigint::Handle();
obj ^= reader.ReadObject();
@@ -425,7 +415,7 @@
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kBigint, root->type);
@@ -433,21 +423,22 @@
EXPECT_STREQ(cstr, hex_value);
free(hex_value);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
Dart_CObject* SerializeAndDeserializeBigint(const Bigint& bigint) {
// Write snapshot with object content.
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(bigint);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(bigint, ILLEGAL_PORT, Message::kNormalPriority);
{
// Switch to a regular zone, where VM handle allocation is allowed.
Thread* thread = Thread::Current();
StackZone zone(thread);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
Bigint& serialized_bigint = Bigint::Handle();
serialized_bigint ^= reader.ReadObject();
const char* str1 = bigint.ToHexCString(thread->zone());
@@ -456,11 +447,14 @@
}
// Read object back from the snapshot into a C structure.
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
// Bigint not supported.
EXPECT_NOTNULL(root);
CheckEncodeDecodeMessage(root);
+
+ delete message;
+
return root;
}
@@ -489,42 +483,30 @@
CheckBigint("-0x9876543210987654321098765432109876543210");
}
+#define TEST_ROUND_TRIP_IDENTICAL(object) \
+ { \
+ MessageWriter writer(true); \
+ Message* message = writer.WriteMessage( \
+ Object::Handle(object), ILLEGAL_PORT, Message::kNormalPriority); \
+ MessageSnapshotReader reader(message, thread); \
+ EXPECT(reader.ReadObject() == object); \
+ delete message; \
+ }
+
TEST_CASE(SerializeSingletons) {
- // Write snapshot with object content.
- uint8_t* buffer;
- MessageWriter writer(&buffer, &malloc_allocator, &malloc_deallocator, true);
- writer.WriteObject(Object::class_class());
- writer.WriteObject(Object::type_arguments_class());
- writer.WriteObject(Object::function_class());
- writer.WriteObject(Object::field_class());
- writer.WriteObject(Object::token_stream_class());
- writer.WriteObject(Object::script_class());
- writer.WriteObject(Object::library_class());
- writer.WriteObject(Object::code_class());
- writer.WriteObject(Object::instructions_class());
- writer.WriteObject(Object::pc_descriptors_class());
- writer.WriteObject(Object::exception_handlers_class());
- writer.WriteObject(Object::context_class());
- writer.WriteObject(Object::context_scope_class());
- intptr_t buffer_len = writer.BytesWritten();
-
- // Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
- EXPECT(Object::class_class() == reader.ReadObject());
- EXPECT(Object::type_arguments_class() == reader.ReadObject());
- EXPECT(Object::function_class() == reader.ReadObject());
- EXPECT(Object::field_class() == reader.ReadObject());
- EXPECT(Object::token_stream_class() == reader.ReadObject());
- EXPECT(Object::script_class() == reader.ReadObject());
- EXPECT(Object::library_class() == reader.ReadObject());
- EXPECT(Object::code_class() == reader.ReadObject());
- EXPECT(Object::instructions_class() == reader.ReadObject());
- EXPECT(Object::pc_descriptors_class() == reader.ReadObject());
- EXPECT(Object::exception_handlers_class() == reader.ReadObject());
- EXPECT(Object::context_class() == reader.ReadObject());
- EXPECT(Object::context_scope_class() == reader.ReadObject());
-
- free(buffer);
+ TEST_ROUND_TRIP_IDENTICAL(Object::class_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::type_arguments_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::function_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::field_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::token_stream_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::script_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::library_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::code_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::instructions_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::pc_descriptors_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::exception_handlers_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::context_class());
+ TEST_ROUND_TRIP_IDENTICAL(Object::context_scope_class());
}
static void TestString(const char* cstr) {
@@ -532,24 +514,24 @@
EXPECT(Utf8::IsValid(reinterpret_cast<const uint8_t*>(cstr), strlen(cstr)));
// Write snapshot with object content.
String& str = String::Handle(String::New(cstr));
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(str);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(str, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
String& serialized_str = String::Handle();
serialized_str ^= reader.ReadObject();
EXPECT(str.Equals(serialized_str));
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kString, root->type);
EXPECT_STREQ(cstr, root->value.as_string);
CheckEncodeDecodeMessage(root);
+ delete message;
}
TEST_CASE(SerializeString) {
@@ -576,20 +558,19 @@
smi ^= Smi::New(i);
array.SetAt(i, smi);
}
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(array);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(array, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
Array& serialized_array = Array::Handle();
serialized_array ^= reader.ReadObject();
EXPECT(array.CanonicalizeEquals(serialized_array));
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -599,6 +580,8 @@
EXPECT_EQ(i, element->value.as_int32);
}
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
TEST_CASE(SerializeArrayWithTypeArgument) {
@@ -612,20 +595,19 @@
smi ^= Smi::New(i);
array.SetAt(i, smi);
}
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(array);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(array, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
Array& serialized_array = Array::Handle();
serialized_array ^= reader.ReadObject();
EXPECT(array.CanonicalizeEquals(serialized_array));
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -635,6 +617,8 @@
EXPECT_EQ(i, element->value.as_int32);
}
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
TEST_CASE(FailSerializeLargeArray) {
@@ -688,25 +672,26 @@
// Write snapshot with object content.
const int kArrayLength = 0;
Array& array = Array::Handle(Array::New(kArrayLength));
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(array);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(array, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
Array& serialized_array = Array::Handle();
serialized_array ^= reader.ReadObject();
EXPECT(array.CanonicalizeEquals(serialized_array));
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
EXPECT(root->value.as_array.values == NULL);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
TEST_CASE(SerializeByteArray) {
@@ -717,20 +702,19 @@
for (int i = 0; i < kTypedDataLength; i++) {
typed_data.SetUint8(i, i);
}
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(typed_data);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(typed_data, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
TypedData& serialized_typed_data = TypedData::Handle();
serialized_typed_data ^= reader.ReadObject();
EXPECT(serialized_typed_data.IsTypedData());
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kTypedData, root->type);
EXPECT_EQ(kTypedDataLength, root->value.as_typed_data.length);
@@ -738,6 +722,8 @@
EXPECT(root->value.as_typed_data.values[i] == i);
}
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
#define TEST_TYPED_ARRAY(darttype, ctype) \
@@ -750,17 +736,17 @@
for (int i = 0; i < kArrayLength; i++) { \
array.Set##darttype((i * scale), i); \
} \
- uint8_t* buffer; \
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true); \
- writer.WriteMessage(array); \
- intptr_t buffer_len = writer.BytesWritten(); \
- MessageSnapshotReader reader(buffer, buffer_len, thread); \
+ MessageWriter writer(true); \
+ Message* message = \
+ writer.WriteMessage(array, ILLEGAL_PORT, Message::kNormalPriority); \
+ MessageSnapshotReader reader(message, thread); \
TypedData& serialized_array = TypedData::Handle(); \
serialized_array ^= reader.ReadObject(); \
for (int i = 0; i < kArrayLength; i++) { \
EXPECT_EQ(static_cast<ctype>(i), \
serialized_array.Get##darttype(i* scale)); \
} \
+ delete message; \
}
#define TEST_EXTERNAL_TYPED_ARRAY(darttype, ctype) \
@@ -772,17 +758,17 @@
ExternalTypedData::New(kExternalTypedData##darttype##ArrayCid, \
reinterpret_cast<uint8_t*>(data), length)); \
intptr_t scale = array.ElementSizeInBytes(); \
- uint8_t* buffer; \
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true); \
- writer.WriteMessage(array); \
- intptr_t buffer_len = writer.BytesWritten(); \
- MessageSnapshotReader reader(buffer, buffer_len, thread); \
+ MessageWriter writer(true); \
+ Message* message = \
+ writer.WriteMessage(array, ILLEGAL_PORT, Message::kNormalPriority); \
+ MessageSnapshotReader reader(message, thread); \
TypedData& serialized_array = TypedData::Handle(); \
serialized_array ^= reader.ReadObject(); \
for (int i = 0; i < length; i++) { \
EXPECT_EQ(static_cast<ctype>(data[i]), \
serialized_array.Get##darttype(i* scale)); \
} \
+ delete message; \
}
TEST_CASE(SerializeTypedArray) {
@@ -816,42 +802,41 @@
const int kTypedDataLength = 0;
TypedData& typed_data = TypedData::Handle(
TypedData::New(kTypedDataUint8ArrayCid, kTypedDataLength));
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
- writer.WriteMessage(typed_data);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(true);
+ Message* message =
+ writer.WriteMessage(typed_data, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot.
- MessageSnapshotReader reader(buffer, buffer_len, thread);
+ MessageSnapshotReader reader(message, thread);
TypedData& serialized_typed_data = TypedData::Handle();
serialized_typed_data ^= reader.ReadObject();
EXPECT(serialized_typed_data.IsTypedData());
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kTypedData, root->type);
EXPECT_EQ(Dart_TypedData_kUint8, root->value.as_typed_data.type);
EXPECT_EQ(kTypedDataLength, root->value.as_typed_data.length);
EXPECT(root->value.as_typed_data.values == NULL);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
class TestSnapshotWriter : public SnapshotWriter {
public:
static const intptr_t kInitialSize = 64 * KB;
- TestSnapshotWriter(uint8_t** buffer, ReAlloc alloc)
+ explicit TestSnapshotWriter(ReAlloc alloc)
: SnapshotWriter(Thread::Current(),
Snapshot::kScript,
- buffer,
alloc,
NULL,
kInitialSize,
&forward_list_,
true /* can_send_any_object */),
forward_list_(thread(), kMaxPredefinedObjectIds) {
- ASSERT(buffer != NULL);
ASSERT(alloc != NULL);
}
~TestSnapshotWriter() {}
@@ -955,12 +940,11 @@
EXPECT(CompilerTest::TestCompileScript(lib, script));
// Write snapshot with script content.
- uint8_t* buffer;
- TestSnapshotWriter writer(&buffer, &malloc_allocator);
+ TestSnapshotWriter writer(&malloc_allocator);
writer.WriteScript(script);
// Read object back from the snapshot.
- ScriptSnapshotReader reader(buffer, writer.BytesWritten(), thread);
+ ScriptSnapshotReader reader(writer.buffer(), writer.BytesWritten(), thread);
Script& serialized_script = Script::Handle(zone);
serialized_script ^= reader.ReadObject();
@@ -1002,7 +986,7 @@
// the same.
GenerateSourceAndCheck(serialized_script);
- free(buffer);
+ free(writer.buffer());
}
#if !defined(PRODUCT) // Uses mirrors.
@@ -1807,53 +1791,50 @@
free(script_snapshot);
}
-#endif // !PRODUCT
+VM_UNIT_TEST_CASE(CheckKernelSnapshot) {
+ intptr_t vm_isolate_snapshot_size;
+ uint8_t* isolate_snapshot = NULL;
+ intptr_t isolate_snapshot_size;
+ uint8_t* full_snapshot = NULL;
+ bool saved_load_deferred_eagerly_mode = FLAG_load_deferred_eagerly;
+ FLAG_load_deferred_eagerly = true;
+ {
+ // Start an Isolate, and create a full snapshot of it.
+ TestIsolateScope __test_isolate__;
+ Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
-TEST_CASE(IntArrayMessage) {
- StackZone zone(Thread::Current());
- uint8_t* buffer = NULL;
- ApiMessageWriter writer(&buffer, &zone_allocator);
-
- static const int kArrayLength = 2;
- intptr_t data[kArrayLength] = {1, 2};
- int len = kArrayLength;
- writer.WriteMessage(len, data);
-
- // Read object back from the snapshot into a C structure.
- ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, writer.BytesWritten());
- Dart_CObject* root = api_reader.ReadMessage();
- EXPECT_EQ(Dart_CObject_kArray, root->type);
- EXPECT_EQ(kArrayLength, root->value.as_array.length);
- for (int i = 0; i < kArrayLength; i++) {
- Dart_CObject* element = root->value.as_array.values[i];
- EXPECT_EQ(Dart_CObject_kInt32, element->type);
- EXPECT_EQ(i + 1, element->value.as_int32);
+ // Write out the script snapshot.
+ Dart_Handle result =
+ Dart_CreateSnapshot(NULL, &vm_isolate_snapshot_size, &isolate_snapshot,
+ &isolate_snapshot_size);
+ EXPECT_VALID(result);
+ full_snapshot = reinterpret_cast<uint8_t*>(malloc(isolate_snapshot_size));
+ memmove(full_snapshot, isolate_snapshot, isolate_snapshot_size);
+ Dart_ExitScope();
}
- CheckEncodeDecodeMessage(root);
+ FLAG_load_deferred_eagerly = saved_load_deferred_eagerly_mode;
+ bool is_kernel = Dart_IsDart2Snapshot(full_snapshot, isolate_snapshot_size);
+ EXPECT_EQ(FLAG_strong, is_kernel);
}
+#endif // !PRODUCT
+
// Helper function to call a top level Dart function and serialize the result.
-static uint8_t* GetSerialized(Dart_Handle lib,
- const char* dart_function,
- intptr_t* buffer_len) {
+static Message* GetSerialized(Dart_Handle lib, const char* dart_function) {
Dart_Handle result;
result = Dart_Invoke(lib, NewString(dart_function), 0, NULL);
EXPECT_VALID(result);
Object& obj = Object::Handle(Api::UnwrapHandle(result));
// Serialize the object into a message.
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
- writer.WriteMessage(obj);
- *buffer_len = writer.BytesWritten();
- return buffer;
+ MessageWriter writer(false);
+ return writer.WriteMessage(obj, ILLEGAL_PORT, Message::kNormalPriority);
}
// Helper function to deserialize the result into a Dart_CObject structure.
-static Dart_CObject* GetDeserialized(uint8_t* buffer, intptr_t buffer_len) {
+static Dart_CObject* GetDeserialized(Message* message) {
// Read object back from the snapshot into a C structure.
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
return api_reader.ReadMessage();
}
@@ -1861,36 +1842,38 @@
StackZone zone(Thread::Current());
String& str = String::Handle();
str ^= Api::UnwrapHandle(dart_string);
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
- writer.WriteMessage(str);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(false);
+ Message* message =
+ writer.WriteMessage(str, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kString, root->type);
EXPECT_STREQ(expected, root->value.as_string);
CheckEncodeDecodeMessage(root);
+
+ delete message;
}
static void CheckStringInvalid(Dart_Handle dart_string) {
StackZone zone(Thread::Current());
String& str = String::Handle();
str ^= Api::UnwrapHandle(dart_string);
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
- writer.WriteMessage(str);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(false);
+ Message* message =
+ writer.WriteMessage(str, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kUnsupported, root->type);
+
+ delete message;
}
VM_UNIT_TEST_CASE(DartGeneratedMessages) {
@@ -2000,32 +1983,31 @@
StackZone zone(thread);
Smi& smi = Smi::Handle();
smi ^= Api::UnwrapHandle(smi_result);
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
- writer.WriteMessage(smi);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(false);
+ Message* message =
+ writer.WriteMessage(smi, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kInt32, root->type);
EXPECT_EQ(42, root->value.as_int32);
CheckEncodeDecodeMessage(root);
+ delete message;
}
if (!Bigint::IsDisabled()) {
StackZone zone(thread);
Bigint& bigint = Bigint::Handle();
bigint ^= Api::UnwrapHandle(bigint_result);
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
- writer.WriteMessage(bigint);
- intptr_t buffer_len = writer.BytesWritten();
+ MessageWriter writer(false);
+ Message* message =
+ writer.WriteMessage(bigint, ILLEGAL_PORT, Message::kNormalPriority);
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len);
+ ApiMessageReader api_reader(message);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kBigint, root->type);
@@ -2033,6 +2015,7 @@
EXPECT_STREQ("-0x424242424242424242424242424242424242", hex_value);
free(hex_value);
CheckEncodeDecodeMessage(root);
+ delete message;
}
CheckString(ascii_string_result, "Hello, world!");
CheckString(non_ascii_string_result, "Blåbærgrød");
@@ -2088,12 +2071,11 @@
CHECK_API_SCOPE(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
- intptr_t buf_len = 0;
{
// Generate a list of nulls from Dart code.
- uint8_t* buf = GetSerialized(lib, "getList", &buf_len);
+ Message* message = GetSerialized(lib, "getList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2101,12 +2083,13 @@
EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type);
}
CheckEncodeDecodeMessage(root);
+ delete message;
}
{
// Generate a list of ints from Dart code.
- uint8_t* buf = GetSerialized(lib, "getIntList", &buf_len);
+ Message* message = GetSerialized(lib, "getIntList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2115,12 +2098,13 @@
EXPECT_EQ(i, root->value.as_array.values[i]->value.as_int32);
}
CheckEncodeDecodeMessage(root);
+ delete message;
}
{
// Generate a list of strings from Dart code.
- uint8_t* buf = GetSerialized(lib, "getStringList", &buf_len);
+ Message* message = GetSerialized(lib, "getStringList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2130,12 +2114,13 @@
snprintf(buffer, sizeof(buffer), "%d", i);
EXPECT_STREQ(buffer, root->value.as_array.values[i]->value.as_string);
}
+ delete message;
}
{
// Generate a list of objects of different types from Dart code.
- uint8_t* buf = GetSerialized(lib, "getMixedList", &buf_len);
+ Message* message = GetSerialized(lib, "getMixedList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2154,6 +2139,7 @@
EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type);
}
}
+ delete message;
}
}
Dart_ExitScope();
@@ -2212,12 +2198,11 @@
CHECK_API_SCOPE(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
- intptr_t buf_len = 0;
{
// Generate a list of nulls from Dart code.
- uint8_t* buf = GetSerialized(lib, "getList", &buf_len);
+ Message* message = GetSerialized(lib, "getList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2225,12 +2210,13 @@
EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type);
}
CheckEncodeDecodeMessage(root);
+ delete message;
}
{
// Generate a list of ints from Dart code.
- uint8_t* buf = GetSerialized(lib, "getIntList", &buf_len);
+ Message* message = GetSerialized(lib, "getIntList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2239,12 +2225,13 @@
EXPECT_EQ(i, root->value.as_array.values[i]->value.as_int32);
}
CheckEncodeDecodeMessage(root);
+ delete message;
}
{
// Generate a list of strings from Dart code.
- uint8_t* buf = GetSerialized(lib, "getStringList", &buf_len);
+ Message* message = GetSerialized(lib, "getStringList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2254,12 +2241,13 @@
snprintf(buffer, sizeof(buffer), "%d", i);
EXPECT_STREQ(buffer, root->value.as_array.values[i]->value.as_string);
}
+ delete message;
}
{
// Generate a list of lists from Dart code.
- uint8_t* buf = GetSerialized(lib, "getListList", &buf_len);
+ Message* message = GetSerialized(lib, "getListList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2273,12 +2261,13 @@
EXPECT_EQ(j, element->value.as_array.values[j]->value.as_int32);
}
}
+ delete message;
}
{
// Generate a list of objects of different types from Dart code.
- uint8_t* buf = GetSerialized(lib, "getMixedList", &buf_len);
+ Message* message = GetSerialized(lib, "getMixedList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2374,6 +2363,7 @@
EXPECT_EQ(Dart_CObject_kInt32, e->type);
EXPECT_EQ(i + 1, e->value.as_int32);
}
+ delete message;
}
}
Dart_ExitScope();
@@ -2458,12 +2448,11 @@
CHECK_API_SCOPE(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
- intptr_t buf_len = 0;
{
// Generate a list of strings from Dart code.
- uint8_t* buf = GetSerialized(lib, "getStringList", &buf_len);
+ Message* message = GetSerialized(lib, "getStringList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2473,12 +2462,13 @@
EXPECT_EQ(Dart_CObject_kString, element->type);
EXPECT_STREQ("Hello, world!", element->value.as_string);
}
+ delete message;
}
{
// Generate a list of medium ints from Dart code.
- uint8_t* buf = GetSerialized(lib, "getMintList", &buf_len);
+ Message* message = GetSerialized(lib, "getMintList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2488,12 +2478,13 @@
EXPECT_EQ(Dart_CObject_kInt64, element->type);
EXPECT_EQ(DART_INT64_C(0x7FFFFFFFFFFFFFFF), element->value.as_int64);
}
+ delete message;
}
if (!Bigint::IsDisabled()) {
// Generate a list of bigints from Dart code.
- uint8_t* buf = GetSerialized(lib, "getBigintList", &buf_len);
+ Message* message = GetSerialized(lib, "getBigintList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2505,12 +2496,13 @@
EXPECT_STREQ("0x1234567890123456789012345678901234567890", hex_value);
free(hex_value);
}
+ delete message;
}
{
// Generate a list of doubles from Dart code.
- uint8_t* buf = GetSerialized(lib, "getDoubleList", &buf_len);
+ Message* message = GetSerialized(lib, "getDoubleList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2524,12 +2516,13 @@
EXPECT_EQ(Dart_CObject_kDouble, element->type);
EXPECT_EQ(3.14, element->value.as_double);
}
+ delete message;
}
{
// Generate a list of Uint8Lists from Dart code.
- uint8_t* buf = GetSerialized(lib, "getTypedDataList", &buf_len);
+ Message* message = GetSerialized(lib, "getTypedDataList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2540,12 +2533,13 @@
EXPECT_EQ(Dart_TypedData_kUint8, element->value.as_typed_data.type);
EXPECT_EQ(256, element->value.as_typed_data.length);
}
+ delete message;
}
{
// Generate a list of Uint8List views from Dart code.
- uint8_t* buf = GetSerialized(lib, "getTypedDataViewList", &buf_len);
+ Message* message = GetSerialized(lib, "getTypedDataViewList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2558,12 +2552,13 @@
EXPECT_EQ(1, element->value.as_typed_data.values[0]);
EXPECT_EQ(0, element->value.as_typed_data.values[1]);
}
+ delete message;
}
{
// Generate a list of objects of different types from Dart code.
- uint8_t* buf = GetSerialized(lib, "getMixedList", &buf_len);
+ Message* message = GetSerialized(lib, "getMixedList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2586,12 +2581,13 @@
EXPECT_STREQ(2.72, element->value.as_double);
}
}
+ delete message;
}
{
// Generate a list of objects of different types from Dart code.
- uint8_t* buf = GetSerialized(lib, "getSelfRefList", &buf_len);
+ Message* message = GetSerialized(lib, "getSelfRefList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2600,6 +2596,7 @@
EXPECT_EQ(Dart_CObject_kArray, element->type);
EXPECT_EQ(root, element);
}
+ delete message;
}
}
Dart_ExitScope();
@@ -2689,12 +2686,11 @@
CHECK_API_SCOPE(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
- intptr_t buf_len = 0;
{
// Generate a list of strings from Dart code.
- uint8_t* buf = GetSerialized(lib, "getStringList", &buf_len);
+ Message* message = GetSerialized(lib, "getStringList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2704,12 +2700,13 @@
EXPECT_EQ(Dart_CObject_kString, element->type);
EXPECT_STREQ("Hello, world!", element->value.as_string);
}
+ delete message;
}
{
// Generate a list of medium ints from Dart code.
- uint8_t* buf = GetSerialized(lib, "getMintList", &buf_len);
+ Message* message = GetSerialized(lib, "getMintList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2719,12 +2716,13 @@
EXPECT_EQ(Dart_CObject_kInt64, element->type);
EXPECT_EQ(DART_INT64_C(0x7FFFFFFFFFFFFFFF), element->value.as_int64);
}
+ delete message;
}
if (!Bigint::IsDisabled()) {
// Generate a list of bigints from Dart code.
- uint8_t* buf = GetSerialized(lib, "getBigintList", &buf_len);
+ Message* message = GetSerialized(lib, "getBigintList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2736,12 +2734,13 @@
EXPECT_STREQ("0x1234567890123456789012345678901234567890", hex_value);
free(hex_value);
}
+ delete message;
}
{
// Generate a list of doubles from Dart code.
- uint8_t* buf = GetSerialized(lib, "getDoubleList", &buf_len);
+ Message* message = GetSerialized(lib, "getDoubleList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2756,12 +2755,13 @@
EXPECT_EQ(Dart_CObject_kDouble, element->type);
EXPECT_EQ(3.14, element->value.as_double);
}
+ delete message;
}
{
// Generate a list of Uint8Lists from Dart code.
- uint8_t* buf = GetSerialized(lib, "getTypedDataList", &buf_len);
+ Message* message = GetSerialized(lib, "getTypedDataList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2772,12 +2772,13 @@
EXPECT_EQ(Dart_TypedData_kUint8, element->value.as_typed_data.type);
EXPECT_EQ(256, element->value.as_typed_data.length);
}
+ delete message;
}
{
// Generate a list of Uint8List views from Dart code.
- uint8_t* buf = GetSerialized(lib, "getTypedDataViewList", &buf_len);
+ Message* message = GetSerialized(lib, "getTypedDataViewList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2790,12 +2791,13 @@
EXPECT_EQ(1, element->value.as_typed_data.values[0]);
EXPECT_EQ(0, element->value.as_typed_data.values[1]);
}
+ delete message;
}
{
// Generate a list of objects of different types from Dart code.
- uint8_t* buf = GetSerialized(lib, "getMixedList", &buf_len);
+ Message* message = GetSerialized(lib, "getMixedList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2818,12 +2820,13 @@
EXPECT_STREQ(2.72, element->value.as_double);
}
}
+ delete message;
}
{
// Generate a list of objects of different types from Dart code.
- uint8_t* buf = GetSerialized(lib, "getSelfRefList", &buf_len);
+ Message* message = GetSerialized(lib, "getSelfRefList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -2832,6 +2835,7 @@
EXPECT_EQ(Dart_CObject_kArray, element->type);
EXPECT_EQ(root, element);
}
+ delete message;
}
}
Dart_ExitScope();
@@ -2930,12 +2934,11 @@
CHECK_API_SCOPE(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
- intptr_t buf_len = 0;
{
// Generate a list of Uint8Lists from Dart code.
- uint8_t* buf = GetSerialized(lib, "getTypedDataList", &buf_len);
+ Message* message = GetSerialized(lib, "getTypedDataList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
struct {
@@ -2956,12 +2959,13 @@
i++;
}
EXPECT_EQ(i, root->value.as_array.length);
+ delete message;
}
{
// Generate a list of Uint8List views from Dart code.
- uint8_t* buf = GetSerialized(lib, "getTypedDataViewList", &buf_len);
+ Message* message = GetSerialized(lib, "getTypedDataViewList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
struct {
@@ -2995,13 +2999,13 @@
i++;
}
EXPECT_EQ(i, root->value.as_array.length);
+ delete message;
}
{
// Generate a list of Uint8Lists from Dart code.
- uint8_t* buf =
- GetSerialized(lib, "getMultipleTypedDataViewList", &buf_len);
+ Message* message = GetSerialized(lib, "getMultipleTypedDataViewList");
ApiNativeScope scope;
- Dart_CObject* root = GetDeserialized(buf, buf_len);
+ Dart_CObject* root = GetDeserialized(message);
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kArray, root->type);
struct {
@@ -3026,6 +3030,7 @@
i++;
}
EXPECT_EQ(i, root->value.as_array.length);
+ delete message;
}
}
Dart_ExitScope();
@@ -3129,12 +3134,13 @@
TEST_CASE(OmittedObjectEncodingLength) {
StackZone zone(Thread::Current());
- uint8_t* buffer;
- MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
+ MessageWriter writer(true);
writer.WriteInlinedObjectHeader(kOmittedObjectId);
// For performance, we'd like single-byte headers when ids are omitted.
// If this starts failing, consider renumbering the snapshot ids.
EXPECT_EQ(1, writer.BytesWritten());
+
+ free(writer.buffer());
}
} // namespace dart
diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
index 67922a4..53cfa03 100644
--- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
@@ -1002,7 +1002,7 @@
while (i < source.length) {
chunk = 0;
- for (int j = 0; j < 4; j++) {
+ for (int j = 0; j < hexDigitsPerChunk; j++) {
var digitValue = _codeUnitToRadixValue(source.codeUnitAt(i++));
if (digitValue >= 16) return null;
chunk = chunk * 16 + digitValue;
@@ -1128,29 +1128,28 @@
factory _BigIntImpl._fromInt(int value) {
bool isNegative = value < 0;
+ assert(_digitBits == 16);
if (isNegative) {
// Handle the min 64-bit value differently, since its negation is not
// positive.
- // TODO(floitsch): we should use min.minValue or 0x8000000000000000 here.
- const int minInt64 = -9223372036854775807 - 1;
+ const int minInt64 = -0x80000000 * 0x100000000;
if (value == minInt64) {
var digits = new Uint16List(4);
digits[3] = 0x8000;
- return new _BigIntImpl._(true, digits.length, digits);
+ return new _BigIntImpl._(true, 4, digits);
}
value = -value;
}
- assert(_digitBits == 16);
if (value < _digitBase) {
var digits = new Uint16List(1);
digits[0] = value;
- return new _BigIntImpl._(isNegative, digits.length, digits);
+ return new _BigIntImpl._(isNegative, 1, digits);
}
if (value <= 0xFFFFFFFF) {
var digits = new Uint16List(2);
digits[0] = value & _digitMask;
digits[1] = value >> _digitBits;
- return new _BigIntImpl._(isNegative, digits.length, digits);
+ return new _BigIntImpl._(isNegative, 2, digits);
}
var bits = value.bitLength;
@@ -1937,7 +1936,7 @@
Uint16List resultDigits;
int resultUsed;
// Normalized positive divisor.
- // The normalized divisor has the most-significant bit of it's most
+ // The normalized divisor has the most-significant bit of its most
// significant digit set.
// This makes estimating the quotient easier.
Uint16List yDigits;
@@ -2614,13 +2613,8 @@
return (this & (signMask - one)) - (this & signMask);
}
- // TODO(floitsch): implement `isValidInt`.
- // Remove the comment in [BigInt.isValidInt] when done.
- bool get isValidInt => true;
+ bool get isValidInt => this == new _BigIntImpl._fromInt(toInt());
- // TODO(floitsch): implement the clamping. It behaves differently on dart2js
- // and the VM.
- // Remove the comment in [BigInt.isValidInt] when done.
int toInt() {
var result = 0;
for (int i = _used - 1; i >= 0; i--) {
diff --git a/sdk/lib/collection/collections.dart b/sdk/lib/collection/collections.dart
index 8b3dda6..743e27a 100644
--- a/sdk/lib/collection/collections.dart
+++ b/sdk/lib/collection/collections.dart
@@ -20,6 +20,16 @@
* efficient [Iterable.length] and [Iterable.elementAt].
*/
UnmodifiableListView(Iterable<E> source) : _source = source;
+
+ List<R> cast<R>() {
+ List<Object> self = this;
+ if (self is List<R>) return self;
+ return new UnmodifiableListView<R>(_source.cast<R>());
+ }
+
+ List<R> retype<R>() => new UnmodifiableListView(_source.retype<R>());
+
int get length => _source.length;
+
E operator [](int index) => _source.elementAt(index);
}
diff --git a/sdk/lib/collection/maps.dart b/sdk/lib/collection/maps.dart
index ac02022a..f6b6b26 100644
--- a/sdk/lib/collection/maps.dart
+++ b/sdk/lib/collection/maps.dart
@@ -334,8 +334,19 @@
* the constructor, except for operations that modify the map.
* Modifying operations throw instead.
*/
-class UnmodifiableMapView<K, V> = MapView<K, V>
- with _UnmodifiableMapMixin<K, V>;
+class UnmodifiableMapView<K, V> extends MapView<K, V>
+ with _UnmodifiableMapMixin<K, V> {
+ UnmodifiableMapView(Map<K, V> map) : super(map);
+
+ Map<RK, RV> cast<RK, RV>() {
+ Map<Object, Object> self = this;
+ if (self is Map<RK, RV>) return self;
+ return new UnmodifiableMapView<RK, RV>(_map.cast<RK, RV>());
+ }
+
+ Map<RK, RV> retype<RK, RV>() =>
+ new UnmodifiableMapView<RK, RV>(_map.retype<RK, RV>());
+}
/**
* Helper class which implements complex [Map] operations
diff --git a/sdk/lib/core/bigint.dart b/sdk/lib/core/bigint.dart
index 5f92625..00bff76 100644
--- a/sdk/lib/core/bigint.dart
+++ b/sdk/lib/core/bigint.dart
@@ -357,17 +357,21 @@
* Whether this big integer can be represented as an `int` without losing
* precision.
*
- * Warning: this function is not yet implemented and always returns true.
+ * Warning: this function may give a different result on
+ * dart2js, dev compiler, and the VM, due to the differences in
+ * integer precision.
*/
bool get isValidInt;
/**
* Returns this [BigInt] as an [int].
*
- * If the number does not fit clamps to the max (or min) integer.
+ * If the number does not fit, clamps to the max (or min)
+ * integer.
*
- * Warning: the clamping is not yet implemented and the behavior of this
- * function will change in future versions of this library.
+ * Warning: the clamping behaves differently on dart2js, dev
+ * compiler, and the VM, due to the differences in integer
+ * precision.
*/
int toInt();
diff --git a/tests/co19/co19-analyzer.status b/tests/co19/co19-analyzer.status
index 723a34f..5ff43c1 100644
--- a/tests/co19/co19-analyzer.status
+++ b/tests/co19/co19-analyzer.status
@@ -3,514 +3,4 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dart2analyzer ]
-Language/Classes/Abstract_Instance_Members/same_name_static_method_in_superclass_t01: MissingStaticWarning # test is out of date
-Language/Classes/Abstract_Instance_Members/same_name_static_method_in_superclass_t02: MissingStaticWarning # test is out of date
-Language/Classes/Abstract_Instance_Members/same_name_static_method_in_superclass_t04: MissingStaticWarning # test is out of date
-Language/Classes/Abstract_Instance_Members/same_name_static_method_in_superclass_t05: MissingStaticWarning # test is out of date
-Language/Classes/Abstract_Instance_Members/same_name_static_method_in_superclass_t06: MissingStaticWarning # test is out of date
-Language/Classes/Classes/method_definition_t06: MissingStaticWarning # Please triage this failure.
-Language/Classes/Getters/static_getter_t02: CompileTimeError # Issue 24534
-Language/Classes/Getters/static_t01: StaticWarning # Please triage this failure.
-Language/Classes/Getters/void_return_type_t01: MissingStaticWarning # Issue co19/30264
-Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t01: MissingStaticWarning # test is out of date
-Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t02: MissingStaticWarning # test is out of date
-Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t04: MissingStaticWarning # test is out of date
-Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t05: MissingStaticWarning # test is out of date
-Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t06: MissingStaticWarning # test is out of date
-Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t07: MissingStaticWarning # test is out of date
-Language/Classes/Instance_Methods/same_name_static_member_in_superclass_t09: MissingStaticWarning # test is out of date
-Language/Classes/Instance_Variables/definition_t03: StaticWarning # Please triage this failure.
-Language/Classes/Static_Methods/same_name_method_and_setter_t01: MissingStaticWarning # Issue 23749
-Language/Classes/Superclasses/Inheritance_and_Overriding/inheritance_t02: MissingStaticWarning # test is out of date
-Language/Classes/Superclasses/Inheritance_and_Overriding/inheritance_t05: MissingStaticWarning # TBF: Static members should not be accessible via subclasses.
-Language/Classes/definition_t23: CompileTimeError # This seems correct, need to adjust test.
-Language/Classes/method_definition_t06: MissingStaticWarning # Please triage this failure.
-Language/Enums/syntax_t08: MissingCompileTimeError # Please triage this failure.
-Language/Enums/syntax_t09: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Assignment/super_assignment_static_warning_t03: StaticWarning # Issue 15467
-Language/Expressions/Constants/exception_t01: Fail, OK # co19 issue #438, Static variables are initialized lazily, need not be constants
-Language/Expressions/Constants/literal_number_t01: CompileTimeError # int64
-Language/Expressions/Constants/logical_expression_t03: MissingCompileTimeError
-Language/Expressions/Constants/math_operators_t01: CompileTimeError # int64
-Language/Expressions/Constants/math_operators_t06: CompileTimeError # int64
-Language/Expressions/Function_Invocation/Unqualified_Invocation/instance_context_invocation_t03: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Function_Invocation/Unqualified_Invocation/instance_context_invocation_t04: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Function_Invocation/Unqualified_Invocation/invocation_t17: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Function_Invocation/Unqualified_Invocation/invocation_t18: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t17: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t18: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t19: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t21: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t22: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t23: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t24: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t25: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t26: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t27: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t28: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t29: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t30: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t31: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t32: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Identifier_Reference/evaluation_type_parameter_t02: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Instance_Creation/Const/abstract_class_t01/01: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Instance_Creation/Const/abstract_class_t03/01: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Instance_Creation/Const/arguments_t03: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Lookup/Method_Lookup/superclass_t07: StaticWarning # Please triage this failure.
-Language/Expressions/Lookup/Method_Lookup/superclass_t08: StaticWarning # Please triage this failure.
-Language/Expressions/Maps/constant_map_t02: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Method_Invocation/Ordinary_Invocation/object_method_invocation_t01: MissingCompileTimeError # Issue 25496
-Language/Expressions/Method_Invocation/Ordinary_Invocation/object_method_invocation_t02: MissingCompileTimeError # Issue 25496
-Language/Expressions/Method_Invocation/Super_Invocation/accessible_instance_member_t03: StaticWarning # Please triage this failure.
-Language/Expressions/Method_Invocation/Super_Invocation/accessible_instance_member_t04: StaticWarning # Please triage this failure.
-Language/Expressions/Method_Invocation/Super_Invocation/accessible_instance_member_t05: StaticWarning # Please triage this failure.
-Language/Expressions/Numbers/static_type_of_int_t01: CompileTimeError # int64
-Language/Expressions/Numbers/syntax_t06: CompileTimeError # int64
-Language/Expressions/Numbers/syntax_t09: CompileTimeError # int64
-Language/Expressions/Numbers/syntax_t10: CompileTimeError # int64
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t01: MissingCompileTimeError # Issue 24332
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t02: MissingCompileTimeError # Issue 24332
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t03: MissingCompileTimeError # Issue 24332
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t04: MissingCompileTimeError # Issue 24332
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t05: MissingCompileTimeError # Issue 24332
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t06: MissingCompileTimeError # Issue 24332
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t07: MissingCompileTimeError # Issue 24332
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t08: MissingCompileTimeError # Issue 24332
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/proxy_annotation_t05: StaticWarning # Issue 15467
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/proxy_annotation_t06: StaticWarning # Issue 15467
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/proxy_annotation_t07: StaticWarning # Issue 15467
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/proxy_annotation_t08: StaticWarning # Issue 15467
-Language/Functions/implicit_return_t01: StaticWarning # invalid use of void for dart 2. Also see #32100
-Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/inheritance_t03: StaticWarning # Please triage this failure.
-Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/not_overriden_members_t01: StaticWarning # uses void in a way not allowed in dart 2, see also #32100
-Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t01: CompileTimeError # Please triage this failure.
-Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t02: CompileTimeError # Please triage this failure.
-Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t02: CompileTimeError # Please triage this failure.
-Language/Libraries_and_Scripts/Parts/compilation_t01: Pass, MissingCompileTimeError # Issue 26692
-Language/Libraries_and_Scripts/Parts/compilation_t02: Pass, MissingCompileTimeError # Issue 26692
-Language/Libraries_and_Scripts/Parts/compilation_t04: Pass, CompileTimeError # Issue 26592
-Language/Libraries_and_Scripts/Parts/compilation_t15: Fail, Pass # Issue 23595
-Language/Libraries_and_Scripts/Scripts/syntax_t11: Pass, CompileTimeError # Issue 26592
-Language/Mixins/Mixin_Application/error_t01: MissingCompileTimeError # Please triage this failure.
-Language/Mixins/Mixin_Application/error_t02: MissingCompileTimeError # Please triage this failure.
-Language/Mixins/Mixin_Application/static_warning_t01: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/static_warning_t02: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/superinterfaces_t06: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/superinterfaces_t07: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t11: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t12: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t13: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t14: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t20: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t21: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t22: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t23: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t24: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/syntax_t25: CompileTimeError # Issue 26409
-Language/Mixins/Mixin_Application/warning_t03: StaticWarning # This seems correct, need to adjust test.
-Language/Mixins/declaring_constructor_t05: MissingCompileTimeError # Issue 24767
-Language/Mixins/declaring_constructor_t06: MissingCompileTimeError # Issue 24767
-Language/Statements/Assert/execution_t08: StaticWarning
-Language/Statements/Assert/syntax_t04: MissingCompileTimeError # Assert messages are enabled by default
-Language/Statements/Assert/type_t02: StaticWarning
-Language/Statements/Assert/type_t08: StaticWarning
-Language/Statements/Switch/last_statement_t03: MissingStaticWarning # Please triage this failure
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t01: MissingCompileTimeError # Issue 25495
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t03: MissingCompileTimeError # Issue 25495
-Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t05: MissingCompileTimeError # Issue 25495
-Language/Types/Interface_Types/subtype_t12: Fail, OK # co19 issue #442, undefined name "Expect"
-Language/Types/Type_Void/syntax_t01: MissingCompileTimeError # Issue co19/30264
-Language/Types/Type_Void/syntax_t02: MissingCompileTimeError # Issue co19/30264
-Language/Types/Type_Void/syntax_t04: MissingCompileTimeError # Issue co19/30264
-Language/Types/Type_Void/syntax_t09: MissingCompileTimeError # Issue 30177: `print(v)` is an error.
-Language/Types/Type_Void/using_t03: StaticWarning # invalid usage of void for dart 2, see also #32100
-Language/Variables/final_or_static_initialization_t01: MissingCompileTimeError # Please triage this failure
-Language/Variables/final_or_static_initialization_t02: MissingCompileTimeError # Please triage this failure
-Language/Variables/final_or_static_initialization_t03: MissingCompileTimeError # Please triage this failure
-Language/Variables/final_t04: MissingCompileTimeError # Please triage this failure
-Language/Variables/final_t05: MissingCompileTimeError # Please triage this failure
-Language/Variables/final_t06: MissingCompileTimeError # Please triage this failure
-Language/Variables/final_t07: MissingCompileTimeError # Please triage this failure
-LayoutTests/fast/animation/request-animation-frame-missing-arguments_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/backgrounds/001_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/canvas/canvas-arc-negative-radius_t01: StaticWarning # Issue 20939
-LayoutTests/fast/canvas/canvas-createImageBitmap-animated_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/canvas/webgl/webgl-specific_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/css/unicode-bidi-computed-value_t01: StaticWarning # uses void in a way not allowed in dart 2, see also #32100
-LayoutTests/fast/dom/DOMImplementation/createDocument-namespace-err_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/DOMImplementation/createDocumentType-err_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/Document/CaretRangeFromPoint/caretRangeFromPoint-in-zoom-and-scroll_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/Element/scrollWidth_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLAnchorElement/anchor-ismap-crash_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-rebase_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLBaseElement/href-attribute-resolves-with-respect-to-document_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLDialogElement/inert-does-not-match-disabled-selector_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLDialogElement/show-modal-focusing-steps_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLDialogElement/top-layer-position-relative_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLDialogElement/top-layer-position-static_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLDocument/clone-node_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLInputElement/size-attribute_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLLabelElement/form/test1_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLLabelElement/label-control_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLObjectElement/set-type-to-null-crash_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLOptionElement/collection-setter-getter_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLScriptElement/isURLAttribute_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLScriptElement/script-async-attr_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLScriptElement/script-set-src_t01: StaticWarning
-LayoutTests/fast/dom/HTMLTableElement/createCaption_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLTableElement/insert-row_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLTemplateElement/custom-element-wrapper-gc_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLTemplateElement/inertContents_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/HTMLTemplateElement/no-form-association_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/MutationObserver/clear-transient-without-delivery_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/MutationObserver/disconnect-cancel-pending_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/MutationObserver/document-fragment-insertion_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/MutationObserver/mutation-record-constructor_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/MutationObserver/observe-exceptions_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/NodeList/nodelist-reachable_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/Range/missing-arguments_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/Range/surroundContents-check-boundary-points_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/StyleSheet/detached-parent-rule-without-wrapper_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/StyleSheet/removed-media-rule-deleted-parent-crash_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/StyleSheet/removed-stylesheet-rule-deleted-parent-crash_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/TreeWalker/TreeWalker-basic_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/Window/atob-btoa_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/Window/replaceable_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/Window/window-scroll-arguments_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/characterdata-api-arguments_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/css-cached-import-rule_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/css-insert-import-rule-twice_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/css-insert-import-rule_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/css-mediarule-deleteRule-update_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/css-mediarule-functions_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/css-mediarule-insertRule-update_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/css-rule-functions_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/destroy-selected-radio-button-crash_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/icon-url-change_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/icon-url-list_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/implementation-api-args_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/javascript-backslash_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered_t01: Skip # Please triage this failure. isProtocolHandlerRegistered and unregisterProtocolHandler don't exist
-LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/option-properties_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/remove-named-attribute-crash_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/shadow/content-pseudo-element-css-text_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/shadow/content-pseudo-element-relative-selector-css-text_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/shadow/shadow-root-js-api_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/dom/text-api-arguments_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/events/event-creation_t01: Skip # Roll 45 OverflowEvent removed
-LayoutTests/fast/events/initkeyboardevent-crash_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/html/article-element_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/html/aside-element_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/html/imports/import-element-removed-flag_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/html/imports/import-events_t01: CompileTimeError, StaticWarning # Please triage this failure.
-LayoutTests/fast/html/select-dropdown-consistent-background-color_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/html/text-field-input-types_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/inline/boundingBox-with-continuation_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/loader/about-blank-hash-kept_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/loader/hashchange-event-properties_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/loader/scroll-position-restored-on-reload-at-load-event_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/loader/stateobjects/replacestate-in-onunload_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/media/media-query-list-syntax_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/media/mq-append-delete_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/media/mq-color-index_t02: StaticWarning # Please triage this failure.
-LayoutTests/fast/media/mq-js-media-except_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/media/mq-js-media-except_t02: StaticWarning # Please triage this failure.
-LayoutTests/fast/media/mq-parsing_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/multicol/vertical-lr/float-truncation_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/multicol/vertical-lr/image-inside-nested-blocks-with-border_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/multicol/vertical-rl/float-truncation_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/ruby/after-doesnt-crash_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/shapes/shape-outside-floats/shape-outside-big-box-border-radius_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-diamond-margin-polygon_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-image-margin_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-image-margin_t02: StaticWarning # Please triage this failure.
-LayoutTests/fast/shapes/shape-outside-floats/shape-outside-rounded-boxes_t01: StaticWarning # Please triage this failure.
-LayoutTests/fast/xmlhttprequest/xmlhttprequest-get_t01: Skip # Roll 45 clipboardData changed
-LayoutTests/fast/xpath/4XPath/Core/test_core_functions_t01: StaticWarning # co19 issue 703
-LibTest/async/StreamController/EventSink_class_A01_t01: StaticWarning # Please triage this failure.
-LibTest/async/StreamController/StreamConsumer_class_A01_t01: StaticWarning # Please triage this failure.
-LibTest/async/Zone/runBinaryGuarded_A01_t01: StaticWarning # uses void in a way not allowed in dart 2, see also #32100
-LibTest/async/Zone/runGuarded_A01_t01: StaticWarning # get the build green #32100
-LibTest/async/Zone/runUnaryGuarded_A01_t01: StaticWarning # uses void in a way not allowed in dart 2, see also #32100
-LibTest/collection/DoubleLinkedQueue/DoubleLinkedQueue_class_A01_t01: Fail, OK # co19 issue 642, The argument type 'int' cannot be assigned to the parameter type 'Iterable'
-LibTest/collection/HashMap/HashMap_class_A01_t01: StaticWarning # Please triage this failure.
-LibTest/collection/HashSet/HashSet_class_A01_t01: StaticWarning # Imports libraries with static warnings
-LibTest/collection/IterableBase/IterableBase_class_A01_t02: StaticWarning # Imports libraries with static warnings
-LibTest/collection/IterableMixin/IterableMixin_class_A02_t01: StaticWarning # Please triage this failure.
-LibTest/collection/LinkedHashMap/LinkedHashMap_class_A01_t01: StaticWarning # Please triage this failure.
-LibTest/collection/LinkedHashSet/LinkedHashSet_class_A01_t01: StaticWarning # Imports libraries with static warnings
-LibTest/collection/ListQueue/ListQueue_class_A01_t01: Fail, OK # co19 issue 642, The argument type 'int' cannot be assigned to the parameter type 'Iterable'
-LibTest/collection/MapView/MapView_class_A01_t01: StaticWarning # Please triage this failure.
-LibTest/collection/Queue/Queue_class_A01_t01: Fail, OK # co19 issue 642, The argument type 'int' cannot be assigned to the parameter type 'Iterable'
-LibTest/collection/SetBase/SetBase_class_A01_t01: StaticWarning # Please triage this failure.
-LibTest/collection/SetMixin/SetMixin_class_A01_t01: StaticWarning # Please triage this failure.
-LibTest/collection/SplayTreeMap/inherited_tests_A01_t01: StaticWarning # Please triage this failure.
-LibTest/collection/SplayTreeSet/SplayTreeSet_class_A01_t01: StaticWarning # Please triage this failure.
-LibTest/convert/JsonEncoder/JsonEncoder_A01_t01: StaticWarning # Please triage this failure
-LibTest/core/Duration/Duration_A02_t01: CompileTimeError # int64
-LibTest/core/Set/IterableBase_A01_t01: StaticWarning # Imports libraries with static warnings
-LibTest/core/double/isInfinite_A01_t03: CompileTimeError # int64
-LibTest/core/double/toStringAsExponential_A02_t01: CompileTimeError # int64
-LibTest/core/int/abs_A01_t01: CompileTimeError # int64
-LibTest/core/int/ceilToDouble_A01_t01: CompileTimeError # int64
-LibTest/core/int/ceil_A01_t01: CompileTimeError # int64
-LibTest/core/int/compareTo_A01_t01: CompileTimeError # int64
-LibTest/core/int/floorToDouble_A01_t01: CompileTimeError # int64
-LibTest/core/int/floor_A01_t01: CompileTimeError # int64
-LibTest/core/int/isEven_A01_t01: CompileTimeError # int64
-LibTest/core/int/isInfinite_A01_t01: CompileTimeError # int64
-LibTest/core/int/isNaN_A01_t01: CompileTimeError # int64
-LibTest/core/int/isNegative_A01_t01: CompileTimeError # int64
-LibTest/core/int/isOdd_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_AND_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_GE_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_GT_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_LE_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_LT_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_NOT_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_OR_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_XOR_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_addition_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_division_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_left_shift_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_multiplication_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_remainder_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_remainder_A01_t02: CompileTimeError # int64
-LibTest/core/int/operator_right_shift_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_subtraction_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_truncating_division_A01_t01: CompileTimeError # int64
-LibTest/core/int/operator_truncating_division_A01_t02: CompileTimeError # int64
-LibTest/core/int/operator_unary_minus_A01_t01: CompileTimeError # int64
-LibTest/core/int/parse_A01_t01: CompileTimeError # int64
-LibTest/core/int/remainder_A01_t01: CompileTimeError # int64
-LibTest/core/int/remainder_A01_t02: CompileTimeError # int64
-LibTest/core/int/roundToDouble_A01_t01: CompileTimeError # int64
-LibTest/core/int/round_A01_t01: CompileTimeError # int64
-LibTest/core/int/toDouble_A01_t01: CompileTimeError # int64
-LibTest/core/int/toInt_A01_t01: CompileTimeError # int64
-LibTest/core/int/toStringAsExponential_A02_t01: CompileTimeError # int64
-LibTest/core/int/toStringAsFixed_A02_t01: CompileTimeError # int64
-LibTest/core/int/toStringAsPrecision_A01_t02: CompileTimeError # int64
-LibTest/core/int/truncateToDouble_A01_t01: CompileTimeError # int64
-LibTest/core/int/truncate_A01_t01: CompileTimeError # int64
-LibTest/html/CanvasRenderingContext2D/addEventListener_A01_t03: StaticWarning # Please triage this failure.
-LibTest/html/Document/adoptNode_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Document/childNodes_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Document/importNode_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Document/securityPolicy_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/HttpRequest/responseText_A01_t02: StaticWarning # Please triage this failure.
-LibTest/html/HttpRequest/responseType_A01_t03: CompileTimeError # Please triage this failure.
-LibTest/html/IFrameElement/attributeChanged_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/IFrameElement/contentWindow_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/IFrameElement/enteredView_A01_t01: CompileTimeError # Please triage this failure.
-LibTest/html/IFrameElement/getNamespacedAttributes_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/IFrameElement/outerHtml_setter_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Node/childNodes_A01_t02: StaticWarning # Please triage this failure.
-LibTest/html/Node/contains_A01_t02: StaticWarning # Please triage this failure.
-LibTest/html/Node/dispatchEvent_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Node/nodes_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Window/document_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Window/moveBy_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Window/moveTo_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Window/moveTo_A02_t01: StaticWarning # Please triage this failure.
-LibTest/html/Window/postMessage_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Window/postMessage_A01_t02: StaticWarning # Please triage this failure.
-LibTest/html/Window/requestFileSystem_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Window/requestFileSystem_A01_t02: StaticWarning # Please triage this failure.
-LibTest/html/Window/requestFileSystem_A02_t01: StaticWarning # Please triage this failure.
-LibTest/html/Window/resizeBy_A01_t01: StaticWarning # Please triage this failure.
-LibTest/html/Window/resizeTo_A01_t01: StaticWarning # Please triage this failure.
-LibTest/isolate/IsolateStream/any_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/any_A02_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/asBroadcastStream_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/contains_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/contains_A02_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/first_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/first_A02_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/first_A02_t02: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/isBroadcast_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/isBroadcast_A01_t02: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/isEmpty_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/last_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/last_A02_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/length_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/single_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/IsolateStream/single_A02_t01: Fail # Please triage this failure.
-LibTest/isolate/ReceivePort/receive_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/ReceivePort/receive_A01_t02: Fail # Please triage this failure.
-LibTest/isolate/ReceivePort/receive_A01_t03: Fail # Please triage this failure.
-LibTest/isolate/ReceivePort/sendPort_A01_t01: StaticWarning # Please triage this failure.
-LibTest/isolate/ReceivePort/toSendPort_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/ReceivePort/toSendPort_A01_t02: Fail # Please triage this failure.
-LibTest/isolate/ReceivePort/toSendPort_A01_t03: Fail # Please triage this failure.
-LibTest/isolate/SendPort/call_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/SendPort/send_A02_t03: Fail # Please triage this failure.
-LibTest/isolate/SendPort/send_A02_t04: Fail # Please triage this failure.
-LibTest/isolate/SendPort/send_A02_t05: Fail # Please triage this failure.
-LibTest/isolate/SendPort/send_A02_t06: Fail # Please triage this failure.
-LibTest/isolate/SendPort/send_A03_t01: Fail # Please triage this failure.
-LibTest/isolate/SendPort/send_A03_t02: Fail # Please triage this failure.
-LibTest/math/Point/operator_addition_A02_t01: StaticWarning # Please triage this failure.
-LibTest/math/Point/operator_mult_A03_t01: StaticWarning # Please triage this failure.
-LibTest/math/Point/operator_subtraction_A02_t01: StaticWarning # Please triage this failure.
-LibTest/math/pow_A10_t01: CompileTimeError # int64
-LibTest/typed_data/ByteData/getUint64_A01_t01: CompileTimeError # int64
-LibTest/typed_data/ByteData/setUint64_A01_t01: CompileTimeError # int64
-LibTest/typed_data/Float32x4/equal_A01_t01: Skip # co19 issue 656
-LibTest/typed_data/Float32x4/greaterThanOrEqual_A01_t01: Skip # co19 issue 656
-LibTest/typed_data/Float32x4/greaterThan_A01_t01: Skip # co19 issue 656
-LibTest/typed_data/Float32x4/lessThanOrEqual_A01_t01: Skip # co19 issue 656
-LibTest/typed_data/Float32x4/lessThan_A01_t01: Skip # co19 issue 656
-LibTest/typed_data/Float32x4/notEqual_A01_t01: Skip # co19 issue 656
-LibTest/typed_data/Uint64List/Uint64List.fromList_A01_t01: CompileTimeError # int64
-LibTest/typed_data/Uint64List/Uint64List.fromList_A01_t02: CompileTimeError # int64
-LibTest/typed_data/Uint64List/Uint64List.view_A01_t01: CompileTimeError # int64
-LibTest/typed_data/Uint64List/Uint64List.view_A01_t02: CompileTimeError # int64
-WebPlatformTest/DOMEvents/approved/Event.bubbles.false_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/DOMEvents/approved/Propagation.path.target.removed_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/custom-elements/*: Pass, StaticWarning # Issue 18095.
-WebPlatformTest/dom/Node-replaceChild_t01: CompileTimeError # Please triage this failure.
-WebPlatformTest/dom/collections/emptyName_A01_t03: StaticWarning # Please triage this failure.
-WebPlatformTest/dom/events/event_constants/constants_A01_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/dom/nodes/DOMImplementation-createDocument_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/dom/nodes/DOMImplementation-createHTMLDocument_t01: CompileTimeError # Please triage this failure.
-WebPlatformTest/dom/nodes/Document-createElement-namespace_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/dom/nodes/Document-createElement_t01: CompileTimeError # Please triage this failure.
-WebPlatformTest/dom/nodes/Element-childElementCount-nochild_t01: CompileTimeError # Please triage this failure.
-WebPlatformTest/dom/nodes/Node-appendChild_t02: StaticWarning # Please triage this failure.
-WebPlatformTest/dom/nodes/Node-contains_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/dom/nodes/Node-insertBefore_t01: StaticWarning # Uses void in a way not allowed in dart 2, see also #32100
-WebPlatformTest/dom/nodes/Node-isEqualNode_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/dom/nodes/Node-parentNode_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/browsers/browsing-the-web/read-media/pageload-image_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/browsers/browsing-the-web/read-media/pageload-video_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/browsers/browsing-the-web/read-text/load-text-plain_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/dom/documents/dom-tree-accessors/document.body-getter_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/dom/documents/dom-tree-accessors/document.body-setter_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/dom/documents/dom-tree-accessors/document.head_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/dom/documents/dom-tree-accessors/document.title_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/dom/documents/dom-tree-accessors/document.title_t07: StaticWarning # Please triage this failure.
-WebPlatformTest/html/dom/elements/global-attributes/dataset-delete_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/dom/elements/global-attributes/dataset-get_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/dom/elements/global-attributes/dataset-set_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/document-metadata/styling/LinkStyle_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/embedded-content/media-elements/error-codes/error_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/embedded-content/media-elements/interfaces/TextTrack/cues_t01: StaticWarning # uses void in a way not allowed in dart 2, see also #32100
-WebPlatformTest/html/semantics/embedded-content/media-elements/interfaces/TextTrack/mode_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/embedded-content/the-audio-element/audio_constructor_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/forms/attributes-common-to-form-controls/formAction_document_address_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/forms/textfieldselection/selection_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/forms/the-datalist-element/datalistelement_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/forms/the-datalist-element/datalistoptions_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/forms/the-fieldset-element/disabled_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/semantics/forms/the-input-element/email_t02: StaticWarning # co19 issue 701
-WebPlatformTest/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol/t01: StaticWarning # Please triage this failure.
-WebPlatformTest/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol/t02: StaticWarning # Please triage this failure.
-WebPlatformTest/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol/t03: StaticWarning # Please triage this failure.
-WebPlatformTest/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol/t04: StaticWarning # Please triage this failure.
-WebPlatformTest/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol/t05: StaticWarning # Please triage this failure.
-WebPlatformTest/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol/t06: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/attributes/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/attributes/test-004_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/attributes/test-004_t02: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/attributes/test-005_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/attributes/test-006_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/methods/elements-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/methods/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/methods/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/methods/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-event-interface/event-path-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-attributes/test-007_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-attributes/test-008_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-attributes/test-009_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-attributes/test-010_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-attributes/test-011_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-attributes/test-012_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-attributes/test-013_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-006_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-007_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/shadowroot-object/shadowroot-methods/test-010_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-content-html-element/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-content-html-element/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-content-html-element/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-content-html-element/test-004_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-content-html-element/test-004_t02: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-content-html-element/test-005_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-content-html-element/test-006_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003_t02: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-004_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-005_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/event-dispatch/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/event-dispatch/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/event-dispatch/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/event-retargeting/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/event-retargeting/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/event-retargeting/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/event-retargeting/test-004_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-004_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-005_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-006_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-007_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-008_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-009_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-001_t02: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-001_t03: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-001_t04: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-001_t05: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-001_t06: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-relatedtarget/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-relatedtarget/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/events/retargeting-relatedtarget/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/html-elements-and-their-shadow-trees/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/html-elements-and-their-shadow-trees/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/html-elements-and-their-shadow-trees/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/html-elements-and-their-shadow-trees/test-004_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/html-elements-in-shadow-trees/html-forms/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/html-elements-in-shadow-trees/html-forms/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/html-elements-in-shadow-trees/inert-html-elements/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/composition/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/custom-pseudo-elements/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/distributed-pseudo-element/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/distributed-pseudo-element/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/hosting-multiple-shadow-trees/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/lower-boundary-encapsulation/distribution-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/lower-boundary-encapsulation/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/lower-boundary-encapsulation/test-004_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/lower-boundary-encapsulation/test-005_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/nested-shadow-trees/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/rendering-shadow-trees/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/reprojection/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/satisfying-matching-criteria/test-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/satisfying-matching-criteria/test-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/satisfying-matching-criteria/test-003_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/satisfying-matching-criteria/test-004_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/satisfying-matching-criteria/test-005_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/satisfying-matching-criteria/test-006_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/satisfying-matching-criteria/test-017_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/dom-tree-accessors-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/ownerdocument-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/ownerdocument-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/selectors-api-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/selectors-api-002_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/shadow-root-001_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/test-005_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/test-007_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/test-009_t01: StaticWarning # Please triage this failure.
-WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/test-011_t01: StaticWarning # Please triage this failure.
-
-[ $compiler == dart2analyzer && $strong ]
-*: Skip # Issue 28649
+*: Skip
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 10eb24a..66ca0e5 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -1396,6 +1396,30 @@
WebPlatformTest/html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context_t01: RuntimeError # Please triage this failure
WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/ownerdocument-001_t01: RuntimeError # Please triage this failure
+[ $compiler == dart2js && $runtime == chrome && $csp && $minified ]
+LayoutTests/fast/dom/HTMLScriptElement/isURLAttribute_t01: SkipByDesign # Uses script injection
+LayoutTests/fast/dom/HTMLScriptElement/remove-source_t01: Pass # Please triage this failure
+LayoutTests/fast/dom/HTMLScriptElement/script-for-attribute-unexpected-execution_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/dom/HTMLScriptElement/script-reexecution_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/dom/HTMLTemplateElement/inertContents_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/dom/Range/create-contextual-fragment-script-unmark-already-started_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/files/workers/inline-worker-via-blob-url_t01: SkipByDesign # inlined script
+LayoutTests/fast/loader/scroll-position-restored-on-back_t01: Skip # Timeout. Please triage this failure
+WebPlatformTest/webstorage/event_local_key_t01: Skip # Timeout. Please triage this failure.
+WebPlatformTest/webstorage/event_local_newvalue_t01: Skip # Timeout. Please triage this failure.
+WebPlatformTest/webstorage/event_local_oldvalue_t01: Skip # Timeout. Please triage this failure.
+WebPlatformTest/webstorage/event_local_storagearea_t01: Skip # Timeout. Please triage this failure.
+WebPlatformTest/webstorage/event_local_url_t01: Skip # Timeout. Please triage this failure.
+WebPlatformTest/webstorage/event_session_key_t01: Skip # Timeout. Please triage this failure.
+WebPlatformTest/webstorage/event_session_newvalue_t01: Skip # Timeout. Please triage this failure.
+WebPlatformTest/webstorage/event_session_oldvalue_t01: Skip # Timeout. Please triage this failure.
+WebPlatformTest/webstorage/event_session_storagearea_t01: Skip # Timeout. Please triage this failure.
+WebPlatformTest/webstorage/event_session_url_t01: Skip # Timeout. Please triage this failure.
+
+[ $compiler == dart2js && $runtime == chrome && !$csp && !$minified ]
+LayoutTests/fast/dom/HTMLScriptElement/remove-source_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/events/event-listener-html-non-html-confusion_t01: RuntimeError # Please triage this failure
+
[ $compiler == dart2js && $runtime != chrome && $runtime != drt && $browser && $fast_startup ]
WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/attributes/test-005_t01: Fail # please triage
WebPlatformTest/shadow-dom/elements-and-dom-objects/extensions-to-element-interface/methods/test-001_t01: Fail # please triage
@@ -2336,16 +2360,6 @@
[ $compiler == dart2js && $runtime == drt && !$checked ]
LayoutTests/fast/xpath/invalid-resolver_t01: RuntimeError # Please triage this failure
-[ $compiler == dart2js && $runtime == drt && $csp && $minified ]
-LayoutTests/fast/dom/HTMLScriptElement/script-for-attribute-unexpected-execution_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/dom/HTMLScriptElement/script-reexecution_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/dom/HTMLTemplateElement/inertContents_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/dom/Range/create-contextual-fragment-script-unmark-already-started_t01: RuntimeError # Please triage this failure
-
-[ $compiler == dart2js && $runtime == drt && !$csp && !$minified ]
-LayoutTests/fast/dom/HTMLScriptElement/remove-source_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/events/event-listener-html-non-html-confusion_t01: RuntimeError # Please triage this failure
-
[ $compiler == dart2js && $runtime != drt && $browser && $fast_startup ]
WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-001_t01: Fail # please triage
WebPlatformTest/shadow-dom/events/events-that-are-always-stopped/test-002_t01: Fail # please triage
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index c7649a6..39af62a 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -49,13 +49,16 @@
serialization/compilation4_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/compilation5_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/compilation_1_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
+serialization/impact_test: Slow, RuntimeError # Issue 32149
serialization/library_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
+serialization/model0_test: Slow, RuntimeError # Issue 32149
serialization/model1_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/model3_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/model4_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/model5_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/model_1_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
serialization/native_data_test: Skip # Skip most serialization tests. These are very slow and are no longer a priority.
+serialization/reserialization_test: Slow, RuntimeError # Issue 32149
sourcemaps/source_mapping_invokes_test: Pass, Slow
sourcemaps/source_mapping_operators_test: Pass, Slow
sourcemaps/source_mapping_test: Pass, Slow
diff --git a/tests/compiler/dart2js/serialization/test_data.dart b/tests/compiler/dart2js/serialization/test_data.dart
index c3f7bef..667ff90 100644
--- a/tests/compiler/dart2js/serialization/test_data.dart
+++ b/tests/compiler/dart2js/serialization/test_data.dart
@@ -217,9 +217,9 @@
double nextDouble() => 0.0;
}
main() {
- // Invocation of `MyRandom.nextInt` is only detected knowing the actual
- // implementation class for `List` and the world impact of its `shuffle`
- // method.
+ // Invocation of `MyRandom.nextInt` is only detected knowing the actual
+ // implementation class for `List` and the world impact of its `shuffle`
+ // method.
[].shuffle(new MyRandom());
}'''
},
@@ -234,7 +234,7 @@
continue loop;
}
break;
- }
+ }
}'''
}),
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 61e0619..c6a7753 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -8,10 +8,10 @@
[ $compiler == dart2js ]
class_test: Fail
constant_javascript_semantics4_test: Fail, OK
+generic_class_is_test: Fail # Issue 32004
local_function_call_test: RuntimeError # Issue 31879
mirror_printer_test: Pass, Slow # Issue 25940, 16473
mirrors_used_closure_test: Fail # Issue 17939
-generic_class_is_test: Fail # Issue 32004
no_such_method_test: Fail # Wrong Invocation.memberName.
statements_test: Fail
typed_locals_test: Pass, Fail
@@ -23,7 +23,7 @@
[ $runtime == none ]
timer_negative_test: Fail, OK # A negative runtime test.
-[ $strong && $compiler == dart2analyzer ]
+[ $compiler == dart2analyzer && $strong ]
dummy_compiler_test: Skip # Issue 28649
recursive_import_test: Skip # Issue 28649
@@ -40,24 +40,12 @@
constant_javascript_semantics2_test: Pass, Slow # Issue 25940
deferred_split_test: Pass, Slow # Issue 25940
+[ $compiler == dart2js && $runtime == chrome && $csp ]
+deferred/load_in_correct_order_test: SkipByDesign # Purposely uses `eval`
+
[ $compiler == dart2js && $runtime == chromeOnAndroid ]
no_such_method_mirrors_test: Pass, Slow # TODO(kasperl): Please triage.
-[ $compiler == dart2js && !$host_checked ]
-dummy_compiler_test: Slow, Pass
-recursive_import_test: Slow, Pass
-
-[ $compiler == dart2js && $host_checked ]
-dummy_compiler_test: Skip # Issue 30773
-recursive_import_test: Skip # Issue 30773
-
-[ $compiler == dart2js && $browser ]
-dummy_compiler_test: Skip
-recursive_import_test: Skip
-
-[ $compiler == dart2js && $runtime == drt && $csp ]
-deferred/load_in_correct_order_test: SkipByDesign # Purposely uses `eval`
-
[ $compiler == dart2js && $runtime == ff && $system == windows ]
consistent_index_error_string_test: Pass, Slow # Issue 25940
@@ -67,6 +55,10 @@
[ $compiler == dart2js && $runtime == safari ]
deferred_fail_and_retry_worker_test: Timeout # Issue 22106
+[ $compiler == dart2js && $browser ]
+dummy_compiler_test: Skip
+recursive_import_test: Skip
+
[ $compiler == dart2js && $checked ]
variable_type_test/01: Fail, OK
variable_type_test/03: Fail, OK
@@ -281,6 +273,14 @@
no_such_method_mirrors_test: Fail # mirrors not supported
reflect_native_types_test: Fail # mirrors not supported
+[ $compiler == dart2js && $host_checked ]
+dummy_compiler_test: Skip # Issue 30773
+recursive_import_test: Skip # Issue 30773
+
+[ $compiler == dart2js && !$host_checked ]
+dummy_compiler_test: Slow, Pass
+recursive_import_test: Slow, Pass
+
[ $compiler == dart2js && $minified ]
code_motion_exception_test: Skip # Requires unminified operator names.
deferred/reflect_multiple_annotations_test: Fail
diff --git a/tests/corelib_2/bigint_test.dart b/tests/corelib_2/bigint_test.dart
index 5d5dd3d..0401e12 100644
--- a/tests/corelib_2/bigint_test.dart
+++ b/tests/corelib_2/bigint_test.dart
@@ -322,6 +322,12 @@
Expect.equals(BigInt.zero, b ~/ a);
Expect.equals(new BigInt.from(123456789),
BigInt.parse("123456789012345678") ~/ new BigInt.from(1000000000));
+ // TruncDiv as used in toString().
+ a = BigInt.parse("4503599627370496"); // 0x10000000000000
+ b = new BigInt.from(10000);
+ Expect.equals(new BigInt.from(450359962737), a ~/ b);
+ b = new BigInt.from(1000000000);
+ Expect.equals(new BigInt.from(4503599), a ~/ b);
// Bigint and Bigint.
a = BigInt.parse("12345678901234567890");
b = BigInt.parse("10000000000000000");
@@ -348,6 +354,12 @@
var b = new BigInt.from(10);
Expect.equals(new BigInt.from(5), a % b);
Expect.equals(new BigInt.from(10), b % a);
+ // Modulo as used in toString().
+ a = BigInt.parse("4503599627370496"); // 0x10000000000000
+ b = new BigInt.from(10000);
+ Expect.equals(new BigInt.from(496), a % b);
+ b = new BigInt.from(1000000000);
+ Expect.equals(new BigInt.from(627370496), a % b);
// Bigint & Bigint
a = BigInt.parse("10000000000000000001");
b = BigInt.parse("10000000000000000000");
@@ -820,7 +832,7 @@
if (i != 0) test(-i);
}
- const minInt64 = -9223372036854775807 - 1;
+ const minInt64 = -0x80000000 * 0x100000000;
test(minInt64);
}
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index 25b3c79..99f9267 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -12,7 +12,7 @@
error_stack_trace_test/static: MissingCompileTimeError
[ $compiler == dartdevk ]
-apply3_test: CompileTimeError
+apply3_test: RuntimeError
bool_from_environment2_test/03: Crash
int_modulo_arith_test/modPow: RuntimeError
int_modulo_arith_test/none: RuntimeError
@@ -280,6 +280,9 @@
symbol_reserved_word_test/03: RuntimeError
uri_base_test: RuntimeError
+[ $compiler == dart2js && $dart2js_with_kernel && $strong ]
+map_unmodifiable_cast_test: Crash
+
[ $compiler == dart2js && $dart2js_with_kernel && !$strong ]
*: SkipByDesign
@@ -350,7 +353,8 @@
# ===== dartk + vm status lines =====
[ $compiler == dartk && $runtime == vm && $strong ]
-apply3_test: CompileTimeError # Issue 31402 (Invocation arguments)
+apply3_test: RuntimeError
+apply_test: RuntimeError, OK
iterable_fold_test/02: RuntimeError
iterable_reduce_test/01: CompileTimeError # Issue 31533
iterable_reduce_test/none: RuntimeError
@@ -365,6 +369,7 @@
# ===== dartkp + dart_precompiled status lines =====
[ $compiler == dartkp && $runtime == dart_precompiled && $strong ]
+apply_test: RuntimeError, OK
iterable_fold_test/02: RuntimeError
iterable_reduce_test/01: CompileTimeError # Issue 31533
iterable_reduce_test/none: RuntimeError
diff --git a/tests/corelib_2/list_unmodifiable_cast_test.dart b/tests/corelib_2/list_unmodifiable_cast_test.dart
new file mode 100644
index 0000000..58815bb
--- /dev/null
+++ b/tests/corelib_2/list_unmodifiable_cast_test.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library list_unmodifiable_cast_test;
+
+import "package:expect/expect.dart";
+import 'dart:collection';
+
+void main() {
+ test(const [37]);
+ test(new UnmodifiableListView([37]));
+
+ test(new UnmodifiableListView<num>(<num>[37]));
+ test(new UnmodifiableListView<num>(<int>[37]));
+
+ test(new UnmodifiableListView<num>(<num>[37]).cast<int>());
+ test(new UnmodifiableListView<num>(<int>[37]).cast<int>());
+ test(new UnmodifiableListView<Object>(<num>[37]).cast<int>());
+ test(new UnmodifiableListView<Object>(<int>[37]).cast<num>());
+
+ test(new UnmodifiableListView<num>(<num>[37]).retype<int>());
+ test(new UnmodifiableListView<num>(<int>[37]).retype<int>());
+ test(new UnmodifiableListView<Object>(<num>[37]).retype<int>());
+ test(new UnmodifiableListView<Object>(<int>[37]).retype<num>());
+
+ var m2 = new List<num>.unmodifiable([37]);
+ test(m2);
+ test(m2.cast<int>());
+}
+
+void test(List list) {
+ Expect.equals(1, list.length);
+ Expect.equals(37, list.first);
+
+ Expect.throws(list.clear);
+ Expect.throws(() {
+ list.remove(37);
+ });
+ Expect.throws(() {
+ list[0] = 42;
+ });
+ Expect.throws(() {
+ list.addAll(<int>[42]);
+ });
+}
diff --git a/tests/corelib_2/map_unmodifiable_cast_test.dart b/tests/corelib_2/map_unmodifiable_cast_test.dart
new file mode 100644
index 0000000..9c1e19b
--- /dev/null
+++ b/tests/corelib_2/map_unmodifiable_cast_test.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library map_unmodifiable_cast_test;
+
+import "package:expect/expect.dart";
+import 'dart:collection';
+
+void main() {
+ test(const {1: 37});
+ test(new UnmodifiableMapView({1: 37}));
+
+ test(new UnmodifiableMapView<num, num>(<num, num>{1: 37}));
+ test(new UnmodifiableMapView<num, num>(<int, int>{1: 37}));
+
+ test(new UnmodifiableMapView<num, num>(<num, num>{1: 37}).cast<int, int>());
+ test(new UnmodifiableMapView<num, num>(<int, int>{1: 37}).cast<int, int>());
+ test(new UnmodifiableMapView<Object, Object>(<num, num>{1: 37})
+ .cast<int, int>());
+ test(new UnmodifiableMapView<Object, Object>(<int, int>{1: 37})
+ .cast<num, num>());
+
+ test(new UnmodifiableMapView<num, num>(<num, num>{1: 37}).retype<int, int>());
+ test(new UnmodifiableMapView<num, num>(<int, int>{1: 37}).retype<int, int>());
+ test(new UnmodifiableMapView<Object, Object>(<num, num>{1: 37})
+ .retype<int, int>());
+ test(new UnmodifiableMapView<Object, Object>(<int, int>{1: 37})
+ .retype<num, num>());
+
+ var m2 = new Map<num, num>.unmodifiable({1: 37});
+ test(m2);
+ test(m2.cast<int, int>());
+}
+
+void test(Map map) {
+ Expect.isTrue(map.containsKey(1));
+ Expect.equals(1, map.length);
+ Expect.equals(1, map.keys.first);
+ Expect.equals(37, map.values.first);
+
+ Expect.throws(map.clear);
+ Expect.throws(() {
+ map.remove(1);
+ });
+ Expect.throws(() {
+ map[2] = 42;
+ });
+ Expect.throws(() {
+ map.addAll(<int, int>{2: 42});
+ });
+}
diff --git a/tests/html/html.status b/tests/html/html.status
index e85d676..6a3157d 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -224,6 +224,9 @@
websql_test: Fail # Firefox Feature support statuses - All changes should be accompanied by platform support annotation changes.
xhr_test/xhr: Pass, Fail # Issue 11602
+[ $compiler == dart2js && $runtime == ff && $system == windows ]
+websql_test: Pass # Triage, seen some double reporting on windows.
+
[ $compiler == dart2js && $browser ]
custom/created_callback_test: Fail # Support for created constructor. Issue 14835
fontface_loaded_test: Fail # Support for promises.
@@ -372,6 +375,13 @@
request_animation_frame_test: Skip # Times out. Issue 22167
transition_event_test/functional: Skip # Times out. Issue 22167
+[ $runtime == chrome && $csp ]
+deferred_multi_app_htmltest: SkipByDesign # uses inline script
+no_linked_scripts_htmltest: SkipByDesign # uses inline script
+scripts_htmltest: SkipByDesign # uses inline script
+two_scripts_htmltest: SkipByDesign # uses inline script
+worker_test/functional: SkipByDesign # starts worker with inline script
+
[ $runtime == chrome || $runtime == chromeOnAndroid || $runtime == drt ]
webgl_1_test: Pass, Fail # Issue 8219
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index f757d51..0b99ca7 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -1341,6 +1341,7 @@
regress_18535_test: CompileTimeError
regress_20394_test/01: MissingCompileTimeError
regress_22936_test/01: RuntimeError
+regress_23408_test: RuntimeError
regress_24283_test: RuntimeError
regress_27572_test: RuntimeError
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
diff --git a/tests/language_2/call_method_as_cast_test.dart b/tests/language_2/call_method_as_cast_test.dart
new file mode 100644
index 0000000..47a14d9
--- /dev/null
+++ b/tests/language_2/call_method_as_cast_test.dart
@@ -0,0 +1,36 @@
+// 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.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+class B {}
+
+class C {
+ B call(B b) => b;
+}
+
+class D implements Function {
+ B call(B b) => b;
+}
+
+typedef B BToB(B x);
+
+typedef Object NullToObject(Null x);
+
+main() {
+ // The presence of a `.call` method does not cause class `C` to become a
+ // subtype of any function type.
+ C c = new C();
+ Expect.throwsCastError(() => c as BToB); //# 01: ok
+ Expect.throwsCastError(() => c as NullToObject); //# 02: ok
+ Expect.throwsCastError(() => c as Function); //# 03: ok
+
+ // The same goes for class `D`, except that it is a subtype of `Function`
+ // because it is explicitly declared to be so.
+ D d = new D();
+ Expect.throwsCastError(() => d as BToB); //# 04: ok
+ Expect.throwsCastError(() => d as NullToObject); //# 05: ok
+ Expect.identical(d as Function, d); //# 06: ok
+}
diff --git a/tests/language_2/call_method_function_typed_value_test.dart b/tests/language_2/call_method_function_typed_value_test.dart
new file mode 100644
index 0000000..7aa9ed8
--- /dev/null
+++ b/tests/language_2/call_method_function_typed_value_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+int f(int i) => 2 * i;
+
+typedef int IntToInt(int x);
+
+main() {
+ // It is possible to use `.call` on a function-typed value (even though it is
+ // redundant). Similarly, it is possible to tear off `.call` on a
+ // function-typed value (but it is a no-op).
+ Expect.equals(f.call(1), 2); //# 01: ok
+ Expect.identical(f.call, f); //# 02: ok
+ IntToInt f2 = f;
+ Expect.equals(f2.call(1), 2); //# 03: ok
+ Expect.identical(f2.call, f); //# 04: ok
+ Function f3 = f;
+ Expect.equals(f3.call(1), 2); //# 05: ok
+ Expect.identical(f3.call, f); //# 06: ok
+ dynamic d = f;
+ Expect.equals(d.call(1), 2); //# 07: ok
+ Expect.identical(d.call, f); //# 08: ok
+}
diff --git a/tests/language_2/call_method_implicit_invoke_instance_test.dart b/tests/language_2/call_method_implicit_invoke_instance_test.dart
new file mode 100644
index 0000000..aa176fa
--- /dev/null
+++ b/tests/language_2/call_method_implicit_invoke_instance_test.dart
@@ -0,0 +1,53 @@
+// 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.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+class C1 {
+ int call(int i) => 2 * i;
+}
+
+class C2 implements Function {
+ int call(int i) => 2 * i;
+}
+
+class D {
+ C1 c1 = new C1();
+ dynamic d1 = new C1();
+ C2 c2 = new C2();
+ dynamic d2 = new C2();
+
+ void test() {
+ // Implicitly invokes c1.call(1)
+ Expect.equals(c1(1), 2); //# 01: ok
+ // Implicitly invokes d1.call(1)
+ Expect.equals(d1(1), 2); //# 02: ok
+ // Implicitly invokes c2.call(1)
+ Expect.equals(c2(1), 2); //# 03: ok
+ // Implicitly invokes d2.call(1)
+ Expect.equals(d2(1), 2); //# 04: ok
+ }
+}
+
+main() {
+ new D().test();
+ // Implicitly invokes D.c1.call(1)
+ Expect.equals(new D().c1(1), 2); //# 09: ok
+ // Implicitly invokes D.d1.call(1)
+ Expect.equals(new D().d1(1), 2); //# 10: ok
+ // Implicitly invokes D.c2.call(1)
+ Expect.equals(new D().c2(1), 2); //# 11: ok
+ // Implicitly invokes D.d2.call(1)
+ Expect.equals(new D().d2(1), 2); //# 12: ok
+ D d = new D();
+ // Implicitly invokes d.c1.call(1)
+ Expect.equals(d.c1(1), 2); //# 09: ok
+ // Implicitly invokes d.d1.call(1)
+ Expect.equals(d.d1(1), 2); //# 10: ok
+ // Implicitly invokes d.c2.call(1)
+ Expect.equals(d.c2(1), 2); //# 11: ok
+ // Implicitly invokes d.d2.call(1)
+ Expect.equals(d.d2(1), 2); //# 12: ok
+}
diff --git a/tests/language_2/call_method_implicit_invoke_local_test.dart b/tests/language_2/call_method_implicit_invoke_local_test.dart
new file mode 100644
index 0000000..02db7ea
--- /dev/null
+++ b/tests/language_2/call_method_implicit_invoke_local_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+class C1 {
+ int call(int i) => 2 * i;
+}
+
+class C2 implements Function {
+ int call(int i) => 2 * i;
+}
+
+main() {
+ C1 c1 = new C1();
+ // Implicitly invokes c1.call(1)
+ Expect.equals(c1(1), 2); //# 01: ok
+ dynamic d1 = c1;
+ // Implicitly invokes d1.call(1)
+ Expect.equals(d1(1), 2); //# 02: ok
+ C2 c2 = new C2();
+ // Implicitly invokes c2.call(1)
+ Expect.equals(c2(1), 2); //# 03: ok
+ dynamic d2 = c2;
+ // Implicitly invokes d2.call(1)
+ Expect.equals(d2(1), 2); //# 04: ok
+}
diff --git a/tests/language_2/call_method_implicit_invoke_static_test.dart b/tests/language_2/call_method_implicit_invoke_static_test.dart
new file mode 100644
index 0000000..17f868d
--- /dev/null
+++ b/tests/language_2/call_method_implicit_invoke_static_test.dart
@@ -0,0 +1,56 @@
+// 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.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+class C1 {
+ int call(int i) => 2 * i;
+}
+
+class C2 implements Function {
+ int call(int i) => 2 * i;
+}
+
+class D {
+ static C1 c1 = new C1();
+ static dynamic d1 = new C1();
+ static C2 c2 = new C2();
+ static dynamic d2 = new C2();
+
+ void test1() {
+ // Implicitly invokes c1.call(1)
+ Expect.equals(c1(1), 2); //# 01: ok
+ // Implicitly invokes d1.call(1)
+ Expect.equals(d1(1), 2); //# 02: ok
+ // Implicitly invokes c2.call(1)
+ Expect.equals(c2(1), 2); //# 03: ok
+ // Implicitly invokes d2.call(1)
+ Expect.equals(d2(1), 2); //# 04: ok
+ }
+
+ static void test2() {
+ // Implicitly invokes c1.call(1)
+ Expect.equals(c1(1), 2); //# 05: ok
+ // Implicitly invokes d1.call(1)
+ Expect.equals(d1(1), 2); //# 06: ok
+ // Implicitly invokes c2.call(1)
+ Expect.equals(c2(1), 2); //# 07: ok
+ // Implicitly invokes d2.call(1)
+ Expect.equals(d2(1), 2); //# 08: ok
+ }
+}
+
+main() {
+ new D().test1();
+ D.test2();
+ // Implicitly invokes D.c1.call(1)
+ Expect.equals(D.c1(1), 2); //# 09: ok
+ // Implicitly invokes D.d1.call(1)
+ Expect.equals(D.d1(1), 2); //# 10: ok
+ // Implicitly invokes D.c2.call(1)
+ Expect.equals(D.c2(1), 2); //# 11: ok
+ // Implicitly invokes D.d2.call(1)
+ Expect.equals(D.d2(1), 2); //# 12: ok
+}
diff --git a/tests/language_2/call_method_implicit_invoke_top_level_test.dart b/tests/language_2/call_method_implicit_invoke_top_level_test.dart
new file mode 100644
index 0000000..eaed546
--- /dev/null
+++ b/tests/language_2/call_method_implicit_invoke_top_level_test.dart
@@ -0,0 +1,30 @@
+// 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.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+class C1 {
+ int call(int i) => 2 * i;
+}
+
+class C2 implements Function {
+ int call(int i) => 2 * i;
+}
+
+C1 c1 = new C1();
+dynamic d1 = new C1();
+C2 c2 = new C2();
+dynamic d2 = new C2();
+
+main() {
+ // Implicitly invokes c1.call(1)
+ Expect.equals(c1(1), 2); //# 01: ok
+ // Implicitly invokes d1.call(1)
+ Expect.equals(d1(1), 2); //# 02: ok
+ // Implicitly invokes c2.call(1)
+ Expect.equals(c2(1), 2); //# 03: ok
+ // Implicitly invokes d2.call(1)
+ Expect.equals(d2(1), 2); //# 04: ok
+}
diff --git a/tests/language_2/call_method_implicit_tear_off_implements_function_test.dart b/tests/language_2/call_method_implicit_tear_off_implements_function_test.dart
new file mode 100644
index 0000000..da4e1dc
--- /dev/null
+++ b/tests/language_2/call_method_implicit_tear_off_implements_function_test.dart
@@ -0,0 +1,96 @@
+// 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.
+// Dart test program to test arithmetic operations.
+
+import "dart:async";
+import "package:expect/expect.dart";
+
+class B {}
+
+class C implements Function {
+ B call(B b) => b;
+}
+
+typedef B BToB(B x);
+
+typedef Object NullToObject(Null x);
+
+C c = new C();
+
+void check1(BToB f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ B b = new B();
+ Expect.identical(f(b), b);
+}
+
+void check2(FutureOr<BToB> f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ BToB f2 = f;
+ B b = new B();
+ Expect.identical(f2(b), b);
+}
+
+void check3(NullToObject f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ Expect.isNull(f(null));
+}
+
+void check4(FutureOr<NullToObject> f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ NullToObject f2 = f;
+ Expect.isNull(f2(null));
+}
+
+void check5(Function f) {
+ Expect.identical(c, f);
+}
+
+void check6(FutureOr<Function> f) {
+ Expect.identical(c, f);
+}
+
+void check7(C x) {
+ Expect.identical(c, x);
+}
+
+void check8(FutureOr<C> x) {
+ Expect.identical(c, x);
+}
+
+void check9(Object o) {
+ Expect.identical(c, o);
+}
+
+void check10(FutureOr<Object> o) {
+ Expect.identical(c, o);
+}
+
+void check11(dynamic d) {
+ Expect.identical(c, d);
+}
+
+void check12(FutureOr<dynamic> d) {
+ Expect.identical(c, d);
+}
+
+main() {
+ // Implicitly tears off c.call
+ check1(c); //# 01: ok
+ check2(c); //# 02: ok
+ check3(c); //# 03: ok
+ check4(c); //# 04: ok
+ // Does not tear off c.call
+ check5(c); //# 05: ok
+ check6(c); //# 06: ok
+ check7(c); //# 07: ok
+ check8(c); //# 08: ok
+ check9(c); //# 09: ok
+ check10(c); //# 10: ok
+ check11(c); //# 11: ok
+ check12(c); //# 12: ok
+}
diff --git a/tests/language_2/call_method_implicit_tear_off_test.dart b/tests/language_2/call_method_implicit_tear_off_test.dart
new file mode 100644
index 0000000..d07eab1
--- /dev/null
+++ b/tests/language_2/call_method_implicit_tear_off_test.dart
@@ -0,0 +1,106 @@
+// 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.
+// Dart test program to test arithmetic operations.
+
+import "dart:async";
+import "package:expect/expect.dart";
+
+class B {}
+
+class C {
+ B call(B b) => b;
+}
+
+typedef B BToB(B x);
+
+typedef Object NullToObject(Null x);
+
+C c = new C();
+
+void check1(BToB f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ B b = new B();
+ Expect.identical(f(b), b);
+}
+
+void check2(FutureOr<BToB> f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ BToB f2 = f;
+ Expect.identical(f, f2);
+ B b = new B();
+ Expect.identical(f2(b), b);
+}
+
+void check3(NullToObject f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ Expect.isNull(f(null));
+}
+
+void check4(FutureOr<NullToObject> f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ NullToObject f2 = f;
+ Expect.identical(f, f2);
+ Expect.isNull(f2(null));
+}
+
+void check5(Function f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ B b = new B();
+ Expect.identical(f(b), b);
+}
+
+void check6(FutureOr<Function> f) {
+ Expect.isFalse(identical(c, f));
+ Expect.equals(c.call, f);
+ Function f2 = f;
+ Expect.identical(f, f2);
+ B b = new B();
+ Expect.identical(f2(b), b);
+}
+
+void check7(C x) {
+ Expect.identical(c, x);
+}
+
+void check8(FutureOr<C> x) {
+ Expect.identical(c, x);
+}
+
+void check9(Object o) {
+ Expect.identical(c, o);
+}
+
+void check10(FutureOr<Object> o) {
+ Expect.identical(c, o);
+}
+
+void check11(dynamic d) {
+ Expect.identical(c, d);
+}
+
+void check12(FutureOr<dynamic> d) {
+ Expect.identical(c, d);
+}
+
+main() {
+ // Implicitly tears off c.call
+ check1(c); //# 01: ok
+ check2(c); //# 02: ok
+ check3(c); //# 03: ok
+ check4(c); //# 04: ok
+ check5(c); //# 05: ok
+ check6(c); //# 06: ok
+ // Does not tear off c.call
+ check7(c); //# 07: ok
+ check8(c); //# 08: ok
+ check9(c); //# 09: ok
+ check10(c); //# 10: ok
+ check11(c); //# 11: ok
+ check12(c); //# 12: ok
+}
diff --git a/tests/language_2/call_method_is_check_test.dart b/tests/language_2/call_method_is_check_test.dart
new file mode 100644
index 0000000..0b8f534
--- /dev/null
+++ b/tests/language_2/call_method_is_check_test.dart
@@ -0,0 +1,36 @@
+// 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.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+class B {}
+
+class C {
+ B call(B b) => b;
+}
+
+class D implements Function {
+ B call(B b) => b;
+}
+
+typedef B BToB(B x);
+
+typedef Object NullToObject(Null x);
+
+main() {
+ // The presence of a `.call` method does not cause class `C` to become a
+ // subtype of any function type.
+ C c = new C();
+ Expect.isFalse(c is BToB); //# 01: ok
+ Expect.isFalse(c is NullToObject); //# 02: ok
+ Expect.isFalse(c is Function); //# 03: ok
+
+ // The same goes for class `D`, except that it is a subtype of `Function`
+ // because it is explicitly declared to be so.
+ D d = new D();
+ Expect.isFalse(d is BToB); //# 04: ok
+ Expect.isFalse(d is NullToObject); //# 05: ok
+ Expect.isTrue(d is Function); //# 06: ok
+}
diff --git a/tests/language_2/call_method_override_test.dart b/tests/language_2/call_method_override_test.dart
new file mode 100644
index 0000000..265ad91
--- /dev/null
+++ b/tests/language_2/call_method_override_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test program to test arithmetic operations.
+
+class B {}
+
+class C {
+ B call(B b) => b;
+}
+
+typedef B BToB(B x);
+
+class D {
+ BToB f() => null;
+ void g(C x) {}
+}
+
+class E extends D {
+ // This override is illegal because C is not a subtype of BToB.
+ C f() => null; //# 01: compile-time error
+
+ // This override is illegal because BToB is not a supertype of C.
+ void g(BToB x) {} //# 02: compile-time error
+}
+
+main() {
+ new E();
+}
diff --git a/tests/language_2/function_propagation_test.dart b/tests/language_2/function_propagation_test.dart
index afb4a1c..83e37d6 100644
--- a/tests/language_2/function_propagation_test.dart
+++ b/tests/language_2/function_propagation_test.dart
@@ -12,24 +12,14 @@
main() {
var a = new A();
- if (a is Function) {
- Expect.isTrue(a is A);
- } else {
- Expect.fail("a should be a Function");
- }
+ Expect.isFalse(a is A);
var a2 = new A();
- if (a2 is F) {
- Expect.isTrue(a2 is A);
- } else {
- Expect.fail("a2 should be an F");
- }
+ Expect.isFalse(a is F);
Function a3 = new A();
- // Dart2Js mistakenly assumed that Function and A couldn't be related and
- // returned false for a is A.
- Expect.isTrue(a3 is A);
+ Expect.isFalse(a3 is A);
F a4 = new A();
- Expect.isTrue(a4 is A);
+ Expect.isFalse(a4 is A);
}
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index 086009d..a1008b0 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -1116,6 +1116,8 @@
accessor_conflict_import_prefixed_test: CompileTimeError # Issue 25626
accessor_conflict_import_test: CompileTimeError # Issue 25626
additional_interface_adds_optional_args_test: CompileTimeError # Issue #30568
+call_method_override_test/01: MissingCompileTimeError
+call_method_override_test/02: MissingCompileTimeError
cascaded_forwarding_stubs_test: CompileTimeError
config_import_corelib_test: CompileTimeError
const_types_test/07: MissingCompileTimeError # Incorrectly allows using type parameter in const expression.
@@ -1164,7 +1166,6 @@
multiple_interface_inheritance_test: CompileTimeError # Issue 30552
no_main_test/01: MissingStaticWarning # Issue 28823
no_such_method_negative_test: CompileTimeError
-object_has_no_call_method_test/02: MissingCompileTimeError
override_inheritance_abstract_test/02: MissingCompileTimeError
override_inheritance_abstract_test/03: MissingCompileTimeError
override_inheritance_abstract_test/04: MissingCompileTimeError
@@ -1268,6 +1269,10 @@
built_in_identifier_type_annotation_test/72: MissingCompileTimeError # Issue 28813
built_in_identifier_type_annotation_test/78: MissingCompileTimeError # Issue 28813
built_in_identifier_type_annotation_test/81: MissingCompileTimeError # Issue 28813
+call_method_implicit_tear_off_implements_function_test/03: StaticWarning
+call_method_implicit_tear_off_test/03: StaticWarning
+call_method_override_test/01: MissingCompileTimeError
+call_method_override_test/02: MissingCompileTimeError
call_type_literal_test: StaticWarning
cast_test/04: MissingCompileTimeError
cast_test/05: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 6e4c689..572064c 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -285,7 +285,34 @@
async_star_test/02: RuntimeError
bit_operations_test: RuntimeError, OK # Issue 1533
branch_canonicalization_test: RuntimeError # Issue 638.
+call_method_as_cast_test/01: RuntimeError
+call_method_as_cast_test/02: RuntimeError
+call_method_as_cast_test/03: RuntimeError
+call_method_as_cast_test/04: RuntimeError
+call_method_as_cast_test/05: RuntimeError
+call_method_function_typed_value_test/02: RuntimeError
+call_method_function_typed_value_test/04: RuntimeError
+call_method_function_typed_value_test/06: RuntimeError
+call_method_function_typed_value_test/08: RuntimeError
+call_method_implicit_tear_off_implements_function_test/01: RuntimeError
+call_method_implicit_tear_off_implements_function_test/02: RuntimeError
+call_method_implicit_tear_off_implements_function_test/03: RuntimeError
+call_method_implicit_tear_off_implements_function_test/04: RuntimeError
+call_method_implicit_tear_off_test/01: RuntimeError
+call_method_implicit_tear_off_test/02: RuntimeError
+call_method_implicit_tear_off_test/03: RuntimeError
+call_method_implicit_tear_off_test/04: RuntimeError
+call_method_implicit_tear_off_test/05: RuntimeError
+call_method_implicit_tear_off_test/06: RuntimeError
+call_method_is_check_test/01: RuntimeError
+call_method_is_check_test/02: RuntimeError
+call_method_is_check_test/03: RuntimeError
+call_method_is_check_test/04: RuntimeError
+call_method_is_check_test/05: RuntimeError
+call_method_override_test/01: MissingCompileTimeError
+call_method_override_test/02: MissingCompileTimeError
covariant_override/runtime_check_test: RuntimeError
+function_propagation_test: RuntimeError
function_type_alias_test: RuntimeError
generic_closure_test: RuntimeError
generic_function_typedef_test/01: RuntimeError
@@ -889,9 +916,31 @@
built_in_identifier_type_annotation_test/66: MissingCompileTimeError # Issue 28815
built_in_identifier_type_annotation_test/67: MissingCompileTimeError # Issue 28815
built_in_identifier_type_annotation_test/68: MissingCompileTimeError # Issue 28815
+callable_test/none: RuntimeError
+call_method_as_cast_test/01: RuntimeError
+call_method_as_cast_test/02: RuntimeError
+call_method_as_cast_test/03: RuntimeError
+call_method_as_cast_test/04: RuntimeError
+call_method_as_cast_test/05: RuntimeError
+call_method_function_typed_value_test/02: RuntimeError
+call_method_function_typed_value_test/04: RuntimeError
+call_method_function_typed_value_test/06: RuntimeError
+call_method_function_typed_value_test/08: RuntimeError
+call_method_is_check_test/01: RuntimeError
+call_method_is_check_test/02: RuntimeError
+call_method_is_check_test/03: RuntimeError
+call_method_is_check_test/04: RuntimeError
+call_method_is_check_test/05: RuntimeError
+call_with_no_such_method_test: RuntimeError
checked_setter2_test: RuntimeError # Issue 31128
checked_setter_test: RuntimeError # Issue 31128
extract_type_arguments_test: Crash # Issue 31371
+function_propagation_test: RuntimeError
+function_type_call_getter2_test/none: RuntimeError
+function_type_call_getter2_test/00: MissingCompileTimeError
+function_type_call_getter2_test/01: MissingCompileTimeError
+function_type_call_getter2_test/02: MissingCompileTimeError
+function_type_call_getter2_test/03: MissingCompileTimeError
generic_test/01: MissingCompileTimeError # front end does not validate `extends`
implicit_downcast_during_constructor_invocation_test: RuntimeError
implicit_downcast_during_for_in_element_test: RuntimeError
@@ -938,7 +987,6 @@
bool_condition_check_test: RuntimeError
branch_canonicalization_test: RuntimeError
call_function_apply_test: RuntimeError
-callable_test/none: RuntimeError
canonical_const2_test: RuntimeError
check_member_static_test/02: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
@@ -1417,13 +1465,8 @@
bool_test: RuntimeError
branch_canonicalization_test: RuntimeError
branches_test: Crash # 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart': Failed assertion: line 441 pos 16: 'identical(combiner.arguments.positional[0], rhs)': is not true.
-call_function2_test: CompileTimeError
-call_function_apply_test: CompileTimeError
-call_function_test: CompileTimeError
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
-call_with_no_such_method_test: CompileTimeError
-callable_test/none: CompileTimeError
canonical_const2_test: RuntimeError
check_member_static_test/01: MissingCompileTimeError
check_member_static_test/02: MissingCompileTimeError
@@ -1558,7 +1601,6 @@
full_stacktrace1_test: RuntimeError
full_stacktrace2_test: RuntimeError
full_stacktrace3_test: RuntimeError
-function_propagation_test: CompileTimeError
function_subtype2_test: RuntimeError
function_subtype3_test: RuntimeError
function_subtype_bound_closure2_test: RuntimeError
@@ -1932,7 +1974,6 @@
regress_23996_test: RuntimeError
regress_24283_test: RuntimeError
regress_24935_test/none: RuntimeError
-regress_25550_test: CompileTimeError
regress_26175_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
regress_28255_test: CompileTimeError
@@ -2191,13 +2232,8 @@
bool_condition_check_test: RuntimeError
bool_test: RuntimeError
branch_canonicalization_test: RuntimeError
-call_function2_test: CompileTimeError
-call_function_apply_test: CompileTimeError
-call_function_test: CompileTimeError
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
-call_with_no_such_method_test: CompileTimeError
-callable_test/none: CompileTimeError
canonical_const2_test: RuntimeError
check_member_static_test/01: MissingCompileTimeError
check_member_static_test/02: MissingCompileTimeError
@@ -2247,9 +2283,7 @@
const_switch_test/02: RuntimeError
const_switch_test/04: RuntimeError
const_types_test/34: MissingCompileTimeError
-const_types_test/35: MissingCompileTimeError
const_types_test/39: MissingCompileTimeError
-const_types_test/40: MissingCompileTimeError
constants_test/05: MissingCompileTimeError
constructor12_test: RuntimeError
constructor_named_arguments_test/none: RuntimeError
@@ -2332,7 +2366,6 @@
full_stacktrace1_test: RuntimeError # Issue 12698
full_stacktrace2_test: RuntimeError # Issue 12698
full_stacktrace3_test: RuntimeError # Issue 12698
-function_propagation_test: CompileTimeError
function_subtype2_test: RuntimeError
function_subtype3_test: RuntimeError
function_subtype_bound_closure2_test: RuntimeError
@@ -2705,7 +2738,6 @@
regress_23996_test: RuntimeError
regress_24283_test: RuntimeError, OK # Requires 64 bit numbers.
regress_24935_test/none: RuntimeError
-regress_25550_test: CompileTimeError
regress_26175_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
regress_28255_test: CompileTimeError
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index bd10851..fa770e2 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -14,6 +14,32 @@
black_listed_test/none: Fail # Issue 14228
built_in_identifier_prefix_test: CompileTimeError
built_in_identifier_type_annotation_test/22: MissingCompileTimeError # Issue 28816
+call_method_as_cast_test/01: RuntimeError
+call_method_as_cast_test/02: RuntimeError
+call_method_as_cast_test/03: RuntimeError
+call_method_as_cast_test/04: RuntimeError
+call_method_as_cast_test/05: RuntimeError
+call_method_function_typed_value_test/02: RuntimeError
+call_method_function_typed_value_test/04: RuntimeError
+call_method_function_typed_value_test/06: RuntimeError
+call_method_function_typed_value_test/08: RuntimeError
+call_method_implicit_tear_off_implements_function_test/01: RuntimeError
+call_method_implicit_tear_off_implements_function_test/02: RuntimeError
+call_method_implicit_tear_off_implements_function_test/03: RuntimeError
+call_method_implicit_tear_off_implements_function_test/04: RuntimeError
+call_method_implicit_tear_off_test/01: RuntimeError
+call_method_implicit_tear_off_test/02: RuntimeError
+call_method_implicit_tear_off_test/03: RuntimeError
+call_method_implicit_tear_off_test/04: RuntimeError
+call_method_implicit_tear_off_test/05: RuntimeError
+call_method_implicit_tear_off_test/06: RuntimeError
+call_method_is_check_test/01: RuntimeError
+call_method_is_check_test/02: RuntimeError
+call_method_is_check_test/03: RuntimeError
+call_method_is_check_test/04: RuntimeError
+call_method_is_check_test/05: RuntimeError
+call_method_override_test/01: MissingCompileTimeError
+call_method_override_test/02: MissingCompileTimeError
cascaded_forwarding_stubs_generic_test: RuntimeError
cascaded_forwarding_stubs_test: CompileTimeError
conflicting_type_variable_and_setter_test: CompileTimeError
@@ -33,6 +59,7 @@
final_syntax_test/03: MissingCompileTimeError
final_syntax_test/04: MissingCompileTimeError
forwarding_stub_tearoff_test: CompileTimeError
+function_propagation_test: RuntimeError
fuzzy_arrows_test/01: MissingCompileTimeError
generic_local_functions_test: CompileTimeError
generic_methods_generic_function_parameter_test: CompileTimeError
@@ -46,7 +73,6 @@
implicit_creation/implicit_const_context_prefix_constructor_generic_test: CompileTimeError
implicit_creation/implicit_new_or_const_composite_test: RuntimeError
implicit_creation/implicit_new_or_const_generic_test: RuntimeError
-implicit_creation/implicit_new_or_const_test: RuntimeError
import_core_prefix_test: CompileTimeError
import_private_test/01: MissingCompileTimeError # Issue 29920
initializing_formal_final_test: MissingCompileTimeError
@@ -90,7 +116,6 @@
multiline_newline_test/02r: CompileTimeError
multiple_interface_inheritance_test: CompileTimeError # Issue 30552
nested_generic_closure_test: CompileTimeError
-object_has_no_call_method_test/02: MissingCompileTimeError
override_inheritance_field_test/04: CompileTimeError
override_inheritance_field_test/06: CompileTimeError
override_inheritance_field_test/26: CompileTimeError
@@ -275,13 +300,23 @@
built_in_identifier_type_annotation_test/66: MissingCompileTimeError
built_in_identifier_type_annotation_test/67: MissingCompileTimeError
built_in_identifier_type_annotation_test/68: MissingCompileTimeError
-call_function2_test: CompileTimeError # Issue 31402; Error: A value of type '#lib1::Bar' can't be assigned to a variable of type '(dart.core::Object) → dart.core::Object'.
-call_function_apply_test: CompileTimeError # Issue 31402 Error: A value of type '#lib1::A' can't be assigned to a variable of type 'dart.core::Function'.
-call_function_test: CompileTimeError
+call_method_as_cast_test/01: RuntimeError
+call_method_as_cast_test/02: RuntimeError
+call_method_as_cast_test/03: RuntimeError
+call_method_as_cast_test/04: RuntimeError
+call_method_as_cast_test/05: RuntimeError
+call_method_function_typed_value_test/02: RuntimeError
+call_method_function_typed_value_test/04: RuntimeError
+call_method_function_typed_value_test/06: RuntimeError
+call_method_function_typed_value_test/08: RuntimeError
+call_method_is_check_test/01: RuntimeError
+call_method_is_check_test/02: RuntimeError
+call_method_is_check_test/03: RuntimeError
+call_method_is_check_test/04: RuntimeError
+call_method_is_check_test/05: RuntimeError
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
-call_with_no_such_method_test: CompileTimeError # Issue 31402 Error: A value of type '#lib1::F' can't be assigned to a variable of type 'dart.core::Function'.
-callable_test/none: CompileTimeError
+call_with_no_such_method_test: RuntimeError
check_member_static_test/01: MissingCompileTimeError
check_member_static_test/02: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
@@ -317,9 +352,7 @@
const_switch2_test/01: MissingCompileTimeError
const_syntax_test/05: MissingCompileTimeError
const_types_test/34: MissingCompileTimeError
-const_types_test/35: MissingCompileTimeError
const_types_test/39: MissingCompileTimeError
-const_types_test/40: MissingCompileTimeError
constants_test/05: MissingCompileTimeError
constructor_redirect1_negative_test/01: MissingCompileTimeError
constructor_redirect2_negative_test: MissingCompileTimeError
@@ -365,7 +398,11 @@
field_override4_test/02: MissingCompileTimeError
field_override_test/00: MissingCompileTimeError
field_override_test/01: MissingCompileTimeError
-function_propagation_test: CompileTimeError
+function_propagation_test: RuntimeError
+function_type_call_getter2_test/00: MissingCompileTimeError
+function_type_call_getter2_test/01: MissingCompileTimeError
+function_type_call_getter2_test/02: MissingCompileTimeError
+function_type_call_getter2_test/03: MissingCompileTimeError
function_type_parameter2_negative_test: Fail
function_type_parameter_negative_test: Fail
generic_function_bounds_test: RuntimeError
@@ -506,25 +543,6 @@
mixin_super_use_test: RuntimeError
mixin_supertype_subclass_test/02: MissingCompileTimeError
mixin_supertype_subclass_test/05: MissingCompileTimeError
-mixin_type_parameter_inference_error_test/01: MissingCompileTimeError
-mixin_type_parameter_inference_error_test/02: MissingCompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/01: Crash # Issue 32091
-mixin_type_parameter_inference_previous_mixin_test/02: CompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/04: Crash # Issue 32091
-mixin_type_parameter_inference_previous_mixin_test/05: Crash # Issue 32091
-mixin_type_parameter_inference_previous_mixin_test/none: Crash # Issue 32091
-mixin_type_parameter_inference_test/01: CompileTimeError
-mixin_type_parameter_inference_test/02: CompileTimeError
-mixin_type_parameter_inference_test/03: CompileTimeError
-mixin_type_parameter_inference_test/06: Crash
-mixin_type_parameter_inference_test/07: Crash
-mixin_type_parameter_inference_test/08: Crash
-mixin_type_parameter_inference_test/09: Crash
-mixin_type_parameter_inference_test/10: Crash
-mixin_type_parameter_inference_test/12: Crash
-mixin_type_parameter_inference_test/13: Crash
-mixin_type_parameter_inference_test/16: Crash
-mixin_type_parameter_inference_test/none: Crash
mixin_type_parameters_errors_test/01: MissingCompileTimeError
mixin_type_parameters_errors_test/02: MissingCompileTimeError
mixin_type_parameters_errors_test/03: MissingCompileTimeError
@@ -589,7 +607,6 @@
redirecting_factory_malbounded_test/01: MissingCompileTimeError
regress_23089_test: Crash # Crashes in KernelClassBuilder.buildTypeArguments
regress_23408_test: CompileTimeError # Issue 31533
-regress_25550_test: CompileTimeError
regress_29025_test: CompileTimeError
regress_29405_test: CompileTimeError # Issue 31402 Error: A value of type '#lib2::Foo' can't be assigned to a variable of type '(#lib2::Foo) → void'.
regress_29784_test/01: MissingCompileTimeError
@@ -715,7 +732,6 @@
library_env_test/has_no_html_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
mock_writable_final_field_test: RuntimeError # Expect.listEquals(list length, expected: <1>, actual: <0>) fails: Next element <123>
mock_writable_final_private_field_test: RuntimeError
-redirecting_factory_long_test: RuntimeError # Expect.isTrue(false) fails.
redirecting_factory_reflection_test: RuntimeError # UnimplementedError: node <InvalidExpression> `invalid-expression`
regress_24283_test: RuntimeError # Expect.equals(expected: <-1>, actual: <4294967295>) fails.
regress_30339_test: RuntimeError # Uncaught Expect.isTrue(false) fails.
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 9e11913..84243f6 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -17,18 +17,6 @@
duplicate_implements_test/02: MissingCompileTimeError
generic_methods_generic_function_result_test/01: MissingCompileTimeError
generic_no_such_method_dispatcher_test: RuntimeError # Issue 31424
-mixin_type_parameter_inference_error_test/01: MissingCompileTimeError
-mixin_type_parameter_inference_error_test/02: MissingCompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/02: CompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/04: MissingCompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/05: RuntimeError
-mixin_type_parameter_inference_test/01: CompileTimeError
-mixin_type_parameter_inference_test/02: CompileTimeError
-mixin_type_parameter_inference_test/03: CompileTimeError
-mixin_type_parameter_inference_test/06: MissingCompileTimeError
-mixin_type_parameter_inference_test/07: MissingCompileTimeError
-mixin_type_parameter_inference_test/08: RuntimeError
-mixin_type_parameter_inference_test/09: RuntimeError
mock_writable_final_field_test: RuntimeError # Issue 31424
no_such_method_subtype_test: RuntimeError # Issue 31424
@@ -82,9 +70,6 @@
closure_invoked_through_interface_target_getter_test: MissingCompileTimeError
compile_time_constant_o_test/01: MissingCompileTimeError
compile_time_constant_o_test/02: MissingCompileTimeError
-const_constructor2_test/20: MissingCompileTimeError
-const_constructor2_test/22: MissingCompileTimeError
-const_constructor2_test/24: MissingCompileTimeError
const_dynamic_type_literal_test/02: MissingCompileTimeError
const_factory_with_body_test/01: MissingCompileTimeError # Fasta bug: Const factory with body.
const_instance_field_test/01: MissingCompileTimeError # Fasta bug: Const instance field.
@@ -92,9 +77,7 @@
const_map3_test/00: MissingCompileTimeError # KernelVM bug: Constant evaluation.
const_switch2_test/01: MissingCompileTimeError # KernelVM bug: Constant evaluation.
const_types_test/34: MissingCompileTimeError
-const_types_test/35: MissingCompileTimeError
const_types_test/39: MissingCompileTimeError
-const_types_test/40: MissingCompileTimeError
constructor_redirect1_negative_test/01: MissingCompileTimeError
constructor_redirect2_negative_test: MissingCompileTimeError
constructor_redirect_test/01: MissingCompileTimeError # Fasta bug: Initializer refers to this.
@@ -624,7 +607,6 @@
[ $compiler == dartk && $runtime == vm && !$checked && $strong ]
bool_check_test: RuntimeError
bool_condition_check_test: RuntimeError
-callable_test/none: RuntimeError
compile_time_constant_static2_test/04: MissingCompileTimeError
compile_time_constant_static3_test/04: MissingCompileTimeError
conditional_rewrite_test: RuntimeError # Issue 31402 (Not)
@@ -640,11 +622,8 @@
async_star_test/02: RuntimeError # Issue 31402 (Invocation arguments)
built_in_identifier_prefix_test: CompileTimeError
built_in_identifier_type_annotation_test/22: DartkCrash # Issue 28814
-call_function2_test: CompileTimeError # Issue 31402 (map literal)
-call_function_apply_test: CompileTimeError # Issue 31402 (Invocation arguments)
-call_function_test: CompileTimeError
-call_with_no_such_method_test: CompileTimeError # Issue 31402 (Invocation arguments)
-callable_test/none: CompileTimeError # Issue 31402 (Variable declaration)
+call_operator_test: RuntimeError, OK
+call_with_no_such_method_test: RuntimeError
cha_deopt1_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
cha_deopt1_test: RuntimeError
compile_time_constant_k_test/01: MissingCompileTimeError
@@ -725,14 +704,19 @@
flatten_test/09: MissingRuntimeError
flatten_test/12: MissingRuntimeError
for_in_side_effects_test/01: MissingCompileTimeError
-function_propagation_test: CompileTimeError # Issue 31402 (Variable declaration)
+function_propagation_test: RuntimeError
function_subtype3_test: RuntimeError
+function_subtype_call0_test: RuntimeError, OK
function_subtype_call1_test: RuntimeError
function_subtype_call2_test: RuntimeError
function_subtype_cast0_test: RuntimeError
function_subtype_inline2_test: RuntimeError
function_type2_test: RuntimeError
function_type_alias6_test/none: RuntimeError
+function_type_call_getter2_test/00: MissingCompileTimeError
+function_type_call_getter2_test/01: MissingCompileTimeError
+function_type_call_getter2_test/02: MissingCompileTimeError
+function_type_call_getter2_test/03: MissingCompileTimeError
generic_function_dcall_test: RuntimeError
generic_instanceof2_test: RuntimeError
generic_is_check_test: RuntimeError
@@ -778,18 +762,6 @@
method_override_test: CompileTimeError # Issue 31616
mixin_illegal_super_use_test: Skip # Issues 24478 and 23773
mixin_illegal_superclass_test: Skip # Issues 24478 and 23773
-mixin_type_parameter_inference_error_test/01: MissingCompileTimeError
-mixin_type_parameter_inference_error_test/02: MissingCompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/02: CompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/04: MissingCompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/05: RuntimeError
-mixin_type_parameter_inference_test/01: CompileTimeError
-mixin_type_parameter_inference_test/02: CompileTimeError
-mixin_type_parameter_inference_test/03: CompileTimeError
-mixin_type_parameter_inference_test/06: MissingCompileTimeError
-mixin_type_parameter_inference_test/07: MissingCompileTimeError
-mixin_type_parameter_inference_test/08: RuntimeError
-mixin_type_parameter_inference_test/09: RuntimeError
mock_writable_final_private_field_test: RuntimeError # Issue 30849
named_constructor_test/01: MissingRuntimeError # Fasta bug: Bad compilation of constructor reference.
named_parameters_default_eq_test/none: RuntimeError
@@ -811,13 +783,11 @@
parser_quirks_test: CompileTimeError # Issue 31533
redirecting_factory_default_values_test/03: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
-redirecting_factory_long_test: RuntimeError # Fasta bug: Bad compilation of type arguments for redirecting factory.
redirecting_factory_malbounded_test/01: MissingCompileTimeError
regress_22443_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_23089_test: Crash
regress_23408_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_23408_test: RuntimeError
-regress_25550_test: CompileTimeError # Issue 31402 (Variable declaration)
regress_28278_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_29025_test: CompileTimeError # Issue 31402 (Variable declaration)
regress_29405_test: CompileTimeError # Issue 31402 (Invocation arguments)
@@ -995,7 +965,6 @@
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
bool_check_test: RuntimeError
bool_condition_check_test: RuntimeError
-callable_test/none: RuntimeError
compile_time_constant_static2_test/04: MissingCompileTimeError
compile_time_constant_static3_test/04: MissingCompileTimeError
conditional_rewrite_test: RuntimeError # Issue 31402 (Not)
@@ -1034,11 +1003,8 @@
bad_named_parameters_test/04: Crash
built_in_identifier_prefix_test: CompileTimeError
built_in_identifier_type_annotation_test/22: DartkCrash # Issue 28814
-call_function2_test: CompileTimeError # Issue 31402 (map literal)
-call_function_apply_test: CompileTimeError # Issue 31402 (Invocation arguments)
-call_function_test: CompileTimeError
-call_with_no_such_method_test: CompileTimeError # Issue 31402 (Invocation arguments)
-callable_test/none: CompileTimeError # Issue 31402 (Variable declaration)
+call_operator_test: RuntimeError, OK
+call_with_no_such_method_test: RuntimeError
cha_deopt1_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
cha_deopt2_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
cha_deopt3_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
@@ -1132,14 +1098,19 @@
flatten_test/09: MissingRuntimeError
flatten_test/12: MissingRuntimeError
for_in_side_effects_test/01: MissingCompileTimeError
-function_propagation_test: CompileTimeError # Issue 31402 (Variable declaration)
+function_propagation_test: RuntimeError
function_subtype3_test: RuntimeError
+function_subtype_call0_test: RuntimeError, OK
function_subtype_call1_test: RuntimeError
function_subtype_call2_test: RuntimeError
function_subtype_cast0_test: RuntimeError
function_subtype_inline2_test: RuntimeError
function_type2_test: RuntimeError
function_type_alias6_test/none: RuntimeError
+function_type_call_getter2_test/00: MissingCompileTimeError
+function_type_call_getter2_test/01: MissingCompileTimeError
+function_type_call_getter2_test/02: MissingCompileTimeError
+function_type_call_getter2_test/03: MissingCompileTimeError
generic_function_dcall_test: RuntimeError
generic_instanceof2_test: RuntimeError
generic_is_check_test: RuntimeError
@@ -1243,7 +1214,6 @@
recursive_mixin_test: Crash
redirecting_factory_default_values_test/03: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
-redirecting_factory_long_test: RuntimeError # Fasta bug: Bad compilation of type arguments for redirecting factory.
redirecting_factory_malbounded_test/01: MissingCompileTimeError
redirecting_factory_reflection_test: SkipByDesign
regress_13462_0_test: SkipByDesign
@@ -1253,7 +1223,6 @@
regress_23089_test: Crash
regress_23408_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_23408_test: RuntimeError
-regress_25550_test: CompileTimeError # Issue 31402 (Variable declaration)
regress_28255_test: SkipByDesign
regress_28278_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_29025_test: CompileTimeError # Issue 31402 (Variable declaration)
diff --git a/tests/language_2/language_2_precompiled.status b/tests/language_2/language_2_precompiled.status
index 355e83e..56a3d0d 100644
--- a/tests/language_2/language_2_precompiled.status
+++ b/tests/language_2/language_2_precompiled.status
@@ -91,6 +91,28 @@
call_constructor_on_unresolvable_class_test/01: MissingCompileTimeError
call_constructor_on_unresolvable_class_test/02: MissingCompileTimeError
call_constructor_on_unresolvable_class_test/03: MissingCompileTimeError
+call_method_as_cast_test/01: RuntimeError
+call_method_as_cast_test/02: RuntimeError
+call_method_as_cast_test/03: RuntimeError
+call_method_as_cast_test/04: RuntimeError
+call_method_as_cast_test/05: RuntimeError
+call_method_implicit_tear_off_implements_function_test/01: RuntimeError
+call_method_implicit_tear_off_implements_function_test/02: RuntimeError
+call_method_implicit_tear_off_implements_function_test/03: RuntimeError
+call_method_implicit_tear_off_implements_function_test/04: RuntimeError
+call_method_implicit_tear_off_test/01: RuntimeError
+call_method_implicit_tear_off_test/02: RuntimeError
+call_method_implicit_tear_off_test/03: RuntimeError
+call_method_implicit_tear_off_test/04: RuntimeError
+call_method_implicit_tear_off_test/05: RuntimeError
+call_method_implicit_tear_off_test/06: RuntimeError
+call_method_is_check_test/01: RuntimeError
+call_method_is_check_test/02: RuntimeError
+call_method_is_check_test/03: RuntimeError
+call_method_is_check_test/04: RuntimeError
+call_method_is_check_test/05: RuntimeError
+call_method_override_test/01: MissingCompileTimeError
+call_method_override_test/02: MissingCompileTimeError
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
call_nonexistent_constructor_test/01: MissingCompileTimeError
@@ -343,6 +365,7 @@
for_in3_test: MissingCompileTimeError
for_in_side_effects_test/01: MissingCompileTimeError
function_malformed_result_type_test/00: MissingCompileTimeError
+function_propagation_test: RuntimeError
function_subtype_bound_closure3_test: RuntimeError
function_subtype_bound_closure4_test: RuntimeError
function_subtype_bound_closure7_test: RuntimeError
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index a0203fb..219b1d4 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -180,6 +180,28 @@
call_constructor_on_unresolvable_class_test/01: MissingCompileTimeError
call_constructor_on_unresolvable_class_test/02: MissingCompileTimeError
call_constructor_on_unresolvable_class_test/03: MissingCompileTimeError
+call_method_as_cast_test/01: RuntimeError
+call_method_as_cast_test/02: RuntimeError
+call_method_as_cast_test/03: RuntimeError
+call_method_as_cast_test/04: RuntimeError
+call_method_as_cast_test/05: RuntimeError
+call_method_implicit_tear_off_implements_function_test/01: RuntimeError
+call_method_implicit_tear_off_implements_function_test/02: RuntimeError
+call_method_implicit_tear_off_implements_function_test/03: RuntimeError
+call_method_implicit_tear_off_implements_function_test/04: RuntimeError
+call_method_implicit_tear_off_test/01: RuntimeError
+call_method_implicit_tear_off_test/02: RuntimeError
+call_method_implicit_tear_off_test/03: RuntimeError
+call_method_implicit_tear_off_test/04: RuntimeError
+call_method_implicit_tear_off_test/05: RuntimeError
+call_method_implicit_tear_off_test/06: RuntimeError
+call_method_is_check_test/01: RuntimeError
+call_method_is_check_test/02: RuntimeError
+call_method_is_check_test/03: RuntimeError
+call_method_is_check_test/04: RuntimeError
+call_method_is_check_test/05: RuntimeError
+call_method_override_test/01: MissingCompileTimeError
+call_method_override_test/02: MissingCompileTimeError
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
call_nonexistent_constructor_test/01: MissingCompileTimeError
@@ -381,6 +403,7 @@
for_in3_test: MissingCompileTimeError
for_in_side_effects_test/01: MissingCompileTimeError
function_malformed_result_type_test/00: MissingCompileTimeError
+function_propagation_test: RuntimeError
function_subtype_bound_closure1_test: RuntimeError
function_subtype_bound_closure2_test: RuntimeError
function_subtype_bound_closure3_test: RuntimeError
diff --git a/tests/language_2/shadow_parameter_and_local_test.dart b/tests/language_2/shadow_parameter_and_local_test.dart
index 1a00dd3..12af69a 100644
--- a/tests/language_2/shadow_parameter_and_local_test.dart
+++ b/tests/language_2/shadow_parameter_and_local_test.dart
@@ -26,9 +26,65 @@
yield a;
}
+// Regression test for https://github.com/dart-lang/sdk/issues/32140
+class C {
+ var x, y, localY, _value;
+
+ C(a) {
+ var a = 123;
+ this.x = a;
+ }
+
+ C.initY(this.y) {
+ var y = 123;
+ this.localY = y;
+ }
+
+ method(a) {
+ var a = 123;
+ return a;
+ }
+
+ get accessor => _value;
+ set accessor(a) {
+ var a = 123;
+ this._value = a;
+ }
+}
+
+testCatch() {
+ try {
+ throw 'oops';
+ } catch (e) {
+ var e = 123;
+ return e;
+ }
+}
+
+testStackTrace() {
+ try {
+ throw 'oops';
+ } catch (e, s) {
+ var s = 123;
+ return s;
+ }
+}
+
main() async {
Expect.equals(foo(42), 123);
Expect.equals(await bar(42), 123);
Expect.equals(baz(42).single, 123);
Expect.equals(await qux(42).single, 123);
+
+ var c = new C('hi');
+ Expect.equals(c.x, 123);
+ Expect.equals(c.method(42), 123);
+ c.accessor = 42;
+ Expect.equals(c.accessor, 123);
+ c = new C.initY(42);
+ Expect.equals(c.y, 42);
+ Expect.equals(c.localY, 123);
+
+ Expect.equals(testCatch(), 123);
+ Expect.equals(testStackTrace(), 123);
}
diff --git a/tests/lib_2/html/deferred_multi_app_htmltest.html b/tests/lib_2/html/deferred_multi_app_htmltest.html
index 554adf8..e352e13 100644
--- a/tests/lib_2/html/deferred_multi_app_htmltest.html
+++ b/tests/lib_2/html/deferred_multi_app_htmltest.html
@@ -8,7 +8,7 @@
START_HTML_DART_TEST
{
- "scripts": ["deferred_multi_app.dart", "deferred_multi_app_lib.dart"],
+ "scripts": ["deferred_multi_app.dart", "dispatch_parent_event.js"],
"expectedMessages": ["one", "two"]
}
END_HTML_DART_TEST
@@ -16,7 +16,7 @@
<html>
<body>
<div id="state">1</div>
- <script>window.parent.dispatchEvent(new Event('detect_errors'));</script>
+ <script src="dispatch_parent_event.js"></script>
<script src="deferred_multi_app.dart" type="application/dart"></script>
<script src="deferred_multi_app.dart" type="application/dart"></script>
</body>
diff --git a/tests/lib_2/html/dispatch_parent_event.js b/tests/lib_2/html/dispatch_parent_event.js
new file mode 100644
index 0000000..ee204b4
--- /dev/null
+++ b/tests/lib_2/html/dispatch_parent_event.js
@@ -0,0 +1,5 @@
+// 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.
+//
+window.parent.dispatchEvent(new Event('detect_errors'));
diff --git a/tests/lib_2/html/no_linked_scripts_htmltest.html b/tests/lib_2/html/no_linked_scripts_htmltest.html
index 3ec0861..3a7add2 100644
--- a/tests/lib_2/html/no_linked_scripts_htmltest.html
+++ b/tests/lib_2/html/no_linked_scripts_htmltest.html
@@ -7,14 +7,14 @@
<!--
START_HTML_DART_TEST
{
- "scripts": [ ],
+ "scripts": [ "dispatch_parent_event.js" ],
"expectedMessages": ["hest", "fisk"]
}
END_HTML_DART_TEST
-->
<html>
<head>
- <script>window.parent.dispatchEvent(new Event('detect_errors'));</script>
+ <script src="dispatch_parent_event.js"></script>
<title>No Linked Scripts HTML test</title>
</head><body>
<h1>No Linked Scripts HTML test</h1>
diff --git a/tests/lib_2/html/scripts_htmltest.html b/tests/lib_2/html/scripts_htmltest.html
index 1819595..63aab06 100644
--- a/tests/lib_2/html/scripts_htmltest.html
+++ b/tests/lib_2/html/scripts_htmltest.html
@@ -7,14 +7,14 @@
<!--
START_HTML_DART_TEST
{
- "scripts": ["scripts_test_dart.dart", "scripts_test_js.js"],
+ "scripts": ["scripts_test_dart.dart", "scripts_test_js.js", "dispatch_parent_event.js"],
"expectedMessages": ["crab", "fish", "squid", "sea urchin"]
}
END_HTML_DART_TEST
-->
<html>
<head>
- <script>window.parent.dispatchEvent(new Event('detect_errors'));</script>
+ <script src="dispatch_parent_event.js"></script>
<title>Scripts HTML test</title>
</head><body>
<h1>Scripts HTML test</h1>
diff --git a/tests/lib_2/html/two_scripts_htmltest.html b/tests/lib_2/html/two_scripts_htmltest.html
index 1a244ca..69c39e4 100644
--- a/tests/lib_2/html/two_scripts_htmltest.html
+++ b/tests/lib_2/html/two_scripts_htmltest.html
@@ -7,7 +7,7 @@
<!--
START_HTML_DART_TEST
{
- "scripts": ["two_scripts_test_first.dart", "two_scripts_test_second.dart"],
+ "scripts": ["two_scripts_test_first.dart", "two_scripts_test_second.dart", "dispatch_parent_event.js"],
"expectedMessages":
["first_local", "first_global", "second_local", "second_global"]
}
@@ -15,7 +15,7 @@
-->
<html>
<head>
- <script>window.parent.dispatchEvent(new Event('detect_errors'));</script>
+ <script src="dispatch_parent_event.js"></script>
<title>Two Scripts HTML test</title>
</head><body>
<h1>Two Scripts HTML test</h1>
diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status
index 87a6273..84514c6 100644
--- a/tests/lib_2/lib_2_dart2js.status
+++ b/tests/lib_2/lib_2_dart2js.status
@@ -81,11 +81,29 @@
html/element_classes_test: RuntimeError # Issue 30291
html/element_types_keygen_test: RuntimeError # Issue 29055
html/file_sample_test: Pass, RuntimeError
+html/fileapi_entry_test: Pass, RuntimeError
html/media_stream_test: RuntimeError # Please triage.
html/speechrecognition_test: RuntimeError # Please triage.
isolate/function_send_test: Skip # Crashes Chrome 62: https://bugs.chromium.org/p/chromium/issues/detail?id=775506
isolate/kill_self_synchronously_test: RuntimeError
+[ $compiler == dart2js && $runtime == chrome && $csp ]
+html/canvas_pixel_array_type_alias_test: RuntimeError
+html/js_browser_test: RuntimeError
+html/js_caching_test: RuntimeError
+html/js_context_test: RuntimeError
+html/js_dart_functions_test: RuntimeError
+html/js_dart_js_test: RuntimeError
+html/js_identity_test: RuntimeError
+html/js_jsarray_test: RuntimeError
+html/js_jsfunc_callmethod_test: RuntimeError
+html/js_jsify_test: RuntimeError
+html/js_jsobject_test: RuntimeError
+html/js_methods_test: RuntimeError
+html/js_transferrables_test: RuntimeError
+html/js_typed_interop_lazy_test/none: RuntimeError
+html/js_typed_interop_rename_static_test: RuntimeError
+
[ $compiler == dart2js && $runtime == chromeOnAndroid ]
html/audiobuffersourcenode_test/supported: Fail # TODO(dart2js-team): Please triage this failure.
html/audiocontext_test/supported: RuntimeError # TODO(dart2js-team): Please triage this failure.
@@ -120,34 +138,9 @@
html/js_interop_constructor_name_error1_test: Fail # Issue 26838
html/js_interop_constructor_name_error2_test: Fail # Issue 26838
-[ $compiler == dart2js && $runtime == drt ]
-html/fileapi_entry_test: RuntimeError # DRT before DomError repl'd DomException
-html/request_animation_frame_test: Skip # Async test hangs.
-html/speechrecognition_test: RuntimeError # Please triage.
-html/svg_test: RuntimeError # Please triage.
-math/math2_test: RuntimeError
-math/math_test: RuntimeError
-
[ $compiler == dart2js && $runtime == drt && !$checked ]
html/audiocontext_test/functional: Pass, Fail
-[ $compiler == dart2js && $runtime == drt && $csp ]
-html/canvas_pixel_array_type_alias_test: RuntimeError
-html/js_browser_test: RuntimeError
-html/js_caching_test: RuntimeError
-html/js_context_test: RuntimeError
-html/js_dart_functions_test: RuntimeError
-html/js_dart_js_test: RuntimeError
-html/js_identity_test: RuntimeError
-html/js_jsarray_test: RuntimeError
-html/js_jsfunc_callmethod_test: RuntimeError
-html/js_jsify_test: RuntimeError
-html/js_jsobject_test: RuntimeError
-html/js_methods_test: RuntimeError
-html/js_transferrables_test: RuntimeError
-html/js_typed_interop_lazy_test/none: RuntimeError
-html/js_typed_interop_rename_static_test: RuntimeError
-
[ $compiler == dart2js && $runtime == ff ]
async/slow_consumer2_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_json_utf8_decode_test: SkipSlow # Times out. Issue 22050
@@ -292,7 +285,7 @@
convert/utf85_test: Pass, Slow # Issue 12029.
html/js_function_getter_trust_types_test: Skip # --trust-type-annotations incompatible with --checked
-[ $compiler == dart2js && $csp && ($runtime == chrome || $runtime == chromeOnAndroid || $runtime == drt || $runtime == ff || $runtime == safari) ]
+[ $compiler == dart2js && $csp && ($runtime == chrome || $runtime == chromeOnAndroid || $runtime == ff || $runtime == safari) ]
html/event_customevent_test: SkipByDesign
html/js_array_test: SkipByDesign
html/js_dart_to_string_test: SkipByDesign
diff --git a/tests/lib_2/lib_2_dartdevc.status b/tests/lib_2/lib_2_dartdevc.status
index c90982c..8821482 100644
--- a/tests/lib_2/lib_2_dartdevc.status
+++ b/tests/lib_2/lib_2_dartdevc.status
@@ -131,3 +131,4 @@
typed_data/int64_list_load_store_test: RuntimeError # Issue 29922
typed_data/typed_data_hierarchy_int64_test: RuntimeError # Issue 29922
typed_data/unmodifiable_typed_data_test: RuntimeError # Issue 10275
+
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index ec87852..91efe02 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -102,6 +102,7 @@
mirrors/empty_test: Crash, RuntimeError
mirrors/enum_test: RuntimeError # Issue 31402 (Invocation arguments)
mirrors/equality_test: RuntimeError
+mirrors/function_apply_test: RuntimeError, OK
mirrors/function_type_mirror_test: RuntimeError
mirrors/generic_f_bounded_mixin_application_test: RuntimeError
mirrors/generic_function_typedef_test: RuntimeError
diff --git a/tools/VERSION b/tools/VERSION
index 4fa6039..6752539 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 25
+PRERELEASE 26
PRERELEASE_PATCH 0
diff --git a/tools/gn.py b/tools/gn.py
index 2b5ebc6..d727fbc 100755
--- a/tools/gn.py
+++ b/tools/gn.py
@@ -172,8 +172,9 @@
# Don't use the wheezy sysroot if we're given another sysroot.
if TargetSysroot(args):
return False
- # Use the downloaded sysroot unless it is explicitly disabled.
- return not args.no_wheezy and not UseSanitizer(args)
+ # The clang toolchain we pull from Fuchsia doesn't have arm and arm64
+ # sysroots, so use the wheezy/jesse ones.
+ return gn_args['is_clang'] and gn_args['target_cpu'].startswith('arm')
def ToGnArgs(args, mode, arch, target_os):
@@ -443,9 +444,8 @@
action='store_true')
other_group.add_argument('--no-wheezy',
help='Disable the Debian wheezy sysroot on Linux',
- default=False,
- dest='no_wheezy',
- action='store_true')
+ dest='wheezy',
+ action='store_false')
other_group.add_argument('--workers', '-w',
type=int,
help='Number of simultaneous GN invocations',