Version 2.0.0-dev.46.0
Merge commit '3acccedc4028506345028be6519a0f086c3eec78' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3a214cd..46c72ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,5 @@
+## 2.0.0-dev.46.0
+
## 2.0.0-dev.45.0
### Tool Changes
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex
index b30b562..2e76f4c 100644
--- a/docs/language/dartLangSpec.tex
+++ b/docs/language/dartLangSpec.tex
@@ -2593,7 +2593,8 @@
\rationale{The name of the resulting class is necessary because it is part of the names of the introduced constructors.}
\LMHash{}
-In both cases above, $C$ declares the same instance members as $M$ (respectively, $M_k$).
+In both cases above, $C$ declares the same instance members as $M$ (respectively, $M_k$),
+and it does not declare any static members.
If any of the instance variables of $M$ (respectively, $M_k$) have initializers,
they are executed in the instance scope of $M$ (respectively, $M_k$)
to initialize the corresponding instance variables of $C$.
diff --git a/pkg/analysis_server/lib/src/flutter/flutter_correction.dart b/pkg/analysis_server/lib/src/flutter/flutter_correction.dart
index 4f667b5..7e16232 100644
--- a/pkg/analysis_server/lib/src/flutter/flutter_correction.dart
+++ b/pkg/analysis_server/lib/src/flutter/flutter_correction.dart
@@ -7,7 +7,7 @@
import 'package:analysis_server/src/services/correction/util.dart';
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
@@ -25,6 +25,7 @@
final AnalysisSession session;
final CompilationUnit unit;
+ AstNode node;
CorrectionUtils utils;
FlutterCorrections(
@@ -42,6 +43,7 @@
assert(unit != null),
selectionEnd = selectionOffset + selectionLength,
selectionRange = new SourceRange(selectionOffset, selectionLength) {
+ node = new NodeLocator(selectionOffset, selectionEnd).searchWithin(unit);
utils = new CorrectionUtils(unit, buffer: fileContent);
}
@@ -50,37 +52,34 @@
*/
String get eol => utils.endOfLine;
- /// Wrap the code between [selectionOffset] and [selectionEnd] into a new
- /// widget with the [parentType]. It is expected that the parent widget has
- /// the default constructor and the `child` named parameter.
- Future<SourceChange> wrapWidget(InterfaceType parentType) async {
- String src = utils.getText(selectionOffset, selectionLength);
- var changeBuilder = new DartChangeBuilder(session);
- await changeBuilder.addFileEdit(file, (builder) {
- builder.addReplacement(selectionRange, (builder) {
- builder.write('new ');
- builder.writeType(parentType);
- builder.write('(');
- if (src.contains(eol)) {
- String indentOld = utils.getLinePrefix(selectionOffset);
- String indentNew = indentOld + utils.getIndent(1);
- builder.write(eol);
- builder.write(indentNew);
- src = _replaceSourceIndent(src, indentOld, indentNew);
- src += ',$eol$indentOld';
- }
- builder.write('child: ');
- builder.selectHere();
- builder.write(src);
- builder.write(')');
- });
- });
- return changeBuilder.sourceChange;
- }
+ Future<SourceChange> addForDesignTimeConstructor() async {
+ final node = this.node;
+ if (node is ClassDeclaration) {
+ var className = node.name.name;
+ var location = utils.prepareNewConstructorLocation(node);
+ var changeBuilder = new DartChangeBuilder(session);
+ await changeBuilder.addFileEdit(file, (builder) {
+ builder.addInsertion(location.offset, (builder) {
+ builder.write(location.prefix);
- static String _replaceSourceIndent(
- String source, String indentOld, String indentNew) {
- return source.replaceAll(
- new RegExp('^$indentOld', multiLine: true), indentNew);
+ // If there are no constructors, we need to add also default.
+ bool hasConstructors =
+ node.members.any((m) => m is ConstructorDeclaration);
+ if (!hasConstructors) {
+ builder.writeln('$className();');
+ builder.writeln();
+ builder.write(' ');
+ }
+
+ builder.writeln('$className.forDesignTime() {');
+ builder.writeln(' // TODO: add arguments');
+ builder.writeln(' return new $className();');
+ builder.write(' }');
+ builder.write(location.suffix);
+ });
+ });
+ return changeBuilder.sourceChange;
+ }
+ return null;
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index 71dd8c0..5281867 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -1296,8 +1296,8 @@
TokenType operator = expression.operator.type;
Expression le = expression.leftOperand;
Expression re = expression.rightOperand;
- _InvertedCondition ls = _invertCondition0(le);
- _InvertedCondition rs = _invertCondition0(re);
+ _InvertedCondition ls = _InvertedCondition._simple(getNodeText(le));
+ _InvertedCondition rs = _InvertedCondition._simple(getNodeText(re));
if (operator == TokenType.LT) {
return _InvertedCondition._binary2(ls, " >= ", rs);
}
@@ -1317,10 +1317,14 @@
return _InvertedCondition._binary2(ls, " == ", rs);
}
if (operator == TokenType.AMPERSAND_AMPERSAND) {
+ ls = _invertCondition0(le);
+ rs = _invertCondition0(re);
return _InvertedCondition._binary(
TokenType.BAR_BAR.precedence, ls, " || ", rs);
}
if (operator == TokenType.BAR_BAR) {
+ ls = _invertCondition0(le);
+ rs = _invertCondition0(re);
return _InvertedCondition._binary(
TokenType.AMPERSAND_AMPERSAND.precedence, ls, " && ", rs);
}
diff --git a/pkg/analysis_server/test/services/correction/util_test.dart b/pkg/analysis_server/test/services/correction/util_test.dart
index 1589df0..05866c9 100644
--- a/pkg/analysis_server/test/services/correction/util_test.dart
+++ b/pkg/analysis_server/test/services/correction/util_test.dart
@@ -1,8 +1,10 @@
// Copyright (c) 2016, 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 'dart:async';
import 'package:analysis_server/src/services/correction/util.dart';
+import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:analyzer_plugin/src/utilities/string_utilities.dart';
@@ -19,6 +21,24 @@
@reflectiveTest
class UtilTest extends AbstractSingleUnitTest {
+ Future<void> assert_invertCondition(String expr, String expected) async {
+ await resolveTestUnit('''
+main() {
+ int v1, v2, v3, v4, v5;
+ bool b1, b2, b3, b4, b5;
+ if ($expr) {
+ 0;
+ } else {
+ 1;
+ }
+}
+''');
+ IfStatement ifStatement = findNodeAtString('if (');
+ Expression condition = ifStatement.condition;
+ String result = new CorrectionUtils(testUnit).invertCondition(condition);
+ expect(result, expected);
+ }
+
test_addLibraryImports_dart_hasImports_between() async {
await resolveTestUnit('''
import 'dart:async';
@@ -220,6 +240,51 @@
''');
}
+ test_invertCondition_binary_compare() async {
+ await assert_invertCondition('0 < 1', '0 >= 1');
+ await assert_invertCondition('0 > 1', '0 <= 1');
+ await assert_invertCondition('0 <= 1', '0 > 1');
+ await assert_invertCondition('0 >= 1', '0 < 1');
+ await assert_invertCondition('0 == 1', '0 != 1');
+ await assert_invertCondition('0 != 1', '0 == 1');
+ }
+
+ test_invertCondition_binary_compare_boolean() async {
+ await assert_invertCondition('b1 == null', 'b1 != null');
+ await assert_invertCondition('b1 != null', 'b1 == null');
+ }
+
+ test_invertCondition_binary_logical() async {
+ await assert_invertCondition('b1 && b2', '!b1 || !b2');
+ await assert_invertCondition('!b1 && !b2', 'b1 || b2');
+ await assert_invertCondition('b1 || b2', '!b1 && !b2');
+ await assert_invertCondition('!b1 || !b2', 'b1 && b2');
+ }
+
+ test_invertCondition_complex() async {
+ await assert_invertCondition('b1 && b2 || b3', '(!b1 || !b2) && !b3');
+ await assert_invertCondition('b1 || b2 && b3', '!b1 && (!b2 || !b3)');
+ await assert_invertCondition('(!b1 || !b2) && !b3', 'b1 && b2 || b3');
+ await assert_invertCondition('!b1 && (!b2 || !b3)', 'b1 || b2 && b3');
+ }
+
+ test_invertCondition_is() async {
+ await assert_invertCondition('v1 is int', 'v1 is! int');
+ await assert_invertCondition('v1 is! int', 'v1 is int');
+ }
+
+ test_invertCondition_literal() async {
+ await assert_invertCondition('true', 'false');
+ await assert_invertCondition('false', 'true');
+ }
+
+ test_invertCondition_not() async {
+ await assert_invertCondition('b1', '!b1');
+ await assert_invertCondition('!b1', 'b1');
+ await assert_invertCondition('!((b1))', 'b1');
+ await assert_invertCondition('(((b1)))', '!b1');
+ }
+
void _assertAddLibraryImport(List<Source> newLibraries, String expectedCode) {
SourceChange change = new SourceChange('');
addLibraryImports(change, testLibraryElement, newLibraries.toSet());
diff --git a/pkg/analysis_server/test/src/flutter/flutter_correction_test.dart b/pkg/analysis_server/test/src/flutter/flutter_correction_test.dart
index fb36548..b285c2b 100644
--- a/pkg/analysis_server/test/src/flutter/flutter_correction_test.dart
+++ b/pkg/analysis_server/test/src/flutter/flutter_correction_test.dart
@@ -2,12 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-
import 'package:analysis_server/src/flutter/flutter_correction.dart';
import 'package:analysis_server/src/protocol_server.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/type.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -23,7 +19,8 @@
@reflectiveTest
class FlutterCorrectionTest extends AbstractSingleUnitTest {
int offset;
- int length;
+ int length = 0;
+ FlutterCorrections corrections;
int findOffset(String search) {
int offset = testCode.indexOf(search);
@@ -37,127 +34,76 @@
packageMap['flutter'] = [configureFlutterPackage(resourceProvider)];
}
- test_wrapWidget_OK_multiLine() async {
+ test_addForDesignTimeConstructor_BAD_notClass() async {
+ await resolveTestUnit('var v = 42;');
+ offset = findOffset('v =');
+ _createCorrections();
+
+ SourceChange change = await corrections.addForDesignTimeConstructor();
+ expect(change, isNull);
+ }
+
+ test_addForDesignTimeConstructor_OK_hasConstructor() async {
await resolveTestUnit('''
import 'package:flutter/widgets.dart';
+
class MyWidget extends StatelessWidget {
+ MyWidget(String text);
+
Widget build(BuildContext context) {
- return /*start*/new Row(
- children: [
- new Text('aaa'),
- new Text('bbb'),
- ],
- )/*end*/;
+ return new Container();
}
}
''');
- _setStartEndSelection();
+ offset = findOffset('class MyWidget');
+ _createCorrections();
- InterfaceType parentType = await _getContainerType();
- SourceChange change = await _wrapWidget(parentType);
-
+ SourceChange change = await corrections.addForDesignTimeConstructor();
_assertChange(change, r'''
import 'package:flutter/widgets.dart';
+
class MyWidget extends StatelessWidget {
+ MyWidget(String text);
+
+ MyWidget.forDesignTime() {
+ // TODO: add arguments
+ return new MyWidget();
+ }
+
Widget build(BuildContext context) {
- return new Container(
- child: /*start*/new Row(
- children: [
- new Text('aaa'),
- new Text('bbb'),
- ],
- )/*end*/,
- );
+ return new Container();
}
}
''');
}
- test_wrapWidget_OK_multiLine_subChild() async {
+ test_addForDesignTimeConstructor_OK_noConstructor() async {
await resolveTestUnit('''
import 'package:flutter/widgets.dart';
+
class MyWidget extends StatelessWidget {
Widget build(BuildContext context) {
- return new Container(
- child: /*start*/new Row(
- children: [
- new Text('aaa'),
- new Text('bbb'),
- ],
- )/*end*/,
- );
+ return new Container();
}
}
''');
- _setStartEndSelection();
+ offset = findOffset('class MyWidget');
+ _createCorrections();
- InterfaceType parentType = await _getContainerType();
- SourceChange change = await _wrapWidget(parentType);
-
+ SourceChange change = await corrections.addForDesignTimeConstructor();
_assertChange(change, r'''
import 'package:flutter/widgets.dart';
+
class MyWidget extends StatelessWidget {
+ MyWidget();
+
+ MyWidget.forDesignTime() {
+ // TODO: add arguments
+ return new MyWidget();
+ }
+
Widget build(BuildContext context) {
- return new Container(
- child: new Container(
- child: /*start*/new Row(
- children: [
- new Text('aaa'),
- new Text('bbb'),
- ],
- )/*end*/,
- ),
- );
- }
-}
-''');
- }
-
- test_wrapWidget_OK_oneLine_newInstance() async {
- await resolveTestUnit('''
-import 'package:flutter/widgets.dart';
-class MyWidget extends StatelessWidget {
- Widget build(BuildContext context) {
- return /*start*/new Text('abc')/*end*/;
- }
-}
-''');
- _setStartEndSelection();
-
- InterfaceType parentType = await _getContainerType();
- SourceChange change = await _wrapWidget(parentType);
-
- _assertChange(change, r'''
-import 'package:flutter/widgets.dart';
-class MyWidget extends StatelessWidget {
- Widget build(BuildContext context) {
- return new Container(child: /*start*/new Text('abc')/*end*/);
- }
-}
-''');
- }
-
- test_wrapWidget_OK_oneLine_variable() async {
- await resolveTestUnit('''
-import 'package:flutter/widgets.dart';
-class MyWidget extends StatelessWidget {
- Widget build(BuildContext context) {
- var text = new Text('abc');
- return /*start*/text/*end*/;
- }
-}
-''');
- _setStartEndSelection();
-
- InterfaceType parentType = await _getContainerType();
- SourceChange change = await _wrapWidget(parentType);
-
- _assertChange(change, r'''
-import 'package:flutter/widgets.dart';
-class MyWidget extends StatelessWidget {
- Widget build(BuildContext context) {
- var text = new Text('abc');
- return new Container(child: /*start*/text/*end*/);
+ return new Container();
}
}
''');
@@ -178,27 +124,13 @@
expect(resultCode, expectedCode);
}
- Future<InterfaceType> _getContainerType() async {
- LibraryElement widgetsLibrary = await testAnalysisResult.session
- .getLibraryByUri('package:flutter/widgets.dart');
- ClassElement containerElement =
- widgetsLibrary.exportNamespace.get('Container');
- return containerElement.type;
- }
-
- void _setStartEndSelection() {
- offset = findOffset('/*start*/');
- length = findOffset('/*end*/') + '/*end*/'.length - offset;
- }
-
- Future<SourceChange> _wrapWidget(InterfaceType parentType) async {
- var corrections = new FlutterCorrections(
+ void _createCorrections() {
+ corrections = new FlutterCorrections(
file: testFile,
fileContent: testCode,
selectionOffset: offset,
selectionLength: length,
session: testAnalysisResult.session,
unit: testUnit);
- return await corrections.wrapWidget(parentType);
}
}
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index c084ed5..f81e3a7 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -492,6 +492,7 @@
}
}
if (ContextBuilderOptions.flutterRepo) {
+ // TODO(devoncarew): Should we still be auto-inserting this?
const lintName = 'public_member_api_docs';
Linter rule = options.lintRules.firstWhere(
(Linter lint) => lint.name == lintName,
diff --git a/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart b/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart
index 9340caf..ba59397 100644
--- a/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/frontend_resolution.dart
@@ -272,7 +272,7 @@
addFileResult(library.fileUri);
for (var part in library.parts) {
- addFileResult(part.fileUri);
+ addFileResult(library.fileUri.resolve(part.partUri));
}
var libraryResult = new LibraryCompilationResult(
@@ -328,7 +328,7 @@
// Remember libraries for parts.
for (var part in library.parts) {
- _partToLibrary[part.fileUri] = library.fileUri;
+ _partToLibrary[library.fileUri.resolve(part.partUri)] = library.fileUri;
}
// Record reverse dependencies.
diff --git a/pkg/analyzer/lib/src/kernel/resynthesize.dart b/pkg/analyzer/lib/src/kernel/resynthesize.dart
index 5586c26..a66763e 100644
--- a/pkg/analyzer/lib/src/kernel/resynthesize.dart
+++ b/pkg/analyzer/lib/src/kernel/resynthesize.dart
@@ -201,7 +201,7 @@
// Build units for parts.
var parts = new List<CompilationUnitElementImpl>(kernel.parts.length);
for (int i = 0; i < kernel.parts.length; i++) {
- var fileUri = kernel.parts[i].fileUri;
+ var fileUri = kernel.fileUri.resolve(kernel.parts[i].partUri);
var unitContext = libraryContext._buildUnit("$fileUri");
parts[i] = unitContext.unit;
}
@@ -974,7 +974,8 @@
List<kernel.Expression> get annotations {
if (_annotations == null) {
for (var part in context.libraryContext.library.parts) {
- if ("${part.fileUri}" == context.fileUri) {
+ if ("${context.libraryContext.library.fileUri.resolve(part.partUri)}" ==
+ context.fileUri) {
return _annotations = part.annotations;
}
}
diff --git a/pkg/analyzer/lib/src/lint/options_rule_validator.dart b/pkg/analyzer/lib/src/lint/options_rule_validator.dart
index 217778a..622aa31 100644
--- a/pkg/analyzer/lib/src/lint/options_rule_validator.dart
+++ b/pkg/analyzer/lib/src/lint/options_rule_validator.dart
@@ -24,6 +24,7 @@
class LinterRuleOptionsValidator extends OptionsValidator {
static const linter = 'linter';
static const rulesKey = 'rules';
+
@override
List<AnalysisError> validate(ErrorReporter reporter, YamlMap options) {
List<AnalysisError> errors = <AnalysisError>[];
@@ -37,8 +38,8 @@
validateRules(YamlNode rules, ErrorReporter reporter) {
if (rules is YamlList) {
- Iterable<String> registeredLints =
- Registry.ruleRegistry.map((r) => r.name);
+ List<String> registeredLints =
+ Registry.ruleRegistry.map((r) => r.name).toList();
rules.nodes.forEach((YamlNode ruleNode) {
Object value = ruleNode.value;
if (value != null && !registeredLints.contains(value)) {
diff --git a/pkg/analyzer/lib/src/task/options.dart b/pkg/analyzer/lib/src/task/options.dart
index c7c83de..0c23e88 100644
--- a/pkg/analyzer/lib/src/task/options.dart
+++ b/pkg/analyzer/lib/src/task/options.dart
@@ -156,6 +156,9 @@
/// Lazily populated set of error codes (hashed for speedy lookup).
static HashSet<String> _errorCodes;
+ /// Lazily populated set of lint codes.
+ Set<String> _lintCodes;
+
/// Legal error code names.
static Set<String> get errorCodes {
if (_errorCodes == null) {
@@ -166,6 +169,14 @@
return _errorCodes;
}
+ Set<String> get lintCodes {
+ if (_lintCodes == null) {
+ _lintCodes = new Set.from(
+ Registry.ruleRegistry.rules.map((rule) => rule.name.toUpperCase()));
+ }
+ return _lintCodes;
+ }
+
@override
void validate(ErrorReporter reporter, YamlMap options) {
var analyzer = getValue(options, AnalyzerOptions.analyzer);
@@ -176,7 +187,7 @@
filters.nodes.forEach((k, v) {
if (k is YamlScalar) {
value = toUpperCase(k.value);
- if (!errorCodes.contains(value)) {
+ if (!errorCodes.contains(value) && !lintCodes.contains(value)) {
reporter.reportErrorForSpan(
AnalysisOptionsWarningCode.UNRECOGNIZED_ERROR_CODE,
k.span,
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index f9ad390..17f11d3 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -500,47 +500,6 @@
@override
@failingTest
- void test_nonConstructorFactory_field() {
- // TODO(brianwilkerson) Does not recover.
- // Internal problem: Compiler cannot run without a compiler context.
- // Tip: Are calls to the compiler wrapped in CompilerContext.runInContext?
- // package:front_end/src/fasta/compiler_context.dart 81:7 CompilerContext.current
- // package:front_end/src/fasta/problems.dart 29:25 internalProblem
- // package:front_end/src/fasta/problems.dart 41:10 unhandled
- // package:analyzer/src/fasta/ast_builder.dart 1498:7 AstBuilder.endFactoryMethod
- // test/generated/parser_fasta_listener.dart 731:14 ForwardingTestListener.endFactoryMethod
- // package:front_end/src/fasta/parser/parser.dart 2465:14 Parser.parseFactoryMethod
- // package:front_end/src/fasta/parser/parser.dart 2240:15 Parser.parseMember
- // test/generated/parser_fasta_test.dart 3702:39 ParserProxy._run
- super.test_nonConstructorFactory_field();
- }
-
- @override
- @failingTest
- void test_nonConstructorFactory_method() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.NON_CONSTRUCTOR_FACTORY, found 0
- super.test_nonConstructorFactory_method();
- }
-
- @override
- @failingTest
- void test_setterInFunction_block() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.SETTER_IN_FUNCTION, found 0
- super.test_setterInFunction_block();
- }
-
- @override
- @failingTest
- void test_setterInFunction_expression() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.SETTER_IN_FUNCTION, found 0
- super.test_setterInFunction_expression();
- }
-
- @override
- @failingTest
void test_unexpectedToken_endOfFieldDeclarationStatement() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.UNEXPECTED_TOKEN, found 0
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index dc7803d..a18492f 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -4878,19 +4878,27 @@
}
void test_nonConstructorFactory_field() {
- createParser('factory int x;');
+ createParser('factory int x;', expectedEndOffset: 12);
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
- listener.assertErrors(
- [expectedError(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, 0, 7)]);
+ listener.assertErrors(usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.MISSING_FUNCTION_PARAMETERS, 12, 1),
+ expectedError(ParserErrorCode.MISSING_FUNCTION_BODY, 12, 1)
+ ]
+ : [expectedError(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, 0, 7)]);
}
void test_nonConstructorFactory_method() {
- createParser('factory int m() {}');
+ createParser('factory int m() {}', expectedEndOffset: 12);
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
- listener.assertErrors(
- [expectedError(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, 0, 7)]);
+ listener.assertErrors(usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.MISSING_FUNCTION_PARAMETERS, 12, 1),
+ expectedError(ParserErrorCode.MISSING_FUNCTION_BODY, 12, 1)
+ ]
+ : [expectedError(ParserErrorCode.NON_CONSTRUCTOR_FACTORY, 0, 7)]);
}
void test_nonIdentifierLibraryName_library() {
@@ -5054,14 +5062,16 @@
void test_setterInFunction_block() {
parseStatement("set x(v) {_x = v;}");
- listener.assertErrors(
- [expectedError(ParserErrorCode.SETTER_IN_FUNCTION, 0, 3)]);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 0, 3)]
+ : [expectedError(ParserErrorCode.SETTER_IN_FUNCTION, 0, 3)]);
}
void test_setterInFunction_expression() {
parseStatement("set x(v) => _x = v;");
- listener.assertErrors(
- [expectedError(ParserErrorCode.SETTER_IN_FUNCTION, 0, 3)]);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 0, 3)]
+ : [expectedError(ParserErrorCode.SETTER_IN_FUNCTION, 0, 3)]);
}
void test_staticAfterConst() {
diff --git a/pkg/analyzer/test/src/task/options_test.dart b/pkg/analyzer/test/src/task/options_test.dart
index 6bec4ec..98a9fcf 100644
--- a/pkg/analyzer/test/src/task/options_test.dart
+++ b/pkg/analyzer/test/src/task/options_test.dart
@@ -544,6 +544,15 @@
''', [AnalysisOptionsWarningCode.UNRECOGNIZED_ERROR_CODE]);
}
+ test_analyzer_lint_codes_recognized() {
+ Registry.ruleRegistry.register(new TestRule());
+ validate('''
+analyzer:
+ errors:
+ fantastic_test_rule: ignore
+ ''', []);
+ }
+
test_analyzer_language_supported() {
validate('''
analyzer:
diff --git a/pkg/compiler/lib/src/inferrer/ast_inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/ast_inferrer_engine.dart
index 71f6445..acea941 100644
--- a/pkg/compiler/lib/src/inferrer/ast_inferrer_engine.dart
+++ b/pkg/compiler/lib/src/inferrer/ast_inferrer_engine.dart
@@ -58,7 +58,7 @@
FunctionEntity lookupCallMethod(covariant ClassElement cls) {
MethodElement callMethod = cls.lookupMember(Identifiers.call);
- if (callMethod == null) {
+ if (callMethod == null || callMethod.isAbstract) {
callMethod = cls.lookupMember(Identifiers.noSuchMethod_);
}
return callMethod;
diff --git a/pkg/compiler/lib/src/inferrer/builder.dart b/pkg/compiler/lib/src/inferrer/builder.dart
index ff6f898..6deee5e 100644
--- a/pkg/compiler/lib/src/inferrer/builder.dart
+++ b/pkg/compiler/lib/src/inferrer/builder.dart
@@ -2508,6 +2508,9 @@
@override
TypeInformation visitTopLevelGetterInvoke(ast.Send node, GetterElement getter,
ast.NodeList arguments, CallStructure callStructure, _) {
+ if (getter.isDeferredLoaderGetter) {
+ return types.dynamicType;
+ }
return handleStaticFieldOrGetterInvoke(node, getter);
}
@@ -2661,6 +2664,9 @@
@override
TypeInformation visitTopLevelGetterGet(
ast.Send node, GetterElement getter, _) {
+ if (getter.isDeferredLoaderGetter) {
+ return types.functionType;
+ }
return handleStaticGetterGet(node, getter);
}
diff --git a/pkg/compiler/lib/src/inferrer/closure_tracer.dart b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
index 4363142..174089d 100644
--- a/pkg/compiler/lib/src/inferrer/closure_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
@@ -21,7 +21,12 @@
ClosureTracerVisitor(this.tracedElements, ApplyableTypeInformation tracedType,
InferrerEngine inferrer)
- : super(tracedType, inferrer);
+ : super(tracedType, inferrer) {
+ assert(
+ tracedElements.every((f) => !f.isAbstract),
+ "Tracing abstract methods: "
+ "${tracedElements.where((f) => f.isAbstract)}");
+ }
ApplyableTypeInformation get tracedType => super.tracedType;
diff --git a/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart
index 24b0ecc..217c1ee 100644
--- a/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart
+++ b/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart
@@ -174,7 +174,7 @@
FunctionEntity lookupCallMethod(ClassEntity cls) {
FunctionEntity function =
_elementEnvironment.lookupClassMember(cls, Identifiers.call);
- if (function == null) {
+ if (function == null || function.isAbstract) {
function =
_elementEnvironment.lookupClassMember(cls, Identifiers.noSuchMethod_);
}
diff --git a/pkg/compiler/lib/src/inferrer/type_system.dart b/pkg/compiler/lib/src/inferrer/type_system.dart
index a4fbfd7..90c3101 100644
--- a/pkg/compiler/lib/src/inferrer/type_system.dart
+++ b/pkg/compiler/lib/src/inferrer/type_system.dart
@@ -376,6 +376,8 @@
}
MemberTypeInformation getInferredTypeOfMember(MemberEntity member) {
+ assert(!member.isAbstract,
+ failedAt(member, "Unexpected abstract member $member."));
return memberTypeInformations.putIfAbsent(member, () {
MemberTypeInformation typeInformation =
strategy.createMemberTypeInformation(member);
diff --git a/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart b/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
index 5da318a..6d75fca 100644
--- a/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
+++ b/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
@@ -105,6 +105,7 @@
NsmCategory _categorizeImpl(FunctionEntity element) {
assert(element.name == Identifiers.noSuchMethod_);
+ assert(!element.isAbstract);
if (defaultImpls.contains(element)) {
return NsmCategory.DEFAULT;
}
diff --git a/pkg/compiler/lib/src/js_backend/resolution_listener.dart b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
index dbfb64a..289ae42 100644
--- a/pkg/compiler/lib/src/js_backend/resolution_listener.dart
+++ b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
@@ -201,7 +201,10 @@
for (ClassEntity cls in recentClasses) {
MemberEntity element = _elementEnvironment.lookupLocalClassMember(
cls, Identifiers.noSuchMethod_);
- if (element != null && element.isInstanceMember && element.isFunction) {
+ if (element != null &&
+ element.isInstanceMember &&
+ element.isFunction &&
+ !element.isAbstract) {
_noSuchMethodRegistry.registerNoSuchMethod(element);
}
}
diff --git a/pkg/compiler/lib/src/kernel/element_map_mixins.dart b/pkg/compiler/lib/src/kernel/element_map_mixins.dart
index c064fbb..8cdbb9c 100644
--- a/pkg/compiler/lib/src/kernel/element_map_mixins.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_mixins.dart
@@ -347,7 +347,7 @@
cls = elementEnvironment.getSuperClass(cls);
MemberEntity member = elementEnvironment.lookupLocalClassMember(
cls, Identifiers.noSuchMethod_);
- if (member != null) {
+ if (member != null && !member.isAbstract) {
if (member.isFunction) {
FunctionEntity function = member;
if (function.parameterStructure.positionalParameters >= 1) {
diff --git a/pkg/compiler/lib/src/source_file_provider.dart b/pkg/compiler/lib/src/source_file_provider.dart
index 15281c8..638a8a1 100644
--- a/pkg/compiler/lib/src/source_file_provider.dart
+++ b/pkg/compiler/lib/src/source_file_provider.dart
@@ -497,4 +497,19 @@
}
return result;
}
+
+ @override
+ api.Input autoReadFromFile(Uri resourceUri) {
+ var path = resourceUri.path;
+ if (path.startsWith('/bazel-root')) {
+ path = path.substring('/bazel-root/'.length);
+ for (var dir in dirs) {
+ var file = dir.resolve(path);
+ if (new File.fromUri(file).existsSync()) {
+ return super.autoReadFromFile(file);
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/pkg/compiler/testing_dart.json b/pkg/compiler/testing_dart.json
index 17a04e0..4ebf407 100644
--- a/pkg/compiler/testing_dart.json
+++ b/pkg/compiler/testing_dart.json
@@ -22,6 +22,11 @@
"^tests/compiler/dart2js/deferred/load_graph_segmentation_test\\.dart",
"^tests/compiler/dart2js/deferred/not_in_main_test\\.dart",
"^tests/compiler/dart2js/in_user_code_test\\.dart",
+ "^tests/compiler/dart2js/inference/data/call_site\\.dart",
+ "^tests/compiler/dart2js/inference/data/general\\.dart",
+ "^tests/compiler/dart2js/inference/data/no_such_method\\.dart",
+ "^tests/compiler/dart2js/inference/data/no_such_method2\\.dart",
+ "^tests/compiler/dart2js/inference/data/postfix_prefix\\.dart",
"^tests/compiler/dart2js/inference/data/super_invoke\\.dart",
"^tests/compiler/dart2js/inference/simple_inferrer_closure_test\\.dart",
"^tests/compiler/dart2js/inference/simple_inferrer_const_closure2_test\\.dart",
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index 3f840d9..122b9ce 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -3040,6 +3040,11 @@
var element = accessor;
if (accessor is PropertyAccessorElement) element = accessor.variable;
+ // If this is one of our compiler's temporary variables, return its JS form.
+ if (element is TemporaryVariableElement) {
+ return element.jsVariable;
+ }
+
// Directly emit constants.
if (element is VariableElement && element.isStatic && element.isConst) {
var val = element.computeConstantValue() as DartObjectImpl;
@@ -3119,11 +3124,6 @@
return _emitParameter(element);
}
- // If this is one of our compiler's temporary variables, return its JS form.
- if (element is TemporaryVariableElement) {
- return element.jsVariable;
- }
-
return new JS.Identifier(name);
}
@@ -4920,7 +4920,8 @@
variable ??= new JS.TemporaryId(name);
- var idElement = new TemporaryVariableElement.forNode(id, variable);
+ var idElement = new TemporaryVariableElement.forNode(id, variable)
+ ..enclosingElement = _currentElement;
id.staticElement = idElement;
id.staticType = type;
setIsDynamicInvoke(id, dynamicInvoke ?? type.isDynamic);
diff --git a/pkg/front_end/lib/src/fasta/builder_graph.dart b/pkg/front_end/lib/src/fasta/builder_graph.dart
index b4350b1..7f54bc2 100644
--- a/pkg/front_end/lib/src/fasta/builder_graph.dart
+++ b/pkg/front_end/lib/src/fasta/builder_graph.dart
@@ -60,7 +60,7 @@
// Parts
for (LibraryPart part in library.library.parts) {
- Uri uri = part.fileUri;
+ Uri uri = library.uri.resolve(part.partUri);
if (builders.containsKey(uri)) {
yield uri;
}
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 073b8d7..fe2dddf9 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -336,7 +336,8 @@
}
} else if (library is DillLibraryBuilder) {
for (LibraryPart part in library.library.parts) {
- addBuilderAndInvalidateUris(part.fileUri, library, false);
+ Uri partUri = library.uri.resolve(part.partUri);
+ addBuilderAndInvalidateUris(partUri, library, false);
}
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/constness_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constness_evaluator.dart
index 6ed7d2b..ab7f9ce 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constness_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constness_evaluator.dart
@@ -328,13 +328,27 @@
visitVariableGet(VariableGet node) {
if (!node.variable.isConst) return const ConstnessInfo.decidedNew();
// TODO(dmitryas): Handle the case of recursive dependencies.
+ // TODO(dmitryas): Find a way to get fileUri of the variable.
return node.variable.initializer.accept(this);
}
@override
visitStaticGet(StaticGet node) {
- // TODO(dmitryas): Handle this case.
- return const ConstnessInfo.taintedConst(null);
+ Member target = node.target;
+ if (target is Field) {
+ if (target.isConst) {
+ if (this.uri == target.fileUri) {
+ return target.initializer.accept(this);
+ }
+ return target.initializer
+ .accept(new ConstnessEvaluator(coreTypes, target.fileUri));
+ } else {
+ return const ConstnessInfo.decidedNew();
+ }
+ } else {
+ // TODO(dmitryas): Handle the case of a tear-off.
+ return const ConstnessInfo.taintedConst(null);
+ }
}
@override
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
index 9d4fa71..2798fb5a 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
@@ -306,12 +306,8 @@
cloned.isAbstract = true;
cloned.isNoSuchMethodForwarder = true;
- String name = cloned.name.name;
cls.procedures.add(cloned);
cloned.parent = cls;
- DillMemberBuilder memberBuilder = new DillMemberBuilder(cloned, this);
- memberBuilder.next = scopeBuilder[name];
- scopeBuilder.addMember(name, memberBuilder);
}
void addNoSuchMethodForwarders(ClassHierarchy hierarchy) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 4cbda32..5bd9437 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -810,12 +810,20 @@
}
for (KernelLibraryBuilder part in parts) {
- library.addPart(new LibraryPart(<Expression>[], part.fileUri));
part.addDependencies(library, seen);
}
}
@override
+ void addPart(List<MetadataBuilder> metadata, String uri, int charOffset) {
+ super.addPart(metadata, uri, charOffset);
+ // TODO(ahe): [metadata] should be stored, evaluated, and added to [part].
+ LibraryPart part = new LibraryPart(<Expression>[], uri)
+ ..fileOffset = charOffset;
+ library.addPart(part);
+ }
+
+ @override
Library build(LibraryBuilder coreLibrary) {
super.build(coreLibrary);
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index ed58944..f53eba3 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -1379,113 +1379,6 @@
}
}
- /// If the token after [token] begins a valid type reference
- /// or looks like a valid type reference, then return the last token
- /// in that type reference, otherwise return [token].
- ///
- /// For example, it is an error when built-in keyword is being used as a type,
- /// as in `abstract<t> foo`. In situations such as this, return the last
- /// token in that type reference and assume the caller will report the error
- /// and recover.
- Token skipTypeReferenceOpt(Token token, bool inDeclaration) {
- final Token beforeStart = token;
- Token next = token.next;
-
- TokenType type = next.type;
- bool looksLikeTypeRef = false;
- if (type != TokenType.IDENTIFIER) {
- String value = next.stringValue;
- if (identical(value, 'get') || identical(value, 'set')) {
- // No type reference.
- return beforeStart;
- } else if (identical(value, 'factory') || identical(value, 'operator')) {
- Token next2 = next.next;
- if (!optional('<', next2) || next2.endGroup == null) {
- // No type reference.
- return beforeStart;
- }
- // Even though built-ins cannot be used as a type,
- // it looks like its being used as such.
- } else if (identical(value, 'void')) {
- // Found type reference.
- looksLikeTypeRef = true;
- } else if (identical(value, 'Function')) {
- // Found type reference.
- return skipGenericFunctionType(token);
- } else if (identical(value, 'typedef')) {
- // `typedef` can be used as a prefix.
- // For example: `typedef.A x = new typedef.A();`
- if (!optional('.', next.next)) {
- // No type reference.
- return beforeStart;
- }
- } else if (!next.isIdentifier) {
- // No type reference.
- return beforeStart;
- }
- }
- token = next;
- next = token.next;
-
- if (optional('.', next)) {
- token = next;
- next = token.next;
- if (next.type != TokenType.IDENTIFIER) {
- String value = next.stringValue;
- if (identical(value, '<')) {
- // Found a type reference, but missing an identifier after the period.
- rewriteAndRecover(
- token,
- fasta.templateExpectedIdentifier.withArguments(next),
- new SyntheticStringToken(
- TokenType.IDENTIFIER, '', next.charOffset, 0));
- // Fall through to continue processing as a type reference.
- next = token.next;
- } else if (!next.isIdentifier) {
- if (identical(value, 'void')) {
- looksLikeTypeRef = true;
- // Found a type reference, but the period
- // and preceding identifier are both invalid.
- reportRecoverableErrorWithToken(
- token, fasta.templateUnexpectedToken);
- // Fall through to continue processing as a type reference.
- } else {
- // No type reference.
- return beforeStart;
- }
- }
- }
- token = next;
- next = token.next;
- }
-
- if (optional('<', next)) {
- token = next.endGroup;
- if (token == null) {
- // TODO(danrubel): Consider better recovery
- // because this is probably a type reference.
- return beforeStart;
- }
- next = token.next;
- if (optional('(', next)) {
- // No type reference - e.g. `f<E>()`.
- return beforeStart;
- }
- }
-
- if (optional('Function', next)) {
- looksLikeTypeRef = true;
- token = skipGenericFunctionType(token);
- next = token.next;
- }
-
- return next.isIdentifier ||
- (inDeclaration && next.isOperator && !optional('=', next)) ||
- looksLikeTypeRef
- ? token
- : beforeStart;
- }
-
/// Returns `true` if [token] matches '<' type (',' type)* '>' '(', and
/// otherwise returns `false`. The final '(' is not part of the grammar
/// construct `typeArguments`, but it is required here such that type
@@ -2892,14 +2785,8 @@
typeContinuation ??= TypeContinuation.Required;
Token beforeType = token;
- // TODO(danrubel): Consider changing the listener contract
- // so that the type reference can be parsed immediately
- // rather than skipped now and parsed later.
- token = skipTypeReferenceOpt(token, true);
- if (token == beforeType) {
- // There is no type reference.
- beforeType = null;
- }
+ TypeInfo typeInfo = computeType(token, false);
+ token = typeInfo.skipType(token);
next = token.next;
Token getOrSet;
@@ -2984,13 +2871,17 @@
}
}
return parseTopLevelMethod(
- beforeStart, externalToken, beforeType, getOrSet, token);
+ beforeStart, externalToken, beforeType, typeInfo, getOrSet, token);
}
if (getOrSet != null) {
reportRecoverableErrorWithToken(
getOrSet, fasta.templateExtraneousModifier);
}
+ // TODO(danrubel): Use typeInfo when parsing fields.
+ if (typeInfo == noTypeInfo) {
+ beforeType = null;
+ }
return parseFields(beforeStart, externalToken, null, null, varFinalOrConst,
beforeType, token, MemberKind.TopLevelField, typeContinuation);
}
@@ -3053,14 +2944,10 @@
}
Token parseTopLevelMethod(Token beforeStart, Token externalToken,
- Token beforeType, Token getOrSet, Token beforeName) {
+ Token beforeType, TypeInfo typeInfo, Token getOrSet, Token beforeName) {
listener.beginTopLevelMethod(beforeStart, externalToken);
- if (beforeType == null) {
- listener.handleNoType(beforeName);
- } else {
- parseType(beforeType, TypeContinuation.Optional);
- }
+ typeInfo.parseType(beforeType, this);
Token name = ensureIdentifier(
beforeName, IdentifierContext.topLevelFunctionDeclaration);
@@ -3722,6 +3609,9 @@
getOrSet, fasta.templateExtraneousModifier);
}
// TODO(danrubel): Use typeInfo when parsing fields.
+ if (typeInfo == noTypeInfo) {
+ beforeType = null;
+ }
token = parseFields(
beforeStart,
externalToken,
@@ -4320,6 +4210,11 @@
return parseExpressionStatementOrConstDeclaration(token);
} else if (!inPlainSync && identical(value, 'await')) {
return parseExpressionStatement(token);
+ } else if (identical(value, 'set') && token.next.next.isIdentifier) {
+ // Recovery: invalid use of `set`
+ reportRecoverableErrorWithToken(
+ token.next, fasta.templateUnexpectedToken);
+ return parseStatementX(token.next);
} else if (token.next.isIdentifier) {
if (optional(':', token.next.next)) {
return parseLabeledStatement(token);
@@ -6509,6 +6404,10 @@
getOrSet,
token);
} else {
+ // TODO(danrubel): Use typeInfo when parsing fields.
+ if (typeInfo == noTypeInfo) {
+ beforeType = null;
+ }
token = parseFields(
beforeStart,
externalToken,
diff --git a/pkg/front_end/lib/src/fasta/parser/type_info.dart b/pkg/front_end/lib/src/fasta/parser/type_info.dart
index 5723020..4b2394a 100644
--- a/pkg/front_end/lib/src/fasta/parser/type_info.dart
+++ b/pkg/front_end/lib/src/fasta/parser/type_info.dart
@@ -118,13 +118,25 @@
if (!isValidTypeReference(next)) {
if (next.type.isBuiltIn) {
Token afterType = next.next;
- if (optional('<', afterType) && afterType.endGroup != null) {
+ if (optional('<', afterType) &&
+ afterType.endGroup != null &&
+ looksLikeName(afterType.endGroup.next)) {
// Recovery: built-in used as a type
- return new ComplexTypeInfo(token)
- .computeSimpleWithTypeArguments(required);
- } else if (isGeneralizedFunctionType(afterType)) {
- // Recovery: built-in used as a type
- return new ComplexTypeInfo(token).computeIdentifierGFT(required);
+ return new ComplexTypeInfo(token).computeBuiltinAsType(required);
+ } else {
+ String value = next.stringValue;
+ if (!identical('get', value) &&
+ !identical('set', value) &&
+ !identical('factory', value) &&
+ !identical('operator', value)) {
+ if (isGeneralizedFunctionType(afterType)) {
+ // Recovery: built-in used as a type
+ return new ComplexTypeInfo(token).computeBuiltinAsType(required);
+ } else if (required) {
+ // Recovery: built-in used as a type
+ return new ComplexTypeInfo(token).computeBuiltinAsType(required);
+ }
+ }
}
}
return noTypeInfo;
@@ -216,7 +228,10 @@
/// Instances of [ComplexTypeInfo] are returned by [computeType] to represent
/// type references that cannot be represented by the constants above.
class ComplexTypeInfo implements TypeInfo {
+ /// The first token in the type reference.
final Token start;
+
+ /// The last token in the type reference.
Token end;
/// Non-null if type arguments were seen during analysis.
@@ -311,9 +326,11 @@
assert(optional('Function', start));
computeRest(start, required);
- return gftHasReturnType != null
- ? this
- : required ? simpleTypeInfo : noTypeInfo;
+ if (gftHasReturnType == null) {
+ return required ? simpleTypeInfo : noTypeInfo;
+ }
+ assert(end != null);
+ return this;
}
/// Given void `Function` non-identifier, compute the type
@@ -323,23 +340,53 @@
assert(optional('Function', start.next));
computeRest(start.next, required);
- return gftHasReturnType != null ? this : voidTypeInfo;
+ if (gftHasReturnType == null) {
+ return voidTypeInfo;
+ }
+ assert(end != null);
+ return this;
+ }
+
+ /// Given a builtin, return the receiver so that parseType will report
+ /// an error for the builtin used as a type.
+ TypeInfo computeBuiltinAsType(bool required) {
+ assert(start.type.isBuiltIn);
+ end = start;
+ Token token = start.next;
+ if (optional('<', token)) {
+ typeArguments = token;
+ token = skipTypeArguments(typeArguments);
+ if (token == null) {
+ token = typeArguments;
+ typeArguments = null;
+ } else {
+ end = token;
+ }
+ }
+ computeRest(token, required);
+
+ assert(end != null);
+ return this;
}
/// Given identifier `Function` non-identifier, compute the type
/// and return the receiver or one of the [TypeInfo] constants.
TypeInfo computeIdentifierGFT(bool required) {
- assert(isValidTypeReference(start) || start.type.isBuiltIn);
+ assert(isValidTypeReference(start));
assert(optional('Function', start.next));
computeRest(start.next, required);
- return gftHasReturnType != null ? this : simpleTypeInfo;
+ if (gftHasReturnType == null) {
+ return simpleTypeInfo;
+ }
+ assert(end != null);
+ return this;
}
/// Given identifier `<` ... `>`, compute the type
/// and return the receiver or one of the [TypeInfo] constants.
TypeInfo computeSimpleWithTypeArguments(bool required) {
- assert(isValidTypeReference(start) || start.type.isBuiltIn);
+ assert(isValidTypeReference(start));
typeArguments = start.next;
assert(optional('<', typeArguments));
@@ -350,9 +397,11 @@
end = token;
computeRest(token.next, required);
- return required || looksLikeName(end.next) || gftHasReturnType != null
- ? this
- : noTypeInfo;
+ if (!required && !looksLikeName(end.next) && gftHasReturnType == null) {
+ return noTypeInfo;
+ }
+ assert(end != null);
+ return this;
}
/// Given identifier `.` identifier, compute the type
@@ -377,9 +426,11 @@
}
computeRest(token, required);
- return required || looksLikeName(end.next) || gftHasReturnType != null
- ? this
- : noTypeInfo;
+ if (!required && !looksLikeName(end.next) && gftHasReturnType == null) {
+ return noTypeInfo;
+ }
+ assert(end != null);
+ return this;
}
void computeRest(Token token, bool required) {
@@ -401,6 +452,9 @@
if (token == null) {
break; // Not a function type.
}
+ if (!required && !token.next.isIdentifier) {
+ break; // `Function` used as the name in a function declaration.
+ }
assert(optional(')', token));
gftHasReturnType ??= typeVariableStart != start;
typeVariableStarters = typeVariableStarters.prepend(typeVariableStart);
diff --git a/pkg/front_end/test/fasta/parser/type_info_test.dart b/pkg/front_end/test/fasta/parser/type_info_test.dart
index 331eb7e..6d4b93b 100644
--- a/pkg/front_end/test/fasta/parser/type_info_test.dart
+++ b/pkg/front_end/test/fasta/parser/type_info_test.dart
@@ -181,16 +181,35 @@
expectInfo(noTypeInfo, 'operator *');
}
+ void test_computeType_builtin() {
+ // Expect complex rather than simpleTypeInfo so that parseType reports
+ // an error for the builtin used as a type.
+ expectComplexInfo('abstract',
+ required: true,
+ expectedErrors: [error(codeBuiltInIdentifierAsType, 0, 8)]);
+ expectComplexInfo('export',
+ required: true,
+ expectedErrors: [error(codeBuiltInIdentifierAsType, 0, 6)]);
+ expectComplexInfo('abstract Function()',
+ required: false,
+ tokenAfter: 'Function',
+ expectedErrors: [error(codeBuiltInIdentifierAsType, 0, 8)]);
+ expectComplexInfo('export Function()',
+ required: false,
+ tokenAfter: 'Function',
+ expectedErrors: [error(codeBuiltInIdentifierAsType, 0, 6)]);
+ }
+
void test_computeType_gft() {
- expectComplexInfo('Function()', expectedCalls: [
+ expectComplexInfo('Function() m', tokenAfter: 'm', expectedCalls: [
'handleNoTypeVariables (',
'beginFunctionType Function',
'handleNoType ',
'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
- 'endFunctionType Function ',
+ 'endFunctionType Function m',
]);
- expectComplexInfo('Function<T>()', expectedCalls: [
+ expectComplexInfo('Function<T>() m', tokenAfter: 'm', expectedCalls: [
'beginTypeVariables <',
'beginTypeVariable T',
'beginMetadataStar T',
@@ -203,9 +222,9 @@
'handleNoType ',
'beginFormalParameters ( MemberKind.GeneralizedFunctionType',
'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
- 'endFunctionType Function ',
+ 'endFunctionType Function m',
]);
- expectComplexInfo('Function(int)', expectedCalls: [
+ expectComplexInfo('Function(int) m', tokenAfter: 'm', expectedCalls: [
'handleNoTypeVariables (',
'beginFunctionType Function',
'handleNoType ',
@@ -222,9 +241,9 @@
'beginTypeVariables null null ) FormalParameterKind.mandatory '
'MemberKind.GeneralizedFunctionType',
'endFormalParameters 1 ( ) MemberKind.GeneralizedFunctionType',
- 'endFunctionType Function ',
+ 'endFunctionType Function m',
]);
- expectComplexInfo('Function<T>(int)', expectedCalls: [
+ expectComplexInfo('Function<T>(int) m', tokenAfter: 'm', expectedCalls: [
'beginTypeVariables <',
'beginTypeVariable T',
'beginMetadataStar T',
@@ -247,11 +266,22 @@
'handleFormalParameterWithoutValue )',
'beginTypeVariables null null ) FormalParameterKind.mandatory MemberKind.GeneralizedFunctionType',
'endFormalParameters 1 ( ) MemberKind.GeneralizedFunctionType',
- 'endFunctionType Function ',
+ 'endFunctionType Function m',
]);
- expectComplexInfo('Function(int x)');
- expectComplexInfo('Function<T>(int x)');
- expectComplexInfo('Function<T>(int x) Function<T>(int x)');
+
+ expectInfo(noTypeInfo, 'Function(int x)', required: false);
+ expectInfo(noTypeInfo, 'Function<T>(int x)', required: false);
+
+ expectComplexInfo('Function(int x)', required: true);
+ expectComplexInfo('Function<T>(int x)', required: true);
+
+ expectComplexInfo('Function(int x) m', tokenAfter: 'm');
+ expectComplexInfo('Function<T>(int x) m', tokenAfter: 'm');
+ expectComplexInfo('Function<T>(int x) Function<T>(int x)',
+ required: false, tokenAfter: 'Function');
+ expectComplexInfo('Function<T>(int x) Function<T>(int x)', required: true);
+ expectComplexInfo('Function<T>(int x) Function<T>(int x) m',
+ tokenAfter: 'm');
}
void test_computeType_identifier() {
@@ -282,14 +312,25 @@
}
void test_computeType_identifierComplex() {
- expectComplexInfo('C Function()');
- expectComplexInfo('C Function<T>()');
- expectComplexInfo('C Function(int)');
- expectComplexInfo('C Function<T>(int)');
- expectComplexInfo('C Function(int x)');
- expectComplexInfo('C Function<T>(int x)');
- expectComplexInfo('C Function<T>(int x) Function<T>(int x)');
+ expectInfo(simpleTypeInfo, 'C Function()', required: false);
+ expectInfo(simpleTypeInfo, 'C Function<T>()', required: false);
+ expectInfo(simpleTypeInfo, 'C Function(int)', required: false);
+ expectInfo(simpleTypeInfo, 'C Function<T>(int)', required: false);
+ expectInfo(simpleTypeInfo, 'C Function(int x)', required: false);
+ expectInfo(simpleTypeInfo, 'C Function<T>(int x)', required: false);
+
+ expectComplexInfo('C Function()', required: true);
+ expectComplexInfo('C Function<T>()', required: true);
+ expectComplexInfo('C Function(int)', required: true);
+ expectComplexInfo('C Function<T>(int)', required: true);
+ expectComplexInfo('C Function(int x)', required: true);
+ expectComplexInfo('C Function<T>(int x)', required: true);
+ expectComplexInfo('C Function<T>(int x) Function<T>(int x)',
+ required: false, tokenAfter: 'Function');
+ expectComplexInfo('C Function<T>(int x) Function<T>(int x)',
+ required: true);
expectComplexInfo('C Function(', // Scanner inserts synthetic ')'.
+ required: true,
expectedCalls: [
'handleNoTypeVariables (',
'beginFunctionType C',
@@ -387,6 +428,7 @@
void test_computeType_identifierTypeArgGFT() {
expectComplexInfo('C<T> Function(', // Scanner inserts synthetic ')'.
+ required: true,
expectedCalls: [
'handleNoTypeVariables (',
'beginFunctionType C',
@@ -401,7 +443,10 @@
'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
'endFunctionType Function ',
]);
- expectComplexInfo('C<T> Function<T>(int x) Function<T>(int x)');
+ expectComplexInfo('C<T> Function<T>(int x) Function<T>(int x)',
+ required: false, tokenAfter: 'Function');
+ expectComplexInfo('C<T> Function<T>(int x) Function<T>(int x)',
+ required: true);
}
void test_computeType_identifierTypeArgRecovery() {
@@ -479,6 +524,7 @@
void test_computeType_prefixedGFT() {
expectComplexInfo('C.a Function(', // Scanner inserts synthetic ')'.
+ required: true,
expectedCalls: [
'handleNoTypeVariables (',
'beginFunctionType C',
@@ -491,7 +537,10 @@
'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
'endFunctionType Function ',
]);
- expectComplexInfo('C.a Function<T>(int x) Function<T>(int x)');
+ expectComplexInfo('C.a Function<T>(int x) Function<T>(int x)',
+ required: false, tokenAfter: 'Function');
+ expectComplexInfo('C.a Function<T>(int x) Function<T>(int x)',
+ required: true);
}
void test_computeType_prefixedTypeArg() {
@@ -522,6 +571,7 @@
void test_computeType_prefixedTypeArgGFT() {
expectComplexInfo('C.a<T> Function<T>(int x) Function<T>(int x)',
+ required: true,
expectedCalls: [
'beginTypeVariables <',
'beginTypeVariable T',
@@ -596,6 +646,7 @@
expectInfo(voidTypeInfo, 'void operator');
expectInfo(voidTypeInfo, 'void Function');
expectComplexInfo('void Function(', // Scanner inserts synthetic ')'.
+ required: true,
expectedCalls: [
'handleNoTypeVariables (',
'beginFunctionType void',
@@ -607,7 +658,8 @@
}
void test_computeType_voidComplex() {
- expectComplexInfo('void Function()', expectedCalls: [
+ expectInfo(voidTypeInfo, 'void Function()', required: false);
+ expectComplexInfo('void Function()', required: true, expectedCalls: [
'handleNoTypeVariables (',
'beginFunctionType void',
'handleVoidKeyword void',
@@ -615,12 +667,23 @@
'endFormalParameters 0 ( ) MemberKind.GeneralizedFunctionType',
'endFunctionType Function ',
]);
- expectComplexInfo('void Function<T>()');
- expectComplexInfo('void Function(int)');
- expectComplexInfo('void Function<T>(int)');
- expectComplexInfo('void Function(int x)');
- expectComplexInfo('void Function<T>(int x)');
- expectComplexInfo('void Function<T>(int x) Function<T>(int x)');
+
+ expectInfo(voidTypeInfo, 'void Function<T>()', required: false);
+ expectInfo(voidTypeInfo, 'void Function(int)', required: false);
+ expectInfo(voidTypeInfo, 'void Function<T>(int)', required: false);
+ expectInfo(voidTypeInfo, 'void Function(int x)', required: false);
+ expectInfo(voidTypeInfo, 'void Function<T>(int x)', required: false);
+
+ expectComplexInfo('void Function<T>()', required: true);
+ expectComplexInfo('void Function(int)', required: true);
+ expectComplexInfo('void Function<T>(int)', required: true);
+ expectComplexInfo('void Function(int x)', required: true);
+ expectComplexInfo('void Function<T>(int x)', required: true);
+
+ expectComplexInfo('void Function<T>(int x) Function<T>(int x)',
+ required: false, tokenAfter: 'Function');
+ expectComplexInfo('void Function<T>(int x) Function<T>(int x)',
+ required: true);
}
}
diff --git a/pkg/front_end/test/incremental_load_from_dill_test.dart b/pkg/front_end/test/incremental_load_from_dill_test.dart
index 93bd46b..b324e31 100644
--- a/pkg/front_end/test/incremental_load_from_dill_test.dart
+++ b/pkg/front_end/test/incremental_load_from_dill_test.dart
@@ -93,10 +93,9 @@
Future<Result<TestData>> run(TestData data, Context context) async {
YamlMap map = data.map;
switch (map["type"]) {
- case "simple":
- await simpleTest(
+ case "basic":
+ await basicTest(
map["sources"],
- map["name"],
map["entry"],
map["strong"],
map["invalidate"],
@@ -116,13 +115,8 @@
}
}
-void simpleTest(
- Map<String, String> sourceFiles,
- String testName,
- String entryPoint,
- bool strong,
- List<String> invalidate,
- Directory outDir) async {
+void basicTest(Map<String, String> sourceFiles, String entryPoint, bool strong,
+ List<String> invalidate, Directory outDir) async {
Uri entryPointUri;
Set<String> invalidateFilenames = invalidate?.toSet() ?? new Set<String>();
List<Uri> invalidateUris = <Uri>[];
@@ -139,9 +133,8 @@
new File.fromUri(uri).writeAsStringSync(source);
}
- Uri output = outDir.uri.resolve("${testName}_full.dill");
- Uri initializedOutput =
- outDir.uri.resolve("${testName}_full_from_initialized.dill");
+ Uri output = outDir.uri.resolve("full.dill");
+ Uri initializedOutput = outDir.uri.resolve("full_from_initialized.dill");
Stopwatch stopwatch = new Stopwatch()..start();
CompilerOptions options = getOptions(strong);
diff --git a/pkg/front_end/testcases/compile.status b/pkg/front_end/testcases/compile.status
index f06a2f9..31b8193 100644
--- a/pkg/front_end/testcases/compile.status
+++ b/pkg/front_end/testcases/compile.status
@@ -126,5 +126,3 @@
co19_language_metadata_syntax_t04: RuntimeError # Fasta doesn't recover well
external_import: RuntimeError # Expected -- test uses import which doesn't exist.
-
-implicit_const_with_static_fields: Fail
diff --git a/pkg/front_end/testcases/implicit_const_with_static_fields.dart.direct.expect b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.direct.expect
new file mode 100644
index 0000000..f928029
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.direct.expect
@@ -0,0 +1,15 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static const field dynamic constField = 87;
+ const constructor •(dynamic x) → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic constTopLevelField = 42;
+static method main() → dynamic {
+ const self::C::•(self::C::constField);
+ const self::C::•(self::constTopLevelField);
+}
diff --git a/pkg/front_end/testcases/implicit_const_with_static_fields.dart.direct.transformed.expect b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.direct.transformed.expect
new file mode 100644
index 0000000..f928029
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.direct.transformed.expect
@@ -0,0 +1,15 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static const field dynamic constField = 87;
+ const constructor •(dynamic x) → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic constTopLevelField = 42;
+static method main() → dynamic {
+ const self::C::•(self::C::constField);
+ const self::C::•(self::constTopLevelField);
+}
diff --git a/pkg/front_end/testcases/implicit_const_with_static_fields.dart.outline.expect b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.outline.expect
new file mode 100644
index 0000000..ad0b9c4
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.outline.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static const field dynamic constField;
+ const constructor •(dynamic x) → void
+ ;
+}
+static const field dynamic constTopLevelField;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/implicit_const_with_static_fields.dart.strong.expect b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.strong.expect
new file mode 100644
index 0000000..90d9837
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.strong.expect
@@ -0,0 +1,15 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static const field core::int constField = 87;
+ const constructor •(dynamic x) → void
+ : super core::Object::•()
+ ;
+}
+static const field core::int constTopLevelField = 42;
+static method main() → dynamic {
+ const self::C::•(self::C::constField);
+ const self::C::•(self::constTopLevelField);
+}
diff --git a/pkg/front_end/testcases/implicit_const_with_static_fields.dart.strong.transformed.expect b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.strong.transformed.expect
new file mode 100644
index 0000000..90d9837
--- /dev/null
+++ b/pkg/front_end/testcases/implicit_const_with_static_fields.dart.strong.transformed.expect
@@ -0,0 +1,15 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ static const field core::int constField = 87;
+ const constructor •(dynamic x) → void
+ : super core::Object::•()
+ ;
+}
+static const field core::int constTopLevelField = 42;
+static method main() → dynamic {
+ const self::C::•(self::C::constField);
+ const self::C::•(self::constTopLevelField);
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/calculated_bounds_no_strongmode.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/calculated_bounds_no_strongmode.yaml
index c6eb17a..9b471de 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/calculated_bounds_no_strongmode.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/calculated_bounds_no_strongmode.yaml
@@ -5,18 +5,17 @@
# Test compiling in non-strong-mode from source and initializing from dill.
# Make sure that any inference if done in the same way.
-type: simple
-name: testCalculatedBounds
-entry: testCalculatedBounds_a.dart
+type: basic
+entry: a.dart
strong: false
invalidate:
- - testCalculatedBounds_a.dart
+ - a.dart
sources:
- testCalculatedBounds_a.dart: |
- import 'testCalculatedBounds_b.dart';
+ a.dart: |
+ import 'b.dart';
class A {
void foo(B cls) {}
}
- testCalculatedBounds_b.dart: |
+ b.dart: |
abstract class B<T extends String> {}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/deferred_library.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/deferred_library.yaml
index 7ffc3f1..7ea4cc0 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/deferred_library.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/deferred_library.yaml
@@ -5,17 +5,16 @@
# Test loading from a dill file with a deferred library.
# This is done by initializing from dill and making no changes/invalidations.
-type: simple
-name: testDeferredLibrary
-entry: testDeferredLibrary_main.dart
+type: basic
+entry: a.dart
strong: false
invalidate:
sources:
- testDeferredLibrary_main.dart: |
- import 'testDeferredLibrary_b.dart' deferred as b;
+ a.dart: |
+ import 'b.dart' deferred as b;
void main() {
print(b.foo());
}
- testDeferredLibrary_b.dart: |
+ b.dart: |
String foo() => "hello from foo in b";
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_export_of_main.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_export_of_main.yaml
index 5a11db2..07e5102 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_export_of_main.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_export_of_main.yaml
@@ -4,14 +4,13 @@
# Invalidate the entrypoint which just exports another file (which has main).
-type: simple
-name: testInvalidateExportOfMain
-entry: testInvalidateExportOfMain_a.dart
+type: basic
+entry: a.dart
strong: true
invalidate:
- - testInvalidateExportOfMain_a.dart
+ - a.dart
sources:
- testInvalidateExportOfMain_a.dart: |
- export 'testInvalidateExportOfMain_b.dart';
- testInvalidateExportOfMain_b.dart: |
+ a.dart: |
+ export 'b.dart';
+ b.dart: |
main() { print("hello"); }
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_package_part_as_file.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_package_part_as_file.yaml
index 759ae72..43eb78b 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_package_part_as_file.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_package_part_as_file.yaml
@@ -4,8 +4,7 @@
# Test that invalidating a part of a package works with file URI.
-type: simple
-name: testDeferredLibrary
+type: basic
entry: "package:dummy/main.dart"
strong: false
invalidate:
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_package_part_as_package.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_package_part_as_package.yaml
index 759ae72..43eb78b 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_package_part_as_package.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_package_part_as_package.yaml
@@ -4,8 +4,7 @@
# Test that invalidating a part of a package works with file URI.
-type: simple
-name: testDeferredLibrary
+type: basic
entry: "package:dummy/main.dart"
strong: false
invalidate:
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_part.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_part.yaml
index e3828ea..8ff940e 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_part.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/invalidate_part.yaml
@@ -4,23 +4,22 @@
# Invalidate a part file.
-type: simple
-name: testInvalidatePart
-entry: testInvalidatePart_a.dart
+type: basic
+entry: a.dart
strong: true
invalidate:
- - testInvalidatePart_b.dart
+ - b.dart
sources:
- testInvalidatePart_a.dart: |
+ a.dart: |
library a;
- import 'testInvalidatePart_c.dart';
- part 'testInvalidatePart_b.dart';
- testInvalidatePart_b.dart: |
+ import 'c.dart';
+ part 'b.dart';
+ b.dart: |
part of a;
b() { print("b"); }
- testInvalidatePart_c.dart: |
+ c.dart: |
library c;
- part 'testInvalidatePart_d.dart';
- testInvalidatePart_d.dart: |
+ part 'd.dart';
+ d.dart: |
part of c;
d() { print("d"); }
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/mixin_from_sdk.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/mixin_from_sdk.yaml
index b86dbc7..30d267a 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/mixin_from_sdk.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/mixin_from_sdk.yaml
@@ -6,14 +6,13 @@
# Make sure compiling from source and compiling where we initialize from dill
# ends up including the same source code.
-type: simple
-name: testMixinFromSdk
-entry: testMixinFromSdk_a.dart
+type: basic
+entry: a.dart
strong: true
invalidate:
- - testMixinFromSdk_a.dart
+ - a.dart
sources:
- testMixinFromSdk_a.dart: |
+ a.dart: |
import 'dart:collection';
class Foo extends Object with ListMixin<int> {
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/strongmode_mixins.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/strongmode_mixins.yaml
index dbabbd3..1981950 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/strongmode_mixins.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/strongmode_mixins.yaml
@@ -6,16 +6,15 @@
# on something compiled from source and (potentially) goes into
# something loaded from dill.
-type: simple
-name: testStrongModeMixins
-entry: testStrongModeMixins_a.dart
+type: basic
+entry: a.dart
strong: true
invalidate:
- - testStrongModeMixins_a.dart
+ - a.dart
sources:
- testStrongModeMixins_a.dart: |
- import 'testStrongModeMixins_b.dart';
+ a.dart: |
+ import 'b.dart';
class A extends Object with B<Object>, C {}
- testStrongModeMixins_b.dart: |
+ b.dart: |
abstract class C<T extends Object> extends Object with B<T> {}
abstract class B<ChildType extends Object> extends Object {}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/strongmode_mixins_2.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/strongmode_mixins_2.yaml
index 4907a06..b82c820 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/strongmode_mixins_2.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/strongmode_mixins_2.yaml
@@ -4,17 +4,16 @@
# Compile in strong mode. Use mixins.
-type: simple
-name: testStrongModeMixins2
-entry: testStrongModeMixins2_a.dart
+type: basic
+entry: a.dart
strong: true
invalidate:
- - testStrongModeMixins2_a.dart
+ - a.dart
sources:
- testStrongModeMixins2_a.dart: |
- import 'testStrongModeMixins2_b.dart';
+ a.dart: |
+ import 'b.dart';
class A extends Object with B<C>, D<Object> {}
- testStrongModeMixins2_b.dart: |
+ b.dart: |
abstract class B<ChildType extends Object> extends Object {
ChildType get child => null;
set child(ChildType value) {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private.dart b/pkg/front_end/testcases/no_such_method_forwarders/private.dart
new file mode 100644
index 0000000..35827b5
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that private members of classes from other libraries don't
+// cause generation of noSuchMethod forwarders.
+
+library private;
+
+import './private_module.dart' show Fisk;
+
+abstract class Foo {
+ dynamic noSuchMethod(Invocation invocation) => 42;
+}
+
+class Bar extends Foo implements Fisk {}
+
+class Baz extends Foo implements Fisk {
+ _hest() => null;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private.dart.direct.expect b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.direct.expect
new file mode 100644
index 0000000..937b5a6
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.direct.expect
@@ -0,0 +1,27 @@
+library private;
+import self as self;
+import "dart:core" as core;
+import "./private_module.dart" as pri;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ return 42;
+}
+class Bar extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+class Baz extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ method _hest() → dynamic
+ return null;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private.dart.direct.transformed.expect b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.direct.transformed.expect
new file mode 100644
index 0000000..937b5a6
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.direct.transformed.expect
@@ -0,0 +1,27 @@
+library private;
+import self as self;
+import "dart:core" as core;
+import "./private_module.dart" as pri;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ return 42;
+}
+class Bar extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+class Baz extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ method _hest() → dynamic
+ return null;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private.dart.outline.expect b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.outline.expect
new file mode 100644
index 0000000..1817793
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.outline.expect
@@ -0,0 +1,25 @@
+library private;
+import self as self;
+import "dart:core" as core;
+import "./private_module.dart" as pri;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ ;
+}
+class Bar extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ ;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+class Baz extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ ;
+ method _hest() → dynamic
+ ;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private.dart.strong.expect b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.strong.expect
new file mode 100644
index 0000000..937b5a6
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.strong.expect
@@ -0,0 +1,27 @@
+library private;
+import self as self;
+import "dart:core" as core;
+import "./private_module.dart" as pri;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ return 42;
+}
+class Bar extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+class Baz extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ method _hest() → dynamic
+ return null;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private.dart.strong.transformed.expect b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.strong.transformed.expect
new file mode 100644
index 0000000..937b5a6
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private.dart.strong.transformed.expect
@@ -0,0 +1,27 @@
+library private;
+import self as self;
+import "dart:core" as core;
+import "./private_module.dart" as pri;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ return 42;
+}
+class Bar extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+class Baz extends self::Foo implements pri::Fisk {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ method _hest() → dynamic
+ return null;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase:///private_module.dart */ _hest() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart
new file mode 100644
index 0000000..b7258fc
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Supplement library for
+// pkg/front_end_testcases/no_such_method_forwarders/private.dart
+
+library private_module;
+
+abstract class Fisk {
+ void _hest();
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.direct.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.direct.expect
new file mode 100644
index 0000000..9565466
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.direct.expect
@@ -0,0 +1,11 @@
+library private_module;
+import self as self;
+import "dart:core" as core;
+
+abstract class Fisk extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method _hest() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.direct.transformed.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.direct.transformed.expect
new file mode 100644
index 0000000..9565466
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.direct.transformed.expect
@@ -0,0 +1,11 @@
+library private_module;
+import self as self;
+import "dart:core" as core;
+
+abstract class Fisk extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method _hest() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.outline.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.outline.expect
new file mode 100644
index 0000000..fd3f8a1
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.outline.expect
@@ -0,0 +1,11 @@
+library private_module;
+import self as self;
+import "dart:core" as core;
+
+abstract class Fisk extends core::Object {
+ synthetic constructor •() → void
+ ;
+ abstract method _hest() → void;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.strong.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.strong.expect
new file mode 100644
index 0000000..9565466
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.strong.expect
@@ -0,0 +1,11 @@
+library private_module;
+import self as self;
+import "dart:core" as core;
+
+abstract class Fisk extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method _hest() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.strong.transformed.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.strong.transformed.expect
new file mode 100644
index 0000000..9565466
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_module.dart.strong.transformed.expect
@@ -0,0 +1,11 @@
+library private_module;
+import self as self;
+import "dart:core" as core;
+
+abstract class Fisk extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method _hest() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart
new file mode 100644
index 0000000..983c5b7
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test checks that a noSuchMethod forwarder is generated for an inherited
+// abstract private member that is declared in the same library as the
+// implementor.
+
+abstract class Foo {
+ void _foo();
+}
+
+class Bar extends Foo {
+ dynamic noSuchMethod(Invocation invocation) => null;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.direct.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.direct.expect
new file mode 100644
index 0000000..dbc0d1d
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.direct.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method _foo() → void;
+}
+class Bar extends self::Foo {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ return null;
+ abstract no-such-method-forwarder method _foo() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.direct.transformed.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.direct.transformed.expect
new file mode 100644
index 0000000..dbc0d1d
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.direct.transformed.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method _foo() → void;
+}
+class Bar extends self::Foo {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ return null;
+ abstract no-such-method-forwarder method _foo() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.outline.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.outline.expect
new file mode 100644
index 0000000..8dc462e
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.outline.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ ;
+ abstract method _foo() → void;
+}
+class Bar extends self::Foo {
+ synthetic constructor •() → void
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ ;
+ abstract no-such-method-forwarder method _foo() → void;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.strong.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.strong.expect
new file mode 100644
index 0000000..dbc0d1d
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.strong.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method _foo() → void;
+}
+class Bar extends self::Foo {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ return null;
+ abstract no-such-method-forwarder method _foo() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.strong.transformed.expect b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.strong.transformed.expect
new file mode 100644
index 0000000..dbc0d1d
--- /dev/null
+++ b/pkg/front_end/testcases/no_such_method_forwarders/private_same.dart.strong.transformed.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method _foo() → void;
+}
+class Bar extends self::Foo {
+ synthetic constructor •() → void
+ : super self::Foo::•()
+ ;
+ method noSuchMethod(core::Invocation invocation) → dynamic
+ return null;
+ abstract no-such-method-forwarder method _foo() → void;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/outline.status b/pkg/front_end/testcases/outline.status
index a31e6b7..80f615e 100644
--- a/pkg/front_end/testcases/outline.status
+++ b/pkg/front_end/testcases/outline.status
@@ -280,5 +280,3 @@
rasta/issue_000047: Fail
rasta/native_is_illegal: Pass # Issue 29763
rasta/type_with_parse_error: Fail
-
-implicit_const_with_static_fields: Fail
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index a1d3394..6f767dc 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -33,7 +33,6 @@
function_type_recovery: Fail
functions: Fail
hello: Fail
-implicit_const_with_static_fields: Fail
implicit_this: Fail
invocations: Fail
literals: Fail
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index 6a577c3..2806388 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -238,8 +238,8 @@
}
type LibraryPart {
- UriReference fileUri;
List<Expression> annotations;
+ StringReference partUri;
}
type Typedef {
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index c2fa92f..dcb6c66 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -523,14 +523,11 @@
/// part <url>;
///
/// optionally with metadata.
-class LibraryPart extends TreeNode implements FileUriNode {
+class LibraryPart extends TreeNode {
final List<Expression> annotations;
- final Uri fileUri;
+ final String partUri;
- LibraryPart(List<Expression> annotations, Uri fileUri)
- : this.byReference(annotations, fileUri);
-
- LibraryPart.byReference(this.annotations, this.fileUri) {
+ LibraryPart(this.annotations, this.partUri) {
setParents(annotations, this);
}
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index 951aedd..97fd9dd 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -715,9 +715,9 @@
}
LibraryPart readLibraryPart(Library library) {
- var fileUri = readUriReference();
- var annotations = readExpressionList();
- return new LibraryPart(annotations, fileUri)..parent = library;
+ List<Expression> annotations = readExpressionList();
+ String partUri = readStringReference();
+ return new LibraryPart(annotations, partUri)..parent = library;
}
Typedef readTypedef() {
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index a050b72..ec68922 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -665,10 +665,8 @@
if (_metadataSubsections != null) {
_recordNodeOffsetForMetadataMapping(node);
}
- final Uri activeFileUriSaved = _activeFileUri;
- _activeFileUri = writeUriReference(node.fileUri);
writeNodeList(node.annotations);
- _activeFileUri = activeFileUriSaved;
+ writeStringReference(node.partUri);
}
void visitTypedef(Typedef node) {
diff --git a/runtime/bin/dfe.cc b/runtime/bin/dfe.cc
index d6bad2b..6bccb8d 100644
--- a/runtime/bin/dfe.cc
+++ b/runtime/bin/dfe.cc
@@ -253,13 +253,17 @@
}
void* DFE::ReadScript(const char* script_uri) const {
+ int64_t start = Dart_TimelineGetMicros();
const uint8_t* buffer = NULL;
intptr_t buffer_length = -1;
bool result = TryReadKernelFile(script_uri, &buffer, &buffer_length);
- if (result) {
- return Dart_ReadKernelBinary(buffer, buffer_length, ReleaseFetchedBytes);
- }
- return NULL;
+ void* read_binary =
+ result ? Dart_ReadKernelBinary(buffer, buffer_length, ReleaseFetchedBytes)
+ : NULL;
+ int64_t end = Dart_TimelineGetMicros();
+ Dart_TimelineEvent("DFE::ReadScript", start, end,
+ Dart_Timeline_Event_Duration, 0, NULL, NULL);
+ return read_binary;
}
bool DFE::TryReadKernelFile(const char* script_uri,
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index f7868e1..99597f7 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -488,6 +488,7 @@
Dart_IsolateFlags* flags,
char** error,
int* exit_code) {
+ int64_t start = Dart_TimelineGetMicros();
ASSERT(script_uri != NULL);
void* kernel_program = NULL;
AppSnapshot* app_snapshot = NULL;
@@ -579,15 +580,21 @@
#if !defined(DART_PRECOMPILED_RUNTIME)
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
+ Dart_Isolate created_isolate = NULL;
if (isolate == NULL) {
delete isolate_data;
- return NULL;
+ } else {
+ bool set_native_resolvers = (kernel_program || isolate_snapshot_data);
+ created_isolate = IsolateSetupHelper(
+ isolate, is_main_isolate, script_uri, package_root, packages_config,
+ set_native_resolvers, isolate_run_app_snapshot, error, exit_code);
}
+ int64_t end = Dart_TimelineGetMicros();
+ Dart_TimelineEvent("CreateIsolateAndSetupHelper", start, end,
+ Dart_Timeline_Event_Duration, 0, NULL, NULL);
- bool set_native_resolvers = (kernel_program || isolate_snapshot_data);
- return IsolateSetupHelper(isolate, is_main_isolate, script_uri, package_root,
- packages_config, set_native_resolvers,
- isolate_run_app_snapshot, error, exit_code);
+ return created_isolate;
}
#undef CHECK_RESULT
diff --git a/runtime/bin/run_vm_tests.cc b/runtime/bin/run_vm_tests.cc
index d5d6ff0..6446440 100644
--- a/runtime/bin/run_vm_tests.cc
+++ b/runtime/bin/run_vm_tests.cc
@@ -200,6 +200,12 @@
return isolate;
}
+static void CleanupIsolate(void* callback_data) {
+ bin::IsolateData* isolate_data =
+ reinterpret_cast<bin::IsolateData*>(callback_data);
+ delete isolate_data;
+}
+
static int Main(int argc, const char** argv) {
// Flags being passed to the Dart VM.
int dart_argc = 0;
@@ -269,7 +275,7 @@
const char* err_msg = Dart::InitOnce(
dart::bin::vm_snapshot_data, dart::bin::vm_snapshot_instructions,
CreateIsolateAndSetup /* create */, NULL /* shutdown */,
- NULL /* cleanup */, NULL /* thread_exit */,
+ CleanupIsolate /* cleanup */, NULL /* thread_exit */,
dart::bin::DartUtils::OpenFile, dart::bin::DartUtils::ReadFile,
dart::bin::DartUtils::WriteFile, dart::bin::DartUtils::CloseFile,
NULL /* entropy_source */, NULL /* get_service_assets */,
diff --git a/runtime/lib/errors_patch.dart b/runtime/lib/errors_patch.dart
index e79dfae..0eb39d1 100644
--- a/runtime/lib/errors_patch.dart
+++ b/runtime/lib/errors_patch.dart
@@ -184,6 +184,10 @@
: _receiver = receiver,
_invocation = invocation as _InvocationMirror;
+ static void _throwNewInvocation(Object receiver, Invocation invocation) {
+ throw new NoSuchMethodError.withInvocation(receiver, invocation);
+ }
+
// The compiler emits a call to _throwNew when it cannot resolve a static
// method at compile time. The receiver is actually the literal class of the
// unresolved method.
diff --git a/runtime/lib/invocation_mirror_patch.dart b/runtime/lib/invocation_mirror_patch.dart
index a1703c5..30c3e74d6 100644
--- a/runtime/lib/invocation_mirror_patch.dart
+++ b/runtime/lib/invocation_mirror_patch.dart
@@ -57,15 +57,17 @@
}
void _setMemberNameAndType() {
+ _type ??= 0;
if (_functionName.startsWith("get:")) {
- _type = _GETTER;
+ _type |= _GETTER;
_memberName = new internal.Symbol.unvalidated(_functionName.substring(4));
} else if (_functionName.startsWith("set:")) {
- _type = _SETTER;
+ _type |= _SETTER;
_memberName =
new internal.Symbol.unvalidated(_functionName.substring(4) + "=");
} else {
- _type = _isSuperInvocation ? (_SUPER << _LEVEL_SHIFT) | _METHOD : _METHOD;
+ _type |=
+ _isSuperInvocation ? (_SUPER << _LEVEL_SHIFT) | _METHOD : _METHOD;
_memberName = new internal.Symbol.unvalidated(_functionName);
}
}
@@ -188,14 +190,15 @@
}
_InvocationMirror(this._functionName, this._argumentsDescriptor,
- this._arguments, this._isSuperInvocation);
+ this._arguments, this._isSuperInvocation, this._type);
_InvocationMirror._withoutType(this._functionName, this._typeArguments,
this._positionalArguments, this._namedArguments, this._isSuperInvocation);
static _allocateInvocationMirror(String functionName,
- List argumentsDescriptor, List arguments, bool isSuperInvocation) {
+ List argumentsDescriptor, List arguments, bool isSuperInvocation,
+ [int type = null]) {
return new _InvocationMirror(
- functionName, argumentsDescriptor, arguments, isSuperInvocation);
+ functionName, argumentsDescriptor, arguments, isSuperInvocation, type);
}
}
diff --git a/runtime/observatory/tests/observatory_ui/observatory_ui.status b/runtime/observatory/tests/observatory_ui/observatory_ui.status
index 1937c70..5f0849e 100644
--- a/runtime/observatory/tests/observatory_ui/observatory_ui.status
+++ b/runtime/observatory/tests/observatory_ui/observatory_ui.status
@@ -8,8 +8,9 @@
[ $runtime == drt || !$browser || $fast_startup ]
*: SkipByDesign
-[ $runtime == ff || $runtime == safari ]
-allocation_profile: Skip
-cpu_profile_table: Skip
-persistent_handles_page: Skip
+# custom elements are not supported on old browsers, we don't
+# intend for observatory to work on old browser versions, so
+# skipping.
+[ $runtime == ff || $runtime == ie10 || $runtime == ie11 || $runtime == safari ]
+*: SkipByDesign
diff --git a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
index c9299b9..40daf1e 100644
--- a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
@@ -71,6 +71,7 @@
void allEventsHaveIsolateNumber(List events) {
for (Map event in events) {
+ print(event);
if (event['ph'] == 'M') {
// Skip meta-data events.
continue;
@@ -91,6 +92,11 @@
// Skip API category events which sometimes don't have an isolate.
continue;
}
+ if (event['cat'] == 'Embedder' &&
+ (event['name'] == 'DFE::ReadScript' ||
+ event['name'] == 'CreateIsolateAndSetupHelper')) {
+ continue;
+ }
Map arguments = event['args'];
expect(arguments, new isInstanceOf<Map>());
expect(arguments['isolateNumber'], new isInstanceOf<String>());
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index 09c0a81..ef225bc 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -680,7 +680,7 @@
// On Windows the reentrent version of strtok is called
// strtok_s. Unify on the posix name strtok_r.
#if defined(HOST_OS_WINDOWS)
-#define snprintf _snprintf
+#define snprintf _sprintf_p
#define strtok_r strtok_s
#endif
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 80613e4..423d363 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -60,6 +60,7 @@
[ $compiler == dartk ]
cc/DartAPI_New: Fail
cc/DartAPI_TypeGetParameterizedTypes: Crash
+cc/IsolateReload_TearOff_Parameter_Count_Mismatch: Pass, Fail # Issue 32781
dart/redirection_type_shuffling_test/00: RuntimeError
dart/redirection_type_shuffling_test/none: RuntimeError
@@ -192,16 +193,12 @@
cc/SourceReport_Coverage_UnusedClass_NoForceCompile: Fail
cc/SourceReport_MultipleReports: Fail
cc/SourceReport_PossibleBreakpoints_Simple: Fail
-cc/StackTraceFormat: Fail
cc/UseDartApi: Fail
dart/data_uri_import_test/utf16: MissingRuntimeError
dart/spawn_shutdown_test: SkipSlow
[ $compiler == dartk && $runtime == vm && $system == macos ]
cc/IsolateReload_LibraryLookup: Fail, Crash
-cc/IsolateReload_TearOff_AddArguments: Fail
-cc/IsolateReload_TearOff_Instance_Equality: Fail
-cc/IsolateReload_TearOff_List_Set: Fail
[ $compiler == dartk && $runtime == vm && $strong ]
cc/IsolateReload_LibraryHide: Crash
@@ -209,15 +206,9 @@
[ $compiler == dartk && $system == linux ]
cc/IsolateReload_LibraryLookup: Fail, Crash
-cc/IsolateReload_TearOff_AddArguments: Fail
-cc/IsolateReload_TearOff_Instance_Equality: Fail
-cc/IsolateReload_TearOff_List_Set: Fail
[ $compiler == dartk && $system == windows ]
cc/IsolateReload_LibraryLookup: Fail, Crash
-cc/IsolateReload_TearOff_AddArguments: Fail
-cc/IsolateReload_TearOff_Instance_Equality: Fail
-cc/IsolateReload_TearOff_List_Set: Fail
cc/Profiler_ContextAllocation: Fail, Pass # Flaky on Windows --- sometimes give "profiler_test.cc: 1107: error: expected: !walker.Down()"
cc/Profiler_FunctionTicks: Fail, Pass
cc/Profiler_ToggleRecordAllocation: Fail, Pass
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index d39e205..6e9ffcbd 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -4206,11 +4206,28 @@
FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfImplicitClosureFunction(
const Function& function) {
+ const Function& parent = Function::ZoneHandle(Z, function.parent_function());
+ const String& func_name = String::ZoneHandle(Z, parent.name());
+ const Class& owner = Class::ZoneHandle(Z, parent.Owner());
+ Function& target = Function::ZoneHandle(Z, owner.LookupFunction(func_name));
+
+ if (target.raw() != parent.raw()) {
+ DEBUG_ASSERT(Isolate::Current()->HasAttemptedReload());
+ if (target.IsNull() || (target.is_static() != parent.is_static()) ||
+ (target.kind() != parent.kind())) {
+ target = Function::null();
+ }
+ }
+
+ if (target.IsNull() ||
+ (parent.num_fixed_parameters() != target.num_fixed_parameters())) {
+ return BuildGraphOfNoSuchMethodForwarder(function, true,
+ parent.is_static());
+ }
+
// The prologue builder needs the default parameter values.
SetupDefaultParameterValues();
- const Function& target = Function::ZoneHandle(Z, function.parent_function());
-
TargetEntryInstr* normal_entry = flow_graph_builder_->BuildTargetEntry();
PrologueInfo prologue_info(-1, -1);
BlockEntryInstr* instruction_cursor =
@@ -4294,10 +4311,10 @@
AlternativeReadingScope _(reader_);
body += BuildArgumentTypeChecks();
} else {
- // Check if target function was annotated with no-dynamic-invocations.
+ // Check if parent function was annotated with no-dynamic-invocations.
const ProcedureAttributesMetadata attrs =
procedure_attributes_metadata_helper_.GetProcedureAttributes(
- target.kernel_offset());
+ parent.kernel_offset());
if (!attrs.has_dynamic_invocations) {
// If it was then we might need to build some checks in the
// tear-off.
@@ -4347,9 +4364,11 @@
}
}
- // Forward them to the target.
+ // Forward them to the parent.
intptr_t argument_count = positional_argument_count + named_argument_count;
- if (!target.is_static()) ++argument_count;
+ if (!parent.is_static()) {
+ ++argument_count;
+ }
body += StaticCall(TokenPosition::kNoSource, target, argument_count,
argument_names, ICData::kNoRebind,
/* result_type = */ NULL, type_args_len);
@@ -4362,9 +4381,13 @@
flow_graph_builder_->last_used_block_id_, prologue_info);
}
+// If throw_no_such_method_error is set to true (defaults to false), an
+// instance of NoSuchMethodError is thrown. Otherwise, the instance
+// noSuchMethod is called.
FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfNoSuchMethodForwarder(
const Function& function,
- bool is_implicit_closure_function) {
+ bool is_implicit_closure_function,
+ bool throw_no_such_method_error) {
// The prologue builder needs the default parameter values.
SetupDefaultParameterValues();
@@ -4515,8 +4538,26 @@
// Load receiver.
if (is_implicit_closure_function) {
- body += LoadLocal(parsed_function()->current_context_var());
- body += B->LoadField(Context::variable_offset(0));
+ if (throw_no_such_method_error) {
+ const Function& parent =
+ Function::ZoneHandle(Z, function.parent_function());
+ const Class& owner = Class::ZoneHandle(Z, parent.Owner());
+ AbstractType& type = AbstractType::ZoneHandle(Z);
+ type ^= Type::New(owner, TypeArguments::Handle(Z), owner.token_pos(),
+ Heap::kOld);
+ // If the current class is the result of a mixin application, we must
+ // use the class scope of the class from which the function originates.
+ if (owner.IsMixinApplication()) {
+ ClassFinalizer::FinalizeType(
+ Class::Handle(Z, parsed_function()->function().origin()), type);
+ } else {
+ type ^= ClassFinalizer::FinalizeType(owner, type);
+ }
+ body += Constant(type);
+ } else {
+ body += LoadLocal(parsed_function()->current_context_var());
+ body += B->LoadField(Context::variable_offset(0));
+ }
} else {
LocalScope* scope = parsed_function()->node_sequence()->scope();
body += LoadLocal(scope->VariableAt(0));
@@ -4544,6 +4585,28 @@
body += Constant(Bool::False());
body += PushArgument();
+ if (throw_no_such_method_error) {
+ const Function& parent =
+ Function::ZoneHandle(Z, function.parent_function());
+ const Class& owner = Class::ZoneHandle(Z, parent.Owner());
+ InvocationMirror::Level im_level = owner.IsTopLevel()
+ ? InvocationMirror::kTopLevel
+ : InvocationMirror::kStatic;
+ InvocationMirror::Kind im_kind;
+ if (function.IsImplicitGetterFunction() || function.IsGetterFunction()) {
+ im_kind = InvocationMirror::kGetter;
+ } else if (function.IsImplicitSetterFunction() ||
+ function.IsSetterFunction()) {
+ im_kind = InvocationMirror::kSetter;
+ } else {
+ im_kind = InvocationMirror::kMethod;
+ }
+ body += IntConstant(InvocationMirror::EncodeType(im_level, im_kind));
+ } else {
+ body += NullConstant();
+ }
+ body += PushArgument();
+
const Class& mirror_class =
Class::Handle(Z, Library::LookupCoreClass(Symbols::InvocationMirror()));
ASSERT(!mirror_class.IsNull());
@@ -4552,11 +4615,23 @@
Library::PrivateCoreLibName(Symbols::AllocateInvocationMirror())));
ASSERT(!allocation_function.IsNull());
body += StaticCall(TokenPosition::kMinSource, allocation_function,
- /* argument_count = */ 4, ICData::kStatic);
+ /* argument_count = */ 5, ICData::kStatic);
body += PushArgument(); // For the call to noSuchMethod.
- body += InstanceCall(TokenPosition::kNoSource, Symbols::NoSuchMethod(),
- Token::kILLEGAL, 2, 1);
+ if (throw_no_such_method_error) {
+ const Class& klass = Class::ZoneHandle(
+ Z, Library::LookupCoreClass(Symbols::NoSuchMethodError()));
+ ASSERT(!klass.IsNull());
+ const Function& throw_function = Function::ZoneHandle(
+ Z,
+ klass.LookupStaticFunctionAllowPrivate(Symbols::ThrowNewInvocation()));
+ ASSERT(!throw_function.IsNull());
+ body += StaticCall(TokenPosition::kNoSource, throw_function, 2,
+ ICData::kStatic);
+ } else {
+ body += InstanceCall(TokenPosition::kNoSource, Symbols::NoSuchMethod(),
+ Token::kILLEGAL, 2, 1);
+ }
body += StoreLocal(TokenPosition::kNoSource, result);
body += Drop();
@@ -5987,8 +6062,8 @@
}
void StreamingFlowGraphBuilder::SkipLibraryPart() {
- ReadUInt(); // Read source_uri_index.
SkipListOfExpressions(); // Read annotations.
+ SkipStringReference(); // Read part URI index.
}
void StreamingFlowGraphBuilder::SkipLibraryTypedef() {
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index e9b3b57..36c1833 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -1121,7 +1121,8 @@
FlowGraph* BuildGraphOfFunction(bool constructor);
FlowGraph* BuildGraphOfNoSuchMethodForwarder(
const Function& function,
- bool is_implicit_closure_function);
+ bool is_implicit_closure_function,
+ bool throw_no_such_method_error = false);
intptr_t GetOffsetForSourceInfo(intptr_t index);
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 3429379..b7a56b9 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1165,6 +1165,7 @@
Dart_IsolateFlags* flags,
void* callback_data,
char** error) {
+ API_TIMELINE_DURATION(Thread::Current());
return CreateIsolate(script_uri, main, snapshot_data, snapshot_instructions,
-1, NULL, flags, callback_data, error);
}
@@ -1175,6 +1176,7 @@
Dart_IsolateFlags* flags,
void* callback_data,
char** error) {
+ API_TIMELINE_DURATION(Thread::Current());
// Setup default flags in case none were passed.
Dart_IsolateFlags api_flags;
if (flags == NULL) {
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 9a55de7..fc532c3 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -3327,6 +3327,11 @@
}
VM_UNIT_TEST_CASE(DartAPI_CurrentIsolateData) {
+ Dart_IsolateShutdownCallback saved_shutdown = Isolate::ShutdownCallback();
+ Dart_IsolateCleanupCallback saved_cleanup = Isolate::CleanupCallback();
+ Isolate::SetShutdownCallback(NULL);
+ Isolate::SetCleanupCallback(NULL);
+
intptr_t mydata = 12345;
Dart_Isolate isolate =
TestCase::CreateTestIsolate(NULL, reinterpret_cast<void*>(mydata));
@@ -3334,6 +3339,9 @@
EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_CurrentIsolateData()));
EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_IsolateData(isolate)));
Dart_ShutdownIsolate();
+
+ Isolate::SetShutdownCallback(saved_shutdown);
+ Isolate::SetCleanupCallback(saved_cleanup);
}
static Dart_Handle LoadScript(const char* url_str, const char* source) {
@@ -7250,31 +7258,41 @@
}
}
-static void* saved_callback_data;
+static void* shutdown_callback_data;
static void IsolateShutdownTestCallback(void* callback_data) {
- saved_callback_data = callback_data;
+ shutdown_callback_data = callback_data;
+}
+static void* cleanup_callback_data;
+static void IsolateCleanupTestCallback(void* callback_data) {
+ cleanup_callback_data = callback_data;
}
-VM_UNIT_TEST_CASE(DartAPI_IsolateShutdown) {
- Dart_IsolateShutdownCallback saved = Isolate::ShutdownCallback();
+VM_UNIT_TEST_CASE(DartAPI_IsolateShutdownAndCleanup) {
+ Dart_IsolateShutdownCallback saved_shutdown = Isolate::ShutdownCallback();
+ Dart_IsolateCleanupCallback saved_cleanup = Isolate::CleanupCallback();
Isolate::SetShutdownCallback(IsolateShutdownTestCallback);
+ Isolate::SetCleanupCallback(IsolateCleanupTestCallback);
- saved_callback_data = NULL;
+ shutdown_callback_data = NULL;
+ cleanup_callback_data = NULL;
void* my_data = reinterpret_cast<void*>(12345);
// Create an isolate.
Dart_Isolate isolate = TestCase::CreateTestIsolate(NULL, my_data);
EXPECT(isolate != NULL);
// The shutdown callback has not been called.
- EXPECT_EQ(0, reinterpret_cast<intptr_t>(saved_callback_data));
+ EXPECT_EQ(0, reinterpret_cast<intptr_t>(shutdown_callback_data));
+ EXPECT_EQ(0, reinterpret_cast<intptr_t>(cleanup_callback_data));
// Shutdown the isolate.
Dart_ShutdownIsolate();
// The shutdown callback has been called.
- EXPECT_EQ(12345, reinterpret_cast<intptr_t>(saved_callback_data));
+ EXPECT_EQ(12345, reinterpret_cast<intptr_t>(shutdown_callback_data));
+ EXPECT_EQ(12345, reinterpret_cast<intptr_t>(cleanup_callback_data));
- Isolate::SetShutdownCallback(saved);
+ Isolate::SetShutdownCallback(saved_shutdown);
+ Isolate::SetCleanupCallback(saved_cleanup);
}
static int64_t add_result = 0;
diff --git a/runtime/vm/isolate_reload_test.cc b/runtime/vm/isolate_reload_test.cc
index a8b8928..08abecb5 100644
--- a/runtime/vm/isolate_reload_test.cc
+++ b/runtime/vm/isolate_reload_test.cc
@@ -1527,6 +1527,99 @@
EXPECT_NON_NULL(lib);
}
+TEST_CASE(IsolateReload_TearOff_Parameter_Count_Mismatch) {
+ const char* kScript =
+ "import 'file:///test:isolate_reload_helper';\n"
+ "class C {\n"
+ " static foo() => 'old';\n"
+ "}\n"
+ "main() {\n"
+ " var f1 = C.foo;\n"
+ " reloadTest();\n"
+ " return f1();\n"
+ "}\n";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
+ EXPECT_VALID(lib);
+
+ const char* kReloadScript =
+ "import 'file:///test:isolate_reload_helper';\n"
+ "class C {\n"
+ " static foo(i) => 'new:$i';\n"
+ "}\n"
+ "main() {\n"
+ " var f1 = C.foo;\n"
+ " reloadTest();\n"
+ " return f1();\n"
+ "}\n";
+
+ TestCase::SetReloadTestScript(kReloadScript);
+
+ Dart_Handle error_handle = SimpleInvokeError(lib, "main");
+
+ const char* error;
+ if (TestCase::UsingDartFrontend()) {
+ error =
+ "NoSuchMethodError: Closure call with mismatched arguments: function "
+ "'C.foo'\n"
+ "Receiver: Closure: (dynamic) => dynamic from Function 'foo': static.\n"
+ "Tried calling: C.foo()\n"
+ "Found: C.foo(dynamic) => dynamic\n"
+ "#0 Object.noSuchMethod "
+ "(dart:core/runtime/libobject_patch.dart:46:5)\n"
+ "#1 main (file:///test-lib:8:12)";
+ } else {
+ error =
+ "NoSuchMethodError: Closure call with mismatched arguments: function "
+ "'C.foo'\n"
+ "Receiver: Closure: (dynamic) => dynamic from Function 'foo': static.\n"
+ "Tried calling: C.foo()\n"
+ "Found: C.foo(dynamic) => dynamic\n"
+ "#0 Object.noSuchMethod "
+ "(dart:core-patch/dart:core/object_patch.dart:46)\n"
+ "#1 main (test-lib:8:12)";
+ }
+ EXPECT_ERROR(error_handle, error);
+}
+
+TEST_CASE(IsolateReload_TearOff_Remove) {
+ const char* kScript =
+ "import 'file:///test:isolate_reload_helper';\n"
+ "class C {\n"
+ " static foo({String bar: 'bar'}) => 'old';\n"
+ "}\n"
+ "main() {\n"
+ " var f1 = C.foo;\n"
+ " reloadTest();\n"
+ " try {\n"
+ " return f1();\n"
+ " } catch(e) { return '$e'; }\n"
+ "}\n";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
+ EXPECT_VALID(lib);
+
+ const char* kReloadScript =
+ "import 'file:///test:isolate_reload_helper';\n"
+ "class C {\n"
+ "}\n"
+ "main() {\n"
+ " var f1;\n"
+ " reloadTest();\n"
+ " try {\n"
+ " return f1();\n"
+ " } catch(e) { return '$e'; }\n"
+ "}\n";
+
+ TestCase::SetReloadTestScript(kReloadScript);
+
+ EXPECT_SUBSTRING(
+ "NoSuchMethodError: No static method 'foo' declared in class 'C'.",
+ SimpleInvokeStr(lib, "main"));
+
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
+}
TEST_CASE(IsolateReload_TearOff_Class_Identity) {
const char* kScript =
"import 'file:///test:isolate_reload_helper';\n"
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index d971e45..7c1f494 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3981,6 +3981,10 @@
continue; // Another interface may work better.
}
}
+ // In Dart 2, implementing Function has no meaning.
+ if (isolate->strong() && interface_class.IsDartFunctionClass()) {
+ continue;
+ }
if (interface_class.TypeTest(test_kind, interface_args, other,
other_type_arguments, bound_error,
bound_trail, space)) {
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 0dd75a3..f7ffc17 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -3248,6 +3248,7 @@
}
TEST_CASE(StackTraceFormat) {
+ Isolate* isolate = Isolate::Current();
const char* kScriptChars =
"void baz() {\n"
" throw 'MyException';\n"
@@ -3290,20 +3291,28 @@
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
EXPECT_VALID(lib);
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
- EXPECT_ERROR(result,
- "Unhandled exception:\n"
- "MyException\n"
- "#0 baz (test-lib:2:3)\n"
- "#1 new _OtherClass._named (test-lib:7:5)\n"
- "#2 globalVar= (test-lib:12:7)\n"
- "#3 _bar (test-lib:16:3)\n"
- "#4 MyClass.field (test-lib:25:5)\n"
- "#5 MyClass.foo.fooHelper (test-lib:30:7)\n"
- "#6 MyClass.foo (test-lib:32:14)\n"
- "#7 new MyClass.<anonymous closure> (test-lib:21:12)\n"
- "#8 new MyClass (test-lib:21:18)\n"
- "#9 main.<anonymous closure> (test-lib:37:14)\n"
- "#10 main (test-lib:37:24)");
+
+ const char* lib_url =
+ isolate->use_dart_frontend() ? "file:///test-lib" : "test-lib";
+ const size_t kExpectedLen = 512;
+ char expected[kExpectedLen];
+ snprintf(expected, kExpectedLen,
+ "Unhandled exception:\n"
+ "MyException\n"
+ "#0 baz (%1$s:2:3)\n"
+ "#1 new _OtherClass._named (%1$s:7:5)\n"
+ "#2 globalVar= (%1$s:12:7)\n"
+ "#3 _bar (%1$s:16:3)\n"
+ "#4 MyClass.field (%1$s:25:5)\n"
+ "#5 MyClass.foo.fooHelper (%1$s:30:7)\n"
+ "#6 MyClass.foo (%1$s:32:14)\n"
+ "#7 new MyClass.<anonymous closure> (%1$s:21:12)\n"
+ "#8 new MyClass (%1$s:21:18)\n"
+ "#9 main.<anonymous closure> (%1$s:37:14)\n"
+ "#10 main (%1$s:37:24)",
+ lib_url);
+
+ EXPECT_ERROR(result, expected);
}
ISOLATE_UNIT_TEST_CASE(WeakProperty_PreserveCrossGen) {
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 01ae09b..4b3f6bc 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -76,6 +76,7 @@
V(CyclicInitializationError, "CyclicInitializationError") \
V(_CompileTimeError, "_CompileTimeError") \
V(ThrowNew, "_throwNew") \
+ V(ThrowNewInvocation, "_throwNewInvocation") \
V(ThrowNewIfNotLoaded, "_throwNewIfNotLoaded") \
V(EvaluateAssertion, "_evaluateAssertion") \
V(Symbol, "Symbol") \
diff --git a/samples-dev/swarm/App.dart b/samples-dev/swarm/App.dart
index 06b5fad..301021b 100644
--- a/samples-dev/swarm/App.dart
+++ b/samples-dev/swarm/App.dart
@@ -34,7 +34,7 @@
// TODO(sigmund): Consider eliminating the call to "wrap", for
// instance, modify event listeners to always wrap, or extend DOM code
// to intercept the beginning & end of each event loop
- EventBatch.wrap((Event event) => onLoad()));
+ EventBatch.wrap((event) => onLoad()));
}
}
diff --git a/samples-dev/swarm/SwarmViews.dart b/samples-dev/swarm/SwarmViews.dart
index 003e544..9896317 100644
--- a/samples-dev/swarm/SwarmViews.dart
+++ b/samples-dev/swarm/SwarmViews.dart
@@ -821,7 +821,7 @@
new CanvasElement(height: img.height, width: img.width);
final CanvasRenderingContext2D ctx = canvas.getContext("2d");
- ctx.drawImage(img, 0, 0, img.width, img.height);
+ ctx.drawImageScaled(img, 0, 0, img.width, img.height);
return canvas.toDataUrl("image/png");
}
diff --git a/samples-dev/swarm/Views.dart b/samples-dev/swarm/Views.dart
index 7bedbfa..3bd25cc 100644
--- a/samples-dev/swarm/Views.dart
+++ b/samples-dev/swarm/Views.dart
@@ -686,7 +686,7 @@
return getPageLength(viewLength) ~/ _itemLength * page;
}
- int getSnapIndex(num offset, int viewLength) {
+ int getSnapIndex(num offset, num viewLength) {
int index = (-offset / _itemLength).round();
if (_paginate) {
index = getPageStartIndex(getPage(index, viewLength), viewLength);
@@ -863,7 +863,7 @@
throw 'Not implemented';
}
- int getSnapIndex(num offset, int viewLength) {
+ int getSnapIndex(num offset, num viewLength) {
for (int i = 1; i < _data.length; i++) {
if (getOffset(i) + getOffset(i - 1) > -offset * 2) {
return i - 1;
diff --git a/samples-dev/swarm/swarm_ui_lib/observable/observable.dart b/samples-dev/swarm/swarm_ui_lib/observable/observable.dart
index 373e350..e9d32f8 100644
--- a/samples-dev/swarm/swarm_ui_lib/observable/observable.dart
+++ b/samples-dev/swarm/swarm_ui_lib/observable/observable.dart
@@ -174,8 +174,8 @@
Iterable<T> get reversed => _internal.reversed;
- void sort([int compare(var a, var b)]) {
- if (compare == null) compare = Comparable.compare;
+ void sort([int compare(T a, T b)]) {
+ //if (compare == null) compare = (u, v) => Comparable.compare(u, v);
_internal.sort(compare);
recordGlobalChange();
}
@@ -296,11 +296,11 @@
throw new UnimplementedError();
}
- List sublist(int start, [int end]) {
+ List<T> sublist(int start, [int end]) {
throw new UnimplementedError();
}
- Iterable getRange(int start, int end) {
+ Iterable<T> getRange(int start, int end) {
throw new UnimplementedError();
}
@@ -331,16 +331,16 @@
}
String join([String separator = ""]) => _internal.join(separator);
- dynamic firstWhere(bool test(T value), {Object orElse()}) {
+ T firstWhere(bool test(T value), {T orElse()}) {
return _internal.firstWhere(test, orElse: orElse);
}
- dynamic lastWhere(bool test(T value), {Object orElse()}) {
+ T lastWhere(bool test(T value), {T orElse()}) {
return _internal.lastWhere(test, orElse: orElse);
}
void shuffle([random]) => throw new UnimplementedError();
- bool remove(T element) => throw new UnimplementedError();
+ bool remove(Object element) => throw new UnimplementedError();
void removeWhere(bool test(T element)) => throw new UnimplementedError();
void retainWhere(bool test(T element)) => throw new UnimplementedError();
List<T> toList({bool growable: true}) => throw new UnimplementedError();
diff --git a/samples-dev/swarm/swarm_ui_lib/touch/Momentum.dart b/samples-dev/swarm/swarm_ui_lib/touch/Momentum.dart
index 05adab5..eea39a0 100644
--- a/samples-dev/swarm/swarm_ui_lib/touch/Momentum.dart
+++ b/samples-dev/swarm/swarm_ui_lib/touch/Momentum.dart
@@ -112,7 +112,7 @@
* class at all.
*/
class Solver {
- static num solve(num fn(num), num targetY, num startX,
+ static num solve(num Function(num) fn, num targetY, num startX,
[int maxIterations = 50]) {
num lastX = 0;
num lastY = fn(lastX);
diff --git a/samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart b/samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart
index 60ed6e4..0a841b7 100644
--- a/samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart
+++ b/samples-dev/swarm/swarm_ui_lib/touch/TouchUtil.dart
@@ -10,7 +10,7 @@
* touch events are created from the actual mouse events.
*/
EventListener mouseToTouchCallback(EventListener callback) {
- return (MouseEvent e) {
+ return (Event e) {
var touches = <Touch>[];
var targetTouches = <Touch>[];
var changedTouches = <Touch>[];
@@ -240,7 +240,7 @@
}
class MockTouchEvent implements TouchEvent {
- MouseEvent wrapped;
+ dynamic /*MouseEvent*/ wrapped;
// TODO(jacobr): these are currently Lists instead of a TouchList.
final List<Touch> touches;
final List<Touch> targetTouches;
@@ -340,7 +340,7 @@
throw new UnimplementedError();
}
- List get path {
+ List<EventTarget> get path {
throw new UnimplementedError();
}
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
index 4c006b6..35df582 100644
--- a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
+++ b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
@@ -95,6 +95,9 @@
/// Display name used for compilation using the new common frontend.
const String kernelName = 'kernel';
+/// Display name used for strong mode compilation using the new common frontend.
+const String strongName = 'strong mode';
+
/// Compute actual data for all members defined in the program with the
/// [entryPoint] and [memorySourceFiles].
///
@@ -439,8 +442,10 @@
/// file and any supporting libraries.
Future checkTests(Directory dataDir, ComputeMemberDataFunction computeFromAst,
ComputeMemberDataFunction computeFromKernel,
- {List<String> skipForAst: const <String>[],
+ {bool testStrongMode: false,
+ List<String> skipForAst: const <String>[],
List<String> skipForKernel: const <String>[],
+ List<String> skipForStrong: const <String>[],
bool filterActualData(IdValue idValue, ActualData actualData),
List<String> options: const <String>[],
List<String> args: const <String>[],
@@ -476,7 +481,9 @@
testOptions.add(Flags.enableAsserts);
} else if (name.endsWith('_strong.dart')) {
strongModeOnlyTest = true;
- testOptions.add(Flags.strongMode);
+ if (!testStrongMode) {
+ testOptions.add(Flags.strongMode);
+ }
} else if (name.endsWith('_checked.dart')) {
testOptions.add(Flags.enableCheckedMode);
}
@@ -496,7 +503,8 @@
};
Map<String, MemberAnnotations<IdValue>> expectedMaps = {
astMarker: new MemberAnnotations<IdValue>(),
- kernelMarker: new MemberAnnotations<IdValue>()
+ kernelMarker: new MemberAnnotations<IdValue>(),
+ strongMarker: new MemberAnnotations<IdValue>(),
};
computeExpectedMap(entryPoint, code[entryPoint], expectedMaps);
Map<String, String> memorySourceFiles = {
@@ -542,7 +550,8 @@
hasFailures = true;
}
}
- if (skipForKernel.contains(name)) {
+ if (skipForKernel.contains(name) ||
+ (testStrongMode && strongModeOnlyTest)) {
print('--skipped for kernel--------------------------------------------');
} else {
print('--from kernel---------------------------------------------------');
@@ -561,6 +570,27 @@
hasFailures = true;
}
}
+ if (testStrongMode) {
+ if (skipForStrong.contains(name)) {
+ print('--skipped for kernel (strong mode)----------------------------');
+ } else {
+ print('--from kernel (strong mode)-----------------------------------');
+ MemberAnnotations<IdValue> annotations = expectedMaps[strongMarker];
+ CompiledData compiledData2 = await computeData(
+ entryPoint, memorySourceFiles, computeFromKernel,
+ computeClassData: computeClassDataFromKernel,
+ options: [Flags.strongMode]..addAll(testOptions),
+ verbose: verbose,
+ forUserLibrariesOnly: forUserLibrariesOnly,
+ globalIds: annotations.globalData.keys);
+ if (await checkCode(
+ kernelName, entity.uri, code, annotations, compiledData2,
+ filterActualData: filterActualData,
+ fatalErrors: !testAfterFailures)) {
+ hasFailures = true;
+ }
+ }
+ }
}
Expect.isFalse(hasFailures, 'Errors found.');
}
@@ -722,20 +752,24 @@
const String astMarker = 'ast.';
const String kernelMarker = 'kernel.';
+const String strongMarker = 'strong.';
-/// Compute two [MemberAnnotations] objects from [code] specifying the expected
-/// annotations we anticipate encountering; one corresponding to the old
-/// implementation, one for the new implementation.
+/// Compute three [MemberAnnotations] objects from [code] specifying the
+/// expected annotations we anticipate encountering; one corresponding to the
+/// old implementation, one for the new implementation, and one for the new
+/// implementation using strong mode.
///
/// If an annotation starts with 'ast.' it is only expected for the old
-/// implementation and if it starts with 'kernel.' it is only expected for the
-/// new implementation. Otherwise it is expected for both implementations.
+/// implementation, if it starts with 'kernel.' it is only expected for the
+/// new implementation, and if it starts with 'strong.' it is only expected for
+/// strong mode (using the common frontend). Otherwise it is expected for all
+/// implementations.
///
/// Most nodes have the same and expectations should match this by using
/// annotations without prefixes.
void computeExpectedMap(Uri sourceUri, AnnotatedCode code,
Map<String, MemberAnnotations<IdValue>> maps) {
- List<String> mapKeys = [astMarker, kernelMarker];
+ List<String> mapKeys = [astMarker, kernelMarker, strongMarker];
Map<String, AnnotatedCode> split = splitByPrefixes(code, mapKeys);
split.forEach((String marker, AnnotatedCode code) {
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence_tester.dart b/tests/compiler/dart2js/equivalence/id_equivalence_tester.dart
index 3592578..93832e4 100644
--- a/tests/compiler/dart2js/equivalence/id_equivalence_tester.dart
+++ b/tests/compiler/dart2js/equivalence/id_equivalence_tester.dart
@@ -42,6 +42,9 @@
'final_field2.dart',
// TODO(johnniwinther): Fix ast equivalence on instance fields in for.
'field_type.dart',
+
+ // Kernel add synthetic nodes for tear off of loadLibrary.
+ 'deferred_load_get.dart',
];
main(List<String> args) {
diff --git a/tests/compiler/dart2js/inference/data/call_site.dart b/tests/compiler/dart2js/inference/data/call_site.dart
index e9bcd9f..5fd4eea 100644
--- a/tests/compiler/dart2js/inference/data/call_site.dart
+++ b/tests/compiler/dart2js/inference/data/call_site.dart
@@ -262,14 +262,14 @@
new A17(). /*invoke: [exact=A17]*/ x17(1);
new A17(). /*invoke: [exact=A17]*/ x17(1, 2);
new A17(). /*invoke: [exact=A17]*/ x17(1, 2, "x");
- // ignore: undefined_named_parameter
- new A17(). /*invoke: [exact=A17]*/ x17(1, p2: 2);
- // ignore: undefined_named_parameter
- new A17(). /*invoke: [exact=A17]*/ x17(1, p3: "x");
- // ignore: undefined_named_parameter
- new A17(). /*invoke: [exact=A17]*/ x17(1, p3: "x", p2: 2);
- // ignore: undefined_named_parameter
- new A17(). /*invoke: [exact=A17]*/ x17(1, p2: 2, p3: "x");
+ dynamic a = new A17();
+ a. /*invoke: [exact=A17]*/ x17(1, p2: 2);
+ dynamic b = new A17();
+ b. /*invoke: [exact=A17]*/ x17(1, p3: "x");
+ dynamic c = new A17();
+ c. /*invoke: [exact=A17]*/ x17(1, p3: "x", p2: 2);
+ dynamic d = new A17();
+ d. /*invoke: [exact=A17]*/ x17(1, p2: 2, p3: "x");
}
/*element: A18.:[exact=A18]*/
@@ -284,10 +284,10 @@
test18() {
new A18(). /*invoke: [exact=A18]*/ x18(1, true, 1.1);
new A18(). /*invoke: [exact=A18]*/ x18(1, false, 2.2);
- // ignore: undefined_named_parameter
- new A18(). /*invoke: [exact=A18]*/ x18(1, p3: 3.3, p2: true);
- // ignore: undefined_named_parameter
- new A18(). /*invoke: [exact=A18]*/ x18(1, p2: false, p3: 4.4);
+ dynamic a = new A18();
+ a. /*invoke: [exact=A18]*/ x18(1, p3: 3.3, p2: true);
+ dynamic b = new A18();
+ b. /*invoke: [exact=A18]*/ x18(1, p2: false, p3: 4.4);
}
/*element: A19.:[exact=A19]*/
diff --git a/tests/compiler/dart2js/inference/data/closurization_instance_call.dart b/tests/compiler/dart2js/inference/data/closurization_instance_call.dart
index 8dd31e7..5a074cd 100644
--- a/tests/compiler/dart2js/inference/data/closurization_instance_call.dart
+++ b/tests/compiler/dart2js/inference/data/closurization_instance_call.dart
@@ -23,18 +23,31 @@
// TODO(johnniwinther): Fix the refined type. Missing call methods in the closed
// world leads to concluding [exact=Class].
-/*element: closurizedCallToString:[exact=JSString]*/
+/*ast.element: closurizedCallToString:[exact=JSString]*/
+/*kernel.element: closurizedCallToString:[exact=JSString]*/
+/*strong.element: closurizedCallToString:[empty]*/
closurizedCallToString() {
var c = new Class();
c.call(); // Make `Class.call` live.
var local = c. /*[exact=Class]*/ method;
- local. /*invoke: [subtype=Function]*/ toString();
+ local
+ .
+ /*ast.invoke: [subtype=Function]*/
+ /*kernel.invoke: [subtype=Function]*/
+ /*strong.invoke: [subclass=Closure]*/
+ toString();
local();
local
- . /*invoke: [exact=Class]*/
+ .
+ /*ast.invoke: [exact=Class]*/
+ /*kernel.invoke: [exact=Class]*/
+ /*strong.invoke: [empty]*/
toString();
local.call();
return local
- . /*invoke: [exact=Class]*/
+ .
+ /*ast.invoke: [exact=Class]*/
+ /*kernel.invoke: [exact=Class]*/
+ /*strong.invoke: [empty]*/
toString();
}
diff --git a/tests/compiler/dart2js/inference/data/closurization_local_call.dart b/tests/compiler/dart2js/inference/data/closurization_local_call.dart
index 30e4983..2e2cf0e 100644
--- a/tests/compiler/dart2js/inference/data/closurization_local_call.dart
+++ b/tests/compiler/dart2js/inference/data/closurization_local_call.dart
@@ -20,18 +20,31 @@
// TODO(johnniwinther): Fix the refined type. Missing call methods in the closed
// world leads to concluding [exact=Class].
-/*element: closurizedCallToString:[exact=JSString]*/
+/*ast.element: closurizedCallToString:[exact=JSString]*/
+/*kernel.element: closurizedCallToString:[exact=JSString]*/
+/*strong.element: closurizedCallToString:[empty]*/
closurizedCallToString() {
var c = new Class();
c.call(); // Make `Class.call` live.
var local = /*[exact=JSUInt31]*/ () => 42;
- local. /*invoke: [subtype=Function]*/ toString();
+ local
+ .
+ /*ast.invoke: [subtype=Function]*/
+ /*kernel.invoke: [subtype=Function]*/
+ /*strong.invoke: [subclass=Closure]*/
+ toString();
local();
local
- . /*invoke: [exact=Class]*/
+ .
+ /*ast.invoke: [exact=Class]*/
+ /*kernel.invoke: [exact=Class]*/
+ /*strong.invoke: [empty]*/
toString();
local.call();
return local
- . /*invoke: [exact=Class]*/
+ .
+ /*ast.invoke: [exact=Class]*/
+ /*kernel.invoke: [exact=Class]*/
+ /*strong.invoke: [empty]*/
toString();
}
diff --git a/tests/compiler/dart2js/inference/data/closurization_static_call.dart b/tests/compiler/dart2js/inference/data/closurization_static_call.dart
index b4d00d8..e4efff1 100644
--- a/tests/compiler/dart2js/inference/data/closurization_static_call.dart
+++ b/tests/compiler/dart2js/inference/data/closurization_static_call.dart
@@ -23,18 +23,31 @@
// TODO(johnniwinther): Fix the refined type. Missing call methods in the closed
// world leads to concluding [exact=Class].
-/*element: closurizedCallToString:[exact=JSString]*/
+/*ast.element: closurizedCallToString:[exact=JSString]*/
+/*kernel.element: closurizedCallToString:[exact=JSString]*/
+/*strong.element: closurizedCallToString:[empty]*/
closurizedCallToString() {
var c = new Class();
c.call(); // Make `Class.call` live.
var local = method;
- local. /*invoke: [subtype=Function]*/ toString();
+ local
+ .
+ /*ast.invoke: [subtype=Function]*/
+ /*kernel.invoke: [subtype=Function]*/
+ /*strong.invoke: [subclass=Closure]*/
+ toString();
local();
local
- . /*invoke: [exact=Class]*/
+ .
+ /*ast.invoke: [exact=Class]*/
+ /*kernel.invoke: [exact=Class]*/
+ /*strong.invoke: [empty]*/
toString();
local.call();
return local
- . /*invoke: [exact=Class]*/
+ .
+ /*ast.invoke: [exact=Class]*/
+ /*kernel.invoke: [exact=Class]*/
+ /*strong.invoke: [empty]*/
toString();
}
diff --git a/tests/compiler/dart2js/inference/data/deferred_load.dart b/tests/compiler/dart2js/inference/data/deferred_load.dart
index 7920746..af34b6e 100644
--- a/tests/compiler/dart2js/inference/data/deferred_load.dart
+++ b/tests/compiler/dart2js/inference/data/deferred_load.dart
@@ -1,3 +1,7 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
import 'package:expect/expect.dart' deferred as expect;
/*element: main:[null]*/
diff --git a/tests/compiler/dart2js/inference/data/deferred_load_get.dart b/tests/compiler/dart2js/inference/data/deferred_load_get.dart
new file mode 100644
index 0000000..44b2121
--- /dev/null
+++ b/tests/compiler/dart2js/inference/data/deferred_load_get.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart' deferred as expect;
+
+// Synthetic getter added by kernel.
+/*kernel.element: __loadLibrary_expect:[null|subclass=Object]*/
+/*strong.element: __loadLibrary_expect:[null|subclass=Object]*/
+
+/*element: main:[null]*/
+main() {
+ tearOffLoadLibrary();
+}
+
+/*element: tearOffLoadLibrary:[subclass=Closure]*/
+tearOffLoadLibrary() => expect.loadLibrary;
diff --git a/tests/compiler/dart2js/inference/data/dictionary_types.dart b/tests/compiler/dart2js/inference/data/dictionary_types.dart
index f6f3cc4..84dc58c 100644
--- a/tests/compiler/dart2js/inference/data/dictionary_types.dart
+++ b/tests/compiler/dart2js/inference/data/dictionary_types.dart
@@ -12,25 +12,35 @@
}
/*element: dictionaryA1:Map([subclass=JsLinkedHashMap], key: [null|subclass=Object], value: [null|subclass=Object])*/
-var dictionaryA1 = {'string': "aString", 'int': 42, 'double': 21.5, 'list': []};
+dynamic dictionaryA1 = {
+ 'string': "aString",
+ 'int': 42,
+ 'double': 21.5,
+ 'list': []
+};
/*element: dictionaryB1:Dictionary([subclass=JsLinkedHashMap], key: [exact=JSString], value: Union([exact=JSDouble], [exact=JSExtendableArray], [exact=JSUInt31], [null|exact=JSString]), map: {string: Value([exact=JSString], value: "aString"), int: [exact=JSUInt31], double: [exact=JSDouble], list: Container([exact=JSExtendableArray], element: [null|subclass=Object], length: null), stringTwo: Value([null|exact=JSString], value: "anotherString"), intTwo: [null|exact=JSUInt31]})*/
-var dictionaryB1 = {'string': "aString", 'int': 42, 'double': 21.5, 'list': []};
+dynamic dictionaryB1 = {
+ 'string': "aString",
+ 'int': 42,
+ 'double': 21.5,
+ 'list': []
+};
/*element: otherDict1:Dictionary([subclass=JsLinkedHashMap], key: [exact=JSString], value: Union([exact=JSUInt31], [null|exact=JSString]), map: {stringTwo: Value([exact=JSString], value: "anotherString"), intTwo: [exact=JSUInt31]})*/
-var otherDict1 = {'stringTwo': "anotherString", 'intTwo': 84};
+dynamic otherDict1 = {'stringTwo': "anotherString", 'intTwo': 84};
/*element: int1:[exact=JSUInt31]*/
-var int1 = 0;
+dynamic int1 = 0;
/*element: anotherInt1:[exact=JSUInt31]*/
-var anotherInt1 = 0;
+dynamic anotherInt1 = 0;
/*element: nullOrInt1:[null|exact=JSUInt31]*/
-var nullOrInt1 = 0;
+dynamic nullOrInt1 = 0;
/*element: dynamic1:[null|subclass=Object]*/
-var dynamic1 = 0;
+dynamic dynamic1 = 0;
/*element: test1:[null]*/
test1() {
@@ -55,19 +65,24 @@
}
/*element: dictionaryA2:Dictionary([subclass=JsLinkedHashMap], key: [exact=JSString], value: Union([exact=JSDouble], [exact=JSExtendableArray], [exact=JSUInt31], [null|exact=JSString]), map: {string: Value([exact=JSString], value: "aString"), int: [exact=JSUInt31], double: [exact=JSDouble], list: Container([exact=JSExtendableArray], element: [empty], length: 0)})*/
-var dictionaryA2 = {'string': "aString", 'int': 42, 'double': 21.5, 'list': []};
+dynamic dictionaryA2 = {
+ 'string': "aString",
+ 'int': 42,
+ 'double': 21.5,
+ 'list': []
+};
/*element: dictionaryB2:Dictionary([subclass=JsLinkedHashMap], key: [exact=JSString], value: Union([exact=JSExtendableArray], [exact=JSUInt31], [null|exact=JSString]), map: {string: Value([exact=JSString], value: "aString"), intTwo: [exact=JSUInt31], list: Container([exact=JSExtendableArray], element: [empty], length: 0)})*/
-var dictionaryB2 = {'string': "aString", 'intTwo': 42, 'list': []};
+dynamic dictionaryB2 = {'string': "aString", 'intTwo': 42, 'list': []};
/*element: nullOrInt2:[null|exact=JSUInt31]*/
-var nullOrInt2 = 0;
+dynamic nullOrInt2 = 0;
/*element: aString2:[exact=JSString]*/
-var aString2 = "";
+dynamic aString2 = "";
/*element: doubleOrNull2:[null|exact=JSDouble]*/
-var doubleOrNull2 = 22.2;
+dynamic doubleOrNull2 = 22.2;
/*element: test2:[null]*/
test2() {
@@ -88,26 +103,31 @@
}
/*element: dictionary3:Dictionary([subclass=JsLinkedHashMap], key: [exact=JSString], value: Union([exact=JSDouble], [exact=JSExtendableArray], [exact=JSUInt31], [null|exact=JSString]), map: {string: Value([exact=JSString], value: "aString"), int: [exact=JSUInt31], double: [exact=JSDouble], list: Container([exact=JSExtendableArray], element: [empty], length: 0)})*/
-var dictionary3 = {'string': "aString", 'int': 42, 'double': 21.5, 'list': []};
+dynamic dictionary3 = {
+ 'string': "aString",
+ 'int': 42,
+ 'double': 21.5,
+ 'list': []
+};
/*element: keyD3:Value([exact=JSString], value: "double")*/
-var keyD3 = 'double';
+dynamic keyD3 = 'double';
/*element: keyI3:Value([exact=JSString], value: "int")*/
-var keyI3 = 'int';
+dynamic keyI3 = 'int';
/*element: keyN3:Value([exact=JSString], value: "notFoundInMap")*/
-var keyN3 = 'notFoundInMap';
+dynamic keyN3 = 'notFoundInMap';
/*element: knownDouble3:[exact=JSDouble]*/
-var knownDouble3 = 42.2;
+dynamic knownDouble3 = 42.2;
/*element: intOrNull3:[null|exact=JSUInt31]*/
-var intOrNull3 = dictionary3
+dynamic intOrNull3 = dictionary3
/*Dictionary([subclass=JsLinkedHashMap], key: [exact=JSString], value: Union([exact=JSDouble], [exact=JSExtendableArray], [exact=JSUInt31], [null|exact=JSString]), map: {string: Value([exact=JSString], value: "aString"), int: [exact=JSUInt31], double: [exact=JSDouble], list: Container([exact=JSExtendableArray], element: [empty], length: 0)})*/
[keyI3];
/*element: justNull3:[null]*/
-var justNull3 = dictionary3
+dynamic justNull3 = dictionary3
/*Dictionary([subclass=JsLinkedHashMap], key: [exact=JSString], value: Union([exact=JSDouble], [exact=JSExtendableArray], [exact=JSUInt31], [null|exact=JSString]), map: {string: Value([exact=JSString], value: "aString"), int: [exact=JSUInt31], double: [exact=JSDouble], list: Container([exact=JSExtendableArray], element: [empty], length: 0)})*/
[keyN3];
@@ -159,13 +179,13 @@
}
/*element: dict5:Map([null|subclass=JsLinkedHashMap], key: [null|subclass=Object], value: [null|subclass=Object])*/
-var dict5 = makeMap5([1, 2]);
+dynamic dict5 = makeMap5([1, 2]);
/*element: notInt5:[null|subclass=Object]*/
-var notInt5 = 0;
+dynamic notInt5 = 0;
/*element: alsoNotInt5:[null|subclass=Object]*/
-var alsoNotInt5 = 0;
+dynamic alsoNotInt5 = 0;
/*element: makeMap5:Map([subclass=JsLinkedHashMap], key: [null|subclass=Object], value: [null|subclass=Object])*/
makeMap5(
diff --git a/tests/compiler/dart2js/inference/data/erroneous_super_get.dart b/tests/compiler/dart2js/inference/data/erroneous_super_get.dart
new file mode 100644
index 0000000..4850cab
--- /dev/null
+++ b/tests/compiler/dart2js/inference/data/erroneous_super_get.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*element: main:[null]*/
+main() {
+ missingSuperFieldAccess();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Access of missing super field.
+////////////////////////////////////////////////////////////////////////////////
+
+/*element: Super4.:[exact=Super4]*/
+class Super4 {}
+
+/*element: Sub4.:[exact=Sub4]*/
+class Sub4 extends Super4 {
+ /*element: Sub4.method:[empty]*/
+ // ignore: UNDEFINED_SUPER_GETTER
+ method() => super.field;
+}
+
+/*element: missingSuperFieldAccess:[null]*/
+missingSuperFieldAccess() {
+ new Sub4(). /*invoke: [exact=Sub4]*/ method();
+}
diff --git a/tests/compiler/dart2js/inference/data/erroneous_super_invoke.dart b/tests/compiler/dart2js/inference/data/erroneous_super_invoke.dart
new file mode 100644
index 0000000..19cf31c
--- /dev/null
+++ b/tests/compiler/dart2js/inference/data/erroneous_super_invoke.dart
@@ -0,0 +1,160 @@
+// 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.
+
+/*element: main:[null]*/
+main() {
+ missingSuperMethodInvoke();
+ superMethodInvokeMissingArgument();
+ superMethodInvokeExtraArgument();
+ superMethodInvokeExtraNamedArgument();
+ missingSuperMethodInvokeNoSuchMethod();
+ abstractSuperMethodInvokeNoSuchMethod();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Invocation of missing super method.
+////////////////////////////////////////////////////////////////////////////////
+
+/*element: Super4.:[exact=Super4]*/
+class Super4 {}
+
+/*element: Sub4.:[exact=Sub4]*/
+class Sub4 extends Super4 {
+ /*element: Sub4.method:[empty]*/
+ method() {
+ // ignore: UNDEFINED_SUPER_METHOD
+ var a = super.method();
+ return a. /*invoke: [empty]*/ abs();
+ }
+}
+
+/*element: missingSuperMethodInvoke:[null]*/
+missingSuperMethodInvoke() {
+ new Sub4(). /*invoke: [exact=Sub4]*/ method();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Invocation of super method with missing argument.
+////////////////////////////////////////////////////////////////////////////////
+
+/*element: Super5.:[exact=Super5]*/
+class Super5 {
+ /*element: Super5.method1:[exact=JSUInt31]*/
+ method1(/*[exact=JSUInt31]*/ x) => 42;
+}
+
+/*element: Sub5.:[exact=Sub5]*/
+class Sub5 extends Super5 {
+ /*element: Sub5.method2:[empty]*/
+ method2() {
+ super.method1(0);
+ // ignore: NOT_ENOUGH_REQUIRED_ARGUMENTS
+ var a = super.method1();
+ return a. /*invoke: [empty]*/ abs();
+ }
+}
+
+/*element: superMethodInvokeMissingArgument:[null]*/
+superMethodInvokeMissingArgument() {
+ new Sub5(). /*invoke: [exact=Sub5]*/ method2();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Invocation of super method with extra argument.
+////////////////////////////////////////////////////////////////////////////////
+
+/*element: Super6.:[exact=Super6]*/
+class Super6 {
+ /*element: Super6.method:[exact=JSUInt31]*/
+ method() => 42;
+}
+
+/*element: Sub6.:[exact=Sub6]*/
+class Sub6 extends Super6 {
+ /*element: Sub6.method:[empty]*/
+ method() {
+ // ignore: EXTRA_POSITIONAL_ARGUMENTS
+ var a = super.method(0);
+ return a. /*invoke: [empty]*/ abs();
+ }
+}
+
+/*element: superMethodInvokeExtraArgument:[null]*/
+superMethodInvokeExtraArgument() {
+ new Sub6(). /*invoke: [exact=Sub6]*/ method();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Invocation of super method with extra named argument.
+////////////////////////////////////////////////////////////////////////////////
+
+/*element: Super7.:[exact=Super7]*/
+class Super7 {
+ /*element: Super7.method:[exact=JSUInt31]*/
+ method() => 42;
+}
+
+/*element: Sub7.:[exact=Sub7]*/
+class Sub7 extends Super7 {
+ /*element: Sub7.method:[empty]*/
+ method() {
+ // ignore: UNDEFINED_NAMED_PARAMETER
+ var a = super.method(a: 0);
+ return a. /*invoke: [empty]*/ abs();
+ }
+}
+
+/*element: superMethodInvokeExtraNamedArgument:[null]*/
+superMethodInvokeExtraNamedArgument() {
+ new Sub7(). /*invoke: [exact=Sub7]*/ method();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Invocation of super method caught by noSuchMethod.
+////////////////////////////////////////////////////////////////////////////////
+
+/*element: Super8.:[exact=Super8]*/
+class Super8 {
+ /*element: Super8.noSuchMethod:[exact=JSUInt31]*/
+ noSuchMethod(/*[null|subclass=Object]*/ _) => 42;
+}
+
+/*element: Sub8.:[exact=Sub8]*/
+class Sub8 extends Super8 {
+ /*element: Sub8.method:[subclass=JSPositiveInt]*/
+ method() {
+ // ignore: UNDEFINED_SUPER_METHOD
+ var a = super.method();
+ return a. /*invoke: [exact=JSUInt31]*/ abs();
+ }
+}
+
+/*element: missingSuperMethodInvokeNoSuchMethod:[null]*/
+missingSuperMethodInvokeNoSuchMethod() {
+ new Sub8(). /*invoke: [exact=Sub8]*/ method();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Invocation of abstract super method caught by noSuchMethod.
+////////////////////////////////////////////////////////////////////////////////
+
+/*element: Super9.:[exact=Super9]*/
+class Super9 {
+ method();
+
+ /*element: Super9.noSuchMethod:[exact=JSUInt31]*/
+ noSuchMethod(/*[null|subclass=Object]*/ im) => 42;
+}
+
+/*element: Sub9.:[exact=Sub9]*/
+class Sub9 extends Super9 {
+ /*element: Sub9.method:[exact=JSUInt31]*/
+ // ignore: abstract_super_member_reference
+ method() => super.method();
+}
+
+/*element: abstractSuperMethodInvokeNoSuchMethod:[null]*/
+abstractSuperMethodInvokeNoSuchMethod() {
+ new Sub9(). /*invoke: [exact=Sub9]*/ method();
+}
diff --git a/tests/compiler/dart2js/inference/data/erroneous_super_set.dart b/tests/compiler/dart2js/inference/data/erroneous_super_set.dart
new file mode 100644
index 0000000..d100a00
--- /dev/null
+++ b/tests/compiler/dart2js/inference/data/erroneous_super_set.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*element: main:[null]*/
+main() {
+ missingSuperFieldUpdate();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Update of missing super field.
+////////////////////////////////////////////////////////////////////////////////
+
+/*element: Super4.:[exact=Super4]*/
+class Super4 {}
+
+/*element: Sub4.:[exact=Sub4]*/
+class Sub4 extends Super4 {
+ /*element: Sub4.method:[empty]*/
+ method() {
+ // ignore: UNDEFINED_SUPER_SETTER
+ var a = super.field = new Sub4();
+ return a. /*[empty]*/ method;
+ }
+}
+
+/*element: missingSuperFieldUpdate:[null]*/
+missingSuperFieldUpdate() {
+ new Sub4(). /*invoke: [exact=Sub4]*/ method();
+}
diff --git a/tests/compiler/dart2js/inference/data/expose_this_mask.dart b/tests/compiler/dart2js/inference/data/expose_this_mask.dart
index 847236b..1447e11 100644
--- a/tests/compiler/dart2js/inference/data/expose_this_mask.dart
+++ b/tests/compiler/dart2js/inference/data/expose_this_mask.dart
@@ -169,6 +169,7 @@
var field6a;
/*ast.element: Class6.field6b:[exact=JSUInt31]*/
/*kernel.element: Class6.field6b:[null|exact=JSUInt31]*/
+ /*strong.element: Class6.field6b:[null|exact=JSUInt31]*/
var field6b;
/*element: Class6.:[exact=Class6]*/
@@ -186,11 +187,13 @@
/*ast.element: SubClass6.access:[exact=JSUInt31]*/
/*kernel.element: SubClass6.access:[null|exact=JSUInt31]*/
+ /*strong.element: SubClass6.access:[null|exact=JSUInt31]*/
get access => super.field6b;
}
/*ast.element: subclassFieldWrite:[exact=JSUInt31]*/
/*kernel.element: subclassFieldWrite:[null|exact=JSUInt31]*/
+/*strong.element: subclassFieldWrite:[null|exact=JSUInt31]*/
subclassFieldWrite() {
new Class6();
return new SubClass6(). /*[exact=SubClass6]*/ access;
@@ -206,6 +209,7 @@
var field9a;
/*ast.element: Class9.field9b:[exact=JSUInt31]*/
/*kernel.element: Class9.field9b:[null|exact=JSUInt31]*/
+ /*strong.element: Class9.field9b:[null|exact=JSUInt31]*/
var field9b;
/*element: Class9.:[exact=Class9]*/
@@ -223,6 +227,7 @@
/*ast.element: SubClass9a.access:[exact=JSUInt31]*/
/*kernel.element: SubClass9a.access:[null|exact=JSUInt31]*/
+ /*strong.element: SubClass9a.access:[null|exact=JSUInt31]*/
get access => super.field9b;
}
@@ -231,6 +236,7 @@
/*ast.element: subclassesFieldWrite:[exact=JSUInt31]*/
/*kernel.element: subclassesFieldWrite:[null|exact=JSUInt31]*/
+/*strong.element: subclassesFieldWrite:[null|exact=JSUInt31]*/
subclassesFieldWrite() {
new Class9();
new SubClass9b();
diff --git a/tests/compiler/dart2js/inference/data/field_type.dart b/tests/compiler/dart2js/inference/data/field_type.dart
index 6936a0e..aeec6f6 100644
--- a/tests/compiler/dart2js/inference/data/field_type.dart
+++ b/tests/compiler/dart2js/inference/data/field_type.dart
@@ -351,6 +351,7 @@
// TODO(johnniwinther): Investigate with these differ.
/*ast.element: A16.f16:Union([exact=JSString], [exact=JSUInt31])*/
/*kernel.element: A16.f16:Union([exact=JSString], [null|exact=JSUInt31])*/
+ /*strong.element: A16.f16:Union([exact=JSString], [null|exact=JSUInt31])*/
var f16;
/*element: A16.:[exact=A16]*/
@@ -463,13 +464,13 @@
/*element: A20.:[exact=A20]*/
A20() {
+ dynamic a = this;
// TODO(johnniwinther): Fix ast equivalence on instance fields in for.
/*iterator: [exact=A20]*/
/*current: [exact=A20]*/
/*moveNext: [exact=A20]*/
- for (/*kernel.update: [exact=A20]*/ f20 in
- // ignore: for_in_of_invalid_type
- this) {}
+ for (/*kernel.update: [exact=A20]*/ /*strong.update: [exact=A20]*/ f20
+ in a) {}
}
/*element: A20.iterator:[exact=A20]*/
@@ -493,14 +494,13 @@
/*element: A21.:[exact=A21]*/
A21() {
+ dynamic a = this;
/*iterator: [exact=A21]*/
/*current: [null]*/
/*moveNext: [null]*/
for (
// ignore: unused_local_variable
- var i
- // ignore: for_in_of_invalid_type
- in this) {}
+ var i in a) {}
/*update: [exact=A21]*/ f21 = 42;
}
/*element: A21.iterator:[null]*/
@@ -659,10 +659,9 @@
/*element: test26:[null]*/
test26() {
- new A26(). /*update: [exact=A26]*/ f26 = [new B26(), new A26()]
+ new A26(). /*update: [exact=A26]*/ f26 = <dynamic>[new B26(), new A26()]
/*Container([exact=JSExtendableArray], element: Union([exact=A26], [exact=B26]), length: 2)*/
[0]
- // ignore: undefined_getter
. /*Union([exact=A26], [exact=B26])*/ f26
/*invoke: [subclass=JSPositiveInt]*/ +
42;
diff --git a/tests/compiler/dart2js/inference/data/general.dart b/tests/compiler/dart2js/inference/data/general.dart
index 8616dce..867e759 100644
--- a/tests/compiler/dart2js/inference/data/general.dart
+++ b/tests/compiler/dart2js/inference/data/general.dart
@@ -90,15 +90,15 @@
/*element: returnEmpty1:[empty]*/
returnEmpty1() {
// Ensure that we don't intrisify a wrong call to [int.remainder].
- // ignore: not_enough_required_arguments
- return 42. /*invoke: [exact=JSUInt31]*/ remainder();
+ dynamic a = 42;
+ return a. /*invoke: [exact=JSUInt31]*/ remainder();
}
/*element: returnEmpty2:[empty]*/
returnEmpty2() {
// Ensure that we don't intrisify a wrong call to [int.abs].
- // ignore: extra_positional_arguments
- return 42. /*invoke: [exact=JSUInt31]*/ abs(42);
+ dynamic a = 42;
+ return a. /*invoke: [exact=JSUInt31]*/ abs(42);
}
/*element: testIsCheck1:[subclass=JSInt]*/
@@ -212,7 +212,7 @@
// TODO(29309): Change to [subclass=JSInt] when 29309 is fixed.
/*element: testIsCheck15:[null|subclass=Object]*/
testIsCheck15(/*[null|subclass=Object]*/ a) {
- var c = 42;
+ dynamic c = 42;
do {
if (a) return c;
c = topLevelGetter();
@@ -222,7 +222,7 @@
/*element: testIsCheck16:[null|subclass=Object]*/
testIsCheck16(/*[null|subclass=Object]*/ a) {
- var c = 42;
+ dynamic c = 42;
do {
if (a) return c;
c = topLevelGetter();
@@ -232,7 +232,7 @@
/*element: testIsCheck17:[subclass=JSInt]*/
testIsCheck17(/*[null|subclass=Object]*/ a) {
- var c = 42;
+ dynamic c = 42;
for (; c is int;) {
if (a) return c;
c = topLevelGetter();
@@ -242,7 +242,7 @@
/*element: testIsCheck18:[null|subclass=Object]*/
testIsCheck18(/*[null|subclass=Object]*/ a) {
- var c = 42;
+ dynamic c = 42;
for (; c is int;) {
if (a) return c;
c = topLevelGetter();
@@ -252,7 +252,7 @@
/*element: testIsCheck19:[null|subclass=Object]*/
testIsCheck19(/*[null|subclass=Object]*/ a) {
- var c = 42;
+ dynamic c = 42;
for (; c is! int;) {
if (a) return c;
c = topLevelGetter();
@@ -357,8 +357,8 @@
/*element: returnIntAsNum:[exact=JSUInt31]*/
returnIntAsNum() {
- // ignore: unnecessary_cast
- return 0 as num;
+ dynamic a = 0;
+ return a as num;
}
typedef int Foo();
diff --git a/tests/compiler/dart2js/inference/data/if_null.dart b/tests/compiler/dart2js/inference/data/if_null.dart
index 7856b3e..d9cca46 100644
--- a/tests/compiler/dart2js/inference/data/if_null.dart
+++ b/tests/compiler/dart2js/inference/data/if_null.dart
@@ -28,7 +28,11 @@
/*element: _ifNotNullInvoke:[null|exact=JSBool]*/
_ifNotNullInvoke(/*[null|exact=JSUInt31]*/ o) {
- return o?. /*ast.[null|exact=JSUInt31]*/ /*kernel.[exact=JSUInt31]*/ isEven;
+ return o?.
+ /*ast.[null|exact=JSUInt31]*/
+ /*kernel.[exact=JSUInt31]*/
+ /*strong.[exact=JSUInt31]*/
+ isEven;
}
/*element: ifNotNullInvoke:[null]*/
diff --git a/tests/compiler/dart2js/inference/data/list.dart b/tests/compiler/dart2js/inference/data/list.dart
index 577be23..1b31de9 100644
--- a/tests/compiler/dart2js/inference/data/list.dart
+++ b/tests/compiler/dart2js/inference/data/list.dart
@@ -106,6 +106,7 @@
/*ast.element: newUint32List:Container([exact=NativeUint32List], element: [subclass=JSUInt32], length: null)*/
/*kernel.element: newUint32List:Container([exact=NativeUint32List], element: [subclass=JSUInt32], length: 13)*/
+/*strong.element: newUint32List:Container([exact=NativeUint32List], element: [subclass=JSUInt32], length: 13)*/
newUint32List() => new Uint32List((13));
////////////////////////////////////////////////////////////////////////////////
diff --git a/tests/compiler/dart2js/inference/data/list_strong.dart b/tests/compiler/dart2js/inference/data/list_strong.dart
deleted file mode 100644
index 577be23..0000000
--- a/tests/compiler/dart2js/inference/data/list_strong.dart
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:typed_data';
-
-/*element: main:[null]*/
-main() {
- emptyList();
- nullList();
- constList();
- constNullList();
- intList();
- newList();
- newFixedList();
- newFilledList();
- newFloat32x4List();
- newInt32x4List();
- newFloat64x2List();
- newFloat32List();
- newFloat64List();
- newInt16List();
- newInt32List();
- newInt8List();
- newUint16List();
- newUint32List();
- newUint8ClampedList();
- newUint8List();
-}
-
-/*element: emptyList:Container([exact=JSExtendableArray], element: [empty], length: 0)*/
-emptyList() => [];
-
-/*element: constList:Container([exact=JSUnmodifiableArray], element: [empty], length: 0)*/
-constList() => const [];
-
-/*element: nullList:Container([exact=JSExtendableArray], element: [null], length: 1)*/
-nullList() => [null];
-
-/*element: constNullList:Container([exact=JSUnmodifiableArray], element: [null], length: 1)*/
-constNullList() => const [null];
-
-/*element: intList:Container([exact=JSExtendableArray], element: [exact=JSUInt31], length: 3)*/
-intList() => [1, 2, 3];
-
-/*element: newList:Container([exact=JSExtendableArray], element: [empty], length: 0)*/
-newList() => new List();
-
-/*element: newFixedList:Container([exact=JSFixedArray], element: [null], length: 2)*/
-newFixedList() => new List(2);
-
-/*element: newFilledList:Container([exact=JSFixedArray], element: Value([exact=JSString], value: ""), length: 3)*/
-newFilledList() => new List.filled(3, '');
-
-/*element: newFloat32x4List:[exact=NativeFloat32x4List]*/
-newFloat32x4List() => new Float32x4List(4);
-
-/*element: newInt32x4List:[exact=NativeInt32x4List]*/
-newInt32x4List() => new Int32x4List(5);
-
-/*element: newFloat64x2List:[exact=NativeFloat64x2List]*/
-newFloat64x2List() => new Float64x2List(6);
-
-/*element: newFloat32List:Container([exact=NativeFloat32List], element: [subclass=JSNumber], length: 7)*/
-newFloat32List() => new Float32List(7);
-
-/*element: newFloat64List:Container([exact=NativeFloat64List], element: [subclass=JSNumber], length: 8)*/
-newFloat64List() => new Float64List(8);
-
-/*element: newInt16List:Container([exact=NativeInt16List], element: [subclass=JSInt], length: 9)*/
-newInt16List() => new Int16List(9);
-
-////////////////////////////////////////////////////////////////////////////////
-// Create a Int32List using an unchanged non-final top-level field as length.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: _field1:[exact=JSUInt31]*/
-var _field1 = 10;
-
-/*element: newInt32List:Container([exact=NativeInt32List], element: [subclass=JSInt], length: null)*/
-newInt32List() => new Int32List(_field1);
-
-////////////////////////////////////////////////////////////////////////////////
-// Create a Int8List using a final top-level field as length.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: _field2:[exact=JSUInt31]*/
-final _field2 = 11;
-
-/*element: newInt8List:Container([exact=NativeInt8List], element: [subclass=JSInt], length: 11)*/
-newInt8List() => new Int8List(_field2);
-
-////////////////////////////////////////////////////////////////////////////////
-// Create a Uint16List using a const top-level field as length.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: _field3:[exact=JSUInt31]*/
-const _field3 = 12;
-
-/*element: newUint16List:Container([exact=NativeUint16List], element: [exact=JSUInt31], length: 12)*/
-newUint16List() => new Uint16List(_field3);
-
-////////////////////////////////////////////////////////////////////////////////
-// Create a Uint32List using a parenthesized literal int as length.
-////////////////////////////////////////////////////////////////////////////////
-
-/*ast.element: newUint32List:Container([exact=NativeUint32List], element: [subclass=JSUInt32], length: null)*/
-/*kernel.element: newUint32List:Container([exact=NativeUint32List], element: [subclass=JSUInt32], length: 13)*/
-newUint32List() => new Uint32List((13));
-
-////////////////////////////////////////////////////////////////////////////////
-// Create a Uint8ClampedList using a constant multiplication as length.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: newUint8ClampedList:Container([exact=NativeUint8ClampedList], element: [exact=JSUInt31], length: null)*/
-newUint8ClampedList() =>
- new Uint8ClampedList(2 /*invoke: [exact=JSUInt31]*/ * 7);
-
-////////////////////////////////////////////////////////////////////////////////
-// Create a Uint8List using a const static field as length.
-////////////////////////////////////////////////////////////////////////////////
-
-abstract class Class1 {
- /*element: Class1.field:[exact=JSUInt31]*/
- static const field = 15;
-}
-
-/*element: newUint8List:Container([exact=NativeUint8List], element: [exact=JSUInt31], length: 15)*/
-newUint8List() => new Uint8List(Class1.field);
diff --git a/tests/compiler/dart2js/inference/data/list_tracer_typed_data_length.dart b/tests/compiler/dart2js/inference/data/list_tracer_typed_data_length.dart
index a042a6c..c528722 100644
--- a/tests/compiler/dart2js/inference/data/list_tracer_typed_data_length.dart
+++ b/tests/compiler/dart2js/inference/data/list_tracer_typed_data_length.dart
@@ -4,6 +4,9 @@
import 'dart:typed_data';
+// TODO(johnniwinther): Fix inference for strong mode. List elements should not
+// be [empty].
+
/*element: myList:Container([null|exact=NativeFloat32List], element: [subclass=JSNumber], length: 42)*/
var myList = new Float32List(42);
@@ -16,7 +19,9 @@
var a = new Float32List(9);
return myList
/*Container([null|exact=NativeFloat32List], element: [subclass=JSNumber], length: 42)*/
- [0] /*invoke: [subclass=JSNumber]*/ +
+ [0]
+ /*invoke: [subclass=JSNumber]*/
+ +
myOtherList
/*Container([null|exact=NativeUint8List], element: [exact=JSUInt31], length: 32)*/
[0];
diff --git a/tests/compiler/dart2js/inference/data/local_functions.dart b/tests/compiler/dart2js/inference/data/local_functions.dart
index c64f6a5..f6b03f1 100644
--- a/tests/compiler/dart2js/inference/data/local_functions.dart
+++ b/tests/compiler/dart2js/inference/data/local_functions.dart
@@ -64,8 +64,8 @@
/*element: namedLocalFunctionInvokeMissingArgument:[null|subclass=Object]*/
namedLocalFunctionInvokeMissingArgument() {
/*[exact=JSUInt31]*/ local(/*[empty]*/ x) => 0;
- // ignore: NOT_ENOUGH_REQUIRED_ARGUMENTS
- return local();
+ dynamic b = local;
+ return b();
}
////////////////////////////////////////////////////////////////////////////////
@@ -75,8 +75,8 @@
/*element: namedLocalFunctionInvokeExtraArgument:[null|subclass=Object]*/
namedLocalFunctionInvokeExtraArgument() {
/*[exact=JSUInt31]*/ local() => 0;
- // ignore: EXTRA_POSITIONAL_ARGUMENTS
- return local(0);
+ dynamic b = local;
+ return b(0);
}
////////////////////////////////////////////////////////////////////////////////
@@ -86,8 +86,8 @@
/*element: namedLocalFunctionInvokeExtraNamedArgument:[null|subclass=Object]*/
namedLocalFunctionInvokeExtraNamedArgument() {
/*[exact=JSUInt31]*/ local() => 0;
- // ignore: UNDEFINED_NAMED_PARAMETER
- return local(a: 0);
+ dynamic b = local;
+ return b(a: 0);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/tests/compiler/dart2js/inference/data/logical_if.dart b/tests/compiler/dart2js/inference/data/logical_if.dart
index 4e1adb1..9313a84 100644
--- a/tests/compiler/dart2js/inference/data/logical_if.dart
+++ b/tests/compiler/dart2js/inference/data/logical_if.dart
@@ -246,7 +246,12 @@
/*element: _promotedNotNotIfThen:[null]*/
_promotedNotNotIfThen(/*Union([exact=Class10], [exact=JSUInt31])*/ o) {
if (!(o is! Class10)) {
- o. /*ast.invoke: Union([exact=Class10], [exact=JSUInt31])*/ /*kernel.invoke: [exact=Class10]*/ toString();
+ o
+ .
+ /*ast.invoke: Union([exact=Class10], [exact=JSUInt31])*/
+ /*kernel.invoke: [exact=Class10]*/
+ /*strong.invoke: [exact=Class10]*/
+ toString();
}
}
@@ -271,7 +276,12 @@
// receiver must be [exact=JSUInt31].
o. /*invoke: Union([exact=Class11], [exact=JSUInt31])*/ toString();
} else {
- o. /*ast.invoke: Union([exact=Class11], [exact=JSUInt31])*/ /*kernel.invoke: [exact=Class11]*/ toString();
+ o
+ .
+ /*ast.invoke: Union([exact=Class11], [exact=JSUInt31])*/
+ /*kernel.invoke: [exact=Class11]*/
+ /*strong.invoke: [exact=Class11]*/
+ toString();
}
}
diff --git a/tests/compiler/dart2js/inference/data/map_tracer_keys.dart b/tests/compiler/dart2js/inference/data/map_tracer_keys.dart
index fb02458..994c879 100644
--- a/tests/compiler/dart2js/inference/data/map_tracer_keys.dart
+++ b/tests/compiler/dart2js/inference/data/map_tracer_keys.dart
@@ -13,10 +13,10 @@
}
/*element: aDouble1:[null|exact=JSDouble]*/
-double aDouble1 = 42.5;
+dynamic aDouble1 = 42.5;
/*element: aList1:Container([exact=JSExtendableArray], element: [exact=JSUInt31], length: 1)*/
-List aList1 = [42];
+dynamic aList1 = [42];
/*element: consume1:Container([exact=JSExtendableArray], element: [exact=JSUInt31], length: 1)*/
consume1(
@@ -44,10 +44,10 @@
}
/*element: aDouble2:[null|exact=JSDouble]*/
-double aDouble2 = 42.5;
+dynamic aDouble2 = 42.5;
/*element: aList2:Container([exact=JSExtendableArray], element: [null|subclass=Object], length: null)*/
-List aList2 = [42];
+dynamic aList2 = [42];
/*element: consume2:Container([exact=JSExtendableArray], element: [null|subclass=Object], length: null)*/
consume2(
@@ -75,10 +75,10 @@
}
/*element: aDouble3:Union([exact=JSDouble], [null|exact=JSExtendableArray])*/
-double aDouble3 = 42.5;
+dynamic aDouble3 = 42.5;
/*element: aList3:Container([exact=JSExtendableArray], element: [null|subclass=Object], length: null)*/
-List aList3 = [42];
+dynamic aList3 = [42];
/*element: consume3:Container([exact=JSExtendableArray], element: [null|subclass=Object], length: null)*/
consume3(
@@ -106,10 +106,10 @@
}
/*element: aDouble4:[null|exact=JSDouble]*/
-double aDouble4 = 42.5;
+dynamic aDouble4 = 42.5;
/*element: aList4:Container([exact=JSExtendableArray], element: [exact=JSUInt31], length: 1)*/
-List aList4 = [42];
+dynamic aList4 = [42];
/*element: consume4:Container([exact=JSExtendableArray], element: [exact=JSUInt31], length: 1)*/
consume4(
@@ -134,10 +134,10 @@
}
/*element: aDouble5:[null|exact=JSDouble]*/
-double aDouble5 = 42.5;
+dynamic aDouble5 = 42.5;
/*element: aList5:Container([exact=JSExtendableArray], element: [null|subclass=Object], length: null)*/
-List aList5 = [42];
+dynamic aList5 = [42];
/*element: consume5:Container([exact=JSExtendableArray], element: [null|subclass=Object], length: null)*/
consume5(
@@ -162,9 +162,9 @@
}
/*element: aDouble6:Union([null|exact=JSDouble], [null|exact=JSExtendableArray])*/
-double aDouble6 = 42.5;
+dynamic aDouble6 = 42.5;
/*element: aList6:Container([exact=JSExtendableArray], element: [exact=JSUInt31], length: 1)*/
-List aList6 = [42];
+dynamic aList6 = [42];
/*element: consume6:Container([exact=JSExtendableArray], element: [exact=JSUInt31], length: 1)*/
consume6(
diff --git a/tests/compiler/dart2js/inference/data/no_such_method.dart b/tests/compiler/dart2js/inference/data/no_such_method.dart
index fa78655..c4225e3 100644
--- a/tests/compiler/dart2js/inference/data/no_such_method.dart
+++ b/tests/compiler/dart2js/inference/data/no_such_method.dart
@@ -16,8 +16,10 @@
noSuchMethod(/*[null|subclass=Object]*/ _) => 42;
/*element: Class1.method:[exact=JSUInt31]*/
- // ignore: UNDEFINED_GETTER
- method() => this. /*[exact=Class1]*/ missingGetter;
+ method() {
+ dynamic a = this;
+ return a. /*[exact=Class1]*/ missingGetter;
+ }
}
/*element: missingGetter:[exact=JSUInt31]*/
@@ -33,8 +35,10 @@
noSuchMethod(/*[null|subclass=Object]*/ _) => 42;
/*element: Class2.method:[exact=JSUInt31]*/
- // ignore: UNDEFINED_METHOD
- method() => this. /*invoke: [exact=Class2]*/ missingMethod();
+ method() {
+ dynamic a = this;
+ return a. /*invoke: [exact=Class2]*/ missingMethod();
+ }
}
/*element: missingMethod:[exact=JSUInt31]*/
@@ -52,9 +56,11 @@
}
/*element: Class3.method:[null|subclass=Object]*/
- // ignore: UNDEFINED_METHOD
- method() => this. /*invoke: [exact=Class3]*/ missingMethod(
- /*[null]*/ (/*[null|subclass=Object]*/ parameter) {})(0);
+ method() {
+ dynamic a = this;
+ return a. /*invoke: [exact=Class3]*/ missingMethod(
+ /*[null]*/ (/*[null|subclass=Object]*/ parameter) {})(0);
+ }
}
/*element: closureThroughMissingMethod:[null|subclass=Object]*/
@@ -79,10 +85,10 @@
/*element: Class4.method:[null]*/
method() {
- // ignore: UNDEFINED_SETTER
- this. /*update: [exact=Class4]*/ missingSetter =
+ dynamic a = this;
+ a. /*update: [exact=Class4]*/ missingSetter =
/*[null]*/ (/*[null|subclass=Object]*/ parameter) {};
- this. /*invoke: [exact=Class4]*/ field(0);
+ a. /*invoke: [exact=Class4]*/ field(0);
}
}
diff --git a/tests/compiler/dart2js/inference/data/no_such_method1.dart b/tests/compiler/dart2js/inference/data/no_such_method1.dart
index 9bf8eba..b4a1774 100644
--- a/tests/compiler/dart2js/inference/data/no_such_method1.dart
+++ b/tests/compiler/dart2js/inference/data/no_such_method1.dart
@@ -25,9 +25,10 @@
[0];
/*element: test1:[exact=JSUInt31]*/
-test1() => new A()
- // ignore: undefined_method
- . /*invoke: [exact=A]*/ foo();
+test1() {
+ dynamic e = new A();
+ return e. /*invoke: [exact=A]*/ foo();
+}
/*element: test2:Union([exact=JSUInt31], [subclass=JsLinkedHashMap])*/
test2() => a. /*invoke: [null|subclass=B]*/ foo();
@@ -39,9 +40,10 @@
test4() => new C(). /*invoke: [exact=C]*/ foo();
/*element: test5:Union([exact=JSUInt31], [subclass=JsLinkedHashMap])*/
-test5() => (a ? new A() : new B())
- // ignore: undefined_method
- . /*invoke: [subclass=A]*/ foo();
+test5() {
+ dynamic e = (a ? new A() : new B());
+ return e. /*invoke: [subclass=A]*/ foo();
+}
/*element: test6:Union([exact=JSUInt31], [subclass=JsLinkedHashMap])*/
test6() => (a ? new B() : new C()). /*invoke: [subclass=B]*/ foo();
diff --git a/tests/compiler/dart2js/inference/data/no_such_method2.dart b/tests/compiler/dart2js/inference/data/no_such_method2.dart
index 434e82a..0d0eb8f 100644
--- a/tests/compiler/dart2js/inference/data/no_such_method2.dart
+++ b/tests/compiler/dart2js/inference/data/no_such_method2.dart
@@ -47,9 +47,10 @@
test4() => (a ? new B() : new C()). /*invoke: [subclass=B]*/ foo();
/*element: test5:Dictionary([subclass=JsLinkedHashMap], key: [empty], value: [null], map: {})*/
-test5() => (a ? new B() : new D())
- // ignore: undefined_method
- . /*invoke: Union([exact=B], [exact=D])*/ foo();
+test5() {
+ dynamic e = (a ? new B() : new D());
+ return e. /*invoke: Union([exact=B], [exact=D])*/ foo();
+}
// Can hit A.noSuchMethod, D.noSuchMethod and Object.noSuchMethod.
/*element: test6:Union([exact=JSDouble], [exact=JSUInt31])*/
@@ -57,31 +58,36 @@
// Can hit A.noSuchMethod.
/*element: test7:[exact=JSUInt31]*/
-test7() => new B()
- // ignore: undefined_method
- . /*invoke: [exact=B]*/ bar();
+test7() {
+ dynamic e = new B();
+ return e. /*invoke: [exact=B]*/ bar();
+}
/*element: test8:[exact=JSUInt31]*/
-test8() => new C()
- // ignore: undefined_method
- . /*invoke: [exact=C]*/ bar();
+test8() {
+ dynamic e = new C();
+ return e. /*invoke: [exact=C]*/ bar();
+}
/*element: test9:[exact=JSUInt31]*/
-test9() => (a ? new B() : new C())
- // ignore: undefined_method
- . /*invoke: [subclass=B]*/ bar();
+test9() {
+ dynamic e = (a ? new B() : new C());
+ return e. /*invoke: [subclass=B]*/ bar();
+}
// Can hit A.noSuchMethod and D.noSuchMethod.
/*element: test10:Union([exact=JSDouble], [exact=JSUInt31])*/
-test10() => (a ? new B() : new D())
- // ignore: undefined_method
- . /*invoke: Union([exact=B], [exact=D])*/ bar();
+test10() {
+ dynamic e = (a ? new B() : new D());
+ return e. /*invoke: Union([exact=B], [exact=D])*/ bar();
+}
// Can hit D.noSuchMethod.
/*element: test11:[exact=JSDouble]*/
-test11() => new D()
- // ignore: undefined_method
- . /*invoke: [exact=D]*/ bar();
+test11() {
+ dynamic e = new D();
+ return e. /*invoke: [exact=D]*/ bar();
+}
/*element: main:[null]*/
main() {
diff --git a/tests/compiler/dart2js/inference/data/no_such_method3.dart b/tests/compiler/dart2js/inference/data/no_such_method3.dart
index 2b31564..ed6a5f7 100644
--- a/tests/compiler/dart2js/inference/data/no_such_method3.dart
+++ b/tests/compiler/dart2js/inference/data/no_such_method3.dart
@@ -27,9 +27,10 @@
/*Container([exact=JSExtendableArray], element: [subclass=B], length: 2)*/
[0];
/*element: test1:[empty]*/
-test1() => new A()
- // ignore: undefined_method
- . /*invoke: [exact=A]*/ foo();
+test1() {
+ dynamic e = new A();
+ return e. /*invoke: [exact=A]*/ foo();
+}
/*element: test2:Dictionary([subclass=JsLinkedHashMap], key: [empty], value: [null], map: {})*/
test2() => a. /*invoke: [null|subclass=B]*/ foo();
@@ -41,9 +42,10 @@
test4() => new C(). /*invoke: [exact=C]*/ foo();
/*element: test5:Dictionary([subclass=JsLinkedHashMap], key: [empty], value: [null], map: {})*/
-test5() => (a ? new A() : new B())
- // ignore: undefined_method
- . /*invoke: [subclass=A]*/ foo();
+test5() {
+ dynamic e = (a ? new A() : new B());
+ return e. /*invoke: [subclass=A]*/ foo();
+}
/*element: test6:Dictionary([subclass=JsLinkedHashMap], key: [empty], value: [null], map: {})*/
test6() => (a ? new B() : new C()). /*invoke: [subclass=B]*/ foo();
diff --git a/tests/compiler/dart2js/inference/data/no_such_method4.dart b/tests/compiler/dart2js/inference/data/no_such_method4.dart
index 1eaaf15..13af644 100644
--- a/tests/compiler/dart2js/inference/data/no_such_method4.dart
+++ b/tests/compiler/dart2js/inference/data/no_such_method4.dart
@@ -27,9 +27,10 @@
[0];
/*element: test1:[empty]*/
-test1() => new A()
- // ignore: undefined_method
- . /*invoke: [exact=A]*/ foo();
+test1() {
+ dynamic e = new A();
+ return e. /*invoke: [exact=A]*/ foo();
+}
/*element: test2:Dictionary([subclass=JsLinkedHashMap], key: [empty], value: [null], map: {})*/
test2() => a. /*invoke: [null|subclass=B]*/ foo();
@@ -41,9 +42,10 @@
test4() => new C(). /*invoke: [exact=C]*/ foo();
/*element: test5:Dictionary([subclass=JsLinkedHashMap], key: [empty], value: [null], map: {})*/
-test5() => (a ? new A() : new B())
- // ignore: undefined_method
- . /*invoke: [subclass=A]*/ foo();
+test5() {
+ dynamic e = (a ? new A() : new B());
+ return e. /*invoke: [subclass=A]*/ foo();
+}
/*element: test6:Dictionary([subclass=JsLinkedHashMap], key: [empty], value: [null], map: {})*/
test6() => (a ? new B() : new C()). /*invoke: [subclass=B]*/ foo();
diff --git a/tests/compiler/dart2js/inference/data/optimizer_hints.dart b/tests/compiler/dart2js/inference/data/optimizer_hints.dart
index bec13c2..bf8463c 100644
--- a/tests/compiler/dart2js/inference/data/optimizer_hints.dart
+++ b/tests/compiler/dart2js/inference/data/optimizer_hints.dart
@@ -57,7 +57,9 @@
// As above but without the annotation.
////////////////////////////////////////////////////////////////////////////////
-/*element: notTrustReturnTypeString:[null|subclass=Object]*/
+/*ast.element: notTrustReturnTypeString:[null|subclass=Object]*/
+/*kernel.element: notTrustReturnTypeString:[null|subclass=Object]*/
+/*strong.element: notTrustReturnTypeString:[null|exact=JSString]*/
String notTrustReturnTypeString() {
return _assumeDynamic(0);
}
@@ -80,7 +82,12 @@
////////////////////////////////////////////////////////////////////////////////
/*element: _notTrustParameterTypeString:[null]*/
-_notTrustParameterTypeString(String /*[null|subclass=Object]*/ o) {}
+_notTrustParameterTypeString(
+ String
+ /*ast.[null|subclass=Object]*/
+ /*kernel.[null|subclass=Object]*/
+ /*strong.[null|exact=JSString]*/
+ o) {}
/*element: notTrustParameterTypeString:[null]*/
notTrustParameterTypeString() {
diff --git a/tests/compiler/dart2js/inference/data/postfix_prefix.dart b/tests/compiler/dart2js/inference/data/postfix_prefix.dart
index 0e54d55..f7428dd 100644
--- a/tests/compiler/dart2js/inference/data/postfix_prefix.dart
+++ b/tests/compiler/dart2js/inference/data/postfix_prefix.dart
@@ -2,6 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+/*element: index:[empty]*/
+dynamic get index => throw '';
+
/*element: A.:[exact=A]*/
class A {
/*element: A.foo:Value([exact=JSString], value: "string")*/
@@ -18,6 +21,7 @@
// TODO(johnniwinther): Investigate why these differ.
/*ast.element: A.returnDynamic1:Union([exact=JSString], [exact=JSUInt31])*/
/*kernel.element: A.returnDynamic1:[exact=JSUInt31]*/
+ /*strong.element: A.returnDynamic1:[exact=JSUInt31]*/
returnDynamic1() => /*[subclass=A]*/ /*update: [subclass=A]*/ foo
/*invoke: Union([exact=JSString], [exact=JSUInt31])*/ --;
@@ -32,38 +36,45 @@
// TODO(johnniwinther): Investigate why these differ.
/*ast.element: A.returnDynamic2:Union([exact=JSString], [exact=JSUInt31])*/
/*kernel.element: A.returnDynamic2:[exact=JSUInt31]*/
+ /*strong.element: A.returnDynamic2:[exact=JSUInt31]*/
returnDynamic2() => this
- // ignore: undefined_identifier
- /*[subclass=A]*/ /*update: [subclass=A]*/ [/*[subclass=A]*/ index]
+ /*[subclass=A]*/ /*update: [subclass=A]*/ [index]
/*invoke: Union([exact=JSString], [exact=JSUInt31])*/ --;
/*element: A.returnNum3:[subclass=JSNumber]*/
returnNum3() => /*invoke: Union([exact=JSString], [exact=JSUInt31])*/ --this
- // ignore: undefined_identifier
- /*[subclass=A]*/ /*update: [subclass=A]*/ [/*[subclass=A]*/ index];
+ /*[subclass=A]*/ /*update: [subclass=A]*/ [index];
/*element: A.returnNum4:[subclass=JSNumber]*/
returnNum4() => this
- // ignore: undefined_identifier
- /*[subclass=A]*/ /*update: [subclass=A]*/ [/*[subclass=A]*/ index]
+ /*[subclass=A]*/ /*update: [subclass=A]*/ [index]
/*invoke: Union([exact=JSString], [exact=JSUInt31])*/ -= 42;
+ // TODO(johnniwinther): Investigate why implementations differ on update.
/*element: A.returnEmpty3:[empty]*/
- returnEmpty3() =>
- // ignore: undefined_setter
- this. /*[subclass=A]*/ /*update: [subclass=A]*/ bar
- /*invoke: [empty]*/ --;
+ returnEmpty3() {
+ dynamic a = this;
+ return a. /*[subclass=A]*/
+ /*ast.update: [subclass=A]*/
+ /*kernel.update: [empty]*/
+ /*strong.update: [empty]*/
+ bar
+ /*invoke: [empty]*/ --;
+ }
/*element: A.returnEmpty1:[empty]*/
- returnEmpty1() => /*invoke: [empty]*/ --this
- // ignore: undefined_setter
- . /*[subclass=A]*/ /*update: [subclass=A]*/ bar;
+ returnEmpty1() {
+ dynamic a = this;
+ return /*invoke: [empty]*/ --a
+ . /*[subclass=A]*/ /*update: [subclass=A]*/ bar;
+ }
/*element: A.returnEmpty2:[empty]*/
- returnEmpty2() => this
- // ignore: undefined_setter
- . /*[subclass=A]*/ /*update: [subclass=A]*/ bar
- /*invoke: [empty]*/ -= 42;
+ returnEmpty2() {
+ dynamic a = this;
+ return a. /*[subclass=A]*/ /*update: [subclass=A]*/ bar
+ /*invoke: [empty]*/ -= 42;
+ }
}
/*element: B.:[exact=B]*/
@@ -76,6 +87,7 @@
// TODO(johnniwinther): Investigate why these differ.
/*ast.element: B.returnString1:Value([exact=JSString], value: "string")*/
/*kernel.element: B.returnString1:[empty]*/
+ /*strong.element: B.returnString1:[empty]*/
returnString1() =>
super.foo /*invoke: Value([exact=JSString], value: "string")*/ --;
@@ -91,23 +103,18 @@
// TODO(johnniwinther): Investigate why these differ.
/*ast.element: B.returnString2:Value([exact=JSString], value: "string")*/
/*kernel.element: B.returnString2:[empty]*/
- returnString2() =>
- // ignore: undefined_identifier
- super[/*[exact=B]*/ index]
+ /*strong.element: B.returnString2:[empty]*/
+ returnString2() => super[index]
/*invoke: Value([exact=JSString], value: "string")*/ --;
/*element: B.returnDynamic3:[empty]*/
returnDynamic3() =>
/*invoke: Value([exact=JSString], value: "string")*/
- --super
- // ignore: undefined_identifier
- [/*[exact=B]*/ index];
+ --super[index];
/*element: B.returnDynamic4:[empty]*/
- returnDynamic4() =>
- // ignore: undefined_identifier
- super[/*[exact=B]*/ index]
- /*invoke: Value([exact=JSString], value: "string")*/ -= 42;
+ returnDynamic4() => super[index]
+ /*invoke: Value([exact=JSString], value: "string")*/ -= 42;
}
/*element: main:[null]*/
diff --git a/tests/compiler/dart2js/inference/data/refine_locals.dart b/tests/compiler/dart2js/inference/data/refine_locals.dart
index bc437fb..c7c328c 100644
--- a/tests/compiler/dart2js/inference/data/refine_locals.dart
+++ b/tests/compiler/dart2js/inference/data/refine_locals.dart
@@ -112,9 +112,24 @@
/*element: _refineToClass1InvokeIfNotNull:[null]*/
_refineToClass1InvokeIfNotNull(
/*Union([exact=Class2], [null|exact=Class1])*/ o) {
- o?. /*ast.invoke: Union([exact=Class2], [null|exact=Class1])*/ /*kernel.invoke: Union([exact=Class1], [exact=Class2])*/ method1();
- o?. /*ast.invoke: [null|exact=Class1]*/ /*kernel.invoke: [exact=Class1]*/ method0();
- o?. /*ast.invoke: [null|exact=Class1]*/ /*kernel.invoke: [exact=Class1]*/ method2();
+ o
+ ?.
+ /*ast.invoke: Union([exact=Class2], [null|exact=Class1])*/
+ /*kernel.invoke: Union([exact=Class1], [exact=Class2])*/
+ /*strong.invoke: Union([exact=Class1], [exact=Class2])*/
+ method1();
+ o
+ ?.
+ /*ast.invoke: [null|exact=Class1]*/
+ /*kernel.invoke: [exact=Class1]*/
+ /*strong.invoke: [exact=Class1]*/
+ method0();
+ o
+ ?.
+ /*ast.invoke: [null|exact=Class1]*/
+ /*kernel.invoke: [exact=Class1]*/
+ /*strong.invoke: [exact=Class1]*/
+ method2();
return o;
}
diff --git a/tests/compiler/dart2js/inference/data/super_get.dart b/tests/compiler/dart2js/inference/data/super_get.dart
index 4b94e76..d1f15f2 100644
--- a/tests/compiler/dart2js/inference/data/super_get.dart
+++ b/tests/compiler/dart2js/inference/data/super_get.dart
@@ -7,7 +7,6 @@
superFieldAccess();
superGetterAccess();
superMethodAccess();
- missingSuperFieldAccess();
}
////////////////////////////////////////////////////////////////////////////////
@@ -72,22 +71,3 @@
superMethodAccess() {
new Sub3(). /*invoke: [exact=Sub3]*/ method();
}
-
-////////////////////////////////////////////////////////////////////////////////
-// Access of missing super field.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: Super4.:[exact=Super4]*/
-class Super4 {}
-
-/*element: Sub4.:[exact=Sub4]*/
-class Sub4 extends Super4 {
- /*element: Sub4.method:[empty]*/
- // ignore: UNDEFINED_SUPER_GETTER
- method() => super.field;
-}
-
-/*element: missingSuperFieldAccess:[null]*/
-missingSuperFieldAccess() {
- new Sub4(). /*invoke: [exact=Sub4]*/ method();
-}
diff --git a/tests/compiler/dart2js/inference/data/super_invoke.dart b/tests/compiler/dart2js/inference/data/super_invoke.dart
index 3950710..4d8c081 100644
--- a/tests/compiler/dart2js/inference/data/super_invoke.dart
+++ b/tests/compiler/dart2js/inference/data/super_invoke.dart
@@ -7,12 +7,6 @@
superMethodInvoke();
superFieldInvoke();
superGetterInvoke();
- missingSuperMethodInvoke();
- superMethodInvokeMissingArgument();
- superMethodInvokeExtraArgument();
- superMethodInvokeExtraNamedArgument();
- missingSuperMethodInvokeNoSuchMethod();
- abstractSuperMethodInvokeNoSuchMethod();
overridingAbstractSuperMethodInvoke();
}
@@ -93,153 +87,6 @@
}
////////////////////////////////////////////////////////////////////////////////
-// Invocation of missing super method.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: Super4.:[exact=Super4]*/
-class Super4 {}
-
-/*element: Sub4.:[exact=Sub4]*/
-class Sub4 extends Super4 {
- /*element: Sub4.method:[empty]*/
- method() {
- // ignore: UNDEFINED_SUPER_METHOD
- var a = super.method();
- return a. /*invoke: [empty]*/ abs();
- }
-}
-
-/*element: missingSuperMethodInvoke:[null]*/
-missingSuperMethodInvoke() {
- new Sub4(). /*invoke: [exact=Sub4]*/ method();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Invocation of super method with missing argument.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: Super5.:[exact=Super5]*/
-class Super5 {
- /*element: Super5.method1:[exact=JSUInt31]*/
- method1(/*[exact=JSUInt31]*/ x) => 42;
-}
-
-/*element: Sub5.:[exact=Sub5]*/
-class Sub5 extends Super5 {
- /*element: Sub5.method2:[empty]*/
- method2() {
- super.method1(0);
- // ignore: NOT_ENOUGH_REQUIRED_ARGUMENTS
- var a = super.method1();
- return a. /*invoke: [empty]*/ abs();
- }
-}
-
-/*element: superMethodInvokeMissingArgument:[null]*/
-superMethodInvokeMissingArgument() {
- new Sub5(). /*invoke: [exact=Sub5]*/ method2();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Invocation of super method with extra argument.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: Super6.:[exact=Super6]*/
-class Super6 {
- /*element: Super6.method:[exact=JSUInt31]*/
- method() => 42;
-}
-
-/*element: Sub6.:[exact=Sub6]*/
-class Sub6 extends Super6 {
- /*element: Sub6.method:[empty]*/
- method() {
- // ignore: EXTRA_POSITIONAL_ARGUMENTS
- var a = super.method(0);
- return a. /*invoke: [empty]*/ abs();
- }
-}
-
-/*element: superMethodInvokeExtraArgument:[null]*/
-superMethodInvokeExtraArgument() {
- new Sub6(). /*invoke: [exact=Sub6]*/ method();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Invocation of super method with extra named argument.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: Super7.:[exact=Super7]*/
-class Super7 {
- /*element: Super7.method:[exact=JSUInt31]*/
- method() => 42;
-}
-
-/*element: Sub7.:[exact=Sub7]*/
-class Sub7 extends Super7 {
- /*element: Sub7.method:[empty]*/
- method() {
- // ignore: UNDEFINED_NAMED_PARAMETER
- var a = super.method(a: 0);
- return a. /*invoke: [empty]*/ abs();
- }
-}
-
-/*element: superMethodInvokeExtraNamedArgument:[null]*/
-superMethodInvokeExtraNamedArgument() {
- new Sub7(). /*invoke: [exact=Sub7]*/ method();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Invocation of super method caught by noSuchMethod.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: Super8.:[exact=Super8]*/
-class Super8 {
- /*element: Super8.noSuchMethod:[exact=JSUInt31]*/
- noSuchMethod(/*[null|subclass=Object]*/ _) => 42;
-}
-
-/*element: Sub8.:[exact=Sub8]*/
-class Sub8 extends Super8 {
- /*element: Sub8.method:[subclass=JSPositiveInt]*/
- method() {
- // ignore: UNDEFINED_SUPER_METHOD
- var a = super.method();
- return a. /*invoke: [exact=JSUInt31]*/ abs();
- }
-}
-
-/*element: missingSuperMethodInvokeNoSuchMethod:[null]*/
-missingSuperMethodInvokeNoSuchMethod() {
- new Sub8(). /*invoke: [exact=Sub8]*/ method();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Invocation of abstract super method caught by noSuchMethod.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: Super9.:[exact=Super9]*/
-class Super9 {
- method();
-
- /*element: Super9.noSuchMethod:[exact=JSUInt31]*/
- noSuchMethod(/*[null|subclass=Object]*/ im) => 42;
-}
-
-/*element: Sub9.:[exact=Sub9]*/
-class Sub9 extends Super9 {
- /*element: Sub9.method:[exact=JSUInt31]*/
- // ignore: abstract_super_member_reference
- method() => super.method();
-}
-
-/*element: abstractSuperMethodInvokeNoSuchMethod:[null]*/
-abstractSuperMethodInvokeNoSuchMethod() {
- new Sub9(). /*invoke: [exact=Sub9]*/ method();
-}
-
-////////////////////////////////////////////////////////////////////////////////
// Invocation of abstract super method that overrides a concrete method.
////////////////////////////////////////////////////////////////////////////////
diff --git a/tests/compiler/dart2js/inference/data/super_set.dart b/tests/compiler/dart2js/inference/data/super_set.dart
index 6c7f0e8..e4f5314 100644
--- a/tests/compiler/dart2js/inference/data/super_set.dart
+++ b/tests/compiler/dart2js/inference/data/super_set.dart
@@ -6,7 +6,6 @@
main() {
superFieldUpdate();
superSetterUpdate();
- missingSuperFieldUpdate();
}
////////////////////////////////////////////////////////////////////////////////
@@ -55,25 +54,3 @@
superSetterUpdate() {
new Sub2(). /*invoke: [exact=Sub2]*/ method();
}
-
-////////////////////////////////////////////////////////////////////////////////
-// Update of missing super field.
-////////////////////////////////////////////////////////////////////////////////
-
-/*element: Super4.:[exact=Super4]*/
-class Super4 {}
-
-/*element: Sub4.:[exact=Sub4]*/
-class Sub4 extends Super4 {
- /*element: Sub4.method:[empty]*/
- method() {
- // ignore: UNDEFINED_SUPER_SETTER
- var a = super.field = new Sub4();
- return a. /*[empty]*/ method;
- }
-}
-
-/*element: missingSuperFieldUpdate:[null]*/
-missingSuperFieldUpdate() {
- new Sub4(). /*invoke: [exact=Sub4]*/ method();
-}
diff --git a/tests/compiler/dart2js/inference/inference_test_helper.dart b/tests/compiler/dart2js/inference/inference_test_helper.dart
index 8e760c1..ed2bc4a 100644
--- a/tests/compiler/dart2js/inference/inference_test_helper.dart
+++ b/tests/compiler/dart2js/inference/inference_test_helper.dart
@@ -25,6 +25,19 @@
'mixin_constructor_default_parameter_values.dart',
];
+const List<String> skipForStrong = const <String>[
+ // TODO(johnniwinther): Remove this when issue 31767 is fixed.
+ 'mixin_constructor_default_parameter_values.dart',
+ // These contain compile-time errors:
+ 'erroneous_super_get.dart',
+ 'erroneous_super_invoke.dart',
+ 'erroneous_super_set.dart',
+ 'switch3.dart',
+ 'switch4.dart',
+ // TODO(johnniwinther): Make a strong mode clean version of this?
+ 'call_in_loop.dart',
+];
+
main(List<String> args) {
runTests(args);
}
@@ -35,10 +48,12 @@
await checkTests(
dataDir, computeMemberAstTypeMasks, computeMemberIrTypeMasks,
libDirectory: new Directory.fromUri(Platform.script.resolve('libs')),
+ testStrongMode: true,
forUserLibrariesOnly: true,
args: args,
options: [stopAfterTypeInference],
skipForKernel: skipForKernel,
+ skipForStrong: skipForStrong,
shardIndex: shardIndex ?? 0,
shards: shardIndex != null ? 2 : 1);
});
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 2fb1e0f..e5a5738 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -601,10 +601,8 @@
async_star_pause_test: Fail, OK
async_star_test/02: RuntimeError # Issue 31402 (Invocation arguments)
built_in_identifier_prefix_test: CompileTimeError
-call_method_as_cast_test/06: RuntimeError
call_method_implicit_tear_off_implements_function_test/05: RuntimeError
call_method_implicit_tear_off_implements_function_test/06: RuntimeError
-call_method_is_check_test/06: RuntimeError
call_method_must_not_be_field_test/03: RuntimeError # Issue 32265
call_method_must_not_be_getter_test/03: RuntimeError # Issue 32265
compile_time_constant_k_test/01: MissingCompileTimeError
@@ -918,10 +916,8 @@
bad_override_test/04: MissingCompileTimeError # Issue 32613: override check is missing in CFE.
bad_override_test/05: MissingCompileTimeError # Issue 32613: override check is missing in CFE.
built_in_identifier_prefix_test: CompileTimeError
-call_method_as_cast_test/06: RuntimeError
call_method_implicit_tear_off_implements_function_test/05: RuntimeError
call_method_implicit_tear_off_implements_function_test/06: RuntimeError
-call_method_is_check_test/06: RuntimeError
call_method_must_not_be_field_test/03: RuntimeError # Issue 32265
call_method_must_not_be_getter_test/03: RuntimeError # Issue 32265
check_member_static_test/02: MissingCompileTimeError # Issue 32613: override check is missing in CFE.
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index 7cace3c..9ea3c4e 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -112,6 +112,7 @@
mirrors/empty_test: Crash, RuntimeError
mirrors/enum_test: RuntimeError # Issue 31402 (Invocation arguments)
mirrors/equality_test: RuntimeError
+mirrors/fake_function_without_call_test: RuntimeError, OK
mirrors/function_apply_test: RuntimeError, OK
mirrors/function_type_mirror_test: RuntimeError
mirrors/generic_f_bounded_mixin_application_test: RuntimeError
diff --git a/tools/VERSION b/tools/VERSION
index 6492cf9..1d9868f 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 45
+PRERELEASE 46
PRERELEASE_PATCH 0
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 9b22618..585a075 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -526,7 +526,7 @@
},
{
"name": "ddc sourcemap tests",
- "script": "out/xcodebuild/dart",
+ "script": "xcodebuild/ReleaseX64/dart",
"arguments": [
"pkg/dev_compiler/test/sourcemap/sourcemaps_ddc_suite.dart",
"-rnone"
@@ -534,7 +534,7 @@
},
{
"name": "ddk sourcemap tests",
- "script": "out/xcodebuild/dart",
+ "script": "xcodebuild/ReleaseX64/dart",
"arguments": [
"pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart",
"-rnone"
@@ -542,7 +542,7 @@
},
{
"name": "ddc sourcemap stacktrace tests",
- "script": "out/xcodebuild/dart",
+ "script": "xcodebuild/ReleaseX64/dart",
"arguments": [
"pkg/dev_compiler/test/sourcemap/stacktrace_ddc_suite.dart",
"-rnone"
@@ -550,7 +550,7 @@
},
{
"name": "ddk sourcemap stacktrace tests",
- "script": "out/xcodebuild/dart",
+ "script": "xcodebuild/ReleaseX64/dart",
"arguments": [
"pkg/dev_compiler/test/sourcemap/stacktrace_ddk_suite.dart",
"-rnone"
diff --git a/tools/infra/config/cq.cfg b/tools/infra/config/cq.cfg
index 74ce8ab..cb94e5f 100644
--- a/tools/infra/config/cq.cfg
+++ b/tools/infra/config/cq.cfg
@@ -24,10 +24,10 @@
builders { name: "vm-linux-release-x64-try"}
builders { name: "vm-mac-release-x64-try"}
builders { name: "dart2js-linux-d8-hostchecked-try"}
- builders { name: "dart2js-linux-d8-kernel-minified-try" }
+ builders { name: "dart2js-linux-d8-kernel-minified-try"}
builders { name: "dart2js-linux-none-only-unittest-try"}
+ builders { name: "dart2js-linux-x64-chrome-try"}
builders { name: "pkg-linux-release-try"}
- builders { name: "dart2js-linux-chrome-try"}
builders { name: "ddc-linux-release-chrome-try"}
builders { name: "vm-linux-product-x64-try"}
builders { name: "dart-sdk-windows-try"}