Version 2.0.0-dev.23.0
Merge commit 'a0795f185052bc927f5564470dd156a0a2d4bf1c' into dev
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index 210a22d..40612c7 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -109,7 +109,7 @@
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
- 1.18.5
+ 1.18.6
</h1>
<p>
This document contains a specification of the API provided by the
@@ -4275,6 +4275,12 @@
The position that should be selected after the edits have been
applied.
</p>
+ </dd><dt class="field"><b>id: String<span style="color:#999999"> (optional)</span></b></dt><dd>
+
+ <p>
+ The optional identifier of the change kind. The identifier remains
+ stable even if the message changes, or is parameterized.
+ </p>
</dd></dl></dd><dt class="typeDefinition"><a name="type_SourceEdit">SourceEdit: object</a></dt><dd>
<p>
A description of a single change to a single file.
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 0ce8a02..de63821 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -108,7 +108,7 @@
* The version of the analysis server. The value should be replaced
* automatically during the build.
*/
- static final String VERSION = '1.18.5';
+ static final String VERSION = '1.18.6';
/**
* The options of this server instance.
diff --git a/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart b/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart
index 819655d..937fee9 100644
--- a/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart
+++ b/pkg/analysis_server/lib/src/flutter/flutter_outline_computer.dart
@@ -38,6 +38,9 @@
/// Flutter attribute, add it to the [attributes].
void _addAttribute(List<protocol.FlutterOutlineAttribute> attributes,
Expression argument, ParameterElement parameter) {
+ if (parameter == null) {
+ return;
+ }
if (argument is NamedExpression) {
argument = (argument as NamedExpression).expression;
}
@@ -88,8 +91,6 @@
var attributes = <protocol.FlutterOutlineAttribute>[];
var children = <protocol.FlutterOutline>[];
for (var argument in node.argumentList.arguments) {
- ParameterElement parameter = argument.staticParameterElement;
-
bool isWidgetArgument = isWidgetType(argument.staticType);
bool isWidgetListArgument = isListOfWidgetsType(argument.staticType);
@@ -119,6 +120,7 @@
}
}
} else {
+ ParameterElement parameter = argument.staticParameterElement;
_addAttribute(attributes, argument, parameter);
}
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
index c13b677..bce108a 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
@@ -87,7 +87,7 @@
return null;
}
CompletionSuggestion suggestion = new CompletionSuggestion(
- CompletionSuggestionKind.IDENTIFIER,
+ CompletionSuggestionKind.OVERRIDE,
DART_RELEVANCE_HIGH,
completion,
targetId.offset,
diff --git a/pkg/analysis_server/lib/src/services/correction/assist.dart b/pkg/analysis_server/lib/src/services/correction/assist.dart
index e5f09b1..accff73 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist.dart
@@ -75,6 +75,10 @@
const AssistKind('EXCHANGE_OPERANDS', 30, "Exchange operands");
static const EXTRACT_CLASS =
const AssistKind('EXTRACT_CLASS', 30, "Extract class into file '{0}'");
+ static const FLUTTER_CONVERT_TO_STATEFUL_WIDGET = const AssistKind(
+ "FLUTTER_CONVERT_TO_STATEFUL_WIDGET", 30, "Convert to StatefulWidget");
+ static const FLUTTER_REPLACE_WITH_CHILDREN = const AssistKind(
+ "FLUTTER_REPLACE_WITH_CHILDREN", 30, "Replace with children");
static const IMPORT_ADD_SHOW =
const AssistKind('IMPORT_ADD_SHOW', 30, "Add explicit 'show' combinator");
static const INTRODUCE_LOCAL_CAST_TYPE = 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 415b0bc..3ba249c 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
@@ -140,8 +140,11 @@
await _addProposal_convertToIsNotEmpty();
await _addProposal_convertToFieldParameter();
await _addProposal_convertToNormalParameter();
+ await _addProposal_convertToStatefulWidget();
await _addProposal_encapsulateField();
await _addProposal_exchangeOperands();
+ await _addProposal_flutterReplaceWithChild();
+ await _addProposal_flutterReplaceWithChildren();
await _addProposal_importAddShow();
await _addProposal_introduceLocalTestedType();
await _addProposal_invertIf();
@@ -1179,6 +1182,100 @@
}
}
+ Future<Null> _addProposal_convertToStatefulWidget() async {
+ ClassDeclaration widgetClass =
+ node.getAncestor((n) => n is ClassDeclaration);
+ TypeName superclass = widgetClass?.extendsClause?.superclass;
+ if (widgetClass == null || superclass == null) {
+ _coverageMarker();
+ return;
+ }
+
+ // Don't spam, activate only from the `class` keyword to the class body.
+ if (selectionOffset < widgetClass.classKeyword.offset ||
+ selectionOffset > widgetClass.leftBracket.end) {
+ _coverageMarker();
+ return;
+ }
+
+ // Find the build() method.
+ MethodDeclaration buildMethod;
+ for (var member in widgetClass.members) {
+ if (member is MethodDeclaration &&
+ member.name.name == 'build' &&
+ member.parameters != null &&
+ member.parameters.parameters.length == 1) {
+ buildMethod = member;
+ break;
+ }
+ }
+ if (buildMethod == null) {
+ _coverageMarker();
+ return;
+ }
+
+ // Must be a StatelessWidget subclasses.
+ ClassElement widgetClassElement = widgetClass.element;
+ if (!flutter.isExactlyStatelessWidgetType(widgetClassElement.supertype)) {
+ _coverageMarker();
+ return;
+ }
+
+ String widgetName = widgetClassElement.displayName;
+ String stateName = widgetName + 'State';
+
+ var buildLinesRange = utils.getLinesRange(range.node(buildMethod));
+ var buildText = utils.getRangeText(buildLinesRange);
+
+ // Update the build() text to insert `widget.` before references to
+ // the widget class members.
+ final List<SourceEdit> buildTextEdits = [];
+ buildMethod.body.accept(new _SimpleIdentifierRecursiveAstVisitor((node) {
+ if (node.staticElement?.enclosingElement == widgetClassElement) {
+ var offset = node.offset - buildLinesRange.offset;
+ AstNode parent = node.parent;
+ if (parent is InterpolationExpression &&
+ parent.leftBracket.type ==
+ TokenType.STRING_INTERPOLATION_IDENTIFIER) {
+ buildTextEdits.add(new SourceEdit(offset, 0, '{widget.'));
+ buildTextEdits.add(new SourceEdit(offset + node.length, 0, '}'));
+ } else {
+ buildTextEdits.add(new SourceEdit(offset, 0, 'widget.'));
+ }
+ }
+ }));
+ buildText = SourceEdit.applySequence(buildText, buildTextEdits.reversed);
+
+ var statefulWidgetClass =
+ await _getExportedClass(flutter.WIDGETS_LIBRARY_URI, 'StatefulWidget');
+ var stateClass =
+ await _getExportedClass(flutter.WIDGETS_LIBRARY_URI, 'State');
+ var stateType = stateClass.type.instantiate([widgetClassElement.type]);
+
+ DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
+ await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) async {
+ builder.addReplacement(range.node(superclass), (builder) {
+ builder.writeType(statefulWidgetClass.type);
+ });
+ builder.addReplacement(buildLinesRange, (builder) {
+ builder.writeln(' @override');
+ builder.writeln(' $stateName createState() {');
+ builder.writeln(' return new $stateName();');
+ builder.writeln(' }');
+ });
+ builder.addInsertion(widgetClass.end, (builder) {
+ builder.writeln();
+ builder.writeln();
+ builder.writeClassDeclaration(stateName, superclass: stateType,
+ membersWriter: () {
+ builder.write(buildText);
+ });
+ });
+ });
+ _addAssistFromBuilder(
+ changeBuilder, DartAssistKind.FLUTTER_CONVERT_TO_STATEFUL_WIDGET);
+ }
+
Future<Null> _addProposal_encapsulateField() async {
// find FieldDeclaration
FieldDeclaration fieldDeclaration =
@@ -1311,6 +1408,71 @@
_addAssistFromBuilder(changeBuilder, DartAssistKind.EXCHANGE_OPERANDS);
}
+ Future<Null> _addProposal_flutterReplaceWithChild() async {
+ var widgetCreation = flutter.identifyNewExpression(node);
+ if (widgetCreation == null) {
+ return;
+ }
+
+ var childArgument = flutter.findChildArgument(widgetCreation);
+ if (childArgument == null) {
+ return;
+ }
+
+ // child: new ThisWidget(child: ourChild)
+ // children: [foo, new ThisWidget(child: ourChild), bar]
+ DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
+ await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
+ var childExpression = childArgument.expression;
+ var childText = utils.getNodeText(childExpression);
+ var indentOld = utils.getLinePrefix(childExpression.offset);
+ var indentNew = utils.getLinePrefix(widgetCreation.offset);
+ childText = _replaceSourceIndent(childText, indentOld, indentNew);
+ builder.addSimpleReplacement(range.node(widgetCreation), childText);
+ });
+ _addAssistFromBuilder(
+ changeBuilder, DartAssistKind.FLUTTER_REPLACE_WITH_CHILDREN);
+ }
+
+ Future<Null> _addProposal_flutterReplaceWithChildren() async {
+ var widgetCreation = flutter.identifyNewExpression(node);
+ if (widgetCreation == null) {
+ return;
+ }
+
+ // We can inline the list of our children only into another list.
+ var widgetParentNode = widgetCreation.parent;
+ if (widgetParentNode is! ListLiteral) {
+ return;
+ }
+
+ // Prepare the list of our children.
+ List<Expression> childrenExpressions;
+ {
+ var childrenArgument = flutter.findChildrenArgument(widgetCreation);
+ var childrenExpression = childrenArgument?.expression;
+ if (childrenExpression is ListLiteral &&
+ childrenExpression.elements.isNotEmpty) {
+ childrenExpressions = childrenExpression.elements;
+ } else {
+ return;
+ }
+ }
+
+ DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
+ await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
+ var firstChild = childrenExpressions.first;
+ var lastChild = childrenExpressions.last;
+ var childText = utils.getRangeText(range.startEnd(firstChild, lastChild));
+ var indentOld = utils.getLinePrefix(firstChild.offset);
+ var indentNew = utils.getLinePrefix(widgetCreation.offset);
+ childText = _replaceSourceIndent(childText, indentOld, indentNew);
+ builder.addSimpleReplacement(range.node(widgetCreation), childText);
+ });
+ _addAssistFromBuilder(
+ changeBuilder, DartAssistKind.FLUTTER_REPLACE_WITH_CHILDREN);
+ }
+
Future<Null> _addProposal_importAddShow() async {
// prepare ImportDirective
ImportDirective importDirective =
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 fcba496..d983f08 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -602,6 +602,7 @@
}
Future<Null> _addFix_addMissingRequiredArgument() async {
+ InstanceCreationExpression creation;
Element targetElement;
ArgumentList argumentList;
@@ -611,50 +612,59 @@
targetElement = invocation.methodName.bestElement;
argumentList = invocation.argumentList;
} else {
- AstNode ancestor =
+ creation =
invocation.getAncestor((p) => p is InstanceCreationExpression);
- if (ancestor is InstanceCreationExpression) {
- targetElement = ancestor.staticElement;
- argumentList = ancestor.argumentList;
+ if (creation != null) {
+ targetElement = creation.staticElement;
+ argumentList = creation.argumentList;
}
}
}
if (targetElement is ExecutableElement) {
// Format: "Missing required argument 'foo"
- List<String> parts = error.message.split("'");
- if (parts.length < 2) {
+ List<String> messageParts = error.message.split("'");
+ if (messageParts.length < 2) {
+ return;
+ }
+ String missingParameterName = messageParts[1];
+
+ ParameterElement missingParameter = targetElement.parameters.firstWhere(
+ (p) => p.name == missingParameterName,
+ orElse: () => null);
+ if (missingParameter == null) {
return;
}
- // add proposal
- String paramName = parts[1];
- final List<Expression> args = argumentList.arguments;
- int offset =
- args.isEmpty ? argumentList.leftParenthesis.end : args.last.end;
+ int offset;
+ bool hasTrailingComma = false;
+ List<Expression> arguments = argumentList.arguments;
+ if (arguments.isEmpty) {
+ offset = argumentList.leftParenthesis.end;
+ } else {
+ Expression lastArgument = arguments.last;
+ offset = lastArgument.end;
+ hasTrailingComma = lastArgument.endToken.next.type == TokenType.COMMA;
+ }
+
DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
builder.addInsertion(offset, (DartEditBuilder builder) {
- if (args.isNotEmpty) {
+ if (arguments.isNotEmpty) {
builder.write(', ');
}
- List<ParameterElement> parameters =
- (targetElement as ExecutableElement).parameters;
- ParameterElement element = parameters
- .firstWhere((p) => p.name == paramName, orElse: () => null);
- String defaultValue = getDefaultStringParameterValue(element);
- builder.write('$paramName: $defaultValue');
+ String defaultValue =
+ getDefaultStringParameterValue(missingParameter);
+ builder.write('$missingParameterName: $defaultValue');
// Insert a trailing comma after Flutter instance creation params.
- InstanceCreationExpression newExpr =
- flutter.identifyNewExpression(node);
- if (newExpr != null && flutter.isWidgetCreation(newExpr)) {
+ if (!hasTrailingComma && flutter.isWidgetExpression(creation)) {
builder.write(',');
}
});
});
_addFixFromBuilder(
changeBuilder, DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT,
- args: [paramName]);
+ args: [missingParameterName]);
}
}
diff --git a/pkg/analysis_server/lib/src/utilities/flutter.dart b/pkg/analysis_server/lib/src/utilities/flutter.dart
index 7f5f1ba..2a774f9 100644
--- a/pkg/analysis_server/lib/src/utilities/flutter.dart
+++ b/pkg/analysis_server/lib/src/utilities/flutter.dart
@@ -11,6 +11,7 @@
const WIDGETS_LIBRARY_URI = 'package:flutter/widgets.dart';
+const _STATELESS_WIDGET_NAME = "StatelessWidget";
const _WIDGET_NAME = "Widget";
const _WIDGET_URI = "package:flutter/src/widgets/framework.dart";
@@ -100,8 +101,8 @@
}
/**
- * Return the named expression representing the 'child' argument of the given
- * [newExpr], or null if none.
+ * Return the named expression representing the `child` argument of the given
+ * [newExpr], or `null` if none.
*/
NamedExpression findChildArgument(InstanceCreationExpression newExpr) =>
newExpr.argumentList.arguments.firstWhere(
@@ -109,6 +110,15 @@
orElse: () => null);
/**
+ * Return the named expression representing the `children` argument of the
+ * given [newExpr], or `null` if none.
+ */
+NamedExpression findChildrenArgument(InstanceCreationExpression newExpr) =>
+ newExpr.argumentList.arguments.firstWhere(
+ (arg) => arg is NamedExpression && arg.name.label.name == 'children',
+ orElse: () => null);
+
+/**
* Return the Flutter instance creation expression that is the value of the
* 'child' argument of the given [newExpr], or null if none.
*/
@@ -247,6 +257,14 @@
}
/**
+ * Return `true` if the given [type] is the Flutter class `StatelessWidget`.
+ */
+bool isExactlyStatelessWidgetType(DartType type) {
+ return type is InterfaceType &&
+ _isExactWidget(type.element, _STATELESS_WIDGET_NAME, _WIDGET_URI);
+}
+
+/**
* Return `true` if the given [type] is the Flutter class `Widget`, or its
* subtype.
*/
@@ -282,7 +300,7 @@
* class that has the Flutter class `Widget` as a superclass.
*/
bool isWidgetCreation(InstanceCreationExpression expr) {
- ClassElement element = expr.staticElement?.enclosingElement;
+ ClassElement element = expr?.staticElement?.enclosingElement;
return isWidget(element);
}
diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
index f41e3d7..7173f6e 100644
--- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
@@ -1281,6 +1281,7 @@
* "edits": List<SourceFileEdit>
* "linkedEditGroups": List<LinkedEditGroup>
* "selection": optional Position
+ * "id": optional String
* }
*/
final Matcher isSourceChange =
@@ -1289,7 +1290,8 @@
"edits": isListOf(isSourceFileEdit),
"linkedEditGroups": isListOf(isLinkedEditGroup)
}, optionalFields: {
- "selection": isPosition
+ "selection": isPosition,
+ "id": isString
}));
/**
diff --git a/pkg/analysis_server/test/mock_sdk.dart b/pkg/analysis_server/test/mock_sdk.dart
index a071987..438b035 100644
--- a/pkg/analysis_server/test/mock_sdk.dart
+++ b/pkg/analysis_server/test/mock_sdk.dart
@@ -163,6 +163,9 @@
return null;
}
}
+
+class _Override { const _Override(); }
+const Object override = const _Override();
''');
static const MockSdkLibrary LIB_ASYNC =
diff --git a/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
index 25178e7..28cdcf6 100644
--- a/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
@@ -36,6 +36,7 @@
}
''');
await computeSuggestions();
+ // TODO(pquitslund): test displayText
_assertOverride('''@override
A suggested1(int x) {
// TODO: implement suggested1
@@ -75,6 +76,7 @@
// assume information for context.getLibrariesContaining has been cached
await computeLibrariesContaining();
await computeSuggestions();
+ // TODO(pquitslund): test displayText
_assertOverride('''@override
A suggested1(int x) {
// TODO: implement suggested1
@@ -88,15 +90,16 @@
'''@override\n C suggested3([String z]) {\n // TODO: implement suggested3\n return null;\n }''');
}
- CompletionSuggestion _assertOverride(String completion) {
+ CompletionSuggestion _assertOverride(String completion,
+ {String displayText}) {
CompletionSuggestion cs = getSuggest(
completion: completion,
- csKind: CompletionSuggestionKind.IDENTIFIER,
+ csKind: CompletionSuggestionKind.OVERRIDE,
elemKind: null);
if (cs == null) {
failedCompletion('expected $completion', suggestions);
}
- expect(cs.kind, equals(CompletionSuggestionKind.IDENTIFIER));
+ expect(cs.kind, equals(CompletionSuggestionKind.OVERRIDE));
expect(cs.relevance, equals(DART_RELEVANCE_HIGH));
expect(cs.importUri, null);
// expect(cs.selectionOffset, equals(completion.length));
@@ -104,6 +107,7 @@
expect(cs.isDeprecated, isFalse);
expect(cs.isPotential, isFalse);
expect(cs.element, isNotNull);
+ expect(cs.displayText, displayText);
return cs;
}
}
diff --git a/pkg/analysis_server/test/services/correction/assist_test.dart b/pkg/analysis_server/test/services/correction/assist_test.dart
index 17e2c43..1961144 100644
--- a/pkg/analysis_server/test/services/correction/assist_test.dart
+++ b/pkg/analysis_server/test/services/correction/assist_test.dart
@@ -71,7 +71,7 @@
List<Assist> assists = await _computeAssists();
for (Assist assist in assists) {
if (assist.kind == kind) {
- throw fail('Unexpected assist $kind in\n${assists.join('\n')}');
+ fail('Unexpected assist $kind in\n${assists.join('\n')}');
}
}
}
@@ -2267,6 +2267,95 @@
''');
}
+ test_convertToStatefulWidget_BAD_notClass() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/material.dart';
+/*caret*/main() {}
+''');
+ _setCaretLocation();
+ assertNoAssist(DartAssistKind.FLUTTER_CONVERT_TO_STATEFUL_WIDGET);
+ }
+
+ test_convertToStatefulWidget_BAD_notStatelessWidget() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/material.dart';
+class /*caret*/MyWidget extends Text {
+ MyWidget() : super('');
+}
+''');
+ _setCaretLocation();
+ assertNoAssist(DartAssistKind.FLUTTER_CONVERT_TO_STATEFUL_WIDGET);
+ }
+
+ test_convertToStatefulWidget_BAD_notWidget() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/material.dart';
+class /*caret*/MyWidget {}
+''');
+ _setCaretLocation();
+ assertNoAssist(DartAssistKind.FLUTTER_CONVERT_TO_STATEFUL_WIDGET);
+ }
+
+ test_convertToStatefulWidget_OK() async {
+ addFlutterPackage();
+ await resolveTestUnit(r'''
+import 'package:flutter/material.dart';
+
+class /*caret*/MyWidget extends StatelessWidget {
+ final String aaa;
+ final String bbb;
+
+ const MyWidget(this.aaa, this.bbb);
+
+ @override
+ Widget build(BuildContext context) {
+ return new Row(
+ children: [
+ new Text(aaa),
+ new Text(bbb),
+ new Text('$aaa'),
+ new Text('${bbb}'),
+ ],
+ );
+ }
+}
+''');
+ _setCaretLocation();
+ await assertHasAssist(
+ DartAssistKind.FLUTTER_CONVERT_TO_STATEFUL_WIDGET, r'''
+import 'package:flutter/material.dart';
+
+class /*caret*/MyWidget extends StatefulWidget {
+ final String aaa;
+ final String bbb;
+
+ const MyWidget(this.aaa, this.bbb);
+
+ @override
+ MyWidgetState createState() {
+ return new MyWidgetState();
+ }
+}
+
+class MyWidgetState extends State<MyWidget> {
+ @override
+ Widget build(BuildContext context) {
+ return new Row(
+ children: [
+ new Text(widget.aaa),
+ new Text(widget.bbb),
+ new Text('${widget.aaa}'),
+ new Text('${widget.bbb}'),
+ ],
+ );
+ }
+}
+''');
+ }
+
test_encapsulateField_BAD_alreadyPrivate() async {
await resolveTestUnit('''
class A {
@@ -2539,6 +2628,182 @@
''');
}
+ test_flutterReplaceWithChild_OK_childIntoChild_multiLine() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/material.dart';
+main() {
+ new Column(
+ children: <Widget>[
+ new Center(
+ child: new /*caret*/Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: new Center(
+ heightFactor: 0.5,
+ child: new Text('foo'),
+ ),
+ ),
+ ),
+ ],
+ );
+}
+''');
+ _setCaretLocation();
+ await assertHasAssist(DartAssistKind.FLUTTER_REPLACE_WITH_CHILDREN, '''
+import 'package:flutter/material.dart';
+main() {
+ new Column(
+ children: <Widget>[
+ new Center(
+ child: new Center(
+ heightFactor: 0.5,
+ child: new Text('foo'),
+ ),
+ ),
+ ],
+ );
+}
+''');
+ }
+
+ test_flutterReplaceWithChild_OK_childIntoChild_singleLine() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/material.dart';
+main() {
+ new Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: new /*caret*/Center(
+ heightFactor: 0.5,
+ child: new Text('foo'),
+ ),
+ );
+}
+''');
+ _setCaretLocation();
+ await assertHasAssist(DartAssistKind.FLUTTER_REPLACE_WITH_CHILDREN, '''
+import 'package:flutter/material.dart';
+main() {
+ new Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: new Text('foo'),
+ );
+}
+''');
+ }
+
+ test_flutterReplaceWithChild_OK_childIntoChildren() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/material.dart';
+main() {
+ new Column(
+ children: <Widget>[
+ new Text('foo'),
+ new /*caret*/Center(
+ heightFactor: 0.5,
+ child: new Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: new Text('bar'),
+ ),
+ ),
+ new Text('baz'),
+ ],
+ );
+}
+''');
+ _setCaretLocation();
+ await assertHasAssist(DartAssistKind.FLUTTER_REPLACE_WITH_CHILDREN, '''
+import 'package:flutter/material.dart';
+main() {
+ new Column(
+ children: <Widget>[
+ new Text('foo'),
+ new Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: new Text('bar'),
+ ),
+ new Text('baz'),
+ ],
+ );
+}
+''');
+ }
+
+ test_flutterReplaceWithChildren_BAD_parentChild() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/material.dart';
+main() {
+ new Center(
+ child: new /*caret*/Row(
+ children: [
+ new Text('aaa'),
+ new Text('bbb'),
+ ],
+ ),
+ );
+}
+''');
+ _setCaretLocation();
+ await assertNoAssist(DartAssistKind.FLUTTER_REPLACE_WITH_CHILDREN);
+ }
+
+ test_flutterReplaceWithChildren_OK_intoChildren() async {
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/material.dart';
+main() {
+ new Column(
+ children: <Widget>[
+ new Text('aaa'),
+ new /*caret*/Column(
+ children: [
+ new Row(
+ children: [
+ new Text('bbb'),
+ new Text('ccc'),
+ ],
+ ),
+ new Row(
+ children: [
+ new Text('ddd'),
+ new Text('eee'),
+ ],
+ ),
+ ],
+ ),
+ new Text('fff'),
+ ],
+ );
+}
+''');
+ _setCaretLocation();
+ await assertHasAssist(DartAssistKind.FLUTTER_REPLACE_WITH_CHILDREN, '''
+import 'package:flutter/material.dart';
+main() {
+ new Column(
+ children: <Widget>[
+ new Text('aaa'),
+ new Row(
+ children: [
+ new Text('bbb'),
+ new Text('ccc'),
+ ],
+ ),
+ new Row(
+ children: [
+ new Text('ddd'),
+ new Text('eee'),
+ ],
+ ),
+ new Text('fff'),
+ ],
+ );
+}
+''');
+ }
+
test_importAddShow_BAD_hasShow() async {
await resolveTestUnit('''
import 'dart:math' show PI;
@@ -4676,7 +4941,7 @@
return assist;
}
}
- throw fail('Expected to find assist $kind in\n${assists.join('\n')}');
+ fail('Expected to find assist $kind in\n${assists.join('\n')}');
}
void _assertLinkedGroup(LinkedEditGroup group, List<String> expectedStrings,
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index 1e84fb1..1fcab846 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -100,7 +100,7 @@
List<Fix> fixes = await _computeFixes(error);
for (Fix fix in fixes) {
if (fix.kind == kind) {
- throw fail('Unexpected fix $kind in\n${fixes.join('\n')}');
+ fail('Unexpected fix $kind in\n${fixes.join('\n')}');
}
}
}
@@ -140,7 +140,7 @@
return fix;
}
}
- throw fail('Expected to find fix $kind in\n${fixes.join('\n')}');
+ fail('Expected to find fix $kind in\n${fixes.join('\n')}');
}
void _assertLinkedGroup(LinkedEditGroup group, List<String> expectedStrings,
@@ -614,9 +614,7 @@
}
''');
- await assertHasFix(
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT,
- '''
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, '''
import 'package:flutter/widgets.dart';
import 'package:meta/meta.dart';
@@ -627,8 +625,38 @@
build() {
return new MyWidget(children: <Widget>[],);
}
-''',
- target: '/test.dart');
+''');
+ }
+
+ test_addMissingRequiredArg_cons_flutter_hasTrailingComma() async {
+ addFlutterPackage();
+ _addMetaPackageSource();
+
+ await resolveTestUnit('''
+import 'package:flutter/widgets.dart';
+import 'package:meta/meta.dart';
+
+class MyWidget extends Widget {
+ MyWidget({@required int a, @required int b});
+}
+
+build() {
+ return new MyWidget(a: 1,);
+}
+''');
+
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, '''
+import 'package:flutter/widgets.dart';
+import 'package:meta/meta.dart';
+
+class MyWidget extends Widget {
+ MyWidget({@required int a, @required int b});
+}
+
+build() {
+ return new MyWidget(a: 1, b: null,);
+}
+''');
}
test_addMissingRequiredArg_cons_single() async {
@@ -649,16 +677,13 @@
A a = new A();
}
''');
- await assertHasFix(
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT,
- '''
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, '''
import 'libA.dart';
main() {
A a = new A(a: null);
}
-''',
- target: '/test.dart');
+''');
}
test_addMissingRequiredArg_cons_single_closure() async {
@@ -682,16 +707,13 @@
A a = new A();
}
''');
- await assertHasFix(
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT,
- '''
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, '''
import 'libA.dart';
main() {
A a = new A(onPressed: () {});
}
-''',
- target: '/test.dart');
+''');
}
test_addMissingRequiredArg_cons_single_closure_2() async {
@@ -715,16 +737,13 @@
A a = new A();
}
''');
- await assertHasFix(
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT,
- '''
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, '''
import 'libA.dart';
main() {
A a = new A(callback: (e) {});
}
-''',
- target: '/test.dart');
+''');
}
test_addMissingRequiredArg_cons_single_closure_3() async {
@@ -748,16 +767,13 @@
A a = new A();
}
''');
- await assertHasFix(
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT,
- '''
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, '''
import 'libA.dart';
main() {
A a = new A(callback: (a, b, c) {});
}
-''',
- target: '/test.dart');
+''');
}
test_addMissingRequiredArg_cons_single_closure_4() async {
@@ -781,16 +797,13 @@
A a = new A();
}
''');
- await assertHasFix(
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT,
- '''
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, '''
import 'libA.dart';
main() {
A a = new A(callback: (int a, String b, c) {});
}
-''',
- target: '/test.dart');
+''');
}
test_addMissingRequiredArg_cons_single_list() async {
@@ -812,16 +825,13 @@
A a = new A();
}
''');
- await assertHasFix(
- DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT,
- '''
+ await assertHasFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, '''
import 'libA.dart';
main() {
A a = new A(names: <String>[]);
}
-''',
- target: '/test.dart');
+''');
}
test_addMissingRequiredArg_multiple() async {
diff --git a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
index 45a6435..6ecf220 100644
--- a/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
+++ b/pkg/analysis_server/test/src/flutter/flutter_outline_computer_test.dart
@@ -159,6 +159,24 @@
expect(attribute.literalValueString, 'my text');
}
+ test_attributes_unresolved() async {
+ FlutterOutline unitOutline = await _computeOutline('''
+import 'package:flutter/widgets.dart';
+
+class MyWidget extends StatelessWidget {
+ @override
+ Widget build(BuildContext context) {
+ return const Row(1, foo: 2)
+ }
+}
+''');
+ var myWidget = unitOutline.children[0];
+ var build = myWidget.children[0];
+
+ var rowOutline = build.children[0];
+ expect(rowOutline.attributes, isEmpty);
+ }
+
test_children() async {
FlutterOutline unitOutline = await _computeOutline('''
import 'package:flutter/widgets.dart';
diff --git a/pkg/analysis_server/test/src/utilities/flutter_test.dart b/pkg/analysis_server/test/src/utilities/flutter_test.dart
index d0daca6..fb85da9 100644
--- a/pkg/analysis_server/test/src/utilities/flutter_test.dart
+++ b/pkg/analysis_server/test/src/utilities/flutter_test.dart
@@ -258,6 +258,8 @@
var a = new Object();
var b = new Text('bbb');
''');
+ expect(isWidgetCreation(null), isFalse);
+
InstanceCreationExpression a = _getTopVariableCreation('a');
expect(isWidgetCreation(a), isFalse);
diff --git a/pkg/analysis_server/test/src/utilities/flutter_util.dart b/pkg/analysis_server/test/src/utilities/flutter_util.dart
index 250cb37..b7bdb1b 100644
--- a/pkg/analysis_server/test/src/utilities/flutter_util.dart
+++ b/pkg/analysis_server/test/src/utilities/flutter_util.dart
@@ -138,7 +138,7 @@
export 'package:flutter/rendering.dart';
class Center extends StatelessWidget {
- const Center({Widget child, Key key});
+ const Center({Key key, double heightFactor, Widget child});
}
class Column extends Flex {
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/SourceChange.java b/pkg/analysis_server/tool/spec/generated/java/types/SourceChange.java
index 2d5f494..ff2d906 100644
--- a/pkg/analysis_server/tool/spec/generated/java/types/SourceChange.java
+++ b/pkg/analysis_server/tool/spec/generated/java/types/SourceChange.java
@@ -56,13 +56,20 @@
private final Position selection;
/**
+ * The optional identifier of the change kind. The identifier remains stable even if the message
+ * changes, or is parameterized.
+ */
+ private final String id;
+
+ /**
* Constructor for {@link SourceChange}.
*/
- public SourceChange(String message, List<SourceFileEdit> edits, List<LinkedEditGroup> linkedEditGroups, Position selection) {
+ public SourceChange(String message, List<SourceFileEdit> edits, List<LinkedEditGroup> linkedEditGroups, Position selection, String id) {
this.message = message;
this.edits = edits;
this.linkedEditGroups = linkedEditGroups;
this.selection = selection;
+ this.id = id;
}
@Override
@@ -73,7 +80,8 @@
ObjectUtilities.equals(other.message, message) &&
ObjectUtilities.equals(other.edits, edits) &&
ObjectUtilities.equals(other.linkedEditGroups, linkedEditGroups) &&
- ObjectUtilities.equals(other.selection, selection);
+ ObjectUtilities.equals(other.selection, selection) &&
+ ObjectUtilities.equals(other.id, id);
}
return false;
}
@@ -83,7 +91,8 @@
List<SourceFileEdit> edits = SourceFileEdit.fromJsonArray(jsonObject.get("edits").getAsJsonArray());
List<LinkedEditGroup> linkedEditGroups = LinkedEditGroup.fromJsonArray(jsonObject.get("linkedEditGroups").getAsJsonArray());
Position selection = jsonObject.get("selection") == null ? null : Position.fromJson(jsonObject.get("selection").getAsJsonObject());
- return new SourceChange(message, edits, linkedEditGroups, selection);
+ String id = jsonObject.get("id") == null ? null : jsonObject.get("id").getAsString();
+ return new SourceChange(message, edits, linkedEditGroups, selection, id);
}
public static List<SourceChange> fromJsonArray(JsonArray jsonArray) {
@@ -106,6 +115,14 @@
}
/**
+ * The optional identifier of the change kind. The identifier remains stable even if the message
+ * changes, or is parameterized.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
* A list of the linked editing groups used to customize the changes that were made.
*/
public List<LinkedEditGroup> getLinkedEditGroups() {
@@ -133,6 +150,7 @@
builder.append(edits);
builder.append(linkedEditGroups);
builder.append(selection);
+ builder.append(id);
return builder.toHashCode();
}
@@ -152,6 +170,9 @@
if (selection != null) {
jsonObject.add("selection", selection.toJson());
}
+ if (id != null) {
+ jsonObject.addProperty("id", id);
+ }
return jsonObject;
}
@@ -166,7 +187,9 @@
builder.append("linkedEditGroups=");
builder.append(StringUtils.join(linkedEditGroups, ", ") + ", ");
builder.append("selection=");
- builder.append(selection);
+ builder.append(selection + ", ");
+ builder.append("id=");
+ builder.append(id);
builder.append("]");
return builder.toString();
}
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index 3459953..09fcb67 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -7,7 +7,7 @@
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
- <version>1.18.5</version>
+ <version>1.18.6</version>
</h1>
<p>
This document contains a specification of the API provided by the
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index 1cf5070..b66e383 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 0.31.1
+
+* Update to reflect that `_InternalLinkedHashMap` is not a subtype of `HashMap`
+ in sdk 2.0.0-dev.22.0.
+
## 0.31.0+1
* Update SDK constraint to require Dart v2-dev release.
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index f0ee200..6a89cad 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -303,7 +303,6 @@
HintCode.UNUSED_LABEL,
HintCode.UNUSED_LOCAL_VARIABLE,
HintCode.UNUSED_SHOWN_NAME,
- HintCode.USE_OF_VOID_RESULT,
HintCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
HtmlErrorCode.PARSE_ERROR,
HtmlWarningCode.INVALID_URI,
@@ -627,6 +626,7 @@
StaticWarningCode.UNDEFINED_STATIC_METHOD_OR_GETTER,
StaticWarningCode.UNDEFINED_SUPER_GETTER,
StaticWarningCode.UNDEFINED_SUPER_SETTER,
+ StaticWarningCode.USE_OF_VOID_RESULT,
StrongModeCode.ASSIGNMENT_CAST,
StrongModeCode.COULD_NOT_INFER,
StrongModeCode.DOWN_CAST_COMPOSITE,
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
index 51f7726..824b3cb 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
@@ -663,17 +663,6 @@
"Try removing the name from the list of shown members.");
/**
- * Hint for cases where the source expects a method or function to return a
- * non-void result, but the method or function signature returns void.
- *
- * Parameters:
- * 0: the name of the method or function that returns void
- */
- static const HintCode USE_OF_VOID_RESULT = const HintCode(
- 'USE_OF_VOID_RESULT',
- "The result of '{0}' is being used, even though it is declared to be 'void'.");
-
- /**
* It will be a static type warning if <i>m</i> is not a generic method with
* exactly <i>n</i> type parameters.
*
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 81f5a4c..dcfe176 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -4761,6 +4761,20 @@
"defining the setter in a superclass of '{1}'.");
/**
+ * It is a static warning to assign void to any non-void type in dart.
+ * compile-time error). Report that error specially for a better user
+ * experience.
+ *
+ * Parameters: none
+ */
+ static const StaticWarningCode USE_OF_VOID_RESULT = const StaticWarningCode(
+ 'USE_OF_VOID_RESULT',
+ "The expression here has a type of 'void', and therefore cannot be used.",
+ 'Check if you are using the correct API; there may be a function or'
+ " call that returns void you didn't expect. Also check type parameters"
+ ' and variables which, in rare cases, may be void as well.');
+
+ /**
* A flag indicating whether this warning is an error when running with strong
* mode enabled.
*/
diff --git a/pkg/analyzer/lib/src/fasta/error_converter.dart b/pkg/analyzer/lib/src/fasta/error_converter.dart
index 9b0220a..383b8a3 100644
--- a/pkg/analyzer/lib/src/fasta/error_converter.dart
+++ b/pkg/analyzer/lib/src/fasta/error_converter.dart
@@ -331,6 +331,10 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.LIBRARY_DIRECTIVE_NOT_FIRST, offset, length);
return;
+ case "MISSING_ASSIGNMENT_IN_INITIALIZER":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, offset, length);
+ return;
case "MISSING_CATCH_OR_FINALLY":
errorReporter?.reportErrorForOffset(
ParserErrorCode.MISSING_CATCH_OR_FINALLY, offset, length);
@@ -363,6 +367,10 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.MISSING_IDENTIFIER, offset, length);
return;
+ case "MISSING_INITIALIZER":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.MISSING_INITIALIZER, offset, length);
+ return;
case "MISSING_KEYWORD_OPERATOR":
errorReporter?.reportErrorForOffset(
ParserErrorCode.MISSING_KEYWORD_OPERATOR, offset, length);
@@ -427,6 +435,10 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.PREFIX_AFTER_COMBINATOR, offset, length);
return;
+ case "REDIRECTING_CONSTRUCTOR_WITH_BODY":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, offset, length);
+ return;
case "REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR":
errorReporter?.reportErrorForOffset(
ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR,
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 9e112c9..5cd21d4 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -166,15 +166,26 @@
Object visitAssignmentExpression(AssignmentExpression node) {
Token operator = node.operator;
TokenType operatorType = operator.type;
+ Expression leftHandSide = node.leftHandSide;
+ DartType staticType = _getStaticType(leftHandSide, read: true);
+
+ // For any compound assignments to a void variable, report bad void usage.
+ // Example: `y += voidFn()`, not allowed.
+ if (operatorType != TokenType.EQ &&
+ staticType != null &&
+ staticType.isVoid) {
+ _recordUndefinedToken(
+ null, StaticWarningCode.USE_OF_VOID_RESULT, operator, []);
+ return null;
+ }
+
if (operatorType != TokenType.AMPERSAND_AMPERSAND_EQ &&
operatorType != TokenType.BAR_BAR_EQ &&
operatorType != TokenType.EQ &&
operatorType != TokenType.QUESTION_QUESTION_EQ) {
operatorType = _operatorFromCompoundAssignment(operatorType);
- Expression leftHandSide = node.leftHandSide;
if (leftHandSide != null) {
String methodName = operatorType.lexeme;
- DartType staticType = _getStaticType(leftHandSide, read: true);
MethodElement staticMethod =
_lookUpMethod(leftHandSide, staticType, methodName);
node.staticElement = staticMethod;
@@ -888,6 +899,9 @@
StaticTypeWarningCode.UNDEFINED_SUPER_METHOD,
methodName,
[methodName.name, targetTypeName]);
+ } else if (identical(errorCode, StaticWarningCode.USE_OF_VOID_RESULT)) {
+ _resolver.errorReporter.reportErrorForNode(
+ StaticWarningCode.USE_OF_VOID_RESULT, target ?? methodName, []);
}
return null;
}
@@ -1304,9 +1318,7 @@
FunctionType getterType = element.type;
if (getterType != null) {
DartType returnType = getterType.returnType;
- if (!_isExecutableType(returnType)) {
- return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
- }
+ return _getErrorCodeForExecuting(returnType);
}
} else if (element is ExecutableElement) {
return null;
@@ -1328,15 +1340,11 @@
FunctionType getterType = getter.type;
if (getterType != null) {
DartType returnType = getterType.returnType;
- if (!_isExecutableType(returnType)) {
- return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
- }
+ return _getErrorCodeForExecuting(returnType);
}
} else if (element is VariableElement) {
DartType variableType = element.type;
- if (!_isExecutableType(variableType)) {
- return StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION;
- }
+ return _getErrorCodeForExecuting(variableType);
} else {
if (target == null) {
ClassElement enclosingClass = _resolver.enclosingClass;
@@ -1365,6 +1373,8 @@
return null;
}
return StaticTypeWarningCode.UNDEFINED_FUNCTION;
+ } else if (targetType.isVoid) {
+ return StaticWarningCode.USE_OF_VOID_RESULT;
} else if (!targetType.isDynamic && target is! NullLiteral) {
// Proxy-conditional warning, based on state of
// targetType.getElement()
@@ -1403,25 +1413,29 @@
Token leftBracket = expression.leftBracket;
Token rightBracket = expression.rightBracket;
ErrorCode errorCode;
+ DartType type =
+ shouldReportMissingMember_static ? staticType : propagatedType;
+ var errorArguments = [methodName, type.displayName];
if (shouldReportMissingMember_static) {
if (target is SuperExpression) {
errorCode = StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR;
+ } else if (staticType != null && staticType.isVoid) {
+ errorCode = StaticWarningCode.USE_OF_VOID_RESULT;
+ errorArguments = [];
} else {
errorCode = StaticTypeWarningCode.UNDEFINED_OPERATOR;
}
} else {
errorCode = HintCode.UNDEFINED_OPERATOR;
}
- DartType type =
- shouldReportMissingMember_static ? staticType : propagatedType;
if (leftBracket == null || rightBracket == null) {
- _recordUndefinedNode(type.element, errorCode, expression,
- [methodName, type.displayName]);
+ _recordUndefinedNode(
+ type.element, errorCode, expression, errorArguments);
} else {
int offset = leftBracket.offset;
int length = rightBracket.offset - offset + 1;
- _recordUndefinedOffset(type.element, errorCode, offset, length,
- [methodName, type.displayName]);
+ _recordUndefinedOffset(
+ type.element, errorCode, offset, length, errorArguments);
}
return true;
}
@@ -1873,6 +1887,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;
+ }
+
+ /**
* Return `true` if the given [type] represents an object that could be
* invoked using the call operator '()'.
*/
@@ -2636,6 +2665,7 @@
staticType.isVoid ? null : staticOrPropagatedEnclosingElt;
if (propertyName.inSetterContext()) {
ErrorCode errorCode;
+ var arguments = [propertyName.name, displayType.displayName];
if (shouldReportMissingMember_static) {
if (target is SuperExpression) {
if (isStaticProperty && !staticType.isVoid) {
@@ -2644,7 +2674,10 @@
errorCode = StaticTypeWarningCode.UNDEFINED_SUPER_SETTER;
}
} else {
- if (isStaticProperty && !staticType.isVoid) {
+ if (staticType.isVoid) {
+ errorCode = StaticWarningCode.USE_OF_VOID_RESULT;
+ arguments = [];
+ } else if (isStaticProperty) {
errorCode = StaticWarningCode.UNDEFINED_SETTER;
} else {
errorCode = StaticTypeWarningCode.UNDEFINED_SETTER;
@@ -2653,10 +2686,11 @@
} else {
errorCode = HintCode.UNDEFINED_SETTER;
}
- _recordUndefinedNode(declaringElement, errorCode, propertyName,
- [propertyName.name, displayType.displayName]);
+ _recordUndefinedNode(
+ declaringElement, errorCode, propertyName, arguments);
} else if (propertyName.inGetterContext()) {
ErrorCode errorCode;
+ var arguments = [propertyName.name, displayType.displayName];
if (shouldReportMissingMember_static) {
if (target is SuperExpression) {
if (isStaticProperty && !staticType.isVoid) {
@@ -2665,7 +2699,10 @@
errorCode = StaticTypeWarningCode.UNDEFINED_SUPER_GETTER;
}
} else {
- if (isStaticProperty && !staticType.isVoid) {
+ if (staticType.isVoid) {
+ errorCode = StaticWarningCode.USE_OF_VOID_RESULT;
+ arguments = [];
+ } else if (isStaticProperty) {
errorCode = StaticWarningCode.UNDEFINED_GETTER;
} else {
errorCode = StaticTypeWarningCode.UNDEFINED_GETTER;
@@ -2674,8 +2711,8 @@
} else {
errorCode = HintCode.UNDEFINED_GETTER;
}
- _recordUndefinedNode(declaringElement, errorCode, propertyName,
- [propertyName.name, displayType.displayName]);
+ _recordUndefinedNode(
+ declaringElement, errorCode, propertyName, arguments);
} else {
_recordUndefinedNode(
declaringElement,
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index f88a050..2fc90b7 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -390,6 +390,7 @@
} else {
_checkForArgumentTypeNotAssignableForArgument(node.rightOperand);
}
+ _checkForUseOfVoidResult(node.leftOperand);
return super.visitBinaryExpression(node);
}
@@ -547,6 +548,9 @@
@override
Object visitConditionalExpression(ConditionalExpression node) {
_checkForNonBoolCondition(node.condition);
+ // TODO(mfairhurst) Enable this and get code compliant.
+ //_checkForUseOfVoidResult(node.thenExpression);
+ //_checkForUseOfVoidResult(node.elseExpression);
return super.visitConditionalExpression(node);
}
@@ -789,7 +793,8 @@
Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
Expression functionExpression = node.function;
DartType expressionType = functionExpression.staticType;
- if (!_isFunctionType(expressionType)) {
+ if (!_checkForUseOfVoidResult(functionExpression) &&
+ !_isFunctionType(expressionType)) {
_errorReporter.reportErrorForNode(
StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
functionExpression);
@@ -924,6 +929,7 @@
@override
Object visitIsExpression(IsExpression node) {
_checkForTypeAnnotationDeferredClass(node.type);
+ _checkForUseOfVoidResult(node.expression);
return super.visitIsExpression(node);
}
@@ -942,6 +948,7 @@
}
_checkForImplicitDynamicTypedLiteral(node);
_checkForListElementTypeNotAssignable(node);
+
return super.visitListLiteral(node);
}
@@ -1175,6 +1182,7 @@
@override
Object visitThrowExpression(ThrowExpression node) {
_checkForConstEvalThrowsException(node);
+ _checkForUseOfVoidResult(node.expression);
return super.visitThrowExpression(node);
}
@@ -2422,7 +2430,8 @@
* [CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE],
* [CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE],
* [StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE], and
- * [StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE].
+ * [StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE], and
+ * [StaticWarningCode.USE_OF_VOID_RESULT].
*/
void _checkForArgumentTypeNotAssignable(
Expression expression,
@@ -2431,6 +2440,10 @@
ErrorCode errorCode) {
// Warning case: test static type information
if (actualStaticType != null && expectedStaticType != null) {
+ if (!expectedStaticType.isVoid && _checkForUseOfVoidResult(expression)) {
+ return;
+ }
+
_checkForAssignableExpressionAtType(
expression, actualStaticType, expectedStaticType, errorCode);
}
@@ -2449,6 +2462,7 @@
if (argument == null) {
return;
}
+
ParameterElement staticParameterElement = argument.staticParameterElement;
DartType staticParameterType = staticParameterElement?.type;
_checkForArgumentTypeNotAssignableWithExpectedTypes(argument,
@@ -4267,6 +4281,10 @@
return;
}
+ if (_checkForUseOfVoidResult(node.iterable)) {
+ return;
+ }
+
DartType iterableType = getStaticType(node.iterable);
if (iterableType.isDynamic) {
return;
@@ -4276,6 +4294,9 @@
SimpleIdentifier variable = node.identifier ?? node.loopVariable.identifier;
DartType variableType = getStaticType(variable);
+ // TODO(mfairhurst) Check and guard against `for(void x in _)`?
+ //_checkForUseOfVoidResult(variable);
+
DartType loopType = node.awaitKeyword != null
? _typeProvider.streamType
: _typeProvider.iterableType;
@@ -4392,6 +4413,11 @@
DartType leftType = (leftVariableElement == null)
? getStaticType(lhs)
: leftVariableElement.type;
+
+ if (_checkForUseOfVoidResult(rhs)) {
+ return;
+ }
+
_checkForAssignableExpression(
rhs, leftType, StaticTypeWarningCode.INVALID_ASSIGNMENT,
isDeclarationCast: isDeclarationCast);
@@ -5156,7 +5182,8 @@
*/
void _checkForNonBoolCondition(Expression condition) {
DartType conditionType = getStaticType(condition);
- if (conditionType != null &&
+ if (!_checkForUseOfVoidResult(condition) &&
+ conditionType != null &&
!_typeSystem.isAssignableTo(conditionType, _boolType)) {
_errorReporter.reportErrorForNode(
StaticTypeWarningCode.NON_BOOL_CONDITION, condition);
@@ -5674,8 +5701,12 @@
* See [StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE].
*/
void _checkForSwitchExpressionNotAssignable(SwitchStatement statement) {
- // prepare 'switch' expression type
Expression expression = statement.expression;
+ if (_checkForUseOfVoidResult(expression)) {
+ return;
+ }
+
+ // prepare 'switch' expression type
DartType expressionType = getStaticType(expression);
if (expressionType == null) {
return;
@@ -6263,6 +6294,31 @@
}
}
+ /**
+ * Check for situations where the result of a method or function is used, when
+ * it returns 'void'. Or, in rare cases, when other types of expressions are
+ * void, such as identifiers.
+ *
+ * See [StaticWarningCode.USE_OF_VOID_RESULT].
+ */
+ bool _checkForUseOfVoidResult(Expression expression) {
+ if (expression == null ||
+ !identical(expression.staticType, VoidTypeImpl.instance)) {
+ return false;
+ }
+
+ if (expression is MethodInvocation) {
+ SimpleIdentifier methodName = expression.methodName;
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.USE_OF_VOID_RESULT, methodName, []);
+ } else {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.USE_OF_VOID_RESULT, expression, []);
+ }
+
+ return true;
+ }
+
DartType _computeReturnTypeForMethod(Expression returnExpression) {
// This method should never be called for generators, since generators are
// never allowed to contain return statements with expressions.
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index b07f7ab7..08c35e1 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -166,7 +166,6 @@
Object visitAssignmentExpression(AssignmentExpression node) {
TokenType operatorType = node.operator.type;
if (operatorType == TokenType.EQ) {
- _checkForUseOfVoidResult(node.rightHandSide);
_checkForInvalidAssignment(node.leftHandSide, node.rightHandSide);
} else {
_checkForDeprecatedMemberUse(node.bestElement, node);
@@ -370,7 +369,6 @@
@override
Object visitVariableDeclaration(VariableDeclaration node) {
- _checkForUseOfVoidResult(node.initializer);
_checkForInvalidAssignment(node.name, node.initializer);
return super.visitVariableDeclaration(node);
}
@@ -1242,25 +1240,6 @@
return false;
}
- /**
- * Check for situations where the result of a method or function is used, when
- * it returns 'void'.
- *
- * See [HintCode.USE_OF_VOID_RESULT].
- */
- void _checkForUseOfVoidResult(Expression expression) {
- // TODO(jwren) Many other situations of use could be covered. We currently
- // cover the cases var x = m() and x = m(), but we could also cover cases
- // such as m().x, m()[k], a + m(), f(m()), return m().
- if (expression is MethodInvocation) {
- if (identical(expression.staticType, VoidTypeImpl.instance)) {
- SimpleIdentifier methodName = expression.methodName;
- _errorReporter.reportErrorForNode(
- HintCode.USE_OF_VOID_RESULT, methodName, [methodName.name]);
- }
- }
- }
-
void _checkRequiredParameter(FormalParameterList node) {
final requiredParameters =
node.parameters.where((p) => p.element?.isRequired == true);
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index d5bfc2e..4b1f7a8 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -1129,7 +1129,9 @@
/// Returns true if we need an implicit cast of [expr] from [from] type to
/// [to] type, returns false if no cast is needed, and returns null if the
- /// types are statically incompatible.
+ /// types are statically incompatible, or the types are compatible but don't
+ /// allow implicit cast (ie, void, which is one form of Top which oill not
+ /// downcast implicitly).
///
/// If [from] is omitted, uses the static type of [expr]
bool _needsImplicitCast(Expression expr, DartType to,
@@ -1138,8 +1140,8 @@
if (!_checkNonNullAssignment(expr, to, from)) return false;
- // We can use anything as void.
- if (to.isVoid) return false;
+ // Void is considered Top, but may only be *explicitly* cast.
+ if (from.isVoid) return null;
// fromT <: toT, no coercion needed.
if (rules.isSubtypeOf(from, to)) return false;
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 7c25bb8..d858c1a 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 0.31.0+1
+version: 0.31.1
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.8
+ front_end: 0.1.0-alpha.9
glob: ^1.0.3
html: '>=0.12.0 <1.14.0'
isolate: '>=0.2.2 <2.0.0'
- kernel: 0.3.0-alpha.5
+ kernel: 0.3.0-alpha.9
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/compile_time_error_code_kernel_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
index d80d8d5..f25776f 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
@@ -1728,6 +1728,12 @@
@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/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
index 5e8fcea..d5c7d92 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -5293,85 +5293,4 @@
assertNoErrors(source2);
verify([source, source2]);
}
-
- test_useOfVoidResult_assignmentExpression_function() async {
- Source source = addSource(r'''
-void f() {}
-class A {
- n() {
- var a;
- a = f();
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
- verify([source]);
- }
-
- test_useOfVoidResult_assignmentExpression_method() async {
- Source source = addSource(r'''
-class A {
- void m() {}
- n() {
- var a;
- a = m();
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
- verify([source]);
- }
-
- test_useOfVoidResult_inForLoop() async {
- Source source = addSource(r'''
-class A {
- void m() {}
- n() {
- for(var a = m();;) {}
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
- verify([source]);
- }
-
- test_useOfVoidResult_variableDeclaration_function() async {
- Source source = addSource(r'''
-void f() {}
-class A {
- n() {
- var a = f();
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
- verify([source]);
- }
-
- test_useOfVoidResult_variableDeclaration_method() async {
- Source source = addSource(r'''
-class A {
- void m() {}
- n() {
- var a = m();
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
- verify([source]);
- }
-
- test_useOfVoidResult_variableDeclaration_method2() async {
- Source source = addSource(r'''
-class A {
- void m() {}
- n() {
- var a = m(), b = m();
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(
- source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
- verify([source]);
- }
}
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 7042388..c5ecd70 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -657,41 +657,6 @@
@override
@failingTest
- void test_invalidTopLevelVar() {
- // TODO(danrubel) Does not recover.
- // 'package:analyzer/src/fasta/ast_builder.dart': Failed assertion:
- // line 238 pos 12: 'token.isKeywordOrIdentifier': is not true.
- // dart:core-patch/errors_patch.dart 35 _AssertionError._doThrowNew
- // dart:core-patch/errors_patch.dart 31 _AssertionError._throwNew
- // package:analyzer/src/fasta/ast_builder.dart 238:12 AstBuilder.handleIdentifier
- // package:front_end/src/fasta/parser/parser.dart 1639:14 Parser.ensureIdentifier
- // package:front_end/src/fasta/parser/parser.dart 2594:13 Parser.parseFields
- // package:front_end/src/fasta/parser/parser.dart 2565:11 Parser.parseTopLevelMember
- // package:front_end/src/fasta/parser/parser.dart 377:14 Parser.parseTopLevelDeclarationImpl
- // package:front_end/src/fasta/parser/parser.dart 300:15 Parser.parseUnit
- // package:analyzer/src/generated/parser_fasta.dart 85:33 _Parser2.parseCompilationUnit2
- super.test_invalidTopLevelVar();
- }
-
- @failingTest
- void test_invalidTypedef() {
- // TODO(danrubel) Does not recover.
- // 'package:analyzer/src/fasta/ast_builder.dart': Failed assertion:
- // line 238 pos 12: 'token.isKeywordOrIdentifier': is not true.
- // dart:core-patch/errors_patch.dart 35 _AssertionError._doThrowNew
- // dart:core-patch/errors_patch.dart 31 _AssertionError._throwNew
- // package:analyzer/src/fasta/ast_builder.dart 238:12 AstBuilder.handleIdentifier
- // package:front_end/src/fasta/parser/parser.dart 1639:14 Parser.ensureIdentifier
- // package:front_end/src/fasta/parser/parser.dart 2594:13 Parser.parseFields
- // package:front_end/src/fasta/parser/parser.dart 2565:11 Parser.parseTopLevelMember
- // package:front_end/src/fasta/parser/parser.dart 377:14 Parser.parseTopLevelDeclarationImpl
- // package:front_end/src/fasta/parser/parser.dart 300:15 Parser.parseUnit
- // package:analyzer/src/generated/parser_fasta.dart 85:33 _Parser2.parseCompilationUnit2
- super.test_invalidTypedef();
- }
-
- @override
- @failingTest
void test_invalidUnicodeEscape_incomplete_noDigits() {
// TODO(brianwilkerson) Does not recover.
// Internal problem: Compiler cannot run without a compiler context.
@@ -1266,22 +1231,6 @@
@override
@failingTest
- void test_redirectingConstructorWithBody_named() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, found 0
- super.test_redirectingConstructorWithBody_named();
- }
-
- @override
- @failingTest
- void test_redirectingConstructorWithBody_unnamed() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, found 0
- super.test_redirectingConstructorWithBody_unnamed();
- }
-
- @override
- @failingTest
void test_setterInFunction_block() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.SETTER_IN_FUNCTION, found 0
@@ -2305,31 +2254,6 @@
@override
@failingTest
- void test_incomplete_constructorInitializers_missingEquals() {
- // TODO(brianwilkerson) exception:
- // NoSuchMethodError: The getter 'thisKeyword' was called on null.
- // Receiver: null
- // Tried calling: thisKeyword
- // dart:core Object.noSuchMethod
- // package:analyzer/src/fasta/ast_builder.dart 440:42 AstBuilder.endInitializers
- // test/generated/parser_fasta_listener.dart 872:14 ForwardingTestListener.endInitializers
- // package:front_end/src/fasta/parser/parser.dart 1942:14 Parser.parseInitializers
- // package:front_end/src/fasta/parser/parser.dart 1923:14 Parser.parseInitializersOpt
- // package:front_end/src/fasta/parser/parser.dart 2412:13 Parser.parseMethod
- // package:front_end/src/fasta/parser/parser.dart 2316:11 Parser.parseMember
- super.test_incomplete_constructorInitializers_missingEquals();
- }
-
- @override
- @failingTest
- void test_incomplete_constructorInitializers_variable() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, found 0
- super.test_incomplete_constructorInitializers_variable();
- }
-
- @override
- @failingTest
void test_incomplete_returnType() {
// TODO(brianwilkerson) reportUnrecoverableErrorWithToken
super.test_incomplete_returnType();
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 7c03a15..dc832df 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -3897,16 +3897,28 @@
}
void test_invalidTopLevelVar() {
- parseCompilationUnit("var Function(var arg);", errors: [
- expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 21, 2),
- expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 21, 2),
- ]);
+ parseCompilationUnit("var Function(var arg);",
+ errors: usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.VAR_RETURN_TYPE, 0, 3),
+ expectedError(ParserErrorCode.MISSING_FUNCTION_BODY, 21, 1),
+ ]
+ : [
+ expectedError(ParserErrorCode.EXPECTED_EXECUTABLE, 21, 2),
+ expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 21, 2),
+ ]);
}
void test_invalidTypedef() {
parseCompilationUnit("typedef var Function(var arg);",
errors: usingFastaParser
- ? [expectedError(ParserErrorCode.VAR_AS_TYPE_NAME, 8, 3)]
+ ? [
+ expectedError(
+ ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 0, 7),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 3),
+ expectedError(ParserErrorCode.VAR_RETURN_TYPE, 8, 3),
+ expectedError(ParserErrorCode.MISSING_FUNCTION_BODY, 29, 1),
+ ]
: [
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 8, 3),
expectedError(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, 8, 3),
@@ -4793,7 +4805,8 @@
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
listener.assertErrors([
- expectedError(ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, 15, 2)
+ expectedError(ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, 15,
+ usingFastaParser ? 1 : 2)
]);
}
@@ -4802,7 +4815,8 @@
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
listener.assertErrors([
- expectedError(ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, 15, 2)
+ expectedError(ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, 15,
+ usingFastaParser ? 1 : 2)
]);
}
@@ -10544,9 +10558,8 @@
createParser('C() : {}');
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
- listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 6, 1)]
- : [expectedError(ParserErrorCode.MISSING_INITIALIZER, 4, 1)]);
+ listener.assertErrors(
+ [expectedError(ParserErrorCode.MISSING_INITIALIZER, 4, 1)]);
}
void test_incomplete_constructorInitializers_missingEquals() {
@@ -10554,7 +10567,8 @@
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
listener.assertErrors([
- expectedError(ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, 11, 1)
+ expectedError(ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER,
+ usingFastaParser ? 6 : 11, 1)
]);
expect(member, new isInstanceOf<ConstructorDeclaration>());
NodeList<ConstructorInitializer> initializers =
@@ -10565,7 +10579,53 @@
Expression expression =
(initializer as ConstructorFieldInitializer).expression;
expect(expression, isNotNull);
- expect(expression, new isInstanceOf<ParenthesizedExpression>());
+ expect(
+ expression,
+ usingFastaParser
+ ? new isInstanceOf<MethodInvocation>()
+ : new isInstanceOf<ParenthesizedExpression>());
+ }
+
+ void test_incomplete_constructorInitializers_this() {
+ createParser('C() : this {}');
+ ClassMember member = parser.parseClassMember('C');
+ expectNotNullIfNoErrors(member);
+ listener.assertErrors([
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 11, 1),
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 11, 1),
+ usingFastaParser
+ ? expectedError(
+ ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, 6, 4)
+ : expectedError(
+ ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, 11, 1)
+ ]);
+ }
+
+ void test_incomplete_constructorInitializers_thisField() {
+ createParser('C() : this.g {}');
+ ClassMember member = parser.parseClassMember('C');
+ expectNotNullIfNoErrors(member);
+ listener.assertErrors([
+ usingFastaParser
+ ? expectedError(
+ ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, 6, 4)
+ : expectedError(
+ ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, 8, 1)
+ ]);
+ }
+
+ void test_incomplete_constructorInitializers_thisPeriod() {
+ createParser('C() : this. {}');
+ ClassMember member = parser.parseClassMember('C');
+ expectNotNullIfNoErrors(member);
+ listener.assertErrors([
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 12, 1),
+ usingFastaParser
+ ? expectedError(
+ ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, 6, 4)
+ : expectedError(
+ ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, 11, 1)
+ ]);
}
void test_incomplete_constructorInitializers_variable() {
@@ -10573,7 +10633,8 @@
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
listener.assertErrors([
- expectedError(ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER, 8, 1)
+ expectedError(ParserErrorCode.MISSING_ASSIGNMENT_IN_INITIALIZER,
+ usingFastaParser ? 6 : 8, 1)
]);
}
@@ -15535,8 +15596,9 @@
void test_parseCompilationUnit_builtIn_asFunctionName() {
for (Keyword keyword in Keyword.values) {
- if (keyword.isBuiltIn) {
+ if (keyword.isBuiltIn || keyword.isPseudo) {
String lexeme = keyword.lexeme;
+ if (lexeme == 'Function' && !usingFastaParser) continue;
parseCompilationUnit('$lexeme(x) => 0;');
parseCompilationUnit('class C {$lexeme(x) => 0;}');
}
@@ -15546,7 +15608,7 @@
void test_parseCompilationUnit_builtIn_asFunctionName_withTypeParameter() {
if (usingFastaParser) {
for (Keyword keyword in Keyword.values) {
- if (keyword.isBuiltIn) {
+ if (keyword.isBuiltIn || keyword.isPseudo) {
String lexeme = keyword.lexeme;
parseCompilationUnit('$lexeme<T>(x) => 0;');
parseCompilationUnit('class C {$lexeme<T>(x) => 0;}');
@@ -15557,7 +15619,7 @@
void test_parseCompilationUnit_builtIn_asGetter() {
for (Keyword keyword in Keyword.values) {
- if (keyword.isBuiltIn) {
+ if (keyword.isBuiltIn || keyword.isPseudo) {
String lexeme = keyword.lexeme;
parseCompilationUnit('get $lexeme => 0;');
parseCompilationUnit('class C {get $lexeme => 0;}');
@@ -15640,6 +15702,16 @@
expect(unit.declarations, hasLength(1));
}
+ void test_parseCompilationUnit_pseudo_prefixed() {
+ for (Keyword keyword in Keyword.values) {
+ if (keyword.isPseudo) {
+ String lexeme = keyword.lexeme;
+ parseCompilationUnit('M.$lexeme f;');
+ parseCompilationUnit('class C {M.$lexeme f;}');
+ }
+ }
+ }
+
void test_parseCompilationUnit_script() {
createParser('#! /bin/dart');
CompilationUnit unit = parser.parseCompilationUnit2();
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 b7c8fd2..b405734 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -1546,14 +1546,6 @@
''', [StaticTypeWarningCode.UNDEFINED_GETTER]);
}
- test_undefinedGetter_void() async {
- await assertErrorsInCode(r'''
-class T {
- void m() {}
-}
-f(T e) { return e.m().f; }''', [StaticTypeWarningCode.UNDEFINED_GETTER]);
- }
-
test_undefinedGetter_wrongNumberOfTypeArguments_tooLittle() async {
await assertErrorsInCode(r'''
class A<K, V> {
@@ -1787,14 +1779,6 @@
}''', [StaticTypeWarningCode.UNDEFINED_SETTER]);
}
- test_undefinedSetter_void() async {
- await assertErrorsInCode(r'''
-class T {
- void m() {}
-}
-f(T e) { e.m().f = 0; }''', [StaticTypeWarningCode.UNDEFINED_SETTER]);
- }
-
test_undefinedSuperGetter() async {
await assertErrorsInCode(r'''
class A {}
diff --git a/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart b/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
index e28d5ae..266dedf 100644
--- a/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
@@ -1811,4 +1811,259 @@
test_undefinedStaticMethodOrGetter_setter_inSuperclass() async {
return super.test_undefinedStaticMethodOrGetter_setter_inSuperclass();
}
+
+ @override
+ @failingTest
+ test_generalizedVoid_assignToVoid_notStrong_error() async {
+ return super.test_generalizedVoid_assignToVoid_notStrong_error();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInForPartsOk() async {
+ return super.test_generalizedVoid_useOfVoidInForPartsOk();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInIsTestError() async {
+ return super.test_generalizedVoid_useOfVoidInIsTestError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInConditionalConditionError() async {
+ return super.test_generalizedVoid_useOfVoidInConditionalConditionError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInConditionalLhsError() async {
+ return super.test_generalizedVoid_useOfVoidInConditionalLhsError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInConditionalRhsError() async {
+ return super.test_generalizedVoid_useOfVoidInConditionalRhsError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidWhenArgumentError() async {
+ return super.test_generalizedVoid_useOfVoidWhenArgumentError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidWithInitializerError() async {
+ return super.test_generalizedVoid_useOfVoidWithInitializerError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidAssignedToDynamicError() async {
+ return super.test_generalizedVoid_useOfVoidAssignedToDynamicError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_throwVoidValueError() async {
+ return super.test_generalizedVoid_throwVoidValueError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInListLiteralError() async {
+ return super.test_generalizedVoid_useOfVoidInListLiteralError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInMapLiteralValueError() async {
+ return super.test_generalizedVoid_useOfVoidInMapLiteralValueError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInMapLiteralKeyError() async {
+ return super.test_generalizedVoid_useOfVoidInMapLiteralKeyError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInNullOperatorLhsError() async {
+ return super.test_generalizedVoid_useOfVoidInNullOperatorLhsError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidReturnInNonVoidFunctionError() async {
+ return super.test_generalizedVoid_useOfVoidReturnInNonVoidFunctionError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInWhileConditionError() async {
+ return super.test_generalizedVoid_useOfVoidInWhileConditionError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInDoWhileConditionError() async {
+ return super.test_generalizedVoid_useOfVoidInDoWhileConditionError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfInForeachIterableError() async {
+ return super.test_generalizedVoid_useOfInForeachIterableError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInForeachVariableError() async {
+ return super.test_generalizedVoid_useOfVoidInForeachVariableError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInSpecialAssignmentError() async {
+ return super.test_generalizedVoid_useOfVoidInSpecialAssignmentError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidCallMethodError() async {
+ return super.test_generalizedVoid_useOfVoidCallMethodError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidCallMethodWithNullError() async {
+ return super.test_generalizedVoid_useOfVoidCallMethodWithNullError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidCascadeError() async {
+ return super.test_generalizedVoid_useOfVoidCascadeError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_invocationOfVoidToplevelError() async {
+ return super.test_generalizedVoid_invocationOfVoidToplevelError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_invocationOfVoidLocalError() async {
+ return super.test_generalizedVoid_invocationOfVoidLocalError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_invocationOfVoidFieldError() async {
+ return super.test_generalizedVoid_invocationOfVoidFieldError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_invocationOfVoidResultError() async {
+ return super.test_generalizedVoid_invocationOfVoidResultError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidByIndexingError() async {
+ return super.test_generalizedVoid_useOfVoidByIndexingError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidAsIndexError() async {
+ return super.test_generalizedVoid_useOfVoidAsIndexError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidAsIndexAssignError() async {
+ return super.test_generalizedVoid_useOfVoidAsIndexAssignError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidInSwitchExpressionError() async {
+ return super.test_generalizedVoid_useOfVoidInSwitchExpressionError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidPropertyAccessError() async {
+ return super.test_generalizedVoid_useOfVoidPropertyAccessError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidCallSetterError() async {
+ return super.test_generalizedVoid_useOfVoidCallSetterError();
+ }
+
+ @override
+ @failingTest
+ test_generalizedVoid_useOfVoidNullPropertyAccessError() async {
+ return super.test_generalizedVoid_useOfVoidNullPropertyAccessError();
+ }
+
+ @failingTest
+ @override
+ test_useOfVoidResult_assignmentExpression_function() async {
+ return super.test_useOfVoidResult_assignmentExpression_function();
+ }
+
+ @failingTest
+ @override
+ test_useOfVoidResult_assignmentExpression_method() async {
+ return super.test_useOfVoidResult_assignmentExpression_method();
+ }
+
+ @failingTest
+ @override
+ test_useOfVoidResult_variableDeclaration_method2() async {
+ return super.test_useOfVoidResult_variableDeclaration_method2();
+ }
+
+ @override
+ test_useOfVoidResult_inForLoop_ok() async {
+ return super.test_useOfVoidResult_inForLoop_ok();
+ }
+
+ @failingTest
+ @override
+ test_useOfVoidResult_inForLoop_error() async {
+ return super.test_useOfVoidResult_inForLoop_error();
+ }
+
+ @override
+ test_useOfVoidResult_variableDeclaration_function_ok() async {
+ return super.test_useOfVoidResult_variableDeclaration_function_ok();
+ }
+
+ @failingTest
+ @override
+ test_useOfVoidResult_variableDeclaration_function_error() async {
+ return super.test_useOfVoidResult_variableDeclaration_function_error();
+ }
+
+ @failingTest
+ @override
+ test_useOfVoidResult_variableDeclaration_method_error() async {
+ return super.test_useOfVoidResult_variableDeclaration_method_error();
+ }
+
+ @override
+ test_useOfVoidResult_variableDeclaration_method_ok() async {
+ return super.test_useOfVoidResult_variableDeclaration_method_ok();
+ }
}
diff --git a/pkg/analyzer/test/generated/static_warning_code_test.dart b/pkg/analyzer/test/generated/static_warning_code_test.dart
index 3319dcb..81eb7e5 100644
--- a/pkg/analyzer/test/generated/static_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_test.dart
@@ -3594,4 +3594,606 @@
await computeAnalysisResult(source);
assertNoErrors(source);
}
+
+ test_generalizedVoid_assignToVoid_notStrong_error() async {
+ // See StrongModeStaticTypeAnalyzer2Test.test_generalizedVoid_assignToVoidOk
+ // for testing that this does not have errors in strong mode.
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x = 42;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
+ }
+
+ test_generalizedVoid_useOfVoidInExpStmtOk() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x;
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
+ test_generalizedVoid_useOfVoidInForPartsOk() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ for (x; false; x) {}
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
+ test_generalizedVoid_useOfVoidCastsOk() async {
+ Source source = addSource(r'''
+void use(dynamic x) { }
+void main() {
+ void x;
+ use(x as int);
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
+ test_generalizedVoid_useOfVoidInIsTestError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x is int;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidInConditionalConditionError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x ? null : null;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ @failingTest
+ test_generalizedVoid_useOfVoidInConditionalLhsError() async {
+ // TODO(mfairhurst) Enable this.
+ Source source = addSource(r'''
+void main(bool c) {
+ void x;
+ c ? x : null;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ @failingTest
+ test_generalizedVoid_useOfVoidInConditionalRhsError() async {
+ // TODO(mfairhurst) Enable this.
+ Source source = addSource(r'''
+void main(bool c) {
+ void x;
+ c ? null : x;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidWhenArgumentError() async {
+ Source source = addSource(r'''
+void use(dynamic x) { }
+void main() {
+ void x;
+ use(x);
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidWithInitializerError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ void y = x;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidAssignedToDynamicError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ dynamic z = x;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_throwVoidValueError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ throw x;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidInListLiteralOk() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ <void>[x]; // not strong mode; we have to specify <void>.
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
+ test_generalizedVoid_useOfVoidInListLiteralError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ <dynamic>[x];
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidInMapLiteralValueOk() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ var m1 = <int, void>{4: x}; // not strong mode; we have to specify <void>.
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
+ test_generalizedVoid_useOfVoidInMapLiteralValueError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ var m1 = <int, dynamic>{4: x};
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidInMapLiteralKeyOk() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ var m2 = <void, int>{x : 4}; // not strong mode; we have to specify <void>.
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
+ test_generalizedVoid_useOfVoidInMapLiteralKeyError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ var m2 = <dynamic, int>{x : 4};
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidInNullOperatorLhsError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x ?? 499;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidInNullOperatorRhsOk() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ null ?? x;
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
+ @failingTest
+ test_generalizedVoid_useOfVoidReturnInNonVoidFunctionError() async {
+ // TODO(mfairhurst) Get this test to pass once codebase is compliant.
+ Source source = addSource(r'''
+dynamic main() {
+ void x;
+ return x;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
+ }
+
+ test_generalizedVoid_useOfVoidReturnInVoidFunctionOk() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ return x;
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
+ test_generalizedVoid_useOfVoidInWhileConditionError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ while (x) {};
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidInDoWhileConditionError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ do {} while (x);
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfInForeachIterableError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ for (var v in x) {}
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ @failingTest // This test may be completely invalid.
+ test_generalizedVoid_useOfVoidInForeachVariableError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ for (x in [1, 2]) {}
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidInSpecialAssignmentError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x += 1;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidCallMethodError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x.toString();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidCallMethodWithNullError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x?.toString();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidCascadeError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x..toString();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_invocationOfVoidToplevelError() async {
+ Source source = addSource(r'''
+void x;
+void main() {
+ x();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_invocationOfVoidLocalError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_invocationOfVoidFieldError() async {
+ Source source = addSource(r'''
+class Container<T>{
+ T value;
+}
+void main(Container<void> voidContainer) {
+ voidContainer.value();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_invocationOfVoidResultError() async {
+ Source source = addSource(r'''
+void main() {
+ main()();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidByIndexingError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x[0];
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidAsIndexError() async {
+ Source source = addSource(r'''
+void main(List list) {
+ void x;
+ list[x];
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidAsIndexAssignError() async {
+ Source source = addSource(r'''
+void main(List list) {
+ void x;
+ list[x] = null;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidInSwitchExpressionError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ switch(x) {}
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidPropertyAccessError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x.foo;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidCallSetterError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x.foo = null;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_useOfVoidNullPropertyAccessError() async {
+ Source source = addSource(r'''
+void main() {
+ void x;
+ x?.foo;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ }
+
+ test_generalizedVoid_assignmentToVoidParameterOk() async {
+ // Note: the spec may decide to disallow this, but at this point that seems
+ // highly unlikely.
+ Source source = addSource(r'''
+void main() {
+ void x;
+ f(x);
+}
+void f(void x) {}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
+ test_useOfVoidResult_assignmentExpression_function() async {
+ Source source = addSource(r'''
+void f() {}
+class A {
+ n() {
+ var a;
+ a = f();
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ verify([source]);
+ }
+
+ test_useOfVoidResult_assignmentExpression_method() async {
+ Source source = addSource(r'''
+class A {
+ void m() {}
+ n() {
+ var a;
+ a = m();
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ verify([source]);
+ }
+
+ @failingTest
+ test_useOfVoidResult_inForLoop_ok() async {
+ Source source = addSource(r'''
+class A {
+ void m() {}
+ n() {
+ for(var a = m();;) {}
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ test_useOfVoidResult_inForLoop_error() async {
+ Source source = addSource(r'''
+class A {
+ void m() {}
+ n() {
+ for(Object a = m();;) {}
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ verify([source]);
+ }
+
+ @failingTest
+ test_useOfVoidResult_variableDeclaration_function_ok() async {
+ Source source = addSource(r'''
+void f() {}
+class A {
+ n() {
+ var a = f();
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ test_useOfVoidResult_variableDeclaration_function_error() async {
+ Source source = addSource(r'''
+void f() {}
+class A {
+ n() {
+ Object a = f();
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ verify([source]);
+ }
+
+ test_useOfVoidResult_variableDeclaration_method_error() async {
+ Source source = addSource(r'''
+class A {
+ void m() {}
+ n() {
+ Object a = m();
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StaticWarningCode.USE_OF_VOID_RESULT]);
+ verify([source]);
+ }
+
+ @failingTest
+ test_useOfVoidResult_variableDeclaration_method_ok() async {
+ Source source = addSource(r'''
+class A {
+ void m() {}
+ n() {
+ var a = m();
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ test_useOfVoidResult_variableDeclaration_method2() async {
+ Source source = addSource(r'''
+class A {
+ void m() {}
+ n() {
+ Object a = m(), b = m();
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ StaticWarningCode.USE_OF_VOID_RESULT,
+ StaticWarningCode.USE_OF_VOID_RESULT
+ ]);
+ verify([source]);
+ }
}
diff --git a/pkg/analyzer/test/source/error_processor_test.dart b/pkg/analyzer/test/source/error_processor_test.dart
index e55d91e..37f2551 100644
--- a/pkg/analyzer/test/source/error_processor_test.dart
+++ b/pkg/analyzer/test/source/error_processor_test.dart
@@ -35,8 +35,8 @@
['x']
]);
- AnalysisError use_of_void_result =
- new AnalysisError(new TestSource(), 0, 1, HintCode.USE_OF_VOID_RESULT, [
+ AnalysisError use_of_void_result = new AnalysisError(
+ new TestSource(), 0, 1, StaticWarningCode.USE_OF_VOID_RESULT, [
['x']
]);
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index 9a53d86..bb6b1d0 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -3751,7 +3751,7 @@
void set d(y) => voidFn();
/*warning:NON_VOID_RETURN_FOR_SETTER*/int set e(y) => 4;
/*warning:NON_VOID_RETURN_FOR_SETTER*/int set f(y) =>
- /*error:RETURN_OF_INVALID_TYPE, info:DOWN_CAST_IMPLICIT*/voidFn();
+ /*error:RETURN_OF_INVALID_TYPE*/voidFn();
set g(y) {return /*error:RETURN_OF_INVALID_TYPE*/4;}
void set h(y) {return /*error:RETURN_OF_INVALID_TYPE*/4;}
/*warning:NON_VOID_RETURN_FOR_SETTER*/int set i(y) {return 4;}
@@ -4437,7 +4437,7 @@
typedef int Foo();
void foo() {}
void main () {
- Foo x = /*info:USE_OF_VOID_RESULT, info:DOWN_CAST_COMPOSITE*/foo();
+ Foo x = /*error:USE_OF_VOID_RESULT*/foo();
}
''');
}
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index fb326f8..18e4279 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -2429,7 +2429,7 @@
class C extends B {
f() {}
}
-var x = /*error:TOP_LEVEL_INSTANCE_METHOD*/new C()./*info:USE_OF_VOID_RESULT*/f();
+var x = /*error:TOP_LEVEL_INSTANCE_METHOD*/new C()./*error:USE_OF_VOID_RESULT*/f();
''');
}
@@ -3516,7 +3516,7 @@
test_inferVariableVoid() async {
var mainUnit = await checkFileElement('''
void f() {}
-var x = /*info:USE_OF_VOID_RESULT*/f();
+var x = /*error:USE_OF_VOID_RESULT*/f();
''');
var x = mainUnit.topLevelVariables[0];
expect(x.name, 'x');
@@ -4309,12 +4309,12 @@
void printRunning() { print("running"); }
var x = run<dynamic>(printRunning);
-var y = /*info:USE_OF_VOID_RESULT*/run(printRunning);
+var y = /*error:USE_OF_VOID_RESULT*/run(printRunning);
main() {
void printRunning() { print("running"); }
var x = run<dynamic>(printRunning);
- var y = /*info:USE_OF_VOID_RESULT*/run(printRunning);
+ var y = /*error:USE_OF_VOID_RESULT*/run(printRunning);
x = 123;
x = 'hi';
y = 123;
diff --git a/pkg/analyzer_plugin/doc/api.html b/pkg/analyzer_plugin/doc/api.html
index 7917358..8c92a60 100644
--- a/pkg/analyzer_plugin/doc/api.html
+++ b/pkg/analyzer_plugin/doc/api.html
@@ -997,6 +997,13 @@
additionally insert a template for the parameters. The information
required in order to do so is contained in other fields.
</p>
+ </dd><dt class="field"><b>displayText: String<span style="color:#999999"> (optional)</span></b></dt><dd>
+
+ <p>
+ Text to be displayed in, for example, a completion pop-up. This field
+ is only defined if the displayed text should be different than the
+ completion. Otherwise it is omitted.
+ </p>
</dd><dt class="field"><b>selectionOffset: int</b></dt><dd>
<p>
@@ -1023,7 +1030,7 @@
<p>
An abbreviated version of the Dartdoc associated with the element
- being suggested, This field is omitted if there is no Dartdoc
+ being suggested. This field is omitted if there is no Dartdoc
associated with the element.
</p>
</dd><dt class="field"><b>docComplete: String<span style="color:#999999"> (optional)</span></b></dt><dd>
@@ -1157,7 +1164,12 @@
suggestions of this kind, the completion is the named argument
identifier including a trailing ':' and a space.
</p>
- </dd><dt class="value">OPTIONAL_ARGUMENT</dt><dt class="value">PARAMETER</dt></dl></dd><dt class="typeDefinition"><a name="type_ContextRoot">ContextRoot: object</a></dt><dd>
+ </dd><dt class="value">OPTIONAL_ARGUMENT</dt><dt class="value">OVERRIDE</dt><dd>
+
+ <p>
+ An overriding implementation of a class member is being suggested.
+ </p>
+ </dd><dt class="value">PARAMETER</dt></dl></dd><dt class="typeDefinition"><a name="type_ContextRoot">ContextRoot: object</a></dt><dd>
<p>
A description of an analysis context.
</p>
@@ -1965,6 +1977,12 @@
The position that should be selected after the edits have been
applied.
</p>
+ </dd><dt class="field"><b>id: String<span style="color:#999999"> (optional)</span></b></dt><dd>
+
+ <p>
+ The optional identifier of the change kind. The identifier remains
+ stable even if the message changes, or is parameterized.
+ </p>
</dd></dl></dd><dt class="typeDefinition"><a name="type_SourceEdit">SourceEdit: object</a></dt><dd>
<p>
A description of a single change to a single file.
diff --git a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
index d622ae2..cb24ea5 100644
--- a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
+++ b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
@@ -597,6 +597,7 @@
* "kind": CompletionSuggestionKind
* "relevance": int
* "completion": String
+ * "displayText": optional String
* "selectionOffset": int
* "selectionLength": int
* "isDeprecated": bool
@@ -626,6 +627,8 @@
String _completion;
+ String _displayText;
+
int _selectionOffset;
int _selectionLength;
@@ -710,6 +713,22 @@
}
/**
+ * Text to be displayed in, for example, a completion pop-up. This field is
+ * only defined if the displayed text should be different than the
+ * completion. Otherwise it is omitted.
+ */
+ String get displayText => _displayText;
+
+ /**
+ * Text to be displayed in, for example, a completion pop-up. This field is
+ * only defined if the displayed text should be different than the
+ * completion. Otherwise it is omitted.
+ */
+ void set displayText(String value) {
+ this._displayText = value;
+ }
+
+ /**
* The offset, relative to the beginning of the completion, of where the
* selection should be placed after insertion.
*/
@@ -767,14 +786,14 @@
/**
* An abbreviated version of the Dartdoc associated with the element being
- * suggested, This field is omitted if there is no Dartdoc associated with
+ * suggested. This field is omitted if there is no Dartdoc associated with
* the element.
*/
String get docSummary => _docSummary;
/**
* An abbreviated version of the Dartdoc associated with the element being
- * suggested, This field is omitted if there is no Dartdoc associated with
+ * suggested. This field is omitted if there is no Dartdoc associated with
* the element.
*/
void set docSummary(String value) {
@@ -983,7 +1002,8 @@
int selectionLength,
bool isDeprecated,
bool isPotential,
- {String docSummary,
+ {String displayText,
+ String docSummary,
String docComplete,
String declaringType,
String defaultArgumentListString,
@@ -1000,6 +1020,7 @@
this.kind = kind;
this.relevance = relevance;
this.completion = completion;
+ this.displayText = displayText;
this.selectionOffset = selectionOffset;
this.selectionLength = selectionLength;
this.isDeprecated = isDeprecated;
@@ -1047,6 +1068,11 @@
} else {
throw jsonDecoder.mismatch(jsonPath, "completion");
}
+ String displayText;
+ if (json.containsKey("displayText")) {
+ displayText = jsonDecoder.decodeString(
+ jsonPath + ".displayText", json["displayText"]);
+ }
int selectionOffset;
if (json.containsKey("selectionOffset")) {
selectionOffset = jsonDecoder.decodeInt(
@@ -1151,6 +1177,7 @@
}
return new CompletionSuggestion(kind, relevance, completion,
selectionOffset, selectionLength, isDeprecated, isPotential,
+ displayText: displayText,
docSummary: docSummary,
docComplete: docComplete,
declaringType: declaringType,
@@ -1176,6 +1203,9 @@
result["kind"] = kind.toJson();
result["relevance"] = relevance;
result["completion"] = completion;
+ if (displayText != null) {
+ result["displayText"] = displayText;
+ }
result["selectionOffset"] = selectionOffset;
result["selectionLength"] = selectionLength;
result["isDeprecated"] = isDeprecated;
@@ -1234,6 +1264,7 @@
return kind == other.kind &&
relevance == other.relevance &&
completion == other.completion &&
+ displayText == other.displayText &&
selectionOffset == other.selectionOffset &&
selectionLength == other.selectionLength &&
isDeprecated == other.isDeprecated &&
@@ -1265,6 +1296,7 @@
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, relevance.hashCode);
hash = JenkinsSmiHash.combine(hash, completion.hashCode);
+ hash = JenkinsSmiHash.combine(hash, displayText.hashCode);
hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode);
@@ -1298,6 +1330,7 @@
* KEYWORD
* NAMED_ARGUMENT
* OPTIONAL_ARGUMENT
+ * OVERRIDE
* PARAMETER
* }
*
@@ -1351,6 +1384,12 @@
static const CompletionSuggestionKind OPTIONAL_ARGUMENT =
const CompletionSuggestionKind._("OPTIONAL_ARGUMENT");
+ /**
+ * An overriding implementation of a class member is being suggested.
+ */
+ static const CompletionSuggestionKind OVERRIDE =
+ const CompletionSuggestionKind._("OVERRIDE");
+
static const CompletionSuggestionKind PARAMETER =
const CompletionSuggestionKind._("PARAMETER");
@@ -1366,6 +1405,7 @@
KEYWORD,
NAMED_ARGUMENT,
OPTIONAL_ARGUMENT,
+ OVERRIDE,
PARAMETER
];
@@ -1390,6 +1430,8 @@
return NAMED_ARGUMENT;
case "OPTIONAL_ARGUMENT":
return OPTIONAL_ARGUMENT;
+ case "OVERRIDE":
+ return OVERRIDE;
case "PARAMETER":
return PARAMETER;
}
@@ -5207,6 +5249,7 @@
* "edits": List<SourceFileEdit>
* "linkedEditGroups": List<LinkedEditGroup>
* "selection": optional Position
+ * "id": optional String
* }
*
* Clients may not extend, implement or mix-in this class.
@@ -5220,6 +5263,8 @@
Position _selection;
+ String _id;
+
/**
* A human-readable description of the change to be applied.
*/
@@ -5273,10 +5318,25 @@
this._selection = value;
}
+ /**
+ * The optional identifier of the change kind. The identifier remains stable
+ * even if the message changes, or is parameterized.
+ */
+ String get id => _id;
+
+ /**
+ * The optional identifier of the change kind. The identifier remains stable
+ * even if the message changes, or is parameterized.
+ */
+ void set id(String value) {
+ this._id = value;
+ }
+
SourceChange(String message,
{List<SourceFileEdit> edits,
List<LinkedEditGroup> linkedEditGroups,
- Position selection}) {
+ Position selection,
+ String id}) {
this.message = message;
if (edits == null) {
this.edits = <SourceFileEdit>[];
@@ -5289,6 +5349,7 @@
this.linkedEditGroups = linkedEditGroups;
}
this.selection = selection;
+ this.id = id;
}
factory SourceChange.fromJson(
@@ -5329,10 +5390,15 @@
selection = new Position.fromJson(
jsonDecoder, jsonPath + ".selection", json["selection"]);
}
+ String id;
+ if (json.containsKey("id")) {
+ id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
+ }
return new SourceChange(message,
edits: edits,
linkedEditGroups: linkedEditGroups,
- selection: selection);
+ selection: selection,
+ id: id);
} else {
throw jsonDecoder.mismatch(jsonPath, "SourceChange", json);
}
@@ -5350,6 +5416,9 @@
if (selection != null) {
result["selection"] = selection.toJson();
}
+ if (id != null) {
+ result["id"] = id;
+ }
return result;
}
@@ -5389,7 +5458,8 @@
(SourceFileEdit a, SourceFileEdit b) => a == b) &&
listEqual(linkedEditGroups, other.linkedEditGroups,
(LinkedEditGroup a, LinkedEditGroup b) => a == b) &&
- selection == other.selection;
+ selection == other.selection &&
+ id == other.id;
}
return false;
}
@@ -5401,6 +5471,7 @@
hash = JenkinsSmiHash.combine(hash, edits.hashCode);
hash = JenkinsSmiHash.combine(hash, linkedEditGroups.hashCode);
hash = JenkinsSmiHash.combine(hash, selection.hashCode);
+ hash = JenkinsSmiHash.combine(hash, id.hashCode);
return JenkinsSmiHash.finish(hash);
}
}
diff --git a/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart b/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
index 5953c1c..62aebc6 100644
--- a/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
+++ b/pkg/analyzer_plugin/test/integration/support/protocol_matchers.dart
@@ -133,6 +133,7 @@
* "kind": CompletionSuggestionKind
* "relevance": int
* "completion": String
+ * "displayText": optional String
* "selectionOffset": int
* "selectionLength": int
* "isDeprecated": bool
@@ -163,6 +164,7 @@
"isDeprecated": isBool,
"isPotential": isBool
}, optionalFields: {
+ "displayText": isString,
"docSummary": isString,
"docComplete": isString,
"declaringType": isString,
@@ -190,6 +192,7 @@
* KEYWORD
* NAMED_ARGUMENT
* OPTIONAL_ARGUMENT
+ * OVERRIDE
* PARAMETER
* }
*/
@@ -202,6 +205,7 @@
"KEYWORD",
"NAMED_ARGUMENT",
"OPTIONAL_ARGUMENT",
+ "OVERRIDE",
"PARAMETER"
]);
@@ -849,6 +853,7 @@
* "edits": List<SourceFileEdit>
* "linkedEditGroups": List<LinkedEditGroup>
* "selection": optional Position
+ * "id": optional String
* }
*/
final Matcher isSourceChange =
@@ -857,7 +862,8 @@
"edits": isListOf(isSourceFileEdit),
"linkedEditGroups": isListOf(isLinkedEditGroup)
}, optionalFields: {
- "selection": isPosition
+ "selection": isPosition,
+ "id": isString
}));
/**
diff --git a/pkg/analyzer_plugin/tool/spec/common_types_spec.html b/pkg/analyzer_plugin/tool/spec/common_types_spec.html
index 1047f8d..fb0b467 100644
--- a/pkg/analyzer_plugin/tool/spec/common_types_spec.html
+++ b/pkg/analyzer_plugin/tool/spec/common_types_spec.html
@@ -198,6 +198,14 @@
required in order to do so is contained in other fields.
</p>
</field>
+ <field name="displayText" optional="true">
+ <ref>String</ref>
+ <p>
+ Text to be displayed in, for example, a completion pop-up. This field
+ is only defined if the displayed text should be different than the
+ completion. Otherwise it is omitted.
+ </p>
+ </field>
<field name="selectionOffset">
<ref>int</ref>
<p>
@@ -228,7 +236,7 @@
<ref>String</ref>
<p>
An abbreviated version of the Dartdoc associated with the element
- being suggested, This field is omitted if there is no Dartdoc
+ being suggested. This field is omitted if there is no Dartdoc
associated with the element.
</p>
</field>
@@ -391,6 +399,12 @@
</p>
</value>
<value><code>OPTIONAL_ARGUMENT</code></value>
+ <value>
+ <code>OVERRIDE</code>
+ <p>
+ An overriding implementation of a class member is being suggested.
+ </p>
+ </value>
<value><code>PARAMETER</code></value>
</enum>
</type>
@@ -1349,6 +1363,13 @@
applied.
</p>
</field>
+ <field name="id" optional="true">
+ <ref>String</ref>
+ <p>
+ The optional identifier of the change kind. The identifier remains
+ stable even if the message changes, or is parameterized.
+ </p>
+ </field>
</object>
</type>
<type name="SourceEdit">
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index f3db942..0d0e81b 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -600,8 +600,10 @@
class ConstantConverter implements ConstantValueVisitor<ConstantValue, Null> {
final Entity Function(Entity) toBackendEntity;
+ final TypeConverter typeConverter;
- ConstantConverter(this.toBackendEntity);
+ ConstantConverter(this.toBackendEntity)
+ : typeConverter = new TypeConverter(toBackendEntity);
ConstantValue visitNull(NullConstantValue constant, _) => constant;
ConstantValue visitInt(IntConstantValue constant, _) => constant;
@@ -612,12 +614,12 @@
ConstantValue visitNonConstant(NonConstantValue constant, _) => constant;
ConstantValue visitFunction(FunctionConstantValue constant, _) {
- return new FunctionConstantValue(
- toBackendEntity(constant.element), _handleType(constant.type));
+ return new FunctionConstantValue(toBackendEntity(constant.element),
+ typeConverter.convert(constant.type));
}
ConstantValue visitList(ListConstantValue constant, _) {
- var type = _handleType(constant.type);
+ var type = typeConverter.convert(constant.type);
List<ConstantValue> entries = _handleValues(constant.entries);
if (identical(entries, constant.entries) && type == constant.type) {
return constant;
@@ -626,7 +628,7 @@
}
ConstantValue visitMap(MapConstantValue constant, _) {
- var type = _handleType(constant.type);
+ var type = typeConverter.convert(constant.type);
List<ConstantValue> keys = _handleValues(constant.keys);
List<ConstantValue> values = _handleValues(constant.values);
if (identical(keys, constant.keys) &&
@@ -638,7 +640,7 @@
}
ConstantValue visitConstructed(ConstructedConstantValue constant, _) {
- var type = _handleType(constant.type);
+ var type = typeConverter.convert(constant.type);
if (type == constant.type && constant.fields.isEmpty) {
return constant;
}
@@ -650,8 +652,8 @@
}
ConstantValue visitType(TypeConstantValue constant, _) {
- var type = _handleType(constant.type);
- var representedType = _handleType(constant.representedType);
+ var type = typeConverter.convert(constant.type);
+ var representedType = typeConverter.convert(constant.representedType);
if (type == constant.type && representedType == constant.representedType) {
return constant;
}
@@ -672,22 +674,6 @@
return new DeferredGlobalConstantValue(referenced, constant.unit);
}
- DartType _handleType(DartType type) {
- if (type is InterfaceType) {
- var element = toBackendEntity(type.element);
- var args = type.typeArguments.map(_handleType).toList();
- return new InterfaceType(element, args);
- }
- if (type is TypedefType) {
- var element = toBackendEntity(type.element);
- var args = type.typeArguments.map(_handleType).toList();
- return new TypedefType(element, args);
- }
-
- // TODO(redemption): handle other types.
- return type;
- }
-
List<ConstantValue> _handleValues(List<ConstantValue> values) {
List<ConstantValue> result;
for (int i = 0; i < values.length; i++) {
@@ -701,3 +687,50 @@
return result ?? values;
}
}
+
+class TypeConverter extends DartTypeVisitor<DartType, Null> {
+ final Entity Function(Entity) toBackendEntity;
+ TypeConverter(this.toBackendEntity);
+
+ DartType convert(DartType type) => type.accept(this, null);
+
+ DartType visitVoidType(VoidType type, _) => type;
+ DartType visitDynamicType(DynamicType type, _) => type;
+
+ DartType visitTypeVariableType(TypeVariableType type, _) {
+ return new TypeVariableType(toBackendEntity(type.element));
+ }
+
+ DartType visitFunctionTypeVariable(FunctionTypeVariable type, _) {
+ var bound = type.bound?.accept(this, null);
+ return new FunctionTypeVariable(type.index, bound);
+ }
+
+ DartType visitFunctionType(FunctionType type, _) {
+ var returnType = type.returnType.accept(this, null);
+ var parameterTypes = _visitList(type.parameterTypes);
+ var optionalParameterTypes = _visitList(type.optionalParameterTypes);
+ var namedParameterTypes = _visitList(type.namedParameterTypes);
+ var typeVariables = type.typeVariables
+ .map<FunctionTypeVariable>((t) => t.accept<DartType, Null>(this, null))
+ .toList();
+ var typedefType = type.typedefType?.accept(this, null);
+ return new FunctionType(returnType, parameterTypes, optionalParameterTypes,
+ type.namedParameters, namedParameterTypes, typeVariables, typedefType);
+ }
+
+ DartType visitInterfaceType(InterfaceType type, _) {
+ var element = toBackendEntity(type.element);
+ var args = _visitList(type.typeArguments);
+ return new InterfaceType(element, args);
+ }
+
+ DartType visitTypedefType(TypedefType type, _) {
+ var element = toBackendEntity(type.element);
+ var args = _visitList(type.typeArguments);
+ return new TypedefType(element, args);
+ }
+
+ List<DartType> _visitList(List<DartType> list) =>
+ list.map<DartType>((t) => t.accept(this, null)).toList();
+}
diff --git a/pkg/compiler/lib/src/resolution/constructors.dart b/pkg/compiler/lib/src/resolution/constructors.dart
index 8f9bbcf..8d721f4 100644
--- a/pkg/compiler/lib/src/resolution/constructors.dart
+++ b/pkg/compiler/lib/src/resolution/constructors.dart
@@ -310,7 +310,7 @@
// parameters (regular ones and initializing formals) we must extend
// the parameter scope rather than adding a new nested scope.
visitor.scope = new ExtensionScope(visitor.scope);
- Link<Node> parameterNodes = (functionNode.parameters == null)
+ Link<Node> parameterNodes = (functionNode?.parameters == null)
? const Link<Node>()
: functionNode.parameters.nodes;
functionParameters.forEachParameter((FormalElement _element) {
@@ -367,7 +367,7 @@
parameterNodes = parameterNodes.tail;
});
- if (functionNode.initializers == null) {
+ if (functionNode?.initializers == null) {
initializers = const Link<Node>();
} else {
initializers = functionNode.initializers.nodes;
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index 056ae25..d3591d3 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -2476,14 +2476,12 @@
for (var field in fieldDecls) {
var f = field.element;
if (f.isStatic) continue;
- var init = field.initializer;
- if (init == null ||
- ctorFields != null &&
- ctorFields.contains(f) &&
- _constants.isFieldInitConstant(field)) {
+ if (ctorFields != null &&
+ ctorFields.contains(f) &&
+ _constants.isFieldInitConstant(field)) {
continue;
}
- emitFieldInit(f, init, field.name);
+ emitFieldInit(f, field.initializer, field.name);
}
if (ctor != null) {
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index 4f1c302..3d16a4c 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -1470,10 +1470,9 @@
for (var f in fields) {
if (f.isStatic) continue;
var init = f.initializer;
- if (init == null ||
- ctorFields != null &&
- ctorFields.contains(f) &&
- _constants.isConstant(init)) {
+ if (ctorFields != null &&
+ ctorFields.contains(f) &&
+ (init == null || _constants.isConstant(init))) {
continue;
}
emitFieldInit(f, init);
diff --git a/pkg/expect/lib/minitest.dart b/pkg/expect/lib/minitest.dart
index d3f2ce6..8082bd5 100644
--- a/pkg/expect/lib/minitest.dart
+++ b/pkg/expect/lib/minitest.dart
@@ -25,7 +25,7 @@
import 'package:expect/expect.dart';
-typedef void _Action();
+typedef dynamic _Action();
typedef void _ExpectationFunction(Object actual);
final List<_Group> _groups = [new _Group()];
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 59301ae..a2aa3c9 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -303,6 +303,13 @@
return _sdkSummaryProgram;
}
+ void set sdkSummaryComponent(Program platform) {
+ if (_sdkSummaryProgram != null) {
+ throw new StateError("sdkSummary already loaded.");
+ }
+ _sdkSummaryProgram = platform;
+ }
+
/// Get the summary programs for each of the underlying `inputSummaries`
/// provided via [CompilerOptions].
// TODO(sigmund): move, this doesn't feel like an "option".
diff --git a/pkg/front_end/lib/src/fasta/command_line_reporting.dart b/pkg/front_end/lib/src/fasta/command_line_reporting.dart
index 2f48cb8..3efcc4d 100644
--- a/pkg/front_end/lib/src/fasta/command_line_reporting.dart
+++ b/pkg/front_end/lib/src/fasta/command_line_reporting.dart
@@ -176,6 +176,22 @@
}
}
+bool isCompileTimeError(Severity severity) {
+ switch (severity) {
+ case Severity.error:
+ case Severity.internalProblem:
+ return true;
+
+ case Severity.errorLegacyWarning:
+ return CompilerContext.current.options.strongMode;
+
+ case Severity.nit:
+ case Severity.warning:
+ return false;
+ }
+ return unexpected("$severity", "isCompileTimeError", -1, null);
+}
+
/// Report [message] unless [severity] is suppressed (see [isHidden]). Throws
/// an exception if [severity] is fatal (see [isFatal]).
///
@@ -183,6 +199,9 @@
/// [CompilerContext.report] instead.
void report(LocatedMessage message, Severity severity) {
if (isHidden(severity)) return;
+ if (isCompileTimeError(severity)) {
+ CompilerContext.current.logError(message, severity);
+ }
_printAndThrowIfDebugging(
format(message, severity), severity, message.uri, message.charOffset);
}
@@ -193,6 +212,9 @@
/// [CompilerContext.reportWithoutLocation] instead.
void reportWithoutLocation(Message message, Severity severity) {
if (isHidden(severity)) return;
+ if (isCompileTimeError(severity)) {
+ CompilerContext.current.logError(message, severity);
+ }
_printAndThrowIfDebugging(
formatWithoutLocation(message, severity), severity, null, -1);
}
diff --git a/pkg/front_end/lib/src/fasta/compiler_context.dart b/pkg/front_end/lib/src/fasta/compiler_context.dart
index 3194861..c34c57f 100644
--- a/pkg/front_end/lib/src/fasta/compiler_context.dart
+++ b/pkg/front_end/lib/src/fasta/compiler_context.dart
@@ -47,6 +47,8 @@
/// programs.
final Map<Uri, Source> uriToSource = <Uri, Source>{};
+ final List errors = <Object>[];
+
FileSystem get fileSystem => options.fileSystem;
bool enableColorsCached = null;
@@ -77,6 +79,11 @@
return command_line_reporting.formatWithoutLocation(message, severity);
}
+ void logError(Object message, Severity severity) {
+ errors.add(message);
+ errors.add(severity);
+ }
+
static CompilerContext get current {
var context = Zone.current[compilerContextKey];
if (context == 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 34ce204..5f95770 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -1372,6 +1372,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageExpectedAnInitializer = const MessageCode(
"ExpectedAnInitializer",
+ analyzerCode: "MISSING_INITIALIZER",
+ dart2jsCode: "*fatal*",
message: r"""Expected an initializer.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -3216,6 +3218,18 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeMissingAssignmentInInitializer =
+ messageMissingAssignmentInInitializer;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageMissingAssignmentInInitializer = const MessageCode(
+ "MissingAssignmentInInitializer",
+ analyzerCode: "MISSING_ASSIGNMENT_IN_INITIALIZER",
+ dart2jsCode: "*fatal*",
+ message: r"""Expected an assignment after the field name.""",
+ tip: r"""To initialize a field, use the syntax 'name = value'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeMissingConstFinalVarOrType =
messageMissingConstFinalVarOrType;
@@ -4201,6 +4215,19 @@
message: r"""An optional named parameter can't start with '_'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeRedirectingConstructorWithBody =
+ messageRedirectingConstructorWithBody;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageRedirectingConstructorWithBody = const MessageCode(
+ "RedirectingConstructorWithBody",
+ analyzerCode: "REDIRECTING_CONSTRUCTOR_WITH_BODY",
+ dart2jsCode: "*fatal*",
+ message: r"""Redirecting constructors can't have a body.""",
+ tip:
+ r"""Try removing the body, or not making this a redirecting constructor.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeRedirectionInNonFactory = messageRedirectionInNonFactory;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index a0ea650..2c46b7b 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -1420,7 +1420,7 @@
// Return the newly inserted synthetic token
// as the end of the type reference.
return token.next;
- } else if (identical(value, '<') || identical(value, 'Function')) {
+ } else if (identical(value, '<')) {
// Found a type reference, but missing an identifier after the period.
rewriteAndRecover(
token,
@@ -3294,12 +3294,57 @@
} else if (optional('super', next)) {
token = parseExpression(token);
} else if (optional('this', next)) {
- token = parseExpression(token);
+ if (!optional('(', next.next)) {
+ if (!optional('.', next.next)) {
+ // Recovery
+ reportRecoverableError(
+ next.next, fasta.templateExpectedButGot.withArguments('.'));
+ rewriter.insertTokenAfter(
+ next, new SyntheticToken(TokenType.PERIOD, next.next.offset));
+ }
+ next = next.next;
+ if (!next.next.isIdentifier) {
+ // Recovery
+ insertSyntheticIdentifier(next, IdentifierContext.fieldInitializer);
+ }
+ next = next.next;
+ }
+ if (optional('(', next.next)) {
+ token = parseExpression(token);
+ next = token.next;
+ if (optional('{', next) || optional('=>', next)) {
+ reportRecoverableError(
+ next, fasta.messageRedirectingConstructorWithBody);
+ }
+ } else {
+ if (!optional('=', next.next)) {
+ // Recovery
+ reportRecoverableError(
+ token.next, fasta.messageMissingAssignmentInInitializer);
+ next = rewriter
+ .insertTokenAfter(
+ next, new SyntheticToken(TokenType.EQ, next.next.offset))
+ .next;
+ rewriter.insertTokenAfter(next,
+ new SyntheticStringToken(TokenType.IDENTIFIER, '', next.offset));
+ }
+ token = parseExpression(token);
+ }
} else if (next.isIdentifier) {
+ if (!optional('=', next.next)) {
+ // Recovery
+ next = insertSyntheticIdentifier(
+ token, IdentifierContext.fieldInitializer,
+ message: fasta.messageMissingAssignmentInInitializer,
+ messageOnToken: next);
+ rewriter.insertTokenAfter(
+ next, new SyntheticToken(TokenType.EQ, next.offset));
+ }
token = parseExpression(token);
} else {
// Recovery
- insertSyntheticIdentifier(token, IdentifierContext.fieldInitializer);
+ insertSyntheticIdentifier(token, IdentifierContext.fieldInitializer,
+ message: fasta.messageExpectedAnInitializer, messageOnToken: token);
token = parseExpression(token);
}
listener.endInitializer(token.next);
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index 2ecd66f..0dda491 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -514,6 +514,9 @@
void endMethod(
Token getOrSet, Token beginToken, Token beginParam, Token endToken) {
debugEvent("Method");
+ // TODO(danrubel): Consider removing the beginParam parameter
+ // and using bodyToken, but pushing a NullValue on the stack
+ // in handleNoFormalParameters rather than the supplied token.
pop(); // bodyToken
Object name = pop();
Token metadata = pop();
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 7882c3b..c6e9652 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -1664,6 +1664,26 @@
ExpectedAnInitializer:
template: "Expected an initializer."
+ analyzerCode: MISSING_INITIALIZER
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { C() : {} }"
+
+MissingAssignmentInInitializer:
+ template: "Expected an assignment after the field name."
+ tip: "To initialize a field, use the syntax 'name = value'."
+ analyzerCode: MISSING_ASSIGNMENT_IN_INITIALIZER
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { C() : x(3) {} }"
+
+RedirectingConstructorWithBody:
+ template: "Redirecting constructors can't have a body."
+ tip: "Try removing the body, or not making this a redirecting constructor."
+ analyzerCode: REDIRECTING_CONSTRUCTOR_WITH_BODY
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { C() : this.x() {} }"
NotAnLvalue:
template: "Can't assign to this."
diff --git a/pkg/front_end/pubspec.yaml b/pkg/front_end/pubspec.yaml
index 370ee5b..25ed266 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.8
+version: 0.1.0-alpha.9
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.5
+ kernel: 0.3.0-alpha.9
meta: '^1.1.1'
package_config: '^1.0.1'
path: '^1.3.9'
diff --git a/pkg/front_end/testcases/regress/issue_31192.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31192.dart.direct.expect
index a3c7dee..e92df86 100644
--- a/pkg/front_end/testcases/regress/issue_31192.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_31192.dart.direct.expect
@@ -5,6 +5,7 @@
class Increment extends core::Object {
field core::int x = null;
constructor •() → void
- : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/regress/issue_31192.dart:7:18: Error: Not a valid initializer.\nTo initialize a field, use the syntax 'name = value'.\n Increment() : x++ {}\n ^" {}
+ : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/regress/issue_31192.dart:7:17: Error: '' isn't an instance field of this class.\n Increment() : x++ {}\n ^" {}
}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_31192.dart:7:17: Error: Expected an assignment after the field name.\nTo initialize a field, use the syntax 'name = value'.\n Increment() : x++ {}\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/regress/issue_31192.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31192.dart.strong.expect
index a3c7dee..e92df86 100644
--- a/pkg/front_end/testcases/regress/issue_31192.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31192.dart.strong.expect
@@ -5,6 +5,7 @@
class Increment extends core::Object {
field core::int x = null;
constructor •() → void
- : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/regress/issue_31192.dart:7:18: Error: Not a valid initializer.\nTo initialize a field, use the syntax 'name = value'.\n Increment() : x++ {}\n ^" {}
+ : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/regress/issue_31192.dart:7:17: Error: '' isn't an instance field of this class.\n Increment() : x++ {}\n ^" {}
}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_31192.dart:7:17: Error: Expected an assignment after the field name.\nTo initialize a field, use the syntax 'name = value'.\n Increment() : x++ {}\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/regress/issue_31996.dart b/pkg/front_end/testcases/regress/issue_31996.dart
new file mode 100644
index 0000000..90260dc
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_31996.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.
+
+abstract class B<T> {}
+
+abstract class C<T> {}
+
+class Base implements B {}
+
+class Child1 extends Base implements C<int> {}
+
+class Child2 extends Base implements C<double> {}
+
+main() {}
diff --git a/pkg/front_end/testcases/regress/issue_31996.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31996.dart.direct.expect
new file mode 100644
index 0000000..7b5a76e
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_31996.dart.direct.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class B<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class C<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Base extends core::Object implements self::B<dynamic> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Child1 extends self::Base implements self::C<core::int> {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+class Child2 extends self::Base implements self::C<core::double> {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/regress/issue_31996.dart.outline.expect b/pkg/front_end/testcases/regress/issue_31996.dart.outline.expect
new file mode 100644
index 0000000..5dca73f
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_31996.dart.outline.expect
@@ -0,0 +1,26 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class B<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+abstract class C<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class Base extends core::Object implements self::B<dynamic> {
+ synthetic constructor •() → void
+ ;
+}
+class Child1 extends self::Base implements self::C<core::int> {
+ synthetic constructor •() → void
+ ;
+}
+class Child2 extends self::Base implements self::C<core::double> {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/regress/issue_31996.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31996.dart.strong.expect
new file mode 100644
index 0000000..7b5a76e
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_31996.dart.strong.expect
@@ -0,0 +1,30 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class B<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+abstract class C<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Base extends core::Object implements self::B<dynamic> {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Child1 extends self::Base implements self::C<core::int> {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+class Child2 extends self::Base implements self::C<core::double> {
+ synthetic constructor •() → void
+ : super self::Base::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect b/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect
index 06a5a03..8e30b21 100644
--- a/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect
+++ b/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect
@@ -72,6 +72,8 @@
method any((self::Stream::T) → core::bool test) → self::Future<core::bool>;
get length() → self::Future<core::int>;
get isEmpty() → self::Future<core::bool>;
+ method cast<R extends core::Object>() → self::Stream<self::Stream::cast::R>;
+ method retype<R extends core::Object>() → self::Stream<self::Stream::retype::R>;
method toList() → self::Future<core::List<self::Stream::T>>;
method toSet() → self::Future<core::Set<self::Stream::T>>;
method drain<E extends core::Object>([self::Stream::drain::E futureValue]) → self::Future<self::Stream::drain::E>;
@@ -83,9 +85,9 @@
get first() → self::Future<self::Stream::T>;
get last() → self::Future<self::Stream::T>;
get single() → self::Future<self::Stream::T>;
- method firstWhere((self::Stream::T) → core::bool test, {() → core::Object defaultValue}) → self::Future<dynamic>;
- method lastWhere((self::Stream::T) → core::bool test, {() → core::Object defaultValue}) → self::Future<dynamic>;
- method singleWhere((self::Stream::T) → core::bool test) → self::Future<self::Stream::T>;
+ method firstWhere((self::Stream::T) → core::bool test, {() → dynamic defaultValue, () → self::Stream::T orElse}) → self::Future<self::Stream::T>;
+ method lastWhere((self::Stream::T) → core::bool test, {() → dynamic defaultValue, () → self::Stream::T orElse}) → self::Future<self::Stream::T>;
+ method singleWhere((self::Stream::T) → core::bool test, {() → self::Stream::T orElse}) → self::Future<self::Stream::T>;
method elementAt(core::int index) → self::Future<self::Stream::T>;
method timeout(core::Duration timeLimit, {(self::EventSink<self::Stream::T>) → void onTimeout}) → self::Stream<self::Stream::T>;
}
@@ -114,6 +116,8 @@
}
abstract class StreamTransformer<S extends core::Object, T extends core::Object> extends core::Object {
abstract method bind(self::Stream<self::StreamTransformer::S> stream) → self::Stream<self::StreamTransformer::T>;
+ abstract method cast<RS extends core::Object, RT extends core::Object>() → self::StreamTransformer<self::StreamTransformer::cast::RS, self::StreamTransformer::cast::RT>;
+ abstract method retype<RS extends core::Object, RT extends core::Object>() → self::StreamTransformer<self::StreamTransformer::retype::RS, self::StreamTransformer::retype::RT>;
}
abstract class StreamIterator<T extends core::Object> extends core::Object {
abstract method moveNext() → self::Future<core::bool>;
diff --git a/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect b/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect
index e788b61..56ce3ff 100644
--- a/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect
+++ b/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect
@@ -62,6 +62,8 @@
- any
- length
- isEmpty
+ - cast
+ - retype
- toList
- toSet
- drain
@@ -99,6 +101,8 @@
- done
- class StreamTransformer
- bind
+ - cast
+ - retype
- class StreamIterator
- moveNext
- current
diff --git a/pkg/front_end/tool/_fasta/batch.dart b/pkg/front_end/tool/_fasta/batch.dart
new file mode 100644
index 0000000..968014e
--- /dev/null
+++ b/pkg/front_end/tool/_fasta/batch.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'entry_points.dart' show batchEntryPoint;
+
+main(List<String> arguments) => batchEntryPoint(arguments);
diff --git a/pkg/front_end/tool/_fasta/entry_points.dart b/pkg/front_end/tool/_fasta/entry_points.dart
index d2304b1..aa54f46 100644
--- a/pkg/front_end/tool/_fasta/entry_points.dart
+++ b/pkg/front_end/tool/_fasta/entry_points.dart
@@ -4,16 +4,22 @@
library fasta.tool.entry_points;
-import 'dart:async' show Future;
+import 'dart:async' show Future, Stream;
-import 'dart:convert' show JSON;
+import 'dart:convert' show JSON, LineSplitter, UTF8;
-import 'dart:io' show File, exitCode;
+import 'dart:io' show File, exitCode, stderr, stdin, stdout;
import 'package:compiler/src/kernel/dart2js_target.dart' show Dart2jsTarget;
+import 'package:kernel/kernel.dart'
+ show CanonicalName, Library, Program, Source, loadProgramFromBytes;
+
import 'package:kernel/target/targets.dart' show TargetFlags, targets;
+import 'package:front_end/src/base/processed_options.dart'
+ show ProcessedOptions;
+
import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/fasta/deprecated_problems.dart'
@@ -33,8 +39,6 @@
import 'package:front_end/src/fasta/uri_translator.dart' show UriTranslator;
-import 'package:kernel/kernel.dart' show Program, loadProgramFromBytes;
-
import 'command_line.dart' show withGlobalOptions;
const bool summary = const bool.fromEnvironment("summary", defaultValue: false);
@@ -73,6 +77,78 @@
}
}
+batchEntryPoint(List<String> arguments) {
+ return new BatchCompiler(
+ stdin.transform(UTF8.decoder).transform(new LineSplitter()))
+ .run();
+}
+
+class BatchCompiler {
+ final Stream lines;
+
+ Uri platformUri;
+
+ Program platformComponent;
+
+ BatchCompiler(this.lines);
+
+ run() async {
+ await for (String line in lines) {
+ try {
+ if (await batchCompile(line)) {
+ stdout.writeln(">>> TEST OK");
+ } else {
+ stdout.writeln(">>> TEST FAIL");
+ }
+ } catch (e, trace) {
+ stderr.writeln("Unhandled exception:\n $e");
+ stderr.writeln(trace);
+ stdout.writeln(">>> TEST CRASH");
+ }
+ await stdout.flush();
+ stderr.writeln(">>> EOF STDERR");
+ await stderr.flush();
+ }
+ }
+
+ Future<bool> batchCompile(String line) async {
+ List<String> arguments = new List<String>.from(JSON.decode(line));
+ try {
+ return await withGlobalOptions("compile", arguments, true,
+ (CompilerContext c, _) async {
+ ProcessedOptions options = c.options;
+ bool verbose = options.verbose;
+ Ticker ticker = new Ticker(isVerbose: verbose);
+ if (verbose) {
+ print("Compiling directly to Kernel: $line");
+ }
+ if (platformComponent == null || platformUri != options.sdkSummary) {
+ platformUri = options.sdkSummary;
+ platformComponent = await options.loadSdkSummary(null);
+ } else {
+ options.sdkSummaryComponent = platformComponent;
+ }
+ CompileTask task = new CompileTask(c, ticker);
+ await task.compile(sansPlatform: true);
+ CanonicalName root = platformComponent.root;
+ for (Library library in platformComponent.libraries) {
+ library.parent = platformComponent;
+ CanonicalName name = library.reference.canonicalName;
+ if (name != null && name.parent != root) {
+ root.adoptChild(name);
+ }
+ }
+ root.unbindAll();
+ return c.errors.isEmpty;
+ });
+ } on deprecated_InputError catch (e) {
+ CompilerContext.runWithDefaultOptions(
+ (c) => c.report(deprecated_InputError.toMessage(e), Severity.error));
+ return false;
+ }
+ }
+}
+
Future<KernelTarget> outline(List<String> arguments) async {
try {
return await withGlobalOptions("outline", arguments, true,
@@ -159,14 +235,27 @@
return kernelTarget;
}
- Future<Uri> compile() async {
+ Future<Uri> compile({bool sansPlatform: false}) async {
KernelTarget kernelTarget = await buildOutline();
if (exitCode != 0) return null;
Uri uri = c.options.output;
- var program = await kernelTarget.buildProgram(verify: c.options.verify);
+ Program program = await kernelTarget.buildProgram(verify: c.options.verify);
if (c.options.debugDump) {
printProgramText(program, libraryFilter: kernelTarget.isSourceLibrary);
}
+ if (sansPlatform) {
+ program.computeCanonicalNames();
+ Program userCode = new Program(
+ nameRoot: program.root,
+ uriToSource: new Map<Uri, Source>.from(program.uriToSource));
+ userCode.mainMethodName = program.mainMethodName;
+ for (Library library in program.libraries) {
+ if (library.importUri.scheme != "dart") {
+ userCode.libraries.add(library);
+ }
+ }
+ program = userCode;
+ }
await writeProgramToFile(program, uri);
ticker.logMs("Wrote program to ${uri.toFilePath()}");
return uri;
diff --git a/pkg/front_end/tool/fasta b/pkg/front_end/tool/fasta
index 97a1833..eb455cd 100755
--- a/pkg/front_end/tool/fasta
+++ b/pkg/front_end/tool/fasta
@@ -54,9 +54,7 @@
PATCHED_SDK_DIR=$(
ls -d {xcodebuild,out}/${DART_CONFIGURATION} 2>/dev/null \
| head -1)
- exec "${DART_VM}" -DDFE_VERBOSE=true \
- --kernel-binaries=${PATCHED_SDK_DIR} \
- --dfe="${REPO_DIR}/pkg/vm/bin/kernel_service.dart" "$@"
+ exec "${DART_VM}" --preview_dart_2 -DDFE_VERBOSE=true "$@"
;;
testing)
SCRIPT="${REPO_DIR}/pkg/testing/bin/testing.dart"
diff --git a/pkg/kernel/lib/class_hierarchy.dart b/pkg/kernel/lib/class_hierarchy.dart
index 0a74e92..53ec37b 100644
--- a/pkg/kernel/lib/class_hierarchy.dart
+++ b/pkg/kernel/lib/class_hierarchy.dart
@@ -26,6 +26,7 @@
}
onAmbiguousSupertypes ??= (Class cls, Supertype a, Supertype b) {
if (!cls.isSyntheticMixinImplementation) {
+ // See https://github.com/dart-lang/sdk/issues/32091
throw "$cls can't implement both $a and $b";
}
};
@@ -945,27 +946,13 @@
_ClassInfo superInfo = _infoFor[supertype.classNode];
if (supertype.typeArguments.isEmpty) {
if (superInfo.genericSuperTypes == null) return;
- // Since the immediate super type is not generic, all entries in its
- // super type map are also valid entries for this class.
- if (subInfo.genericSuperTypes == null &&
- superInfo.ownsGenericSuperTypeMap) {
- // Instead of copying the map, take ownership of the map object.
- // This may result in more entries being added to the map later. Those
- // are not valid for the super type, but it works out because all
- // lookups in the map are guarded by a subtype check, so the super type
- // will not be bothered by the extra entries.
- subInfo.genericSuperTypes = superInfo.genericSuperTypes;
- superInfo.ownsGenericSuperTypeMap = false;
- } else {
- // Copy over the super type entries.
- subInfo.genericSuperTypes ??= <Class, List<Supertype>>{};
- superInfo.genericSuperTypes
- ?.forEach((Class key, List<Supertype> types) {
- for (Supertype type in types) {
- subInfo.recordGenericSuperType(key, type, _onAmbiguousSupertypes);
- }
- });
- }
+ // Copy over the super type entries.
+ subInfo.genericSuperTypes ??= <Class, List<Supertype>>{};
+ superInfo.genericSuperTypes?.forEach((Class key, List<Supertype> types) {
+ for (Supertype type in types) {
+ subInfo.recordGenericSuperType(key, type, _onAmbiguousSupertypes);
+ }
+ });
} else {
// Copy over all transitive generic super types, and substitute the
// free variables with those provided in [supertype].
@@ -1066,10 +1053,7 @@
int getSuperTypeHashTableSize() {
int sum = 0;
for (Class class_ in classes) {
- _ClassInfo info = _infoFor[class_];
- if (info.ownsGenericSuperTypeMap) {
- sum += _infoFor[class_].genericSuperTypes?.length ?? 0;
- }
+ sum += _infoFor[class_].genericSuperTypes?.length ?? 0;
}
return sum;
}
@@ -1204,29 +1188,8 @@
///
/// E.g. `List` maps to `List<String>` for a class that directly of indirectly
/// implements `List<String>`.
- ///
- /// However, the map may contain additional entries for classes that are not
- /// supertypes of this class, so that a single map object can be shared
- /// between different classes. Lookups into the map should therefore be
- /// guarded by a subtype check.
- ///
- /// For example:
- ///
- /// class Q<T>
- /// class A<T>
- ///
- /// class B extends A<String>
- /// class C extends B implements Q<int>
- ///
- /// In this case, a single map object `{A: A<String>, Q: Q<int>}` may be
- /// shared by the classes `B` and `C`.
Map<Class, List<Supertype>> genericSuperTypes;
- /// If true, this is the current "owner" of [genericSuperTypes], meaning
- /// we may add additional entries to the map or transfer ownership to another
- /// class.
- bool ownsGenericSuperTypeMap = true;
-
/// Instance fields, getters, methods, and operators declared in this class
/// or its mixed-in class, sorted according to [_compareMembers].
List<Member> declaredGettersAndCalls;
diff --git a/pkg/kernel/pubspec.yaml b/pkg/kernel/pubspec.yaml
index 4a5212c..c3ca880 100644
--- a/pkg/kernel/pubspec.yaml
+++ b/pkg/kernel/pubspec.yaml
@@ -1,5 +1,5 @@
name: kernel
-version: 0.3.0-alpha.5
+version: 0.3.0-alpha.9
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.8
+ front_end: 0.1.0-alpha.9
test: ^0.12.15+6
stack_trace: ^1.6.6
ansicolor: ^0.0.9
diff --git a/pkg/kernel/test/reify/suite.dart b/pkg/kernel/test/reify/suite.dart
index 0d7aca2..b9a70a8 100644
--- a/pkg/kernel/test/reify/suite.dart
+++ b/pkg/kernel/test/reify/suite.dart
@@ -140,10 +140,7 @@
File generated = new File.fromUri(uri);
StdioProcess process;
try {
- var args = [
- '--kernel-binaries=${context.platformBinaries.toFilePath()}',
- generated.path
- ];
+ var args = [generated.path];
process = await StdioProcess.run(context.vm.toFilePath(), args);
print(process.output);
} finally {
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 2fa7f84..78d03b8 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -52,6 +52,7 @@
[ $compiler == dart2analyzer ]
dev_compiler/test/options/*: SkipByDesign
+typed_mock/test/typed_mock_test: StaticWarning
[ $compiler != dart2analyzer ]
analyzer/test/src/summary/summarize_fasta_test: RuntimeError, Slow
diff --git a/pkg/vm/bin/gen_kernel.dart b/pkg/vm/bin/gen_kernel.dart
index 1a5b13c..be3b85d 100644
--- a/pkg/vm/bin/gen_kernel.dart
+++ b/pkg/vm/bin/gen_kernel.dart
@@ -12,6 +12,8 @@
import 'package:kernel/src/tool/batch_util.dart' as batch_util;
import 'package:kernel/target/targets.dart' show TargetFlags;
import 'package:kernel/target/vm.dart' show VmTarget;
+import 'package:kernel/text/ast_to_text.dart'
+ show globalDebuggingNames, NameSystem;
import 'package:vm/kernel_front_end.dart' show compileToKernel, ErrorDetector;
final ArgParser _argParser = new ArgParser(allowTrailingOptions: true)
@@ -109,6 +111,10 @@
// report the compilation result accordingly.
//
final exitCode = await compile(arguments);
+
+ // Re-create global NameSystem to avoid accumulating garbage.
+ globalDebuggingNames = new NameSystem();
+
switch (exitCode) {
case 0:
return batch_util.CompilerOutcome.Ok;
diff --git a/pkg/vm/tool/dart2 b/pkg/vm/tool/dart2
index 66ac062..e127775 100755
--- a/pkg/vm/tool/dart2
+++ b/pkg/vm/tool/dart2
@@ -38,11 +38,10 @@
DART_BINARY="$BUILD_DIR"/dart
KERNEL_BINARIES_DIR="$BUILD_DIR"
fi
-KERNEL_SERVICE_SNAPSHOT="$BUILD_DIR"/gen/kernel-service.dart.snapshot
exec "$DART_BINARY" \
+ --preview_dart_2 \
--strong \
--reify-generic-functions \
--limit-ints-to-64-bits \
- --dfe="$KERNEL_SERVICE_SNAPSHOT" \
"$@"
diff --git a/pkg/vm/tool/dart2.bat b/pkg/vm/tool/dart2.bat
index 91004d6..83e73bb 100644
--- a/pkg/vm/tool/dart2.bat
+++ b/pkg/vm/tool/dart2.bat
@@ -35,4 +35,4 @@
)
set KERNEL_SERVICE_SNAPSHOT=%BUILD_DIR%/gen/kernel-service.dart.snapshot
-"%DART_BINARY%" --strong --reify-generic-functions --limit-ints-to-64-bits --dfe="%KERNEL_SERVICE_SNAPSHOT%" --kernel-binaries="%KERNEL_BINARIES_DIR%" %*
+"%DART_BINARY%" --preview_dart_2 --strong --reify-generic-functions --limit-ints-to-64-bits %*
diff --git a/runtime/bin/dfe.h b/runtime/bin/dfe.h
index 72dacfe..9d5e471 100644
--- a/runtime/bin/dfe.h
+++ b/runtime/bin/dfe.h
@@ -95,7 +95,6 @@
void* platform_strong_program_;
// Kernel binary specified on the cmd line.
- // Loaded instead of platform if --kernel-binaries is not specified.
void* application_kernel_binary_;
DISALLOW_COPY_AND_ASSIGN(DFE);
diff --git a/runtime/bin/platform.h b/runtime/bin/platform.h
index d174902..7361772 100644
--- a/runtime/bin/platform.h
+++ b/runtime/bin/platform.h
@@ -91,6 +91,9 @@
static DART_NORETURN void Exit(int exit_code);
private:
+ static void SaveConsoleConfiguration();
+ static void RestoreConsoleConfiguration();
+
// The path to the executable.
static const char* executable_name_;
// The path to the resolved executable.
diff --git a/runtime/bin/platform_android.cc b/runtime/bin/platform_android.cc
index 7e3f880..9f29cb5 100644
--- a/runtime/bin/platform_android.cc
+++ b/runtime/bin/platform_android.cc
@@ -7,13 +7,16 @@
#include "bin/platform.h"
+#include <errno.h> // NOLINT
#include <signal.h> // NOLINT
#include <string.h> // NOLINT
#include <sys/utsname.h> // NOLINT
+#include <termios.h> // NOLINT
#include <unistd.h> // NOLINT
#include "bin/fdutils.h"
#include "bin/file.h"
+#include "platform/signal_blocker.h"
namespace dart {
namespace bin {
@@ -28,6 +31,53 @@
abort();
}
+class PlatformPosix {
+ public:
+ static void SaveConsoleConfiguration() {
+ SaveConsoleConfigurationHelper(STDOUT_FILENO, &stdout_initial_c_lflag_);
+ SaveConsoleConfigurationHelper(STDERR_FILENO, &stderr_initial_c_lflag_);
+ SaveConsoleConfigurationHelper(STDIN_FILENO, &stdin_initial_c_lflag_);
+ }
+
+ static void RestoreConsoleConfiguration() {
+ RestoreConsoleConfigurationHelper(STDOUT_FILENO, stdout_initial_c_lflag_);
+ RestoreConsoleConfigurationHelper(STDERR_FILENO, stderr_initial_c_lflag_);
+ RestoreConsoleConfigurationHelper(STDIN_FILENO, stdin_initial_c_lflag_);
+ stdout_initial_c_lflag_ = -1;
+ stderr_initial_c_lflag_ = -1;
+ stdin_initial_c_lflag_ = -1;
+ }
+
+ private:
+ static tcflag_t stdout_initial_c_lflag_;
+ static tcflag_t stderr_initial_c_lflag_;
+ static tcflag_t stdin_initial_c_lflag_;
+
+ static void SaveConsoleConfigurationHelper(intptr_t fd, tcflag_t* flag) {
+ ASSERT(flag != NULL);
+ struct termios term;
+ int status = NO_RETRY_EXPECTED(tcgetattr(fd, &term));
+ if (status != 0) {
+ return;
+ }
+ *flag = term.c_lflag;
+ }
+
+ static void RestoreConsoleConfigurationHelper(intptr_t fd, tcflag_t flag) {
+ struct termios term;
+ int status = NO_RETRY_EXPECTED(tcgetattr(fd, &term));
+ if (status != 0) {
+ return;
+ }
+ term.c_lflag = flag;
+ NO_RETRY_EXPECTED(tcsetattr(fd, TCSANOW, &term));
+ }
+};
+
+tcflag_t PlatformPosix::stdout_initial_c_lflag_ = 0;
+tcflag_t PlatformPosix::stderr_initial_c_lflag_ = 0;
+tcflag_t PlatformPosix::stdin_initial_c_lflag_ = 0;
+
bool Platform::Initialize() {
// Turn off the signal handler for SIGPIPE as it causes the process
// to terminate on writing to a closed pipe. Without the signal
@@ -62,7 +112,7 @@
perror("sigaction() failed.");
return false;
}
-
+ SaveConsoleConfiguration();
return true;
}
@@ -142,9 +192,18 @@
}
void Platform::Exit(int exit_code) {
+ RestoreConsoleConfiguration();
exit(exit_code);
}
+void Platform::SaveConsoleConfiguration() {
+ PlatformPosix::SaveConsoleConfiguration();
+}
+
+void Platform::RestoreConsoleConfiguration() {
+ PlatformPosix::RestoreConsoleConfiguration();
+}
+
} // namespace bin
} // namespace dart
diff --git a/runtime/bin/platform_fuchsia.cc b/runtime/bin/platform_fuchsia.cc
index cda405e..d0277e0 100644
--- a/runtime/bin/platform_fuchsia.cc
+++ b/runtime/bin/platform_fuchsia.cc
@@ -150,6 +150,16 @@
exit(exit_code);
}
+bool Platform::SaveConsoleConfiguration() {
+ UNIMPLEMENTED();
+ return false;
+}
+
+bool Platform::RestoreConsoleConfiguration() {
+ UNIMPLEMENTED();
+ return false;
+}
+
} // namespace bin
} // namespace dart
diff --git a/runtime/bin/platform_linux.cc b/runtime/bin/platform_linux.cc
index e681f03..b087151 100644
--- a/runtime/bin/platform_linux.cc
+++ b/runtime/bin/platform_linux.cc
@@ -7,13 +7,16 @@
#include "bin/platform.h"
+#include <errno.h> // NOLINT
#include <signal.h> // NOLINT
#include <string.h> // NOLINT
#include <sys/utsname.h> // NOLINT
+#include <termios.h> // NOLINT
#include <unistd.h> // NOLINT
#include "bin/fdutils.h"
#include "bin/file.h"
+#include "platform/signal_blocker.h"
namespace dart {
namespace bin {
@@ -28,6 +31,53 @@
abort();
}
+class PlatformPosix {
+ public:
+ static void SaveConsoleConfiguration() {
+ SaveConsoleConfigurationHelper(STDOUT_FILENO, &stdout_initial_c_lflag_);
+ SaveConsoleConfigurationHelper(STDERR_FILENO, &stderr_initial_c_lflag_);
+ SaveConsoleConfigurationHelper(STDIN_FILENO, &stdin_initial_c_lflag_);
+ }
+
+ static void RestoreConsoleConfiguration() {
+ RestoreConsoleConfigurationHelper(STDOUT_FILENO, stdout_initial_c_lflag_);
+ RestoreConsoleConfigurationHelper(STDERR_FILENO, stderr_initial_c_lflag_);
+ RestoreConsoleConfigurationHelper(STDIN_FILENO, stdin_initial_c_lflag_);
+ stdout_initial_c_lflag_ = -1;
+ stderr_initial_c_lflag_ = -1;
+ stdin_initial_c_lflag_ = -1;
+ }
+
+ private:
+ static tcflag_t stdout_initial_c_lflag_;
+ static tcflag_t stderr_initial_c_lflag_;
+ static tcflag_t stdin_initial_c_lflag_;
+
+ static void SaveConsoleConfigurationHelper(intptr_t fd, tcflag_t* flag) {
+ ASSERT(flag != NULL);
+ struct termios term;
+ int status = NO_RETRY_EXPECTED(tcgetattr(fd, &term));
+ if (status != 0) {
+ return;
+ }
+ *flag = term.c_lflag;
+ }
+
+ static void RestoreConsoleConfigurationHelper(intptr_t fd, tcflag_t flag) {
+ struct termios term;
+ int status = NO_RETRY_EXPECTED(tcgetattr(fd, &term));
+ if (status != 0) {
+ return;
+ }
+ term.c_lflag = flag;
+ NO_RETRY_EXPECTED(tcsetattr(fd, TCSANOW, &term));
+ }
+};
+
+tcflag_t PlatformPosix::stdout_initial_c_lflag_ = 0;
+tcflag_t PlatformPosix::stderr_initial_c_lflag_ = 0;
+tcflag_t PlatformPosix::stdin_initial_c_lflag_ = 0;
+
bool Platform::Initialize() {
// Turn off the signal handler for SIGPIPE as it causes the process
// to terminate on writing to a closed pipe. Without the signal
@@ -62,6 +112,7 @@
perror("sigaction() failed.");
return false;
}
+ SaveConsoleConfiguration();
return true;
}
@@ -141,9 +192,18 @@
}
void Platform::Exit(int exit_code) {
+ RestoreConsoleConfiguration();
exit(exit_code);
}
+void Platform::SaveConsoleConfiguration() {
+ PlatformPosix::SaveConsoleConfiguration();
+}
+
+void Platform::RestoreConsoleConfiguration() {
+ PlatformPosix::RestoreConsoleConfiguration();
+}
+
} // namespace bin
} // namespace dart
diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc
index e563788..3f72398 100644
--- a/runtime/bin/platform_macos.cc
+++ b/runtime/bin/platform_macos.cc
@@ -12,16 +12,19 @@
#if !HOST_OS_IOS
#include <crt_externs.h> // NOLINT
#endif // !HOST_OS_IOS
+#include <errno.h> // NOLINT
#include <mach-o/dyld.h>
#include <signal.h> // NOLINT
#include <string.h> // NOLINT
#include <sys/sysctl.h> // NOLINT
#include <sys/types.h> // NOLINT
#include <sys/utsname.h> // NOLINT
+#include <termios.h> // NOLINT
#include <unistd.h> // NOLINT
#include "bin/fdutils.h"
#include "bin/file.h"
+#include "platform/signal_blocker.h"
namespace dart {
namespace bin {
@@ -36,6 +39,53 @@
abort();
}
+class PlatformPosix {
+ public:
+ static void SaveConsoleConfiguration() {
+ SaveConsoleConfigurationHelper(STDOUT_FILENO, &stdout_initial_c_lflag_);
+ SaveConsoleConfigurationHelper(STDERR_FILENO, &stderr_initial_c_lflag_);
+ SaveConsoleConfigurationHelper(STDIN_FILENO, &stdin_initial_c_lflag_);
+ }
+
+ static void RestoreConsoleConfiguration() {
+ RestoreConsoleConfigurationHelper(STDOUT_FILENO, stdout_initial_c_lflag_);
+ RestoreConsoleConfigurationHelper(STDERR_FILENO, stderr_initial_c_lflag_);
+ RestoreConsoleConfigurationHelper(STDIN_FILENO, stdin_initial_c_lflag_);
+ stdout_initial_c_lflag_ = -1;
+ stderr_initial_c_lflag_ = -1;
+ stdin_initial_c_lflag_ = -1;
+ }
+
+ private:
+ static tcflag_t stdout_initial_c_lflag_;
+ static tcflag_t stderr_initial_c_lflag_;
+ static tcflag_t stdin_initial_c_lflag_;
+
+ static void SaveConsoleConfigurationHelper(intptr_t fd, tcflag_t* flag) {
+ ASSERT(flag != NULL);
+ struct termios term;
+ int status = NO_RETRY_EXPECTED(tcgetattr(fd, &term));
+ if (status != 0) {
+ return;
+ }
+ *flag = term.c_lflag;
+ }
+
+ static void RestoreConsoleConfigurationHelper(intptr_t fd, tcflag_t flag) {
+ struct termios term;
+ int status = NO_RETRY_EXPECTED(tcgetattr(fd, &term));
+ if (status != 0) {
+ return;
+ }
+ term.c_lflag = flag;
+ NO_RETRY_EXPECTED(tcsetattr(fd, TCSANOW, &term));
+ }
+};
+
+tcflag_t PlatformPosix::stdout_initial_c_lflag_ = 0;
+tcflag_t PlatformPosix::stderr_initial_c_lflag_ = 0;
+tcflag_t PlatformPosix::stdin_initial_c_lflag_ = 0;
+
bool Platform::Initialize() {
// Turn off the signal handler for SIGPIPE as it causes the process
// to terminate on writing to a closed pipe. Without the signal
@@ -69,6 +119,7 @@
perror("sigaction() failed.");
return false;
}
+ SaveConsoleConfiguration();
return true;
}
@@ -229,9 +280,18 @@
}
void Platform::Exit(int exit_code) {
+ RestoreConsoleConfiguration();
exit(exit_code);
}
+void Platform::SaveConsoleConfiguration() {
+ PlatformPosix::SaveConsoleConfiguration();
+}
+
+void Platform::RestoreConsoleConfiguration() {
+ PlatformPosix::RestoreConsoleConfiguration();
+}
+
} // namespace bin
} // namespace dart
diff --git a/runtime/bin/platform_win.cc b/runtime/bin/platform_win.cc
index 333d57c..8b61246 100644
--- a/runtime/bin/platform_win.cc
+++ b/runtime/bin/platform_win.cc
@@ -47,6 +47,9 @@
platform_win_mutex_ = new Mutex();
saved_output_cp_ = -1;
saved_input_cp_ = -1;
+ saved_stdout_mode_ = -1;
+ saved_stderr_mode_ = -1;
+ saved_stdin_mode_ = -1;
// Set up a no-op handler so that CRT functions return an error instead of
// hitting an assertion failure.
// See: https://msdn.microsoft.com/en-us/library/a9yf33zb.aspx
@@ -83,6 +86,9 @@
// Set both the input and output code pages to UTF8.
ASSERT(saved_output_cp_ == -1);
ASSERT(saved_input_cp_ == -1);
+ ASSERT(saved_stdout_mode_ == -1);
+ ASSERT(saved_stderr_mode_ == -1);
+ ASSERT(saved_stdin_mode_ == -1);
const int output_cp = GetConsoleOutputCP();
const int input_cp = GetConsoleCP();
if (output_cp != CP_UTF8) {
@@ -95,12 +101,11 @@
}
// Try to set the bits for ANSI support, but swallow any failures.
- HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
- DWORD out_mode;
- if ((out != INVALID_HANDLE_VALUE) && GetConsoleMode(out, &out_mode)) {
- const DWORD request = out_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
- SetConsoleMode(out, request);
- }
+ saved_stdout_mode_ =
+ ModifyMode(STD_OUTPUT_HANDLE, ENABLE_VIRTUAL_TERMINAL_PROCESSING);
+ saved_stderr_mode_ = ModifyMode(STD_ERROR_HANDLE, 0);
+ saved_stdin_mode_ = ModifyMode(STD_INPUT_HANDLE, 0);
+
// TODO(28984): Due to issue #29104, we cannot set
// ENABLE_VIRTUAL_TERMINAL_INPUT here, as it causes ENABLE_PROCESSED_INPUT
// to be ignored.
@@ -133,43 +138,54 @@
static Mutex* platform_win_mutex_;
static int saved_output_cp_;
static int saved_input_cp_;
+ static DWORD saved_stdout_mode_;
+ static DWORD saved_stderr_mode_;
+ static DWORD saved_stdin_mode_;
- static void RestoreConsoleLocked() {
- // STD_OUTPUT_HANDLE and STD_INPUT_HANDLE may have been closed or
- // redirected. Therefore, we explicitly open the CONOUT$ and CONIN$
- // devices, so that we can be sure that we are really unsetting
- // ENABLE_VIRTUAL_TERMINAL_PROCESSING and ENABLE_VIRTUAL_TERMINAL_INPUT
- // respectively.
+ static DWORD ModifyMode(DWORD handle, DWORD flags) {
+ HANDLE h = GetStdHandle(handle);
+ DWORD mode;
+ DWORD old_mode = 0;
+
+ if ((h != INVALID_HANDLE_VALUE) && GetConsoleMode(h, &mode)) {
+ old_mode = mode;
+ if (flags != 0) {
+ const DWORD request = mode | flags;
+ SetConsoleMode(h, request);
+ }
+ }
+ return old_mode;
+ }
+
+ static void CleanupDevices(const char* device,
+ DWORD handle,
+ DWORD orig_flags) {
const intptr_t kWideBufLen = 64;
- const char* conout = "CONOUT$";
wchar_t widebuf[kWideBufLen];
int result =
- MultiByteToWideChar(CP_UTF8, 0, conout, -1, widebuf, kWideBufLen);
+ MultiByteToWideChar(CP_UTF8, 0, device, -1, widebuf, kWideBufLen);
ASSERT(result != 0);
- HANDLE out = CreateFileW(widebuf, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
- if (out != INVALID_HANDLE_VALUE) {
- SetStdHandle(STD_OUTPUT_HANDLE, out);
+ HANDLE h = CreateFileW(widebuf, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
+ if (h != INVALID_HANDLE_VALUE) {
+ SetStdHandle(STD_OUTPUT_HANDLE, h);
+ if (orig_flags != -1) {
+ SetConsoleMode(h, orig_flags);
+ }
}
- DWORD out_mode;
- if ((out != INVALID_HANDLE_VALUE) && GetConsoleMode(out, &out_mode)) {
- DWORD request = out_mode & ~ENABLE_VIRTUAL_TERMINAL_INPUT;
- SetConsoleMode(out, request);
- }
+ }
- const char* conin = "CONIN$";
- result = MultiByteToWideChar(CP_UTF8, 0, conin, -1, widebuf, kWideBufLen);
- ASSERT(result != 0);
- HANDLE in = CreateFileW(widebuf, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
- if (in != INVALID_HANDLE_VALUE) {
- SetStdHandle(STD_INPUT_HANDLE, in);
- }
- DWORD in_mode;
- if ((in != INVALID_HANDLE_VALUE) && GetConsoleMode(in, &in_mode)) {
- DWORD request = in_mode & ~ENABLE_VIRTUAL_TERMINAL_INPUT;
- SetConsoleMode(in, request);
- }
+ static void RestoreConsoleLocked() {
+ // STD_OUTPUT_HANDLE, STD_ERROR_HANDLE, and STD_INPUT_HANDLE may have been
+ // closed or redirected. Therefore, we explicitly open the CONOUT$, CONERR$
+ // and CONIN$ devices, so that we can be sure that we are really restoring
+ // the console to its original state.
+ CleanupDevices("CONOUT$", STD_OUTPUT_HANDLE, saved_stdout_mode_);
+ saved_stdout_mode_ = -1;
+ CleanupDevices("CONERR$", STD_ERROR_HANDLE, saved_stderr_mode_);
+ saved_stderr_mode_ = -1;
+ CleanupDevices("CONIN$", STD_INPUT_HANDLE, saved_stdin_mode_);
+ saved_stdin_mode_ = -1;
if (saved_output_cp_ != -1) {
SetConsoleOutputCP(saved_output_cp_);
@@ -196,11 +212,15 @@
int PlatformWin::saved_output_cp_ = -1;
int PlatformWin::saved_input_cp_ = -1;
+DWORD PlatformWin::saved_stdout_mode_ = -1;
+DWORD PlatformWin::saved_stderr_mode_ = -1;
+DWORD PlatformWin::saved_stdin_mode_ = -1;
+
Mutex* PlatformWin::platform_win_mutex_ = NULL;
bool Platform::Initialize() {
PlatformWin::InitOnce();
- PlatformWin::SaveAndConfigureConsole();
+ SaveConsoleConfiguration();
return true;
}
@@ -385,12 +405,20 @@
// TODO(zra): Remove once VM shuts down cleanly.
::dart::private_flag_windows_run_tls_destructors = false;
// Restore the console's output code page
- PlatformWin::RestoreConsole();
+ RestoreConsoleConfiguration();
// On Windows we use ExitProcess so that threads can't clobber the exit_code.
// See: https://code.google.com/p/nativeclient/issues/detail?id=2870
::ExitProcess(exit_code);
}
+void Platform::SaveConsoleConfiguration() {
+ PlatformWin::SaveAndConfigureConsole();
+}
+
+void Platform::RestoreConsoleConfiguration() {
+ PlatformWin::RestoreConsole();
+}
+
} // namespace bin
} // namespace dart
diff --git a/runtime/bin/thread_fuchsia.cc b/runtime/bin/thread_fuchsia.cc
index f424ebb..64e7fce 100644
--- a/runtime/bin/thread_fuchsia.cc
+++ b/runtime/bin/thread_fuchsia.cc
@@ -9,7 +9,6 @@
#include "bin/thread_fuchsia.h"
#include <errno.h> // NOLINT
-#include <sys/resource.h> // NOLINT
#include <sys/time.h> // NOLINT
#include "platform/assert.h"
diff --git a/runtime/observatory/tests/service/breakpoint_in_parts_class_part.dart b/runtime/observatory/tests/service/breakpoint_in_parts_class_part.dart
index 2da4190..4855332 100644
--- a/runtime/observatory/tests/service/breakpoint_in_parts_class_part.dart
+++ b/runtime/observatory/tests/service/breakpoint_in_parts_class_part.dart
@@ -88,4 +88,4 @@
}
}
-var foo2 = foo();
+var foo2 = foo() as dynamic;
diff --git a/runtime/observatory/tests/service/service_test_common.dart b/runtime/observatory/tests/service/service_test_common.dart
index 254ee14..71eea66 100644
--- a/runtime/observatory/tests/service/service_test_common.dart
+++ b/runtime/observatory/tests/service/service_test_common.dart
@@ -552,7 +552,8 @@
bool isKernel() {
for (String argument in Platform.executableArguments) {
- if (argument.startsWith("--dfe=")) return true;
+ if (argument.startsWith("--preview_dart_2") || argument.startsWith("--dfe"))
+ return true;
}
return false;
}
diff --git a/runtime/platform/utils.h b/runtime/platform/utils.h
index 04e2241..69a615c 100644
--- a/runtime/platform/utils.h
+++ b/runtime/platform/utils.h
@@ -31,7 +31,7 @@
static inline T Abs(T x) {
// Note: as a general rule, it is not OK to use STL in Dart VM.
// However, std::numeric_limits<T>::min() and max() are harmless
- // and worthwile exception from this rule.
+ // and worthwhile exception from this rule.
ASSERT(x != std::numeric_limits<T>::min());
if (x < 0) return -x;
return x;
@@ -45,7 +45,7 @@
if (x < 0) {
// Note: as a general rule, it is not OK to use STL in Dart VM.
// However, std::numeric_limits<T>::min() and max() are harmless
- // and worthwile exception from this rule.
+ // and worthwhile exception from this rule.
if (x == std::numeric_limits<T>::min()) {
return std::numeric_limits<T>::max();
}
diff --git a/runtime/tests/vm/dart/wrap_around_in_range_analysis_test.dart b/runtime/tests/vm/dart/wrap_around_in_range_analysis_test.dart
new file mode 100644
index 0000000..3ef127d
--- /dev/null
+++ b/runtime/tests/vm/dart/wrap_around_in_range_analysis_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// VMOptions=--no-background-compilation --enable-inlining-annotations
+
+// Test for overflow (wrap-around) during computations in range analysis.
+
+import "package:expect/expect.dart";
+
+const NeverInline = 'NeverInline';
+
+@NeverInline
+int foofoo(int b) {
+ for (int i = 0x7ffffffffffffffc; i <= b; i += 2) {
+ if (i < 0) {
+ return i - 0x4000000000000000;
+ }
+ }
+ return 0;
+}
+
+main() {
+ for (var i = 0; i < 10000; i++) {
+ foofoo(0x7fffffffffffffff);
+ }
+ Expect.equals(foofoo(0x7fffffffffffffff), 4611686018427387904);
+}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 9ca4e38..ee0eaf1 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -62,6 +62,7 @@
dart/simd128float32_array_test: Skip # compilers not aware of Simd128
dart/simd128float32_test: Skip # compilers not aware of Simd128
dart/truncating_ints_test: Skip # dart2js doesn't know about --limit-ints-to-64-bits
+dart/wrap_around_in_range_analysis_test: SkipByDesign # The test requires int64.
[ $compiler == dartk ]
cc/DartAPI_New: Crash
@@ -386,6 +387,9 @@
[ $compiler == none && $runtime == drt ]
dart/truncating_ints_test: Skip # Issue 14651
+[ $compiler == precompiler && $runtime == dart_precompiled ]
+dart/optimized_stacktrace_line_and_column_test: RuntimeError, OK # AOT lacks column information
+
[ $mode == debug && $system == windows ]
dart/spawn_shutdown_test: Skip # Flaky crashes unable to start thread; likely low memory on the bot.
diff --git a/runtime/vm/compiler/assembler/assembler.h b/runtime/vm/compiler/assembler/assembler.h
index cb8f495..daa31a5 100644
--- a/runtime/vm/compiler/assembler/assembler.h
+++ b/runtime/vm/compiler/assembler/assembler.h
@@ -24,6 +24,80 @@
class AssemblerBuffer;
class MemoryRegion;
+class Label : public ValueObject {
+ public:
+ Label() : position_(0), unresolved_(0) {
+#ifdef DEBUG
+ for (int i = 0; i < kMaxUnresolvedBranches; i++) {
+ unresolved_near_positions_[i] = -1;
+ }
+#endif // DEBUG
+ }
+
+ ~Label() {
+ // Assert if label is being destroyed with unresolved branches pending.
+ ASSERT(!IsLinked());
+ ASSERT(!HasNear());
+ }
+
+ // Returns the position for bound and linked labels. Cannot be used
+ // for unused labels.
+ intptr_t Position() const {
+ ASSERT(!IsUnused());
+ return IsBound() ? -position_ - kWordSize : position_ - kWordSize;
+ }
+
+ intptr_t LinkPosition() const {
+ ASSERT(IsLinked());
+ return position_ - kWordSize;
+ }
+
+ intptr_t NearPosition() {
+ ASSERT(HasNear());
+ return unresolved_near_positions_[--unresolved_];
+ }
+
+ bool IsBound() const { return position_ < 0; }
+ bool IsUnused() const { return position_ == 0 && unresolved_ == 0; }
+ bool IsLinked() const { return position_ > 0; }
+ bool HasNear() const { return unresolved_ != 0; }
+
+ private:
+#if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_IA32)
+ static const int kMaxUnresolvedBranches = 20;
+#else
+ static const int kMaxUnresolvedBranches = 1; // Unused on non-Intel.
+#endif
+
+ intptr_t position_;
+ intptr_t unresolved_;
+ intptr_t unresolved_near_positions_[kMaxUnresolvedBranches];
+
+ void Reinitialize() { position_ = 0; }
+
+ void BindTo(intptr_t position) {
+ ASSERT(!IsBound());
+ ASSERT(!HasNear());
+ position_ = -position - kWordSize;
+ ASSERT(IsBound());
+ }
+
+ void LinkTo(intptr_t position) {
+ ASSERT(!IsBound());
+ position_ = position + kWordSize;
+ ASSERT(IsLinked());
+ }
+
+ void NearLinkTo(intptr_t position) {
+ ASSERT(!IsBound());
+ ASSERT(unresolved_ < kMaxUnresolvedBranches);
+ unresolved_near_positions_[unresolved_++] = position;
+ }
+
+ friend class Assembler;
+ DISALLOW_COPY_AND_ASSIGN(Label);
+};
+
// External labels keep a function pointer to allow them
// to be called from code generated by the assembler.
class ExternalLabel : public ValueObject {
diff --git a/runtime/vm/compiler/assembler/assembler_arm.h b/runtime/vm/compiler/assembler/assembler_arm.h
index fafeff5..b13d839 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.h
+++ b/runtime/vm/compiler/assembler/assembler_arm.h
@@ -64,47 +64,6 @@
B27 = 1 << 27,
};
-class Label : public ValueObject {
- public:
- Label() : position_(0) {}
-
- ~Label() {
- // Assert if label is being destroyed with unresolved branches pending.
- ASSERT(!IsLinked());
- }
-
- // Returns the position for bound and linked labels. Cannot be used
- // for unused labels.
- intptr_t Position() const {
- ASSERT(!IsUnused());
- return IsBound() ? -position_ - kWordSize : position_ - kWordSize;
- }
-
- bool IsBound() const { return position_ < 0; }
- bool IsUnused() const { return position_ == 0; }
- bool IsLinked() const { return position_ > 0; }
-
- private:
- intptr_t position_;
-
- void Reinitialize() { position_ = 0; }
-
- void BindTo(intptr_t position) {
- ASSERT(!IsBound());
- position_ = -position - kWordSize;
- ASSERT(IsBound());
- }
-
- void LinkTo(intptr_t position) {
- ASSERT(!IsBound());
- position_ = position + kWordSize;
- ASSERT(IsLinked());
- }
-
- friend class Assembler;
- DISALLOW_COPY_AND_ASSIGN(Label);
-};
-
class ArmEncode : public AllStatic {
public:
static inline uint32_t Rd(Register rd) {
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.h b/runtime/vm/compiler/assembler/assembler_arm64.h
index ce1f83b..4a9c450 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.h
+++ b/runtime/vm/compiler/assembler/assembler_arm64.h
@@ -41,47 +41,6 @@
friend class Assembler;
};
-class Label : public ValueObject {
- public:
- Label() : position_(0) {}
-
- ~Label() {
- // Assert if label is being destroyed with unresolved branches pending.
- ASSERT(!IsLinked());
- }
-
- // Returns the position for bound and linked labels. Cannot be used
- // for unused labels.
- intptr_t Position() const {
- ASSERT(!IsUnused());
- return IsBound() ? -position_ - kWordSize : position_ - kWordSize;
- }
-
- bool IsBound() const { return position_ < 0; }
- bool IsUnused() const { return position_ == 0; }
- bool IsLinked() const { return position_ > 0; }
-
- private:
- intptr_t position_;
-
- void Reinitialize() { position_ = 0; }
-
- void BindTo(intptr_t position) {
- ASSERT(!IsBound());
- position_ = -position - kWordSize;
- ASSERT(IsBound());
- }
-
- void LinkTo(intptr_t position) {
- ASSERT(!IsBound());
- position_ = position + kWordSize;
- ASSERT(IsLinked());
- }
-
- friend class Assembler;
- DISALLOW_COPY_AND_ASSIGN(Label);
-};
-
class Arm64Encode : public AllStatic {
public:
static inline uint32_t Rd(Register rd) {
diff --git a/runtime/vm/compiler/assembler/assembler_dbc.h b/runtime/vm/compiler/assembler/assembler_dbc.h
index 794ec1b..29e6d3a 100644
--- a/runtime/vm/compiler/assembler/assembler_dbc.h
+++ b/runtime/vm/compiler/assembler/assembler_dbc.h
@@ -25,47 +25,6 @@
Address();
};
-class Label : public ValueObject {
- public:
- Label() : position_(0) {}
-
- ~Label() {
- // Assert if label is being destroyed with unresolved branches pending.
- ASSERT(!IsLinked());
- }
-
- // Returns the position for bound and linked labels. Cannot be used
- // for unused labels.
- intptr_t Position() const {
- ASSERT(!IsUnused());
- return IsBound() ? -position_ - kWordSize : position_ - kWordSize;
- }
-
- bool IsBound() const { return position_ < 0; }
- bool IsUnused() const { return position_ == 0; }
- bool IsLinked() const { return position_ > 0; }
-
- private:
- intptr_t position_;
-
- void Reinitialize() { position_ = 0; }
-
- void BindTo(intptr_t position) {
- ASSERT(!IsBound());
- position_ = -position - kWordSize;
- ASSERT(IsBound());
- }
-
- void LinkTo(intptr_t position) {
- ASSERT(!IsBound());
- position_ = position + kWordSize;
- ASSERT(IsLinked());
- }
-
- friend class Assembler;
- DISALLOW_COPY_AND_ASSIGN(Label);
-};
-
class Assembler : public ValueObject {
public:
explicit Assembler(bool use_far_branches = false) : buffer_(), comments_() {}
diff --git a/runtime/vm/compiler/assembler/assembler_ia32.h b/runtime/vm/compiler/assembler/assembler_ia32.h
index 8c861e4..0164bab 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32.h
+++ b/runtime/vm/compiler/assembler/assembler_ia32.h
@@ -221,74 +221,6 @@
}
};
-class Label : public ValueObject {
- public:
- Label() : position_(0), unresolved_(0) {
-#ifdef DEBUG
- for (int i = 0; i < kMaxUnresolvedBranches; i++) {
- unresolved_near_positions_[i] = -1;
- }
-#endif // DEBUG
- }
-
- ~Label() {
- // Assert if label is being destroyed with unresolved branches pending.
- ASSERT(!IsLinked());
- ASSERT(!HasNear());
- }
-
- // Returns the position for bound labels. Cannot be used for unused or linked
- // labels.
- intptr_t Position() const {
- ASSERT(IsBound());
- return -position_ - kWordSize;
- }
-
- intptr_t LinkPosition() const {
- ASSERT(IsLinked());
- return position_ - kWordSize;
- }
-
- intptr_t NearPosition() {
- ASSERT(HasNear());
- return unresolved_near_positions_[--unresolved_];
- }
-
- bool IsBound() const { return position_ < 0; }
- bool IsUnused() const { return (position_ == 0) && (unresolved_ == 0); }
- bool IsLinked() const { return position_ > 0; }
- bool HasNear() const { return unresolved_ != 0; }
-
- private:
- void BindTo(intptr_t position) {
- ASSERT(!IsBound());
- ASSERT(!HasNear());
- position_ = -position - kWordSize;
- ASSERT(IsBound());
- }
-
- void LinkTo(intptr_t position) {
- ASSERT(!IsBound());
- position_ = position + kWordSize;
- ASSERT(IsLinked());
- }
-
- void NearLinkTo(intptr_t position) {
- ASSERT(!IsBound());
- ASSERT(unresolved_ < kMaxUnresolvedBranches);
- unresolved_near_positions_[unresolved_++] = position;
- }
-
- static const int kMaxUnresolvedBranches = 20;
-
- intptr_t position_;
- intptr_t unresolved_;
- intptr_t unresolved_near_positions_[kMaxUnresolvedBranches];
-
- friend class Assembler;
- DISALLOW_COPY_AND_ASSIGN(Label);
-};
-
class Assembler : public ValueObject {
public:
explicit Assembler(bool use_far_branches = false)
diff --git a/runtime/vm/compiler/assembler/assembler_x64.h b/runtime/vm/compiler/assembler/assembler_x64.h
index e73773c..c6117d1 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.h
+++ b/runtime/vm/compiler/assembler/assembler_x64.h
@@ -275,74 +275,6 @@
}
};
-class Label : public ValueObject {
- public:
- Label() : position_(0), unresolved_(0) {
-#ifdef DEBUG
- for (int i = 0; i < kMaxUnresolvedBranches; i++) {
- unresolved_near_positions_[i] = -1;
- }
-#endif // DEBUG
- }
-
- ~Label() {
- // Assert if label is being destroyed with unresolved branches pending.
- ASSERT(!IsLinked());
- ASSERT(!HasNear());
- }
-
- // Returns the position for bound labels. Cannot be used for unused or linked
- // labels.
- intptr_t Position() const {
- ASSERT(IsBound());
- return -position_ - kWordSize;
- }
-
- intptr_t LinkPosition() const {
- ASSERT(IsLinked());
- return position_ - kWordSize;
- }
-
- intptr_t NearPosition() {
- ASSERT(HasNear());
- return unresolved_near_positions_[--unresolved_];
- }
-
- bool IsBound() const { return position_ < 0; }
- bool IsUnused() const { return (position_ == 0) && (unresolved_ == 0); }
- bool IsLinked() const { return position_ > 0; }
- bool HasNear() const { return unresolved_ != 0; }
-
- private:
- void BindTo(intptr_t position) {
- ASSERT(!IsBound());
- ASSERT(!HasNear());
- position_ = -position - kWordSize;
- ASSERT(IsBound());
- }
-
- void LinkTo(intptr_t position) {
- ASSERT(!IsBound());
- position_ = position + kWordSize;
- ASSERT(IsLinked());
- }
-
- void NearLinkTo(intptr_t position) {
- ASSERT(!IsBound());
- ASSERT(unresolved_ < kMaxUnresolvedBranches);
- unresolved_near_positions_[unresolved_++] = position;
- }
-
- static const int kMaxUnresolvedBranches = 20;
-
- intptr_t position_;
- intptr_t unresolved_;
- intptr_t unresolved_near_positions_[kMaxUnresolvedBranches];
-
- friend class Assembler;
- DISALLOW_COPY_AND_ASSIGN(Label);
-};
-
class Assembler : public ValueObject {
public:
explicit Assembler(bool use_far_branches = false);
diff --git a/runtime/vm/compiler/backend/inliner.cc b/runtime/vm/compiler/backend/inliner.cc
index 74b9b45..b888721 100644
--- a/runtime/vm/compiler/backend/inliner.cc
+++ b/runtime/vm/compiler/backend/inliner.cc
@@ -2768,6 +2768,10 @@
value_check = Cids::CreateMonomorphic(Z, kFloat32x4Cid);
break;
}
+ case kTypedDataInt64ArrayCid:
+ // StoreIndexedInstr takes unboxed int64, so value
+ // is checked when unboxing.
+ break;
default:
// Array cids are already checked in the caller.
UNREACHABLE();
@@ -3339,6 +3343,13 @@
return InlineByteArrayBaseStore(flow_graph, target, call, receiver,
receiver_cid, kTypedDataUint32ArrayCid,
entry, last);
+ case MethodRecognizer::kByteArrayBaseSetInt64:
+ if (!ShouldInlineInt64ArrayOps()) {
+ return false;
+ }
+ return InlineByteArrayBaseStore(flow_graph, target, call, receiver,
+ receiver_cid, kTypedDataInt64ArrayCid,
+ entry, last);
case MethodRecognizer::kByteArrayBaseSetFloat32:
if (!CanUnboxDouble()) {
return false;
diff --git a/runtime/vm/compiler/backend/range_analysis.cc b/runtime/vm/compiler/backend/range_analysis.cc
index 6a2aa26..865982a 100644
--- a/runtime/vm/compiler/backend/range_analysis.cc
+++ b/runtime/vm/compiler/backend/range_analysis.cc
@@ -1785,6 +1785,7 @@
if (defn->IsConstant() && defn->AsConstant()->value().IsSmi()) {
return FromConstant(Smi::Cast(defn->AsConstant()->value()).Value() + offs);
}
+ ASSERT(IsValidOffsetForSymbolicRangeBoundary(offs));
return RangeBoundary(kSymbol, reinterpret_cast<intptr_t>(defn), offs);
}
@@ -1846,6 +1847,10 @@
const int64_t offset = a.offset() + b.ConstantValue();
+ if (!IsValidOffsetForSymbolicRangeBoundary(offset)) {
+ return false;
+ }
+
*result = RangeBoundary::FromDefinition(a.symbol(), offset);
return true;
} else if (b.IsSymbol() && a.IsConstant()) {
@@ -1864,6 +1869,10 @@
const int64_t offset = a.offset() - b.ConstantValue();
+ if (!IsValidOffsetForSymbolicRangeBoundary(offset)) {
+ return false;
+ }
+
*result = RangeBoundary::FromDefinition(a.symbol(), offset);
return true;
}
@@ -1959,6 +1968,10 @@
}
} while (changed);
+ if (!RangeBoundary::IsValidOffsetForSymbolicRangeBoundary(offset)) {
+ return overflow;
+ }
+
return RangeBoundary::FromDefinition(symbol, offset);
}
@@ -1975,6 +1988,11 @@
const int64_t offset = range->max().offset() + a->offset();
+ if (!RangeBoundary::IsValidOffsetForSymbolicRangeBoundary(offset)) {
+ *a = RangeBoundary::PositiveInfinity();
+ return true;
+ }
+
*a = CanonicalizeBoundary(
RangeBoundary::FromDefinition(range->max().symbol(), offset),
RangeBoundary::PositiveInfinity());
@@ -1995,6 +2013,11 @@
const int64_t offset = range->min().offset() + a->offset();
+ if (!RangeBoundary::IsValidOffsetForSymbolicRangeBoundary(offset)) {
+ *a = RangeBoundary::NegativeInfinity();
+ return true;
+ }
+
*a = CanonicalizeBoundary(
RangeBoundary::FromDefinition(range->min().symbol(), offset),
RangeBoundary::NegativeInfinity());
diff --git a/runtime/vm/compiler/backend/range_analysis.h b/runtime/vm/compiler/backend/range_analysis.h
index fd533c4..33f53b6 100644
--- a/runtime/vm/compiler/backend/range_analysis.h
+++ b/runtime/vm/compiler/backend/range_analysis.h
@@ -63,6 +63,17 @@
// Construct a RangeBoundary from a definition and offset.
static RangeBoundary FromDefinition(Definition* defn, int64_t offs = 0);
+ static bool IsValidOffsetForSymbolicRangeBoundary(int64_t offset) {
+ if (FLAG_limit_ints_to_64_bits) {
+ if ((offset > (kMaxInt64 - kSmiMax)) ||
+ (offset < (kMinInt64 - kSmiMin))) {
+ // Avoid creating symbolic range boundaries which can wrap around.
+ return false;
+ }
+ }
+ return true;
+ }
+
// Construct a RangeBoundary for the constant MinSmi value.
static RangeBoundary MinSmi() { return FromConstant(Smi::kMinValue); }
@@ -70,12 +81,6 @@
static RangeBoundary MaxSmi() { return FromConstant(Smi::kMaxValue); }
// Construct a RangeBoundary for the constant kMin value.
- static RangeBoundary MinConstant() { return FromConstant(kMin); }
-
- // Construct a RangeBoundary for the constant kMax value.
- static RangeBoundary MaxConstant() { return FromConstant(kMax); }
-
- // Construct a RangeBoundary for the constant kMin value.
static RangeBoundary MinConstant(RangeSize size) {
switch (size) {
case kRangeBoundarySmi:
@@ -288,8 +293,15 @@
class Range : public ZoneAllocated {
public:
Range() : min_(), max_() {}
+
Range(RangeBoundary min, RangeBoundary max) : min_(min), max_(max) {
ASSERT(min_.IsUnknown() == max_.IsUnknown());
+
+ if (FLAG_limit_ints_to_64_bits &&
+ (min_.IsInfinity() || max_.IsInfinity())) {
+ // Value can wrap around, so fall back to the full 64-bit range.
+ SetInt64Range();
+ }
}
Range(const Range& other)
@@ -326,8 +338,24 @@
const RangeBoundary& min() const { return min_; }
const RangeBoundary& max() const { return max_; }
- void set_min(const RangeBoundary& value) { min_ = value; }
- void set_max(const RangeBoundary& value) { max_ = value; }
+
+ void set_min(const RangeBoundary& value) {
+ min_ = value;
+
+ if (FLAG_limit_ints_to_64_bits && min_.IsInfinity()) {
+ // Value can wrap around, so fall back to the full 64-bit range.
+ SetInt64Range();
+ }
+ }
+
+ void set_max(const RangeBoundary& value) {
+ max_ = value;
+
+ if (FLAG_limit_ints_to_64_bits && max_.IsInfinity()) {
+ // Value can wrap around, so fall back to the full 64-bit range.
+ SetInt64Range();
+ }
+ }
static RangeBoundary ConstantMinSmi(const Range* range) {
return ConstantMin(range, RangeBoundary::kRangeBoundarySmi);
@@ -453,6 +481,11 @@
private:
RangeBoundary min_;
RangeBoundary max_;
+
+ void SetInt64Range() {
+ min_ = RangeBoundary::MinConstant(RangeBoundary::kRangeBoundaryInt64);
+ max_ = RangeBoundary::MaxConstant(RangeBoundary::kRangeBoundaryInt64);
+ }
};
class RangeUtils : public AllStatic {
@@ -537,12 +570,6 @@
bool ConstrainValueAfterBranch(Value* use, Definition* defn);
void ConstrainValueAfterCheckArrayBound(Value* use, Definition* defn);
- // Replace uses of the definition def that are dominated by instruction dom
- // with uses of other definition.
- void RenameDominatedUses(Definition* def,
- Instruction* dom,
- Definition* other);
-
// Infer ranges for integer (smi or mint) definitions.
void InferRanges();
diff --git a/runtime/vm/compiler/backend/range_analysis_test.cc b/runtime/vm/compiler/backend/range_analysis_test.cc
index 4cb1586..081c7e8 100644
--- a/runtime/vm/compiler/backend/range_analysis_test.cc
+++ b/runtime/vm/compiler/backend/range_analysis_test.cc
@@ -102,27 +102,46 @@
EXPECT(RangeBoundary::NegativeInfinity().OverflowedMint());
EXPECT(RangeBoundary::PositiveInfinity().OverflowedMint());
+ const Range fullInt64Range = Range::Full(RangeBoundary::kRangeBoundaryInt64);
+
Range* all = new Range(RangeBoundary::NegativeInfinity(),
RangeBoundary::PositiveInfinity());
+ if (FLAG_limit_ints_to_64_bits) {
+ EXPECT(all->Equals(&fullInt64Range));
+ }
EXPECT(all->Overlaps(0, 0));
EXPECT(all->Overlaps(-1, 1));
EXPECT(!all->IsWithin(0, 100));
+
Range* positive = new Range(RangeBoundary::FromConstant(0),
RangeBoundary::PositiveInfinity());
- EXPECT(positive->IsPositive());
+ if (FLAG_limit_ints_to_64_bits) {
+ EXPECT(positive->Equals(&fullInt64Range));
+ } else {
+ EXPECT(positive->IsPositive());
+ EXPECT(!positive->Overlaps(-2, -1));
+ }
EXPECT(positive->Overlaps(0, 1));
EXPECT(positive->Overlaps(1, 100));
EXPECT(positive->Overlaps(-1, 0));
- EXPECT(!positive->Overlaps(-2, -1));
+
Range* negative = new Range(RangeBoundary::NegativeInfinity(),
RangeBoundary::FromConstant(-1));
- EXPECT(!negative->IsPositive());
- EXPECT(!negative->Overlaps(0, 1));
- EXPECT(!negative->Overlaps(1, 100));
+ if (FLAG_limit_ints_to_64_bits) {
+ EXPECT(positive->Equals(&fullInt64Range));
+ } else {
+ EXPECT(!negative->IsPositive());
+ EXPECT(!negative->Overlaps(0, 1));
+ EXPECT(!negative->Overlaps(1, 100));
+ }
EXPECT(negative->Overlaps(-1, 0));
EXPECT(negative->Overlaps(-2, -1));
+
Range* negpos = new Range(RangeBoundary::NegativeInfinity(),
RangeBoundary::FromConstant(0));
+ if (FLAG_limit_ints_to_64_bits) {
+ EXPECT(negpos->Equals(&fullInt64Range));
+ }
EXPECT(!negpos->IsPositive());
Range* a = new Range(RangeBoundary::NegativeInfinity(),
@@ -134,45 +153,74 @@
Range* c = new Range(RangeBoundary::NegativeInfinity(),
RangeBoundary::FromConstant(32));
- EXPECT(a->OnlyLessThanOrEqualTo(31));
- EXPECT(b->OnlyLessThanOrEqualTo(31));
+ if (FLAG_limit_ints_to_64_bits) {
+ EXPECT(a->Equals(&fullInt64Range));
+ EXPECT(b->Equals(&fullInt64Range));
+ EXPECT(c->Equals(&fullInt64Range));
+ } else {
+ EXPECT(a->OnlyLessThanOrEqualTo(31));
+ EXPECT(b->OnlyLessThanOrEqualTo(31));
+ }
EXPECT(!c->OnlyLessThanOrEqualTo(31));
Range* unsatisfiable = new Range(RangeBoundary::PositiveInfinity(),
RangeBoundary::NegativeInfinity());
- EXPECT(unsatisfiable->IsUnsatisfiable());
+ if (FLAG_limit_ints_to_64_bits) {
+ EXPECT(unsatisfiable->Equals(&fullInt64Range));
+ } else {
+ EXPECT(unsatisfiable->IsUnsatisfiable());
+ }
Range* unsatisfiable_right = new Range(RangeBoundary::PositiveInfinity(),
RangeBoundary::FromConstant(0));
- EXPECT(unsatisfiable_right->IsUnsatisfiable());
+ if (FLAG_limit_ints_to_64_bits) {
+ EXPECT(unsatisfiable_right->Equals(&fullInt64Range));
+ } else {
+ EXPECT(unsatisfiable_right->IsUnsatisfiable());
+ }
Range* unsatisfiable_left = new Range(RangeBoundary::FromConstant(0),
RangeBoundary::NegativeInfinity());
- EXPECT(unsatisfiable_left->IsUnsatisfiable());
+ if (FLAG_limit_ints_to_64_bits) {
+ EXPECT(unsatisfiable_left->Equals(&fullInt64Range));
+ } else {
+ EXPECT(unsatisfiable_left->IsUnsatisfiable());
+ }
}
TEST_CASE(RangeUtils) {
+ // Use kMin/kMax instead of +/-inf with limited 64-bit integers, as
+ // any range with a +/-inf bound is converted to the full int64
+ // range due to wrap-around.
+ const RangeBoundary negativeInfinity =
+ (FLAG_limit_ints_to_64_bits
+ ? RangeBoundary::FromConstant(RangeBoundary::kMin)
+ : RangeBoundary::NegativeInfinity());
+ const RangeBoundary positiveInfinity =
+ (FLAG_limit_ints_to_64_bits
+ ? RangeBoundary::FromConstant(RangeBoundary::kMax)
+ : RangeBoundary::PositiveInfinity());
+
// [-inf, +inf].
- const Range& range_0 = *(new Range(RangeBoundary::NegativeInfinity(),
- RangeBoundary::PositiveInfinity()));
+ const Range& range_0 = *(new Range(negativeInfinity, positiveInfinity));
// [-inf, -1].
- const Range& range_a = *(new Range(RangeBoundary::NegativeInfinity(),
- RangeBoundary::FromConstant(-1)));
+ const Range& range_a =
+ *(new Range(negativeInfinity, RangeBoundary::FromConstant(-1)));
// [-inf, 0].
- const Range& range_b = *(new Range(RangeBoundary::NegativeInfinity(),
- RangeBoundary::FromConstant(0)));
+ const Range& range_b =
+ *(new Range(negativeInfinity, RangeBoundary::FromConstant(0)));
// [-inf, 1].
- const Range& range_c = *(new Range(RangeBoundary::NegativeInfinity(),
- RangeBoundary::FromConstant(1)));
+ const Range& range_c =
+ *(new Range(negativeInfinity, RangeBoundary::FromConstant(1)));
// [-1, +inf]
- const Range& range_d = *(new Range(RangeBoundary::FromConstant(-1),
- RangeBoundary::PositiveInfinity()));
+ const Range& range_d =
+ *(new Range(RangeBoundary::FromConstant(-1), positiveInfinity));
// [0, +inf]
- const Range& range_e = *(new Range(RangeBoundary::FromConstant(0),
- RangeBoundary::PositiveInfinity()));
+ const Range& range_e =
+ *(new Range(RangeBoundary::FromConstant(0), positiveInfinity));
// [1, +inf].
- const Range& range_f = *(new Range(RangeBoundary::FromConstant(1),
- RangeBoundary::PositiveInfinity()));
+ const Range& range_f =
+ *(new Range(RangeBoundary::FromConstant(1), positiveInfinity));
// [1, 2].
const Range& range_g = *(new Range(RangeBoundary::FromConstant(1),
RangeBoundary::FromConstant(2)));
@@ -237,23 +285,53 @@
}
TEST_CASE(RangeBinaryOp) {
- Range* range_a = new Range(RangeBoundary::FromConstant(-1),
- RangeBoundary::PositiveInfinity());
- range_a->Clamp(RangeBoundary::kRangeBoundaryInt64);
- EXPECT(range_a->min().ConstantValue() == -1);
- EXPECT(range_a->max().ConstantValue() == RangeBoundary::kMax);
- Range* range_b = new Range(RangeBoundary::NegativeInfinity(),
- RangeBoundary::FromConstant(1));
- range_b->Clamp(RangeBoundary::kRangeBoundaryInt64);
- EXPECT(range_b->min().ConstantValue() == RangeBoundary::kMin);
- EXPECT(range_b->max().ConstantValue() == 1);
+ if (FLAG_limit_ints_to_64_bits) {
+ Range* range_a =
+ new Range(RangeBoundary::FromConstant(-1),
+ RangeBoundary::FromConstant(RangeBoundary::kMax));
+ range_a->Clamp(RangeBoundary::kRangeBoundaryInt32);
+ EXPECT(range_a->min().ConstantValue() == -1);
+ EXPECT(range_a->max().ConstantValue() == kMaxInt32);
+ range_a->set_max(RangeBoundary::FromConstant(RangeBoundary::kMax));
- {
- Range result;
- Range::BinaryOp(Token::kADD, range_a, range_b, NULL, &result);
- ASSERT(!Range::IsUnknown(&result));
- EXPECT(result.min().IsNegativeInfinity());
- EXPECT(result.max().IsPositiveInfinity());
+ Range* range_b = new Range(RangeBoundary::FromConstant(RangeBoundary::kMin),
+ RangeBoundary::FromConstant(1));
+ range_b->Clamp(RangeBoundary::kRangeBoundaryInt32);
+ EXPECT(range_b->min().ConstantValue() == kMinInt32);
+ EXPECT(range_b->max().ConstantValue() == 1);
+ range_b->set_min(RangeBoundary::FromConstant(RangeBoundary::kMin));
+
+ {
+ Range result;
+ Range::BinaryOp(Token::kADD, range_a, range_b, NULL, &result);
+ ASSERT(!Range::IsUnknown(&result));
+ EXPECT(!result.min().IsNegativeInfinity());
+ EXPECT(!result.max().IsPositiveInfinity());
+ EXPECT(result.min().Equals(
+ RangeBoundary::MinConstant(RangeBoundary::kRangeBoundaryInt64)));
+ EXPECT(result.max().Equals(
+ RangeBoundary::MaxConstant(RangeBoundary::kRangeBoundaryInt64)));
+ }
+ } else {
+ Range* range_a = new Range(RangeBoundary::FromConstant(-1),
+ RangeBoundary::PositiveInfinity());
+ range_a->Clamp(RangeBoundary::kRangeBoundaryInt64);
+ EXPECT(range_a->min().ConstantValue() == -1);
+ EXPECT(range_a->max().ConstantValue() == RangeBoundary::kMax);
+
+ Range* range_b = new Range(RangeBoundary::NegativeInfinity(),
+ RangeBoundary::FromConstant(1));
+ range_b->Clamp(RangeBoundary::kRangeBoundaryInt64);
+ EXPECT(range_b->min().ConstantValue() == RangeBoundary::kMin);
+ EXPECT(range_b->max().ConstantValue() == 1);
+
+ {
+ Range result;
+ Range::BinaryOp(Token::kADD, range_a, range_b, NULL, &result);
+ ASSERT(!Range::IsUnknown(&result));
+ EXPECT(result.min().IsNegativeInfinity());
+ EXPECT(result.max().IsPositiveInfinity());
+ }
}
// Test that [5, 10] + [0, 5] = [5, 15].
diff --git a/runtime/vm/dwarf.cc b/runtime/vm/dwarf.cc
index 2b2bf2a..4270fdc 100644
--- a/runtime/vm/dwarf.cc
+++ b/runtime/vm/dwarf.cc
@@ -28,7 +28,10 @@
end_pc_offset(-1),
children_head(NULL),
children_tail(NULL),
- children_next(NULL) {}
+ children_next(NULL) {
+ ASSERT(!function.IsNull());
+ ASSERT(function.IsNotTemporaryScopedHandle());
+ }
void AppendChild(InliningNode* child) {
if (children_tail == NULL) {
@@ -86,7 +89,7 @@
}
intptr_t Dwarf::AddFunction(const Function& function) {
- ASSERT(!function.IsNull());
+ RELEASE_ASSERT(!function.IsNull());
FunctionIndexPair* pair = function_to_index_.Lookup(&function);
if (pair != NULL) {
return pair->index_;
@@ -349,7 +352,7 @@
return NULL;
}
const Array& functions = Array::Handle(zone_, code.inlined_id_to_function());
- const Function& root_function = Function::Handle(zone_, code.function());
+ const Function& root_function = Function::ZoneHandle(zone_, code.function());
GrowableArray<InliningNode*> node_stack(zone_, 4);
GrowableArray<TokenPosition> token_positions(zone_, 4);
@@ -380,7 +383,7 @@
case CodeSourceMapBuilder::kPushFunction: {
int32_t func = stream.Read<int32_t>();
const Function& child_func =
- Function::Handle(zone_, Function::RawCast(functions.At(func)));
+ Function::ZoneHandle(zone_, Function::RawCast(functions.At(func)));
TokenPosition call_pos = token_positions.Last();
InliningNode* child_node =
new (zone_) InliningNode(child_func, call_pos, current_pc_offset);
diff --git a/runtime/vm/dwarf.h b/runtime/vm/dwarf.h
index d51dc40..070eb75 100644
--- a/runtime/vm/dwarf.h
+++ b/runtime/vm/dwarf.h
@@ -34,8 +34,10 @@
return pair.script_->raw() == key->raw();
}
- ScriptIndexPair(const Script* s, intptr_t index)
- : script_(s), index_(index) {}
+ ScriptIndexPair(const Script* s, intptr_t index) : script_(s), index_(index) {
+ ASSERT(!s->IsNull());
+ ASSERT(s->IsNotTemporaryScopedHandle());
+ }
ScriptIndexPair() : script_(NULL), index_(-1) {}
@@ -64,7 +66,10 @@
}
FunctionIndexPair(const Function* f, intptr_t index)
- : function_(f), index_(index) {}
+ : function_(f), index_(index) {
+ ASSERT(!f->IsNull());
+ ASSERT(f->IsNotTemporaryScopedHandle());
+ }
FunctionIndexPair() : function_(NULL), index_(-1) {}
@@ -95,7 +100,10 @@
return pair.code_->raw() == key->raw();
}
- CodeIndexPair(const Code* c, intptr_t index) : code_(c), index_(index) {}
+ CodeIndexPair(const Code* c, intptr_t index) : code_(c), index_(index) {
+ ASSERT(!c->IsNull());
+ ASSERT(c->IsNotTemporaryScopedHandle());
+ }
CodeIndexPair() : code_(NULL), index_(-1) {}
diff --git a/sdk/lib/_http/websocket_impl.dart b/sdk/lib/_http/websocket_impl.dart
index 726dfba..4ed7bb2 100644
--- a/sdk/lib/_http/websocket_impl.dart
+++ b/sdk/lib/_http/websocket_impl.dart
@@ -62,11 +62,9 @@
* socket will be closed when the processor encounter an error. Not using it
* will lead to undefined behaviour.
*/
-class _WebSocketProtocolTransformer
- implements
- EventSink<List<int>>,
- StreamTransformer<List<int>,
- dynamic /*List<int>|_WebSocketPing|_WebSocketPong*/ > {
+class _WebSocketProtocolTransformer extends StreamTransformerBase<List<int>,
+ dynamic /*List<int>|_WebSocketPing|_WebSocketPong*/ >
+ implements EventSink<List<int>> {
static const int START = 0;
static const int LEN_FIRST = 1;
static const int LEN_REST = 2;
@@ -406,7 +404,9 @@
typedef /*String|Future<String>*/ _ProtocolSelector(List<String> protocols);
-class _WebSocketTransformerImpl implements WebSocketTransformer {
+class _WebSocketTransformerImpl
+ extends StreamTransformerBase<HttpRequest, WebSocket>
+ implements WebSocketTransformer {
final StreamController<WebSocket> _controller =
new StreamController<WebSocket>(sync: true);
final _ProtocolSelector _protocolSelector;
@@ -655,7 +655,7 @@
// TODO(ajohnsen): Make this transformer reusable.
class _WebSocketOutgoingTransformer
- implements StreamTransformer<dynamic, List<int>>, EventSink {
+ extends StreamTransformerBase<dynamic, List<int>> implements EventSink {
final _WebSocketImpl webSocket;
EventSink<List<int>> _eventSink;
diff --git a/sdk/lib/async/async.dart b/sdk/lib/async/async.dart
index 6e2f3a9..c616cda 100644
--- a/sdk/lib/async/async.dart
+++ b/sdk/lib/async/async.dart
@@ -92,7 +92,13 @@
library dart.async;
import "dart:collection" show HashMap, IterableBase;
-import "dart:_internal" show printToZone, printToConsole, IterableElementError;
+import "dart:_internal"
+ show
+ CastStream,
+ CastStreamTransformer,
+ printToZone,
+ printToConsole,
+ IterableElementError;
part 'async_error.dart';
part 'broadcast_stream_controller.dart';
diff --git a/sdk/lib/async/broadcast_stream_controller.dart b/sdk/lib/async/broadcast_stream_controller.dart
index 2bcb539..44e468d 100644
--- a/sdk/lib/async/broadcast_stream_controller.dart
+++ b/sdk/lib/async/broadcast_stream_controller.dart
@@ -282,7 +282,7 @@
Future addStream(Stream<T> stream, {bool cancelOnError}) {
if (!_mayAddEvent) throw _addEventError();
_state |= _STATE_ADDSTREAM;
- _addStreamState = new _AddStreamState(this, stream, cancelOnError ?? true);
+ _addStreamState = new _AddStreamState(this, stream, cancelOnError ?? false);
return _addStreamState.addStreamFuture;
}
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 7bbc70e..9d06d03 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -270,7 +270,7 @@
* void close() { _outputSink.close(); }
* }
*
- * class DuplicationTransformer implements StreamTransformer<String, String> {
+ * class DuplicationTransformer extends StreamTransformerBase<String, String> {
* // Some generic types omitted for brevity.
* Stream bind(Stream stream) => new Stream<String>.eventTransformed(
* stream,
@@ -287,6 +287,17 @@
}
/**
+ * Adapts [source] to be a `Stream<T>`.
+ *
+ * This allows [source] to be used at the new type, but at run-time it
+ * must satisfy the requirements of both the new type and its original type.
+ *
+ * Data events created by the source stream must also be instances of [T].
+ */
+ static Stream<T> castFrom<S, T>(Stream<S> source) =>
+ new CastStream<S, T>(source);
+
+ /**
* Whether this stream is a broadcast stream.
*/
bool get isBroadcast => false;
@@ -922,6 +933,26 @@
}
/**
+ * Adapt this stream to be a `Stream<R>`.
+ *
+ * If this stream already has the desired type, its returned directly.
+ * Otherwise it is wrapped as a `Stream<R>` which checks at run-time that
+ * each data event emitted by this stream is also an instance of [R].
+ */
+ Stream<R> cast<R>() {
+ Stream<Object> self = this;
+ return self is Stream<R> ? self : retype<R>();
+ }
+
+ /**
+ * Adapt this stream to be a `Stream<R>`.
+ *
+ * This stream is wrapped as a `Stream<R>` which checks at run-time that
+ * each data event emitted by this stream is also an instance of [R].
+ */
+ Stream<R> retype<R>() => Stream.castFrom<T, R>(this);
+
+ /**
* Collects all elements of this stream in a [List].
*
* Creates a `List<T>` and adds all elements of the stream to the list
@@ -1225,8 +1256,8 @@
* that [test] returns `true` for.
*
* If no such element is found before this stream is done, and a
- * [defaultValue] function is provided, the result of calling [defaultValue]
- * becomes the value of the future. If [defaultValue] throws, the returned
+ * [orElse] function is provided, the result of calling [orElse]
+ * becomes the value of the future. If [orElse] throws, the returned
* future is completed with that error.
*
* If this stream emits an error before the first matching element,
@@ -1240,11 +1271,12 @@
* streams are closed and cannot be reused after a call to this method.
*
* If an error occurs, or if this stream ends without finding a match and
- * with no [defaultValue] function provided,
+ * with no [orElse] function provided,
* the returned future is completed with an error.
*/
- Future<dynamic> firstWhere(bool test(T element), {Object defaultValue()}) {
- _Future<dynamic> future = new _Future();
+ Future<T> firstWhere(bool test(T element),
+ {dynamic defaultValue(), T orElse()}) {
+ _Future<T> future = new _Future();
StreamSubscription subscription;
subscription = this.listen(
(T value) {
@@ -1256,8 +1288,11 @@
},
onError: future._completeError,
onDone: () {
- if (defaultValue != null) {
- _runUserCode(defaultValue, future._complete, future._completeError);
+ if (orElse == null && defaultValue != null) {
+ orElse = () => defaultValue() as T;
+ }
+ if (orElse != null) {
+ _runUserCode(orElse, future._complete, future._completeError);
return;
}
try {
@@ -1281,8 +1316,9 @@
* That means that a non-error result cannot be provided before this stream
* is done.
*/
- Future<dynamic> lastWhere(bool test(T element), {Object defaultValue()}) {
- _Future<dynamic> future = new _Future();
+ Future<T> lastWhere(bool test(T element),
+ {dynamic defaultValue(), T orElse()}) {
+ _Future<T> future = new _Future();
T result = null;
bool foundResult = false;
StreamSubscription subscription;
@@ -1301,8 +1337,11 @@
future._complete(result);
return;
}
- if (defaultValue != null) {
- _runUserCode(defaultValue, future._complete, future._completeError);
+ if (orElse == null && defaultValue != null) {
+ orElse = () => defaultValue() as T;
+ }
+ if (orElse != null) {
+ _runUserCode(orElse, future._complete, future._completeError);
return;
}
try {
@@ -1321,7 +1360,7 @@
* Like [lastWhere], except that it is an error if more than one
* matching element occurs in the stream.
*/
- Future<T> singleWhere(bool test(T element)) {
+ Future<T> singleWhere(bool test(T element), {T orElse()}) {
_Future<T> future = new _Future<T>();
T result = null;
bool foundResult = false;
@@ -1350,6 +1389,10 @@
return;
}
try {
+ if (orElse != null) {
+ _runUserCode(orElse, future._complete, future._completeError);
+ return;
+ }
throw IterableElementError.noElement();
} catch (e, s) {
_completeWithErrorCallback(future, e, s);
@@ -1948,6 +1991,21 @@
void handleDone(EventSink<T> sink)}) = _StreamHandlerTransformer<S, T>;
/**
+ * Adapts [source] to be a `StreamTransfomer<TS, TT>`.
+ *
+ * This allows [source] to be used at the new type, but at run-time it
+ * must satisfy the requirements of both the new type and its original type.
+ *
+ * Data events passed into the returned transformer must also be instances
+ * of [SS], and data events produced by [source] for those events must
+ * also be instances of [TT].
+ */
+ static StreamTransformer<TS, TT> castFrom<SS, ST, TS, TT>(
+ StreamTransformer<SS, ST> source) {
+ return new CastStreamTransformer<SS, ST, TS, TT>(source);
+ }
+
+ /**
* Transforms the provided [stream].
*
* Returns a new stream with events that are computed from events of the
@@ -1969,6 +2027,25 @@
* duration. Others might not delay them at all, or just by a microtask.
*/
Stream<T> bind(Stream<S> stream);
+
+ /**
+ * Provides a `StreamTransformer<RS, RT>` view of this stream transformer.
+ *
+ * If this transformer already has the desired type, or a subtype,
+ * it is returned directly,
+ * otherwise returns the result of `retype<RS, RT>()`.
+ */
+ StreamTransformer<RS, RT> cast<RS, RT>();
+
+ /**
+ * Provides a `StreamTrasformer<RS, RT>` view of this stream transformer.
+ *
+ * The resulting transformer will check at run-time that all data events
+ * of the stream it transforms are actually instances of [S],
+ * and it will check that all data events produced by this transformer
+ * are acually instances of [RT].
+ */
+ StreamTransformer<RS, RT> retype<RS, RT>();
}
/**
@@ -1978,6 +2055,14 @@
*/
abstract class StreamTransformerBase<S, T> implements StreamTransformer<S, T> {
const StreamTransformerBase();
+
+ StreamTransformer<RS, RT> cast<RS, RT>() {
+ StreamTransformer<Object, Object> self = this;
+ return self is StreamTransformer<RS, RT> ? self : retype<RS, RT>();
+ }
+
+ StreamTransformer<RS, RT> retype<RS, RT>() =>
+ StreamTransformer.castFrom<S, T, RS, RT>(this);
}
/**
diff --git a/sdk/lib/async/stream_controller.dart b/sdk/lib/async/stream_controller.dart
index 8b89163e..71b857f 100644
--- a/sdk/lib/async/stream_controller.dart
+++ b/sdk/lib/async/stream_controller.dart
@@ -271,7 +271,7 @@
* forwarded to the controller's stream, and the `addStream` ends
* after this. If [cancelOnError] is false, all errors are forwarded
* and only a done event will end the `addStream`.
- * If [cancelOnError] is omitted, it defaults to true.
+ * If [cancelOnError] is omitted, it defaults to false.
*/
Future addStream(Stream<T> source, {bool cancelOnError});
}
@@ -555,7 +555,7 @@
if (_isCanceled) return new _Future.immediate(null);
_StreamControllerAddStreamState<T> addState =
new _StreamControllerAddStreamState<T>(
- this, _varData, source, cancelOnError ?? true);
+ this, _varData, source, cancelOnError ?? false);
_varData = addState;
_state |= _STATE_ADDSTREAM;
return addState.addStreamFuture;
@@ -863,8 +863,9 @@
}
Future close() => _target.close();
- Future addStream(Stream<T> source, {bool cancelOnError}) =>
- _target.addStream(source, cancelOnError: cancelOnError);
+
+ Future addStream(Stream<T> source) => _target.addStream(source);
+
Future get done => _target.done;
}
diff --git a/sdk/lib/async/stream_transformers.dart b/sdk/lib/async/stream_transformers.dart
index ad75a4d..37bbc02 100644
--- a/sdk/lib/async/stream_transformers.dart
+++ b/sdk/lib/async/stream_transformers.dart
@@ -155,7 +155,7 @@
*
* Note that this class can be `const`.
*/
-class _StreamSinkTransformer<S, T> implements StreamTransformer<S, T> {
+class _StreamSinkTransformer<S, T> extends StreamTransformerBase<S, T> {
final _SinkMapper<S, T> _sinkMapper;
const _StreamSinkTransformer(this._sinkMapper);
@@ -298,7 +298,7 @@
* `StreamSubscription`. As such it can also act on `cancel` events, making it
* fully general.
*/
-class _StreamSubscriptionTransformer<S, T> implements StreamTransformer<S, T> {
+class _StreamSubscriptionTransformer<S, T> extends StreamTransformerBase<S, T> {
final _SubscriptionTransformer<S, T> _onListen;
const _StreamSubscriptionTransformer(this._onListen);
diff --git a/sdk/lib/convert/convert.dart b/sdk/lib/convert/convert.dart
index 21f8521..1255c22 100644
--- a/sdk/lib/convert/convert.dart
+++ b/sdk/lib/convert/convert.dart
@@ -55,7 +55,7 @@
import 'dart:async';
import 'dart:typed_data';
-import 'dart:_internal' show parseHexByte;
+import 'dart:_internal' show CastConverter, parseHexByte;
part 'ascii.dart';
part 'base64.dart';
diff --git a/sdk/lib/convert/converter.dart b/sdk/lib/convert/converter.dart
index 6c135cb..01d6186 100644
--- a/sdk/lib/convert/converter.dart
+++ b/sdk/lib/convert/converter.dart
@@ -10,10 +10,22 @@
* It is recommended that implementations of `Converter` extend this class,
* to inherit any further methods that may be added to the class.
*/
-abstract class Converter<S, T> implements StreamTransformer<S, T> {
+abstract class Converter<S, T> extends StreamTransformerBase<S, T> {
const Converter();
/**
+ * Adapts [source] to be a `Converter<TS, TT>`.
+ *
+ * This allows [source] to be used at the new type, but at run-time it
+ * must satisfy the requirements of both the new type and its original type.
+ *
+ * Conversion input must be both [SS] and [TS] and the output created by
+ * [source] for those input must be both [ST] and [TT].
+ */
+ static Converter<TS, TT> castFrom<SS, ST, TS, TT>(Converter<SS, ST> source) =>
+ new CastConverter<SS, ST, TS, TT>(source);
+
+ /**
* Converts [input] and returns the result of the conversion.
*/
T convert(S input);
@@ -43,6 +55,28 @@
return new Stream<T>.eventTransformed(
stream, (EventSink sink) => new _ConverterStreamEventSink(this, sink));
}
+
+ /**
+ * Provides a `Converter<RS, RT>` view of this stream transformer.
+ *
+ * If this transformer already has the desired type, or a subtype,
+ * it is returned directly,
+ * otherwise returns the result of `retype<RS, RT>()`.
+ */
+ Converter<RS, RT> cast<RS, RT>() {
+ Converter<Object, Object> self = this;
+ return self is Converter<RS, RT> ? self : retype<RS, RT>();
+ }
+
+ /**
+ * Provides a `Converter<RS, RT>` view of this stream transformer.
+ *
+ * The resulting transformer will check at run-time that all conversion
+ * inputs are actually instances of [S],
+ * and it will check that all conversion output produced by this converter
+ * are acually instances of [RT].
+ */
+ Converter<RS, RT> retype<RS, RT>() => Converter.castFrom<S, T, RS, RT>(this);
}
/**
diff --git a/sdk/lib/convert/line_splitter.dart b/sdk/lib/convert/line_splitter.dart
index b9b024c..2522b14 100644
--- a/sdk/lib/convert/line_splitter.dart
+++ b/sdk/lib/convert/line_splitter.dart
@@ -18,7 +18,7 @@
* The returned lines do not contain the line terminators.
*/
-class LineSplitter implements StreamTransformer<String, String> {
+class LineSplitter extends StreamTransformerBase<String, String> {
const LineSplitter();
/// Split [lines] into individual lines.
diff --git a/sdk/lib/internal/async_cast.dart b/sdk/lib/internal/async_cast.dart
new file mode 100644
index 0000000..924ac53
--- /dev/null
+++ b/sdk/lib/internal/async_cast.dart
@@ -0,0 +1,88 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of dart._internal;
+
+// Casting wrappers for asynchronous classes.
+
+class CastStream<S, T> extends Stream<T> {
+ final Stream<S> _source;
+ CastStream(this._source);
+ bool get isBroadcast => _source.isBroadcast;
+
+ StreamSubscription<T> listen(void onData(T data),
+ {Function onError, void onDone(), bool cancelOnError}) {
+ return new CastStreamSubscription<S, T>(_source.listen(null,
+ onError: onError, onDone: onDone, cancelOnError: cancelOnError))
+ ..onData(onData);
+ }
+
+ Stream<R> cast<R>() {
+ Stream<Object> self = this;
+ return self is Stream<R> ? self : this.retype<R>();
+ }
+
+ Stream<R> retype<R>() => new CastStream<S, R>(_source);
+}
+
+class CastStreamSubscription<S, T> implements StreamSubscription<T> {
+ final StreamSubscription<S> _source;
+
+ CastStreamSubscription(this._source);
+
+ Future cancel() => _source.cancel();
+
+ void onData(void handleData(T data)) {
+ _source.onData((S data) => handleData(data as T));
+ }
+
+ void onError(Function handleError) {
+ _source.onError(handleError);
+ }
+
+ void onDone(void handleDone()) {
+ _source.onDone(handleDone);
+ }
+
+ void pause([Future resumeSignal]) {
+ _source.pause(resumeSignal);
+ }
+
+ void resume() {
+ _source.resume();
+ }
+
+ bool get isPaused => _source.isPaused;
+
+ Future<E> asFuture<E>([E futureValue]) => _source.asFuture<E>(futureValue);
+}
+
+class CastStreamTransformer<SS, ST, TS, TT>
+ extends StreamTransformerBase<TS, TT> {
+ final StreamTransformer<SS, ST> _source;
+ CastStreamTransformer(this._source);
+
+ // cast is inherited from StreamTransformerBase.
+
+ StreamTransformer<RS, RT> retype<RS, RT>() =>
+ new CastStreamTransformer<SS, ST, RS, RT>(_source);
+
+ Stream<TT> bind(Stream<TS> stream) =>
+ _source.bind(stream.cast<SS>()).cast<TT>();
+}
+
+class CastConverter<SS, ST, TS, TT> extends Converter<TS, TT> {
+ final Converter<SS, ST> _source;
+ CastConverter(this._source);
+
+ TT convert(TS input) => _source.convert(input as SS) as TT;
+
+ // cast is inherited from Converter.
+
+ Stream<TT> bind(Stream<TS> stream) =>
+ _source.bind(stream.cast<SS>()).cast<TT>();
+
+ Converter<RS, RT> retype<RS, RT>() =>
+ new CastConverter<SS, ST, RS, RT>(_source);
+}
diff --git a/sdk/lib/internal/cast.dart b/sdk/lib/internal/cast.dart
index d871f40..c91dff7 100644
--- a/sdk/lib/internal/cast.dart
+++ b/sdk/lib/internal/cast.dart
@@ -4,7 +4,7 @@
part of dart._internal;
-// Casting wrappers for collections and asynchronous classes.
+// Casting wrappers for collection classes.
abstract class _CastIterableBase<S, T> extends Iterable<T> {
Iterable<S> get _source;
diff --git a/sdk/lib/internal/internal.dart b/sdk/lib/internal/internal.dart
index 0869856..96bbddf 100644
--- a/sdk/lib/internal/internal.dart
+++ b/sdk/lib/internal/internal.dart
@@ -6,10 +6,19 @@
import 'dart:collection';
+import 'dart:async'
+ show
+ Future,
+ Stream,
+ StreamSubscription,
+ StreamTransformer,
+ StreamTransformerBase;
+import 'dart:convert' show Converter;
import 'dart:core' hide Symbol;
import 'dart:core' as core;
import 'dart:math' show Random;
+part 'async_cast.dart';
part 'cast.dart';
part 'iterable.dart';
part 'list.dart';
diff --git a/sdk/lib/internal/internal_sources.gni b/sdk/lib/internal/internal_sources.gni
index 6acd227..7c8af46 100644
--- a/sdk/lib/internal/internal_sources.gni
+++ b/sdk/lib/internal/internal_sources.gni
@@ -7,6 +7,7 @@
"internal.dart",
# The above file needs to be first as it lists the parts below.
+ "async_cast.dart",
"cast.dart",
"iterable.dart",
"list.dart",
diff --git a/tests/co19/co19-analyzer.status b/tests/co19/co19-analyzer.status
index 352cb5c..723a34f 100644
--- a/tests/co19/co19-analyzer.status
+++ b/tests/co19/co19-analyzer.status
@@ -80,7 +80,9 @@
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.
@@ -121,6 +123,7 @@
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
@@ -133,6 +136,7 @@
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.
@@ -227,6 +231,9 @@
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
@@ -374,6 +381,7 @@
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.
@@ -389,6 +397,7 @@
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.
@@ -505,4 +514,3 @@
[ $compiler == dart2analyzer && $strong ]
*: Skip # Issue 28649
-
diff --git a/tests/co19/co19-co19.status b/tests/co19/co19-co19.status
index d6bebfe..494dd14 100644
--- a/tests/co19/co19-co19.status
+++ b/tests/co19/co19-co19.status
@@ -62,6 +62,8 @@
Language/Expressions/Instance_Creation/Const/abstract_class_t01: Pass, Fail # co19 issue 66
Language/Expressions/Instance_Creation/Const/abstract_class_t03: Pass, Fail # co19 issue 66
LibTest/async/Stream/asBroadcastStream_A02_t01: Fail # co19 issue 687
+LibTest/async/StreamController/addStream_A03_t01: RuntimeError # Issue <TODO>
+LibTest/async/StreamSink/addStream_A01_t02: RuntimeError # Issue <TODO>
LibTest/async/Zone/runBinaryGuarded_A01_t01: Fail # co19 issue 126
LibTest/async/Zone/runGuarded_A01_t01: Fail # co19 issue 126
LibTest/async/Zone/runUnaryGuarded_A01_t01: Fail # co19 issue 126
diff --git a/tests/co19/co19-kernel.status b/tests/co19/co19-kernel.status
index 93bda7c..e55b34f 100644
--- a/tests/co19/co19-kernel.status
+++ b/tests/co19/co19-kernel.status
@@ -66,7 +66,6 @@
Language/Classes/Constructors/Generative_Constructors/execution_t06: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/execution_t07: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/execution_t12: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/redirection_t02: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/redirection_t03: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/redirection_t07: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/redirection_t08: MissingCompileTimeError
@@ -80,8 +79,6 @@
Language/Classes/Static_Methods/declaration_t01: MissingCompileTimeError
Language/Classes/Superclasses/wrong_superclass_t08: MissingCompileTimeError
Language/Classes/Superinterfaces/wrong_type_t05: MissingCompileTimeError
-Language/Classes/declarations_t06: MissingCompileTimeError
-Language/Classes/declarations_t08: MissingCompileTimeError
Language/Classes/declarations_t33: MissingCompileTimeError
Language/Classes/same_name_type_variable_t04: MissingCompileTimeError
Language/Classes/same_name_type_variable_t07: MissingCompileTimeError
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index cb6325d..0e0083a 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -34,6 +34,7 @@
old_frontend/compile_with_empty_libraries_test: Fail # Issue 24223
old_frontend/compile_with_empty_libraries_test: Fail # Issue 24223
old_frontend/patch_test/bug: RuntimeError # Issue 21132
+old_frontend/resolver_test: RuntimeError # Test must be updated given new parser recovery
packages/*: Skip # Skip packages folder
quarantined/http_test: Pass, Slow
rti/rti_need_test: Pass, Slow, Fail # Issue 32055
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_typed_map.dart b/tests/compiler/dart2js/deferred_loading/data/deferred_typed_map.dart
new file mode 100644
index 0000000..0015e60
--- /dev/null
+++ b/tests/compiler/dart2js/deferred_loading/data/deferred_typed_map.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import '../libs/deferred_typed_map_lib1.dart' deferred as lib;
+
+/*element: main:OutputUnit(main, {})*/
+main() async {
+ await lib.loadLibrary();
+ print(lib.table[1]);
+}
diff --git a/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart b/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
index c4f9e1a..d69452a 100644
--- a/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
+++ b/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
@@ -139,7 +139,7 @@
SourceSpan span = computeSourceSpanFromTreeNode(node);
if (node is ir.ConstructorInvocation ||
node is ir.ListLiteral ||
- node is ir.MapLiteral) {
+ (node is ir.MapLiteral && node.keyType == null)) {
// Adjust the source-span to match the AST-based location. The kernel FE
// skips the "const" keyword for the expression offset and any prefix in
// front of the constructor. The "-6" is an approximation assuming that
diff --git a/tests/compiler/dart2js/deferred_loading/libs/deferred_typed_map_lib1.dart b/tests/compiler/dart2js/deferred_loading/libs/deferred_typed_map_lib1.dart
new file mode 100644
index 0000000..0700011
--- /dev/null
+++ b/tests/compiler/dart2js/deferred_loading/libs/deferred_typed_map_lib1.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class M {}
+
+typedef dynamic FF({M b});
+
+/*element: table:OutputUnit(1, {lib})*/
+const table =
+/*ast.null*/
+/*kernel.OutputUnit(1, {lib})*/
+ const <int, FF>{1: f1, 2: f2};
+
+/*element: f1:OutputUnit(1, {lib})*/
+dynamic f1({M b}) => null;
+
+/*element: f2:OutputUnit(1, {lib})*/
+dynamic f2({M b}) => null;
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index fa02dc6c..4f5250d 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -190,9 +190,6 @@
map_test: Crash # tests/corelib_2/map_test.dart:903:7: Internal problem: Unhandled Null in installDefaultConstructor.
symbol_reserved_word_test/03: RuntimeError
-[ $compiler == dart2js && $checked && $dart2js_with_kernel && !$strong ]
-*: SkipByDesign
-
[ $compiler == dart2js && $dart2js_with_kernel ]
int_from_environment_test: Pass # Issue 31762
int_parse_radix_test/none: Pass # Issue 31762
@@ -208,12 +205,10 @@
symbol_reserved_word_test/03: RuntimeError
uri_base_test: Crash # RangeError (index): Invalid value: Valid value range is empty: 0
-[ $compiler == dart2js && $dart2js_with_kernel && $fast_startup && !$strong ]
-*: SkipByDesign
-
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked && $strong ]
apply3_test: CompileTimeError
cast_test: RuntimeError
+collection_length_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
collection_removes_test: RuntimeError
dynamic_nosuchmethod_test: CompileTimeError
error_stack_trace1_test: RuntimeError # Issue 12399
@@ -227,46 +222,36 @@
iterable_empty_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart': Failed assertion: line 391 pos 16: 'receiver.nonCheck() == user.inputs[1].nonCheck()': is not true.
iterable_fold_test: Crash # NoSuchMethodError: The getter 'isDynamic' was called on null.
iterable_generate_test/01: RuntimeError
-iterable_generate_test/none: RuntimeError
iterable_reduce_test: Crash # NoSuchMethodError: The getter 'isDynamic' was called on null.
-iterable_return_type_test/01: RuntimeError
-iterable_return_type_test/02: RuntimeError
-iterable_return_type_test/none: RuntimeError
-iterable_to_list_test/01: RuntimeError
-iterable_to_list_test/none: RuntimeError
+iterable_return_type_test/01: Crash # Assertion failure: Only 2 of 4 arguments have been read from: [HTypeInfoExpression(COMPLETE, int), HTypeInfoExpression(COMPLETE, int), HTypeInfoExpression(COMPLETE, int), HTypeInfoExpression(COMPLETE, int)]
+iterable_return_type_test/02: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+iterable_return_type_test/none: Crash # Assertion failure: Only 2 of 4 arguments have been read from: [HTypeInfoExpression(COMPLETE, int), HTypeInfoExpression(COMPLETE, int), HTypeInfoExpression(COMPLETE, int), HTypeInfoExpression(COMPLETE, int)]
+iterable_to_list_test/01: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+iterable_to_list_test/none: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
iterable_to_set_test: RuntimeError
-linked_hash_map_from_iterable_test: RuntimeError
-linked_hash_map_from_iterables_test: RuntimeError
+json_map_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
list_concurrent_modify_test: RuntimeError
-list_filled_type_argument_test: RuntimeError
list_insert_all_test: RuntimeError
list_replace_range_test: RuntimeError
list_set_all_test: RuntimeError
list_test/01: RuntimeError
list_test/none: RuntimeError
-map_from_iterable_test: RuntimeError
-map_from_iterables_test: RuntimeError
+list_unmodifiable_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
map_keys2_test: RuntimeError
-map_test: RuntimeError
-map_values2_test: RuntimeError
-map_values3_test: RuntimeError
-map_values4_test: RuntimeError
nan_infinity_test/01: RuntimeError
null_nosuchmethod_test/01: CompileTimeError
null_nosuchmethod_test/none: CompileTimeError
+null_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
queue_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart': Failed assertion: line 391 pos 16: 'receiver.nonCheck() == user.inputs[1].nonCheck()': is not true.
splay_tree_from_iterable_test: RuntimeError
-splay_tree_from_iterables_test: RuntimeError
stacktrace_fromstring_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).
string_replace_test: Crash # NoSuchMethodError: The getter 'isDynamic' was called on null.
string_split_test/checkedstore: RuntimeError
symbol_reserved_word_test/03: RuntimeError
+type_hashcode_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
uri_base_test: RuntimeError
uri_query_test: Crash # Assertion failure: Cannot find value local(testQueryParameters#normalizedQuery) in (BoxLocal(_box_0)) for j:signature(testQueryParameters_test.$signature).
-[ $compiler == dart2js && $dart2js_with_kernel && $host_checked && !$strong ]
-*: SkipByDesign
-
[ $compiler == dart2js && $dart2js_with_kernel && $minified && $strong ]
apply3_test: CompileTimeError
cast_test: RuntimeError
@@ -288,7 +273,6 @@
iterable_return_type_test/01: RuntimeError
iterable_return_type_test/02: RuntimeError
iterable_to_list_test/01: RuntimeError
-iterable_to_list_test/none: RuntimeError
iterable_to_set_test: RuntimeError
list_concurrent_modify_test: RuntimeError
list_insert_all_test: RuntimeError
@@ -311,7 +295,7 @@
uri_base_test: RuntimeError
uri_query_test: Crash # Assertion failure: Cannot find value local(testQueryParameters#normalizedQuery) in (BoxLocal(_box_0)) for j:signature(testQueryParameters_test.$signature).
-[ $compiler == dart2js && $dart2js_with_kernel && $minified && !$strong ]
+[ $compiler == dart2js && $dart2js_with_kernel && !$strong ]
*: SkipByDesign
[ $compiler == dart2js && !$dart2js_with_kernel ]
@@ -335,6 +319,11 @@
string_base_vm_static_test: MissingCompileTimeError
string_static_test: MissingCompileTimeError
+# Dart2JS does not support strong mode without the new front end, though it
+# does support checked mode which is partly compatible.
+[ $compiler == dart2js && !$dart2js_with_kernel && $strong ]
+*: SkipByDesign
+
[ $compiler == dart2js && $fast_startup ]
apply3_test: Fail # mirrors not supported
dynamic_nosuchmethod_test: Fail # mirrors not supported
diff --git a/tests/corelib_2/set_removeAll_test.dart b/tests/corelib_2/set_removeAll_test.dart
index 12dfa39..c48cb06 100644
--- a/tests/corelib_2/set_removeAll_test.dart
+++ b/tests/corelib_2/set_removeAll_test.dart
@@ -23,6 +23,6 @@
for (var setToTest in sets) {
// Test that the set accepts a list that is not of the same type:
// Set<B>.removeAll(List<A>)
- Expect.isNull(setToTest.removeAll(<A>[new A()]));
+ Expect.isNull(setToTest.removeAll(<A>[new A()]) as dynamic);
}
}
diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status
index 67463f9..814eee9 100644
--- a/tests/language/language_analyzer2.status
+++ b/tests/language/language_analyzer2.status
@@ -117,6 +117,7 @@
getter_no_setter_test/01: StaticWarning
getter_no_setter_test/none: Fail # Issue 11579
getter_setter_in_lib_test: Fail # Issue 23286
+if_null_evaluation_order_test/01: StaticWarning # invalid use of void for dart 2, see also #32100
implicit_this_test/02: StaticWarning
implicit_this_test/none: Fail # Issue 11575
implied_interface_test: StaticWarning
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index ad5f14a..368ba6a 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -1136,7 +1136,6 @@
constructor_named_arguments_test/none: RuntimeError
constructor_redirect1_negative_test: Crash # Issue 30856
constructor_redirect2_negative_test: Crash # Issue 30856
-constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
cyclic_constructor_test/01: Crash # Issue 30856
deferred_constraints_constants_test/none: CompileTimeError
diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status
index 40ddb5e..7f1bb06 100644
--- a/tests/language/language_kernel.status
+++ b/tests/language/language_kernel.status
@@ -28,7 +28,6 @@
constants_test/05: MissingCompileTimeError
constructor_redirect1_negative_test: Fail
constructor_redirect2_negative_test: Fail
-constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: MissingCompileTimeError
cyclic_constructor_test/01: MissingCompileTimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
diff --git a/tests/language_2/field_test.dart b/tests/language_2/field_test.dart
index fd255fa..03e7085 100644
--- a/tests/language_2/field_test.dart
+++ b/tests/language_2/field_test.dart
@@ -4,13 +4,10 @@
// Dart test program for testing setting/getting of instance fields.
import "package:expect/expect.dart";
-import "package:meta/meta.dart" show virtual;
class First {
First() {}
- @virtual
var a;
- @virtual
var b;
addFields() {
@@ -25,8 +22,6 @@
}
class Second extends First {
- // TODO: consider removing once http://b/4254120 is fixed.
- Second() : super() {}
var c;
get a {
return -12;
@@ -37,6 +32,21 @@
}
}
+class FieldInitializedToNull {
+ int x, y;
+
+ static void test() {
+ var f = new FieldInitializedToNull();
+ int missingArg([int x = 42]) => x;
+ Expect.isNull(f.x);
+ Expect.isNull(f.y);
+ // Regression tests for a DDC bug, where undefined gets initialized in the
+ // fields, and is incorrect recognized as a missing argument.
+ Expect.isNull(missingArg(f.x));
+ Expect.isNull(missingArg(f.y));
+ }
+}
+
class FieldTest {
static one() {
var f = new First();
@@ -68,13 +78,10 @@
o.b = o;
Expect.equals(12, o.c);
}
-
- static testMain() {
- // FieldTest.one();
- FieldTest.two();
- }
}
main() {
- FieldTest.testMain();
+ FieldTest.one();
+ FieldTest.two();
+ FieldInitializedToNull.test();
}
diff --git a/tests/language_2/generalized_void_syntax_test.dart b/tests/language_2/generalized_void_syntax_test.dart
index f18d69a..6ceb475 100644
--- a/tests/language_2/generalized_void_syntax_test.dart
+++ b/tests/language_2/generalized_void_syntax_test.dart
@@ -28,11 +28,13 @@
A<void> m3(A<void> x, [A<void> y]) => new A<void>(null);
A<void> m4(A<void> x, {A<void> y}) => new A<void>(null);
-class B<S, T> implements A<void> { void get t => null; }
+class B<S, T> implements A<void> {
+ void get t => null;
+}
class C extends A<void> with B<void, A<void>> {
- C(): super(null);
-
+ C() : super(null);
+
static final void x1 = null;
static final A<void> x2 = new A<void>(null);
@@ -47,7 +49,7 @@
covariant void x11 = null, x12;
covariant A<void> x13 = new A<void>(null), x14;
-
+
static void get g1 => null;
static A<void> get g2 => new A<void>(null);
static void set s1(void x) => null;
@@ -68,11 +70,25 @@
// Ensure that all members are used, and use `void` in expressions.
void run() {
- List<dynamic> ignore = [
- x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, //
- g1, g2, g3, g4,
- ];
-
+ x1;
+ x2;
+ x3;
+ x4;
+ x5;
+ x6;
+ x7;
+ x8;
+ x9;
+ x10;
+ x11;
+ x12;
+ x13;
+ x14;
+ g1;
+ g2;
+ g3;
+ g4;
+
s1 = null;
s2 = new A<void>(null);
s3 = null;
@@ -96,7 +112,17 @@
// Testing syntax, just enforce compilation.
main() {
- List<dynamic> ignore = [x1, x2, x3, x4, x5, x6, x7, x8, g1, g2];
+ // ignore
+ x1;
+ x2;
+ x3;
+ x4;
+ x5;
+ x6;
+ x7;
+ x8;
+ g1;
+ g2;
s1 = null;
s2 = new A<void>(null);
diff --git a/tests/language_2/if_null_evaluation_order_test.dart b/tests/language_2/if_null_evaluation_order_test.dart
index fa93170..c819a9b 100644
--- a/tests/language_2/if_null_evaluation_order_test.dart
+++ b/tests/language_2/if_null_evaluation_order_test.dart
@@ -10,7 +10,7 @@
import "package:expect/expect.dart";
-void bad() {
+bad() {
throw new Exception();
}
diff --git a/tests/language_2/inlined_throw_test.dart b/tests/language_2/inlined_throw_test.dart
index 976f127..52f3ef4 100644
--- a/tests/language_2/inlined_throw_test.dart
+++ b/tests/language_2/inlined_throw_test.dart
@@ -126,7 +126,7 @@
call1() => ternary(0, kast("call1"), 1);
call2() => ternary(kast("call2"), 0, 1);
call3() => ternary(0, 1, kast("call3"));
-call1c() => ternary(callMe(), kast("call1"), 1);
+call1c() => ternary(callMe() as dynamic, kast("call1"), 1);
call3c() => ternary(callMeTrue(), 1, kast("call3"));
call4c() => ternary(0, callMeTrue(), kast("call3"));
@@ -135,7 +135,7 @@
}
sendSetCallThrow() {
- var x = callMe(), y = kast("sendSet");
+ var x = callMe() as dynamic, y = kast("sendSet");
}
isSend() => kast("isSend") is int;
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index d231e1f..2902b0f 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -156,201 +156,81 @@
void_type_override_test/01: MissingCompileTimeError
void_type_override_test/02: MissingCompileTimeError
void_type_override_test/03: MissingCompileTimeError
-void_type_usage_test/call_argument: MissingCompileTimeError
void_type_usage_test/call_conditional: MissingCompileTimeError
-void_type_usage_test/call_do_while: MissingCompileTimeError
-void_type_usage_test/call_dynamic_init: MissingCompileTimeError
-void_type_usage_test/call_for_in: MissingCompileTimeError
-void_type_usage_test/call_is: MissingCompileTimeError
void_type_usage_test/call_literal_list_init: MissingCompileTimeError
void_type_usage_test/call_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/call_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/call_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/call_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/call_null_equals2: MissingCompileTimeError
void_type_usage_test/call_return: MissingCompileTimeError
-void_type_usage_test/call_throw: MissingCompileTimeError
-void_type_usage_test/call_void_init: MissingCompileTimeError
-void_type_usage_test/call_while: MissingCompileTimeError
-void_type_usage_test/conditional2_argument: MissingCompileTimeError
void_type_usage_test/conditional2_conditional: MissingCompileTimeError
-void_type_usage_test/conditional2_dynamic_init: MissingCompileTimeError
void_type_usage_test/conditional2_for: MissingCompileTimeError
void_type_usage_test/conditional2_literal_list_init: MissingCompileTimeError
void_type_usage_test/conditional2_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/conditional2_literal_map_value_init2: MissingCompileTimeError
void_type_usage_test/conditional2_null_equals2: MissingCompileTimeError
void_type_usage_test/conditional2_parens: MissingCompileTimeError
void_type_usage_test/conditional2_return: MissingCompileTimeError
void_type_usage_test/conditional2_return_to_void: MissingCompileTimeError
void_type_usage_test/conditional2_stmt: MissingCompileTimeError
-void_type_usage_test/conditional2_throw: MissingCompileTimeError
-void_type_usage_test/conditional2_void_init: MissingCompileTimeError
-void_type_usage_test/conditional2do_while: MissingCompileTimeError
-void_type_usage_test/conditional2for_in: MissingCompileTimeError
-void_type_usage_test/conditional2while: MissingCompileTimeError
-void_type_usage_test/conditional3_argument: MissingCompileTimeError
void_type_usage_test/conditional3_conditional: MissingCompileTimeError
-void_type_usage_test/conditional3_dynamic_init: MissingCompileTimeError
void_type_usage_test/conditional3_for: MissingCompileTimeError
void_type_usage_test/conditional3_literal_list_init: MissingCompileTimeError
void_type_usage_test/conditional3_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/conditional3_literal_map_value_init2: MissingCompileTimeError
void_type_usage_test/conditional3_null_equals2: MissingCompileTimeError
void_type_usage_test/conditional3_parens: MissingCompileTimeError
void_type_usage_test/conditional3_return: MissingCompileTimeError
void_type_usage_test/conditional3_return_to_void: MissingCompileTimeError
void_type_usage_test/conditional3_stmt: MissingCompileTimeError
-void_type_usage_test/conditional3_throw: MissingCompileTimeError
-void_type_usage_test/conditional3_void_init: MissingCompileTimeError
-void_type_usage_test/conditional_argument: MissingCompileTimeError
void_type_usage_test/conditional_conditional: MissingCompileTimeError
-void_type_usage_test/conditional_do_while: MissingCompileTimeError
-void_type_usage_test/conditional_dynamic_init: MissingCompileTimeError
void_type_usage_test/conditional_for: MissingCompileTimeError
-void_type_usage_test/conditional_for_in: MissingCompileTimeError
void_type_usage_test/conditional_literal_list_init: MissingCompileTimeError
void_type_usage_test/conditional_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/conditional_literal_map_value_init2: MissingCompileTimeError
void_type_usage_test/conditional_null_equals2: MissingCompileTimeError
void_type_usage_test/conditional_parens: MissingCompileTimeError
void_type_usage_test/conditional_return: MissingCompileTimeError
void_type_usage_test/conditional_return_to_void: MissingCompileTimeError
void_type_usage_test/conditional_stmt: MissingCompileTimeError
-void_type_usage_test/conditional_throw: MissingCompileTimeError
-void_type_usage_test/conditional_void_init: MissingCompileTimeError
-void_type_usage_test/conditional_while: MissingCompileTimeError
-void_type_usage_test/final_local_argument: MissingCompileTimeError
void_type_usage_test/final_local_conditional: MissingCompileTimeError
-void_type_usage_test/final_local_do_while: MissingCompileTimeError
-void_type_usage_test/final_local_dynamic_init: MissingCompileTimeError
-void_type_usage_test/final_local_for_in: MissingCompileTimeError
void_type_usage_test/final_local_for_in2: MissingCompileTimeError
-void_type_usage_test/final_local_is: MissingCompileTimeError
void_type_usage_test/final_local_literal_list_init: MissingCompileTimeError
void_type_usage_test/final_local_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/final_local_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/final_local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/final_local_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/final_local_null_equals2: MissingCompileTimeError
void_type_usage_test/final_local_return: MissingCompileTimeError
-void_type_usage_test/final_local_throw: MissingCompileTimeError
-void_type_usage_test/final_local_void_init: MissingCompileTimeError
-void_type_usage_test/final_local_while: MissingCompileTimeError
-void_type_usage_test/global_argument: MissingCompileTimeError
void_type_usage_test/global_conditional: MissingCompileTimeError
-void_type_usage_test/global_do_while: MissingCompileTimeError
-void_type_usage_test/global_dynamic_init: MissingCompileTimeError
-void_type_usage_test/global_for_in: MissingCompileTimeError
-void_type_usage_test/global_is: MissingCompileTimeError
void_type_usage_test/global_literal_list_init: MissingCompileTimeError
void_type_usage_test/global_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/global_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/global_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/global_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/global_null_equals2: MissingCompileTimeError
void_type_usage_test/global_return: MissingCompileTimeError
-void_type_usage_test/global_throw: MissingCompileTimeError
-void_type_usage_test/global_void_init: MissingCompileTimeError
-void_type_usage_test/global_while: MissingCompileTimeError
-void_type_usage_test/instance2_argument: MissingCompileTimeError
void_type_usage_test/instance2_conditional: MissingCompileTimeError
-void_type_usage_test/instance2_do_while: MissingCompileTimeError
-void_type_usage_test/instance2_dynamic_init: MissingCompileTimeError
-void_type_usage_test/instance2_for_in: MissingCompileTimeError
void_type_usage_test/instance2_for_in2: MissingCompileTimeError
-void_type_usage_test/instance2_is: MissingCompileTimeError
void_type_usage_test/instance2_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance2_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/instance2_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/instance2_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance2_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/instance2_null_equals2: MissingCompileTimeError
void_type_usage_test/instance2_return: MissingCompileTimeError
-void_type_usage_test/instance2_throw: MissingCompileTimeError
-void_type_usage_test/instance2_void_init: MissingCompileTimeError
-void_type_usage_test/instance2_while: MissingCompileTimeError
-void_type_usage_test/instance3_argument: MissingCompileTimeError
void_type_usage_test/instance3_conditional: MissingCompileTimeError
-void_type_usage_test/instance3_do_while: MissingCompileTimeError
-void_type_usage_test/instance3_dynamic_init: MissingCompileTimeError
-void_type_usage_test/instance3_for_in: MissingCompileTimeError
void_type_usage_test/instance3_for_in2: MissingCompileTimeError
-void_type_usage_test/instance3_is: MissingCompileTimeError
void_type_usage_test/instance3_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance3_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/instance3_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/instance3_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance3_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/instance3_null_equals2: MissingCompileTimeError
void_type_usage_test/instance3_return: MissingCompileTimeError
-void_type_usage_test/instance3_throw: MissingCompileTimeError
-void_type_usage_test/instance3_void_init: MissingCompileTimeError
-void_type_usage_test/instance3_while: MissingCompileTimeError
-void_type_usage_test/instance_argument: MissingCompileTimeError
void_type_usage_test/instance_conditional: MissingCompileTimeError
-void_type_usage_test/instance_do_while: MissingCompileTimeError
-void_type_usage_test/instance_dynamic_init: MissingCompileTimeError
-void_type_usage_test/instance_for_in: MissingCompileTimeError
-void_type_usage_test/instance_is: MissingCompileTimeError
void_type_usage_test/instance_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/instance_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/instance_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/instance_null_equals2: MissingCompileTimeError
void_type_usage_test/instance_return: MissingCompileTimeError
-void_type_usage_test/instance_throw: MissingCompileTimeError
-void_type_usage_test/instance_void_init: MissingCompileTimeError
-void_type_usage_test/instance_while: MissingCompileTimeError
-void_type_usage_test/local_argument: MissingCompileTimeError
void_type_usage_test/local_conditional: MissingCompileTimeError
-void_type_usage_test/local_do_while: MissingCompileTimeError
-void_type_usage_test/local_dynamic_init: MissingCompileTimeError
-void_type_usage_test/local_for_in: MissingCompileTimeError
-void_type_usage_test/local_is: MissingCompileTimeError
void_type_usage_test/local_literal_list_init: MissingCompileTimeError
void_type_usage_test/local_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/local_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/local_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/local_null_equals2: MissingCompileTimeError
void_type_usage_test/local_return: MissingCompileTimeError
-void_type_usage_test/local_throw: MissingCompileTimeError
-void_type_usage_test/local_void_init: MissingCompileTimeError
-void_type_usage_test/local_while: MissingCompileTimeError
-void_type_usage_test/param_argument: MissingCompileTimeError
void_type_usage_test/param_conditional: MissingCompileTimeError
-void_type_usage_test/param_do_while: MissingCompileTimeError
-void_type_usage_test/param_dynamic_init: MissingCompileTimeError
-void_type_usage_test/param_for_in: MissingCompileTimeError
-void_type_usage_test/param_is: MissingCompileTimeError
void_type_usage_test/param_literal_list_init: MissingCompileTimeError
void_type_usage_test/param_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/param_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/param_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/param_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/param_null_equals2: MissingCompileTimeError
void_type_usage_test/param_return: MissingCompileTimeError
-void_type_usage_test/param_throw: MissingCompileTimeError
-void_type_usage_test/param_void_init: MissingCompileTimeError
-void_type_usage_test/param_while: MissingCompileTimeError
-void_type_usage_test/paren_argument: MissingCompileTimeError
void_type_usage_test/paren_conditional: MissingCompileTimeError
-void_type_usage_test/paren_do_while: MissingCompileTimeError
-void_type_usage_test/paren_dynamic_init: MissingCompileTimeError
-void_type_usage_test/paren_for_in: MissingCompileTimeError
-void_type_usage_test/paren_is: MissingCompileTimeError
void_type_usage_test/paren_literal_list_init: MissingCompileTimeError
void_type_usage_test/paren_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/paren_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/paren_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/paren_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/paren_null_equals2: MissingCompileTimeError
void_type_usage_test/paren_return: MissingCompileTimeError
-void_type_usage_test/paren_throw: MissingCompileTimeError
-void_type_usage_test/paren_void_init: MissingCompileTimeError
-void_type_usage_test/paren_while: MissingCompileTimeError
[ $compiler == dart2analyzer && $runtime == none ]
error_stacktrace_test/00: MissingCompileTimeError
@@ -1243,6 +1123,7 @@
instantiate_type_variable_test/01: CompileTimeError
interceptor6_test: CompileTimeError
issue13673_test: StaticWarning # Issue 31925
+issue15606_test/none: CompileTimeError # invalid use of void for dart 2
issue31596_implement_covariant_test: CompileTimeError
issue31596_override_test/01: CompileTimeError
issue31596_override_test/02: CompileTimeError
@@ -1333,7 +1214,6 @@
type_promotion_functions_test/10: Pass
vm/lazy_deopt_with_exception_test: CompileTimeError
void_type_callbacks_test/00: MissingCompileTimeError # Issue 30177
-void_type_callbacks_test/01: MissingCompileTimeError # Issue 30177
void_type_function_types_test/none: CompileTimeError # Issue 30177
[ $compiler == dart2analyzer && !$strong ]
@@ -1534,6 +1414,7 @@
invalid_cast_test/11: MissingCompileTimeError
invocation_mirror_test: StaticWarning
issue13179_test: StaticWarning
+issue15606_test/none: StaticWarning # invalid use of void for dart 2, see also #32100
issue31596_override_test/05: MissingCompileTimeError
issue31596_override_test/06: MissingCompileTimeError
issue31596_override_test/07: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 29af3d6..22eab3f 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -755,9 +755,6 @@
type_parameter_test/09: Crash # Internal Error: Unexpected type variable in static context.
type_variable_scope_test/03: Crash # Internal Error: Unexpected type variable in static context.
-[ $compiler == dart2js && $checked && $dart2js_with_kernel && !$strong ]
-*: SkipByDesign
-
[ $compiler == dart2js && $checked && !$dart2js_with_kernel ]
async_return_types_test/nestedFuture: Fail # Issue 26429
async_return_types_test/wrongTypeParameter: Fail # Issue 26429
@@ -877,9 +874,6 @@
list_literal1_test/01: MissingCompileTimeError
type_check_const_function_typedef2_test: MissingCompileTimeError
-[ $compiler == dart2js && !$checked && !$dart2js_with_kernel && $minified ]
-function_subtype_inline2_test: RuntimeError
-
[ $compiler == dart2js && $dart2js_with_kernel ]
async_error_timing_test: Crash
bug31436_test: RuntimeError
@@ -1351,9 +1345,6 @@
type_variable_conflict2_test/02: MissingCompileTimeError
typevariable_substitution2_test/02: RuntimeError
-[ $compiler == dart2js && $dart2js_with_kernel && $fast_startup && !$strong ]
-*: SkipByDesign
-
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked && $strong ]
abstract_factory_constructor_test/00: MissingCompileTimeError
abstract_getter_test/01: MissingCompileTimeError
@@ -1432,7 +1423,6 @@
class_literal_static_test/01: MissingCompileTimeError
class_literal_static_test/03: MissingCompileTimeError
class_literal_static_test/07: MissingCompileTimeError
-closure_in_constructor_test: RuntimeError
closure_invoked_through_interface_target_field_test: MissingCompileTimeError
closure_invoked_through_interface_target_getter_test: MissingCompileTimeError
closure_self_reference_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/nodes.dart': Failed assertion: line 641 pos 12: 'isClosed()': is not true.
@@ -1482,7 +1472,6 @@
constructor_named_arguments_test/none: RuntimeError
constructor_redirect1_negative_test/01: Crash # Stack Overflow
constructor_redirect2_negative_test: Crash # Issue 30856
-constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
constructor_redirect_test/none: CompileTimeError
covariance_type_parameter_test/01: RuntimeError
@@ -1521,6 +1510,7 @@
duplicate_export_negative_test: Fail
duplicate_implements_test/01: MissingCompileTimeError
duplicate_implements_test/02: MissingCompileTimeError
+dynamic_invoke_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
dynamic_prefix_core_test/none: CompileTimeError
dynamic_test: RuntimeError
emit_const_fields_test: CompileTimeError
@@ -1533,6 +1523,9 @@
external_test/21: CompileTimeError
external_test/24: CompileTimeError
extract_type_arguments_test: RuntimeError
+f_bounded_equality_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+f_bounded_quantification4_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+f_bounded_quantification5_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
f_bounded_quantification_test/01: MissingCompileTimeError
f_bounded_quantification_test/02: MissingCompileTimeError
factory2_test/03: MissingCompileTimeError
@@ -1552,6 +1545,11 @@
field_override4_test/02: MissingCompileTimeError
field_override_test/00: MissingCompileTimeError
field_override_test/01: MissingCompileTimeError
+first_class_types_libraries_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+first_class_types_literals_test/01: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+first_class_types_literals_test/02: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+first_class_types_literals_test/none: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+first_class_types_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
flatten_test/05: MissingRuntimeError
flatten_test/08: MissingRuntimeError
flatten_test/09: MissingRuntimeError
@@ -1576,7 +1574,6 @@
function_subtype_checked0_test: RuntimeError
function_subtype_closure0_test: RuntimeError
function_subtype_closure1_test: RuntimeError
-function_subtype_factory0_test: RuntimeError
function_subtype_factory1_test: RuntimeError
function_subtype_inline1_test: RuntimeError
function_subtype_inline2_test: RuntimeError
@@ -1598,6 +1595,7 @@
function_subtype_typearg3_test: RuntimeError
function_subtype_typearg5_test: RuntimeError
function_type2_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(B.T) in (local(B.#)) for j:signature(B_closure.$signature).
+function_type_alias10_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
function_type_alias2_test: RuntimeError
function_type_alias3_test: RuntimeError
function_type_alias4_test: RuntimeError
@@ -1605,8 +1603,9 @@
function_type_call_getter2_test/none: RuntimeError
function_type_test: RuntimeError
fuzzy_arrows_test/03: RuntimeError
-generic_closure_test/01: RuntimeError
+generic_closure_test/01: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
generic_closure_test/none: RuntimeError
+generic_creation_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
generic_field_mixin6_test/none: RuntimeError
generic_function_bounds_test: Crash # Unsupported operation: Unsupported type parameter type node U.
generic_function_dcall_test: Crash # Unsupported operation: Unsupported type parameter type node T.
@@ -1622,9 +1621,9 @@
generic_methods_dynamic_test/02: MissingRuntimeError
generic_methods_dynamic_test/04: MissingRuntimeError
generic_methods_generic_class_tearoff_test: RuntimeError
-generic_methods_generic_function_result_test/01: MissingCompileTimeError
+generic_methods_generic_function_result_test/01: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+generic_methods_generic_function_result_test/none: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
generic_methods_named_parameters_test: RuntimeError
-generic_methods_new_test: RuntimeError
generic_methods_optional_parameters_test: RuntimeError
generic_methods_overriding_test/01: MissingCompileTimeError
generic_methods_recursive_bound_test/02: MissingCompileTimeError
@@ -1803,6 +1802,7 @@
mixin_mixin3_test: RuntimeError
mixin_mixin_type_arguments_test: RuntimeError
mixin_of_mixin_test/none: CompileTimeError
+mixin_regress_13688_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
mixin_super_2_test/none: CompileTimeError
mixin_super_bound_test/01: MissingCompileTimeError
mixin_super_bound_test/02: MissingCompileTimeError
@@ -1857,12 +1857,13 @@
named_parameters_test/08: MissingCompileTimeError
named_parameters_test/10: MissingCompileTimeError
nan_identical_test: RuntimeError
-nested_generic_closure_test: RuntimeError
+nested_generic_closure_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
no_main_test/01: CompileTimeError
no_such_method_mock_test: RuntimeError
no_such_method_test: CompileTimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/05: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/06: RuntimeError
+null2_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
null_no_such_method_test: CompileTimeError
null_test/mirrors: CompileTimeError
null_test/none: CompileTimeError
@@ -1935,6 +1936,7 @@
override_method_with_field_test/01: MissingCompileTimeError
parser_quirks_test: CompileTimeError
prefix5_negative_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.
+recursive_generic_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
redirecting_factory_default_values_test/01: MissingCompileTimeError
redirecting_factory_default_values_test/02: MissingCompileTimeError
redirecting_factory_default_values_test/03: MissingCompileTimeError
@@ -1947,7 +1949,6 @@
regress_18535_test: CompileTimeError
regress_23089_test: Crash # Stack Overflow
regress_23408_test: CompileTimeError
-regress_23650_test: RuntimeError
regress_24283_test: 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).
@@ -1960,7 +1961,9 @@
regress_30339_test: CompileTimeError
regress_31591_test: RuntimeError
regress_32012_test: Crash # Unsupported operation: Unsupported type parameter type node B.
-runtime_type_function_test: RuntimeError
+reify_typevar_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+runtime_type_function_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
+runtime_type_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
setter4_test: MissingCompileTimeError
setter_no_getter_call_test/01: CompileTimeError
setter_no_getter_test/01: CompileTimeError
@@ -2031,7 +2034,6 @@
type_error_test: RuntimeError
type_literal_prefix_call_test/00: MissingCompileTimeError
type_literal_test: RuntimeError
-type_parameter_test/none: RuntimeError
type_promotion_functions_test/02: CompileTimeError
type_promotion_functions_test/03: CompileTimeError
type_promotion_functions_test/04: CompileTimeError
@@ -2054,10 +2056,8 @@
type_variable_bounds_test/06: MissingCompileTimeError
type_variable_bounds_test/08: MissingCompileTimeError
type_variable_bounds_test/11: MissingCompileTimeError
-type_variable_closure2_test: RuntimeError
-type_variable_closure4_test: RuntimeError
type_variable_nested_test/01: RuntimeError
-type_variable_promotion_test: RuntimeError
+type_variable_promotion_test: Crash # Assertion failure: Only 2 of 3 arguments have been read from: [HRef(HForeignCode("# ? Object.keys(#) : []")), literal: NullConstant, literal: NullConstant]
typevariable_substitution2_test/02: RuntimeError
vm/async_await_catch_stacktrace_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).
vm/causal_async_exception_stack2_test: Crash # Assertion failure: Unexpected arguments. Expected 1 argument, actual: [invoke dynamic method: selector=Selector(operator, *, arity=1), mask=[subclass=JSUInt32], HTypeInfoReadVariable(ListQueue.E)].
@@ -2130,9 +2130,6 @@
wrong_number_type_arguments_test/01: MissingCompileTimeError
wrong_number_type_arguments_test/none: Pass
-[ $compiler == dart2js && $dart2js_with_kernel && $host_checked && !$strong ]
-*: SkipByDesign
-
[ $compiler == dart2js && $dart2js_with_kernel && $minified && $strong ]
abstract_factory_constructor_test/00: MissingCompileTimeError
abstract_getter_test/01: MissingCompileTimeError
@@ -2259,7 +2256,6 @@
constructor_named_arguments_test/none: RuntimeError
constructor_redirect1_negative_test/01: Crash # Stack Overflow
constructor_redirect2_negative_test: Crash # Issue 30856
-constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
constructor_redirect_test/none: CompileTimeError
covariance_type_parameter_test/01: RuntimeError
@@ -2840,7 +2836,7 @@
wrong_number_type_arguments_test/01: MissingCompileTimeError
wrong_number_type_arguments_test/none: Pass
-[ $compiler == dart2js && $dart2js_with_kernel && $minified && !$strong ]
+[ $compiler == dart2js && $dart2js_with_kernel && !$strong ]
*: SkipByDesign
[ $compiler == dart2js && !$dart2js_with_kernel ]
@@ -3226,8 +3222,7 @@
identical_const_test/03: MissingCompileTimeError
identical_const_test/04: MissingCompileTimeError
if_null_assignment_behavior_test/03: MissingCompileTimeError
-if_null_assignment_behavior_test/13: Crash # Issue 23491
-if_null_assignment_behavior_test/13: MissingCompileTimeError
+if_null_assignment_behavior_test/13: MissingCompileTimeError, Crash # Issue 23491
if_null_assignment_behavior_test/14: Crash # Issue 23491
if_null_assignment_behavior_test/15: MissingCompileTimeError
if_null_assignment_static_test/02: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index 5e36a0c..e3eb89a 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -54,6 +54,7 @@
instantiate_tearoff_of_call_test: RuntimeError
interface_test/00: MissingCompileTimeError
internal_library_test/01: MissingCompileTimeError # Issue 29920
+issue15606_test/none: CompileTimeError
issue31596_implement_covariant_test: CompileTimeError
issue31596_override_test/01: CompileTimeError
issue31596_override_test/02: CompileTimeError
@@ -135,208 +136,87 @@
type_promotion_functions_test/none: CompileTimeError # Issue 30895
type_variable_scope_test/none: CompileTimeError
void_type_callbacks_test/00: MissingCompileTimeError # Issue 30514
-void_type_callbacks_test/01: MissingCompileTimeError # Issue 30514
void_type_function_types_test/none: CompileTimeError # Issue 30514
void_type_override_test/00: MissingCompileTimeError
void_type_override_test/00b: MissingCompileTimeError
void_type_override_test/01: MissingCompileTimeError
void_type_override_test/02: MissingCompileTimeError
void_type_override_test/03: MissingCompileTimeError
-void_type_usage_test/call_argument: MissingCompileTimeError
void_type_usage_test/call_conditional: MissingCompileTimeError
-void_type_usage_test/call_do_while: MissingCompileTimeError
-void_type_usage_test/call_dynamic_init: MissingCompileTimeError
-void_type_usage_test/call_for_in: MissingCompileTimeError
-void_type_usage_test/call_is: MissingCompileTimeError
void_type_usage_test/call_literal_list_init: MissingCompileTimeError
void_type_usage_test/call_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/call_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/call_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/call_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/call_null_equals2: MissingCompileTimeError
void_type_usage_test/call_return: MissingCompileTimeError
-void_type_usage_test/call_throw: MissingCompileTimeError
-void_type_usage_test/call_void_init: MissingCompileTimeError
-void_type_usage_test/call_while: MissingCompileTimeError
-void_type_usage_test/conditional2_argument: MissingCompileTimeError
void_type_usage_test/conditional2_conditional: MissingCompileTimeError
-void_type_usage_test/conditional2_dynamic_init: MissingCompileTimeError
void_type_usage_test/conditional2_for: MissingCompileTimeError
void_type_usage_test/conditional2_literal_list_init: MissingCompileTimeError
void_type_usage_test/conditional2_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/conditional2_literal_map_value_init2: MissingCompileTimeError
void_type_usage_test/conditional2_null_equals2: MissingCompileTimeError
void_type_usage_test/conditional2_parens: MissingCompileTimeError
void_type_usage_test/conditional2_return: MissingCompileTimeError
void_type_usage_test/conditional2_return_to_void: MissingCompileTimeError
void_type_usage_test/conditional2_stmt: MissingCompileTimeError
-void_type_usage_test/conditional2_throw: MissingCompileTimeError
-void_type_usage_test/conditional2_void_init: MissingCompileTimeError
-void_type_usage_test/conditional2do_while: MissingCompileTimeError
-void_type_usage_test/conditional2for_in: MissingCompileTimeError
-void_type_usage_test/conditional2while: MissingCompileTimeError
-void_type_usage_test/conditional3_argument: MissingCompileTimeError
void_type_usage_test/conditional3_conditional: MissingCompileTimeError
-void_type_usage_test/conditional3_dynamic_init: MissingCompileTimeError
void_type_usage_test/conditional3_for: MissingCompileTimeError
void_type_usage_test/conditional3_literal_list_init: MissingCompileTimeError
void_type_usage_test/conditional3_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/conditional3_literal_map_value_init2: MissingCompileTimeError
void_type_usage_test/conditional3_null_equals2: MissingCompileTimeError
void_type_usage_test/conditional3_parens: MissingCompileTimeError
void_type_usage_test/conditional3_return: MissingCompileTimeError
void_type_usage_test/conditional3_return_to_void: MissingCompileTimeError
void_type_usage_test/conditional3_stmt: MissingCompileTimeError
-void_type_usage_test/conditional3_throw: MissingCompileTimeError
-void_type_usage_test/conditional3_void_init: MissingCompileTimeError
-void_type_usage_test/conditional_argument: MissingCompileTimeError
void_type_usage_test/conditional_conditional: MissingCompileTimeError
-void_type_usage_test/conditional_do_while: MissingCompileTimeError
-void_type_usage_test/conditional_dynamic_init: MissingCompileTimeError
void_type_usage_test/conditional_for: MissingCompileTimeError
-void_type_usage_test/conditional_for_in: MissingCompileTimeError
void_type_usage_test/conditional_literal_list_init: MissingCompileTimeError
void_type_usage_test/conditional_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/conditional_literal_map_value_init2: MissingCompileTimeError
void_type_usage_test/conditional_null_equals2: MissingCompileTimeError
void_type_usage_test/conditional_parens: MissingCompileTimeError
void_type_usage_test/conditional_return: MissingCompileTimeError
void_type_usage_test/conditional_return_to_void: MissingCompileTimeError
void_type_usage_test/conditional_stmt: MissingCompileTimeError
-void_type_usage_test/conditional_throw: MissingCompileTimeError
-void_type_usage_test/conditional_void_init: MissingCompileTimeError
-void_type_usage_test/conditional_while: MissingCompileTimeError
-void_type_usage_test/final_local_argument: MissingCompileTimeError
void_type_usage_test/final_local_conditional: MissingCompileTimeError
-void_type_usage_test/final_local_do_while: MissingCompileTimeError
-void_type_usage_test/final_local_dynamic_init: MissingCompileTimeError
-void_type_usage_test/final_local_for_in: MissingCompileTimeError
void_type_usage_test/final_local_for_in2: MissingCompileTimeError
-void_type_usage_test/final_local_is: MissingCompileTimeError
void_type_usage_test/final_local_literal_list_init: MissingCompileTimeError
void_type_usage_test/final_local_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/final_local_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/final_local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/final_local_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/final_local_null_equals2: MissingCompileTimeError
void_type_usage_test/final_local_return: MissingCompileTimeError
-void_type_usage_test/final_local_throw: MissingCompileTimeError
-void_type_usage_test/final_local_void_init: MissingCompileTimeError
-void_type_usage_test/final_local_while: MissingCompileTimeError
-void_type_usage_test/global_argument: MissingCompileTimeError
void_type_usage_test/global_conditional: MissingCompileTimeError
-void_type_usage_test/global_do_while: MissingCompileTimeError
-void_type_usage_test/global_dynamic_init: MissingCompileTimeError
-void_type_usage_test/global_for_in: MissingCompileTimeError
-void_type_usage_test/global_is: MissingCompileTimeError
void_type_usage_test/global_literal_list_init: MissingCompileTimeError
void_type_usage_test/global_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/global_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/global_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/global_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/global_null_equals2: MissingCompileTimeError
void_type_usage_test/global_return: MissingCompileTimeError
-void_type_usage_test/global_throw: MissingCompileTimeError
-void_type_usage_test/global_void_init: MissingCompileTimeError
-void_type_usage_test/global_while: MissingCompileTimeError
-void_type_usage_test/instance2_argument: MissingCompileTimeError
void_type_usage_test/instance2_conditional: MissingCompileTimeError
-void_type_usage_test/instance2_do_while: MissingCompileTimeError
-void_type_usage_test/instance2_dynamic_init: MissingCompileTimeError
-void_type_usage_test/instance2_for_in: MissingCompileTimeError
void_type_usage_test/instance2_for_in2: MissingCompileTimeError
-void_type_usage_test/instance2_is: MissingCompileTimeError
void_type_usage_test/instance2_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance2_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/instance2_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/instance2_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance2_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/instance2_null_equals2: MissingCompileTimeError
void_type_usage_test/instance2_return: MissingCompileTimeError
-void_type_usage_test/instance2_throw: MissingCompileTimeError
-void_type_usage_test/instance2_void_init: MissingCompileTimeError
-void_type_usage_test/instance2_while: MissingCompileTimeError
-void_type_usage_test/instance3_argument: MissingCompileTimeError
void_type_usage_test/instance3_conditional: MissingCompileTimeError
-void_type_usage_test/instance3_do_while: MissingCompileTimeError
-void_type_usage_test/instance3_dynamic_init: MissingCompileTimeError
-void_type_usage_test/instance3_for_in: MissingCompileTimeError
void_type_usage_test/instance3_for_in2: MissingCompileTimeError
-void_type_usage_test/instance3_is: MissingCompileTimeError
void_type_usage_test/instance3_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance3_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/instance3_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/instance3_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance3_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/instance3_null_equals2: MissingCompileTimeError
void_type_usage_test/instance3_return: MissingCompileTimeError
-void_type_usage_test/instance3_throw: MissingCompileTimeError
-void_type_usage_test/instance3_void_init: MissingCompileTimeError
-void_type_usage_test/instance3_while: MissingCompileTimeError
-void_type_usage_test/instance_argument: MissingCompileTimeError
void_type_usage_test/instance_conditional: MissingCompileTimeError
-void_type_usage_test/instance_do_while: MissingCompileTimeError
-void_type_usage_test/instance_dynamic_init: MissingCompileTimeError
-void_type_usage_test/instance_for_in: MissingCompileTimeError
-void_type_usage_test/instance_is: MissingCompileTimeError
void_type_usage_test/instance_literal_list_init: MissingCompileTimeError
void_type_usage_test/instance_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/instance_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/instance_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/instance_null_equals2: MissingCompileTimeError
void_type_usage_test/instance_return: MissingCompileTimeError
-void_type_usage_test/instance_throw: MissingCompileTimeError
-void_type_usage_test/instance_void_init: MissingCompileTimeError
-void_type_usage_test/instance_while: MissingCompileTimeError
-void_type_usage_test/local_argument: MissingCompileTimeError
void_type_usage_test/local_conditional: MissingCompileTimeError
-void_type_usage_test/local_do_while: MissingCompileTimeError
-void_type_usage_test/local_dynamic_init: MissingCompileTimeError
-void_type_usage_test/local_for_in: MissingCompileTimeError
-void_type_usage_test/local_is: MissingCompileTimeError
void_type_usage_test/local_literal_list_init: MissingCompileTimeError
void_type_usage_test/local_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/local_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/local_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/local_null_equals2: MissingCompileTimeError
void_type_usage_test/local_return: MissingCompileTimeError
-void_type_usage_test/local_throw: MissingCompileTimeError
-void_type_usage_test/local_void_init: MissingCompileTimeError
-void_type_usage_test/local_while: MissingCompileTimeError
-void_type_usage_test/param_argument: MissingCompileTimeError
void_type_usage_test/param_conditional: MissingCompileTimeError
-void_type_usage_test/param_do_while: MissingCompileTimeError
-void_type_usage_test/param_dynamic_init: MissingCompileTimeError
-void_type_usage_test/param_for_in: MissingCompileTimeError
-void_type_usage_test/param_is: MissingCompileTimeError
void_type_usage_test/param_literal_list_init: MissingCompileTimeError
void_type_usage_test/param_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/param_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/param_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/param_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/param_null_equals2: MissingCompileTimeError
void_type_usage_test/param_return: MissingCompileTimeError
-void_type_usage_test/param_throw: MissingCompileTimeError
-void_type_usage_test/param_void_init: MissingCompileTimeError
-void_type_usage_test/param_while: MissingCompileTimeError
-void_type_usage_test/paren_argument: MissingCompileTimeError
void_type_usage_test/paren_conditional: MissingCompileTimeError
-void_type_usage_test/paren_do_while: MissingCompileTimeError
-void_type_usage_test/paren_dynamic_init: MissingCompileTimeError
-void_type_usage_test/paren_for_in: MissingCompileTimeError
-void_type_usage_test/paren_is: MissingCompileTimeError
void_type_usage_test/paren_literal_list_init: MissingCompileTimeError
void_type_usage_test/paren_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/paren_literal_map_key_init2: MissingCompileTimeError
void_type_usage_test/paren_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/paren_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/paren_null_equals2: MissingCompileTimeError
void_type_usage_test/paren_return: MissingCompileTimeError
-void_type_usage_test/paren_throw: MissingCompileTimeError
-void_type_usage_test/paren_void_init: MissingCompileTimeError
-void_type_usage_test/paren_while: MissingCompileTimeError
[ $compiler == dartdevk ]
abstract_factory_constructor_test/00: MissingCompileTimeError
@@ -430,7 +310,6 @@
constants_test/05: MissingCompileTimeError
constructor_redirect1_negative_test/01: MissingCompileTimeError
constructor_redirect2_negative_test: MissingCompileTimeError
-constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: MissingCompileTimeError
covariant_subtyping_test: CompileTimeError
cyclic_constructor_test/01: MissingCompileTimeError
@@ -616,9 +495,11 @@
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: MissingCompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/05: RuntimeError
+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
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 20d84c2..ff7baba 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -97,7 +97,6 @@
const_types_test/40: MissingCompileTimeError
constructor_redirect1_negative_test/01: MissingCompileTimeError
constructor_redirect2_negative_test: MissingCompileTimeError
-constructor_redirect2_test/01: MissingCompileTimeError # Fasta bug: Body on redirecting constructor.
constructor_redirect_test/01: MissingCompileTimeError # Fasta bug: Initializer refers to this.
covariant_subtyping_test: CompileTimeError
cyclic_constructor_test/01: MissingCompileTimeError # Fasta bug: Cyclic constructor redirection.
diff --git a/tests/language_2/pure_function2_test.dart b/tests/language_2/pure_function2_test.dart
index 159564e..61b218e 100644
--- a/tests/language_2/pure_function2_test.dart
+++ b/tests/language_2/pure_function2_test.dart
@@ -30,7 +30,7 @@
var t1 = f(trace);
var t2 = b(trace);
var t3 = identical(t2, "foo");
- var t4 = trace.add(t1);
+ trace.add(t1);
trace.add(t3);
trace.add(t3);
Expect.listEquals(["foo", "bar", "foo", false, false], trace);
diff --git a/tests/language_2/void_subtype_test.dart b/tests/language_2/void_subtype_test.dart
index 6cf3082..2ecdc33 100644
--- a/tests/language_2/void_subtype_test.dart
+++ b/tests/language_2/void_subtype_test.dart
@@ -7,7 +7,7 @@
var _str = new StringBuffer();
-/*=T*/ run/*<T>*/(/*=T*/ f()) {
+T run<T>(T f()) {
_str.write("+");
var t = f();
_str.write("-");
@@ -20,12 +20,12 @@
main() {
{
- var x = run/*<dynamic>*/(writeV);
+ var x = run<dynamic>(writeV);
Expect.equals('+V-', _str.toString());
Expect.equals(null, x);
_str.clear();
- var y = run(writeV);
+ var y = run(writeV) as dynamic;
Expect.equals('+V-', _str.toString());
Expect.equals(null, y);
_str.clear();
@@ -34,7 +34,7 @@
// implicit cast
{
dynamic d = writeV;
- var x = run/*<dynamic>*/(d);
+ var x = run<dynamic>(d);
Expect.equals('+V-', _str.toString());
Expect.equals(null, x);
_str.clear();
@@ -48,7 +48,7 @@
// dynamic dispatch
{
dynamic d = run;
- var x = d/*<dynamic>*/(writeV);
+ var x = d<dynamic>(writeV);
Expect.equals('+V-', _str.toString());
Expect.equals(null, x);
_str.clear();
diff --git a/tests/language_2/void_type_test.dart b/tests/language_2/void_type_test.dart
index 37cd993..c858989 100644
--- a/tests/language_2/void_type_test.dart
+++ b/tests/language_2/void_type_test.dart
@@ -21,12 +21,12 @@
return f();
}
-void test(int n, void func(), bool must_get_error) {
+void test(int n, void func()) {
// Test as closure call.
{
bool got_type_error = false;
try {
- var x = func();
+ func();
} on TypeError catch (error) {
got_type_error = true;
}
@@ -39,16 +39,16 @@
var x;
switch (n) {
case 0:
- x = f();
+ x = f() as dynamic;
break;
case 1:
- x = f_null();
+ x = f_null() as dynamic;
break;
case 2:
- x = f_dyn_null();
+ x = f_dyn_null() as dynamic;
break;
case 3:
- x = f_f();
+ x = f_f() as dynamic;
break;
}
} on TypeError catch (error) {
@@ -59,8 +59,8 @@
}
main() {
- test(0, f, false);
- test(1, f_null, false);
- test(2, f_dyn_null, false);
- test(3, f_f, false);
+ test(0, f);
+ test(1, f_null);
+ test(2, f_dyn_null);
+ test(3, f_f);
}
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 4af0127..9370d97 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -12,6 +12,7 @@
mirrors/*: Skip # Issue 27929: Triage
[ $compiler == dart2analyzer ]
+async/stream_event_transformed_test: StaticWarning
convert/base64_test/01: CompileTimeError # int64
convert/utf82_test: CompileTimeError # int64
math/double_pow_test: CompileTimeError # int64
@@ -28,6 +29,9 @@
profiler/metrics_test: Fail # Issue 20309
typed_data/int32x4_bigint_test: CompileTimeError # int64
+[ $compiler != dart2analyzer ]
+async/stream_controller_async_test: StaticWarning
+
[ $compiler == dart2js ]
async/schedule_microtask6_test: RuntimeError # global error handling is not supported. Issue 5958
convert/base64_test/01: Fail, OK # Uses bit-wise operations to detect invalid values. Some large invalid values accepted by dart2js.
@@ -166,6 +170,10 @@
async/stream_event_transformed_test: Skip # Flutter Issue 9113
mirrors/*: Skip # Flutter does not support mirrors.
+[ $runtime != none ]
+async/stream_controller_async_test: RuntimeError # Library changed.
+async/stream_from_iterable_test: RuntimeError # Library changed.
+
[ $runtime == safari ]
convert/json_test: Fail # https://bugs.webkit.org/show_bug.cgi?id=134920
typed_data/float32x4_test: Fail, Pass # Safari has an optimization bug (nightlies are already fine).
@@ -199,6 +207,10 @@
[ $strong ]
*: SkipByDesign # tests/lib_2 has the strong mode versions of these tests.
+[ !$strong ]
+async/stream_first_where_test: RuntimeError
+async/stream_last_where_test: RuntimeError
+
[ $arch == ia32 && $mode == debug && $system == windows ]
convert/streamed_conversion_json_utf8_decode_test: Skip # Verification OOM.
@@ -503,6 +515,11 @@
mirrors/native_class_test: Fail, OK # This test is meant to run in a browser.
typed_data/int32x4_bigint_test: CompileTimeError # Large integer literal
+[ $runtime == dart_precompiled || $runtime == flutter || $runtime == vm || $compiler == dart2js && $dart2js_with_kernel ]
+convert/base64_test/01: CompileTimeError # Large integer literal
+convert/utf82_test: CompileTimeError # Large integer literal
+math/double_pow_test: CompileTimeError # Large integer literal
+
[ $hot_reload || $hot_reload_rollback ]
async/stream_transformer_test: Pass, Fail # Closure identity
mirrors/fake_function_with_call_test: SkipByDesign # Method equality
diff --git a/tests/lib_2/async/first_regression_test.dart b/tests/lib_2/async/first_regression_test.dart
index 7efcb81..590251b 100644
--- a/tests/lib_2/async/first_regression_test.dart
+++ b/tests/lib_2/async/first_regression_test.dart
@@ -8,7 +8,7 @@
import 'dart:async';
-class DoubleTransformer<T> implements StreamTransformer<T, T> {
+class DoubleTransformer<T> extends StreamTransformerBase<T, T> {
Stream<T> bind(Stream<T> stream) {
var transformer = new StreamTransformer<T, T>.fromHandlers(
handleData: (T data, EventSink<T> sink) {
diff --git a/tests/lib_2/async/stream_controller_async_test.dart b/tests/lib_2/async/stream_controller_async_test.dart
index 104b6f8..17c2349 100644
--- a/tests/lib_2/async/stream_controller_async_test.dart
+++ b/tests/lib_2/async/stream_controller_async_test.dart
@@ -155,8 +155,7 @@
test("firstWhere 3", () {
StreamController c = new StreamController();
- Future f =
- c.stream.firstWhere((x) => (x % 4) == 0, defaultValue: () => 999);
+ Future f = c.stream.firstWhere((x) => (x % 4) == 0, orElse: () => 999);
f.then(expectAsync((v) {
Expect.equals(999, v);
}));
@@ -181,7 +180,7 @@
test("lastWhere 3", () {
StreamController c = new StreamController();
- Future f = c.stream.lastWhere((x) => (x % 4) == 0, defaultValue: () => 999);
+ Future f = c.stream.lastWhere((x) => (x % 4) == 0, orElse: () => 999);
f.then(expectAsync((v) {
Expect.equals(999, v);
}));
@@ -813,7 +812,7 @@
..error("BAD")
..close();
StreamController sourceController = new StreamController();
- c.addStream(sourceController.stream).then((_) {
+ c.addStream(sourceController.stream, cancelOnError: true).then((_) {
c.close().then((_) {
Expect.listEquals(expected.events, actual.events);
done();
@@ -843,7 +842,7 @@
..close();
StreamController sourceController = new StreamController();
- c.addStream(sourceController.stream, cancelOnError: false).then((_) {
+ c.addStream(sourceController.stream).then((_) {
c.close().then((_) {
Expect.listEquals(source.events, actual.events);
done();
@@ -881,7 +880,7 @@
..add(5);
expected..close();
- c.addStream(s1).then((_) {
+ c.addStream(s1, cancelOnError: true).then((_) {
c.addStream(s2, cancelOnError: false).then((_) {
c.close().then((_) {
Expect.listEquals(expected.events, actual.events);
diff --git a/tests/lib_2/async/stream_event_transformed_test.dart b/tests/lib_2/async/stream_event_transformed_test.dart
index 7f75785..2a05683 100644
--- a/tests/lib_2/async/stream_event_transformed_test.dart
+++ b/tests/lib_2/async/stream_event_transformed_test.dart
@@ -71,7 +71,7 @@
}
}
-class SinkTransformer<S, T> implements StreamTransformer<S, T> {
+class SinkTransformer<S, T> extends StreamTransformerBase<S, T> {
final Function sinkMapper;
SinkTransformer(this.sinkMapper);
diff --git a/tests/lib_2/async/stream_first_where_test.dart b/tests/lib_2/async/stream_first_where_test.dart
index ff5f261..ad1a83c 100644
--- a/tests/lib_2/async/stream_first_where_test.dart
+++ b/tests/lib_2/async/stream_first_where_test.dart
@@ -7,10 +7,7 @@
import 'dart:async';
import 'package:expect/expect.dart';
-import 'package:unittest/unittest.dart';
-
-import 'event_helper.dart';
-import 'stream_state_helper.dart';
+import 'package:async_helper/async_helper.dart';
class A {
const A();
@@ -20,17 +17,30 @@
const B();
}
-main() {
- Events sentEvents = new Events()..close();
+class C extends B {
+ const C();
+}
- // Make sure that firstWhere allows to return instances of types that are
- // different than the generic type of the stream.
- test("firstWhere with super class", () {
- StreamController c = new StreamController<B>();
- Future f = c.stream.firstWhere((x) => false, defaultValue: () => const A());
- f.then(expectAsync((v) {
- Expect.equals(const A(), v);
- }));
- sentEvents.replay(c);
- });
+main() {
+ asyncStart();
+ {
+ Stream<B> stream = new Stream<B>.fromIterable([new B()]);
+ A aFunc() => const A();
+ // Make sure that firstWhere does not allow you to return instances
+ // of types that are not subtypes of the generic type of the stream.
+ stream.firstWhere((x) => false, //# badType: compile-time error
+ orElse: aFunc); // //# badType: continued
+ }
+ {
+ asyncStart();
+ C cFunc() => const C();
+ Stream<B> stream = new Stream<B>.fromIterable([new B()]);
+ // Make sure that firstWhere does allow you to return instances
+ // of types that are subtypes of the generic type of the stream.
+ stream.firstWhere((x) => false, orElse: cFunc).then((value) {
+ Expect.identical(const C(), value);
+ asyncEnd();
+ });
+ }
+ asyncEnd();
}
diff --git a/tests/lib_2/async/stream_from_iterable_test.dart b/tests/lib_2/async/stream_from_iterable_test.dart
index 9367cc7..dfe199c 100644
--- a/tests/lib_2/async/stream_from_iterable_test.dart
+++ b/tests/lib_2/async/stream_from_iterable_test.dart
@@ -105,29 +105,6 @@
});
});
- test("regression-14334-a", () {
- var from = new Stream.fromIterable([1, 2, 3, 4, 5]);
-
- // odd numbers as data events, even numbers as error events
- from = from.map((x) => x.isOdd ? x : throw x);
-
- var c = new StreamController();
- var sink = c.sink;
-
- var done = expectAsync(() {}, count: 2);
-
- var data = [], errors = [];
- c.stream.listen(data.add, onError: errors.add, onDone: () {
- Expect.listEquals([1], data);
- Expect.listEquals([2], errors);
- done();
- });
- sink.addStream(from).then((_) {
- c.close();
- done();
- });
- });
-
test("regression-14334-b", () {
var from = new Stream.fromIterable([1, 2, 3, 4, 5]);
@@ -144,7 +121,7 @@
Expect.listEquals([2, 4], errors);
done();
});
- c.addStream(from, cancelOnError: false).then((_) {
+ c.addStream(from).then((_) {
c.close();
done();
});
diff --git a/tests/lib_2/async/stream_last_where_test.dart b/tests/lib_2/async/stream_last_where_test.dart
index 805cfc0..42418b9 100644
--- a/tests/lib_2/async/stream_last_where_test.dart
+++ b/tests/lib_2/async/stream_last_where_test.dart
@@ -7,10 +7,7 @@
import 'dart:async';
import 'package:expect/expect.dart';
-import 'package:unittest/unittest.dart';
-
-import 'event_helper.dart';
-import 'stream_state_helper.dart';
+import 'package:async_helper/async_helper.dart';
class A {
const A();
@@ -20,17 +17,30 @@
const B();
}
-main() {
- Events sentEvents = new Events()..close();
+class C extends B {
+ const C();
+}
- // Make sure that lastWhere allows to return instances of types that are
- // different than the generic type of the stream.
- test("lastWhere with super class", () {
- StreamController c = new StreamController<B>();
- Future f = c.stream.lastWhere((x) => false, defaultValue: () => const A());
- f.then(expectAsync((v) {
- Expect.equals(const A(), v);
- }));
- sentEvents.replay(c);
- });
+main() {
+ asyncStart();
+ {
+ Stream<B> stream = new Stream<B>.fromIterable([new B()]);
+ A aFunc() => const A();
+ // Make sure that lastWhere does not allow you to return instances
+ // of types that are not subtypes of the generic type of the stream.
+ stream.lastWhere((x) => false, //# badType: compile-time error
+ orElse: aFunc); // //# badType: continued
+ }
+ {
+ asyncStart();
+ C cFunc() => const C();
+ Stream<B> stream = new Stream<B>.fromIterable([new B()]);
+ // Make sure that lastWhere does allow you to return instances
+ // of types that are subtypes of the generic type of the stream.
+ stream.lastWhere((x) => false, orElse: cFunc).then((value) {
+ Expect.identical(const C(), value);
+ asyncEnd();
+ });
+ }
+ asyncEnd();
}
diff --git a/tests/lib_2/html/js_typed_interop_test.dart b/tests/lib_2/html/js_typed_interop_test.dart
index bcbbf0b..c75116e 100644
--- a/tests/lib_2/html/js_typed_interop_test.dart
+++ b/tests/lib_2/html/js_typed_interop_test.dart
@@ -78,6 +78,8 @@
function confuse(obj) { return obj; }
+ function isUndefined(obj) { return obj === void 0; }
+
function StringWrapper(str) {
this.str = str;
}
@@ -192,6 +194,9 @@
external confuse(obj);
@JS()
+external isUndefined(obj);
+
+@JS()
external CanvasRenderingContext2D getCanvasContext();
@JS('window.window.document.documentProperty')
@@ -200,6 +205,10 @@
@JS('window.self.window.window.windowProperty')
external num get propertyOnWindow;
+class DartClassWithNullField {
+ int x;
+}
+
main() {
_injectJs();
@@ -433,6 +442,7 @@
expect(selection is List, isTrue);
});
});
+
group('html', () {
test('return html type', () {
expect(getCanvasContext() is CanvasRenderingContext2D, isTrue);
@@ -442,4 +452,8 @@
expect(propertyOnDocument, equals(45));
});
});
+
+ test('Dart field is null instead of undefined', () {
+ expect(isUndefined(new DartClassWithNullField().x), false);
+ });
}
diff --git a/tests/lib_2/lib_2.status b/tests/lib_2/lib_2.status
index 21354c7..8dafc68 100644
--- a/tests/lib_2/lib_2.status
+++ b/tests/lib_2/lib_2.status
@@ -116,6 +116,10 @@
[ $jscl ]
isolate/spawn_uri_multi_test/none: RuntimeError # Issue 13544
+[ !$strong ]
+async/stream_first_where_test/badType: MissingCompileTimeError
+async/stream_last_where_test/badType: MissingCompileTimeError
+
[ $builder_tag == mac10_7 && $runtime == safari ]
typed_data/setRange_2_test: Fail # Safari doesn't fully implement spec for TypedArray.set
typed_data/setRange_3_test: Fail # Safari doesn't fully implement spec for TypedArray.set
@@ -185,6 +189,7 @@
html/webgl_1_test: Pass, Fail # Issue 8219
[ $runtime == chrome || $runtime == ff ]
+async/periodic_timer4_test: Pass, RuntimeError # Flaky. Issue 32094
async/slow_consumer2_test: SkipSlow # Times out. Issue 22050
async/stream_timeout_test: SkipSlow # Times out. Issue 22050
diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status
index 4c6228e..21b3a73 100644
--- a/tests/lib_2/lib_2_dart2js.status
+++ b/tests/lib_2/lib_2_dart2js.status
@@ -764,7 +764,6 @@
convert/streamed_conversion_json_utf8_encode_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_utf8_decode_test: SkipSlow # Times out. Issue 22050
isolate/kill_self_synchronously_test: RuntimeError
-periodic_timer4_test: Pass, RuntimeError # Flaky. Issue 32094.
[ $compiler == dart2js && ($runtime == d8 || $runtime == jsshell) ]
isolate/browser/issue_12474_test: RuntimeError # packageRoot not implemented.
diff --git a/tests/standalone_2/io/file_test.dart b/tests/standalone_2/io/file_test.dart
index 335cb9e..c5229cf 100644
--- a/tests/standalone_2/io/file_test.dart
+++ b/tests/standalone_2/io/file_test.dart
@@ -873,7 +873,7 @@
;
write([start, end]) {
- var returnValue = openedFile.writeFromSync(buffer, start, end);
+ openedFile.writeFromSync(buffer, start, end);
result.addAll(buffer.sublist(start, end));
}
diff --git a/tools/VERSION b/tools/VERSION
index a6b4427..1145d30 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 22
+PRERELEASE 23
PRERELEASE_PATCH 0
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 82a859b..6efea6f 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -30,7 +30,7 @@
"third_party/pkg_tested/",
"third_party/d8/",
"third_party/firefox_jsshell/",
- "third_party/observatory_pub_packages/packages/web_components/",
+ "third_party/observatory_pub_packages/packages/",
"tests/",
"pkg/async_helper/",
"pkg/expect/",
@@ -63,9 +63,24 @@
"tools/",
"third_party/pkg/",
"third_party/pkg_tested/",
- "third_party/observatory_pub_packages/packages/unittest/",
- "third_party/observatory_pub_packages/packages/web_components/",
- "tests/",
+ "third_party/observatory_pub_packages/packages/",
+ "tests/angular/",
+ "tests/co19/",
+ "tests/compiler/",
+ "tests/corelib/",
+ "tests/corelib_2/",
+ "tests/dart/",
+ "tests/html/",
+ "tests/isolate/",
+ "tests/kernel/",
+ "tests/language/",
+ "tests/language_2/",
+ "tests/lib/",
+ "tests/lib_2/",
+ "tests/light_unittest.dart",
+ "tests/search/",
+ "tests/standalone/",
+ "tests/standalone_2/",
"pkg/async_helper/",
"pkg/dart_internal/",
"pkg/expect/",
@@ -171,7 +186,9 @@
"--compiler=dartkp",
"--runtime=dart_precompiled",
"--use-blobs"
- ]
+ ],
+ "fileset": "vm-kernel",
+ "shards": 10
},
{
"name": "strong vm tests",
@@ -180,7 +197,9 @@
"--runtime=dart_precompiled",
"--strong",
"--use-blobs"
- ]
+ ],
+ "fileset": "vm-kernel",
+ "shards": 10
}
]
},
@@ -203,7 +222,9 @@
{
"name": "vm tests",
"arguments": [
- "--compiler=dartkp","--runtime=dart_precompiled"]
+ "--compiler=dartkp","--runtime=dart_precompiled"],
+ "fileset": "vm-kernel",
+ "shards": 10
},
{
"name": "strong vm tests",
@@ -211,7 +232,9 @@
"--compiler=dartkp",
"--runtime=dart_precompiled",
"--strong"
- ]
+ ],
+ "fileset": "vm-kernel",
+ "shards": 10
}
]
},
@@ -237,7 +260,9 @@
"--compiler=dartkp",
"--runtime=dart_precompiled",
"--vm-options=--no-enable-malloc-hooks"
- ]
+ ],
+ "fileset": "vm-kernel",
+ "shards": 10
},
{
"name": "strong vm tests",
@@ -246,7 +271,9 @@
"--runtime=dart_precompiled",
"--vm-options=--no-enable-malloc-hooks",
"--strong"
- ]
+ ],
+ "fileset": "vm-kernel",
+ "shards": 10
}
]
},
@@ -309,11 +336,15 @@
},
{
"name": "vm tests",
- "arguments": ["--compiler=dartk"]
+ "arguments": ["--compiler=dartk"],
+ "fileset": "vm-kernel",
+ "shards": 10
},
{
"name": "strong vm tests",
- "arguments": ["--compiler=dartk", "--strong"]
+ "arguments": ["--compiler=dartk", "--strong"],
+ "fileset": "vm-kernel",
+ "shards": 10
},
{
"name": "front-end tests",
@@ -589,7 +620,9 @@
"arguments": [
"--compiler=dartk",
"--vm-options=--optimization-counter-threshold=5"
- ]
+ ],
+ "fileset": "vm-kernel",
+ "shards": 10
},
{
"name": "strong vm tests",
@@ -597,7 +630,9 @@
"--compiler=dartk",
"--strong",
"--vm-options=--optimization-counter-threshold=5"
- ]
+ ],
+ "fileset": "vm-kernel",
+ "shards": 10
}
]
},
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index be259ac..8cb66ae 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -169,11 +169,7 @@
// correct arguments to VM binary. No need to pass any additional
// arguments.
if (!_isStrong) {
- args.add('--dfe=${buildDir}/gen/kernel-service.dart.snapshot');
- args.add('--kernel-binaries=' +
- (_useSdk
- ? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
- : '${buildDir}'));
+ args.add('--preview_dart_2');
}
if (_isDebug) {
// Temporarily disable background compilation to avoid flaky crashes
diff --git a/tools/testing/dart/runtime_configuration.dart b/tools/testing/dart/runtime_configuration.dart
index c7482f3..83e9078 100644
--- a/tools/testing/dart/runtime_configuration.dart
+++ b/tools/testing/dart/runtime_configuration.dart
@@ -232,10 +232,6 @@
String executable = suite.dartVmBinaryFileName;
if (type == 'application/kernel-ir-fully-linked') {
- // We don't use the pkg/vm/tool/dart2 wrapper script for fully linked
- // kernel files, since we don't want to pass the --dfe/--kernel-binaries
- // flags to the VM (the vm cannot distinguish fully-linked vs
- // not-fully-linked, see http://dartbug.com/31545)
executable = suite.dartVmExecutableFileName;
}
return [Command.vm(executable, arguments, environmentOverrides)];