Version 2.0.0-dev.29.0
Merge commit '89cec72771ad0df061d9b9975297749d1495a633' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 204f682..adfbe9a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,29 +23,80 @@
the assignment to `y`.
```dart
- test() {
- Future<int> f;
- var x = f.then<Future<List<int>>>((x) => []);
- Future<List<int>> y = x;
- }
- ```
-
+ test() {
+ Future<int> f;
+ var x = f.then<Future<List<int>>>((x) => []);
+ Future<List<int>> y = x;
+ }
+ ```
### Core library changes
* `dart:async`
- * The `Zone` class was changed to be strong-mode clean. This required
- some breaking API changes. See https://goo.gl/y9mW2x for more information.
- * Renamed `Zone.ROOT` to `Zone.root`.
+
+ * `Stream`:
+ * Added `cast`, `castFrom`, and `retype`.
+ * Changed `firstWhere`, `lastWhere`, and `singleWhere` to return `Future<T>`
+ and added an optional `T orElse()` callback.
+ * `StreamTransformer`: added `cast`, `castFrom`, `retype`.
+ * `StreamTransformerBase`: new class.
+ * `Timer`: added `tick` property.
+ * `Zone`
+ * changed to be strong-mode clean.
+ This required some breaking API changes.
+ See https://goo.gl/y9mW2x for more information.
+ * Added `bindBinaryCallbackGuarded`, `bindCallbackGuarded`, and
+ `bindUnaryCallbackGuarded`.
+ * Renamed `Zone.ROOT` to `Zone.root`.
* `dart:cli`
- * Added function `waitFor` that suspends a stack to wait for a `Future` to
+
+ * *New* "provisional" library for CLI-specific features.
+
+ * `waitFor`: function that suspends a stack to wait for a `Future` to
complete.
+* `dart:collection`
+
+ * `MapBase`: added `mapToString`.
+ * `LinkedHashMap` no longer implements `HashMap`
+ * `LinkedHashSet` no longer implements `HashSet`.
+
+* `dart:convert`
+
+ * `Base64Codec.decode` return type is now `Uint8List`.
+ * `JsonUnsupportedObjectError`: added `partialResult` property
+ * `LineSplitter` now implements `StreamTransformer<String, String>` instead of
+ `Converter`.
+ It retains `Converter` methods `convert` and `startChunkedConversion`.
+ * `Utf8Decoder` when compiled with dart2js uses the browser's `TextDecoder` in
+ some common cases for faster decoding.
+ * Renamed `ASCII`, `BASE64`, `BASE64URI`, `JSON`, `LATIN1` and `UTF8` to
+ `ascii`, `base64`, `base64Uri`, `json`, `latin1` and `utf8`.
+ * Renamed the `HtmlEscapeMode` constants `UNKNOWN`, `ATTRIBUTE`,
+ `SQ_ATTRIBUTE` and `ELEMENT` to `unknown`, `attribute`, `sqAttribute` and
+ `elements`.
+
* `dart:core`
+
+ * Deprecated the `proxy` annotation.
+ * Added `Provisional` class and `provisional` field.
+ * `RegExp` added static `escape` function.
* The `Uri` class now correctly handles paths while running on Node.js on
Windows.
- * Deprecated the `proxy` annotation.
+ * Core collection changes
+ * `Iterable` added members `cast`, `castFrom`, `followedBy`, `retype` and
+ `whereType`.
+ * `Iterable.singleWhere` added `orElse` parameter.
+ * `List` added `+` operator, `first` and `last` setters, and `indexWhere`
+ and `lastIndexWhere` methods.
+ * `Map` added `fromEntries` constructor.
+ * `Map` added `addEntries`, `cast`, `entries`, `map`, `removeWhere`,
+ `retype`, `update` and `updateAll` members.
+ * `MapEntry`: new class used by `Map.entries`.
+ * *Note*: if a class extends `IterableBase`, `ListBase`, `SetBase` or
+ `MapBase` (or uses the corresponding mixins) from `dart:collection`, the
+ new members are implemented automatically.
* Renamed `double.INFINITY`, `double.NEGATIVE_INFINITY`, `double.NAN`,
`double.MAX_FINITE` and `double.MIN_POSITIVE`
to `double.infinity`, `double.negativeInfinity`, `double.nan`,
@@ -70,33 +121,6 @@
`SECONDS_PER_DAY` to `secondsPerDay`,
`MINUTES_PER_DAY` to `minutesPerDay`, and
`ZERO` to `zero`.
- * Added `Provisional` annotation to `dart:core`.
- * Added static `escape` function to `RegExp` class.
- * Added members `cast`, `followedBy`, `retype` and `whereType` to `Iterable`.
- * Added `orElse` parameter to `Iterable.singleWhere`.
- * Added `+` operator, `first` and `last` setters, and `indexWhere`
- and `lastIndexWhere` methods to `List`.
- * Added `addEntries`, `cast`, `entries`, `map`, `removeWhere`, `retype`,
- `update` and `updateAll` members to `Map`.
- * If a class extends `IterableBase`, `ListBase`, `SetBase` or `MapBase`
- (or uses the corresponding mixins), the new members are implemented
- automatically.
- * Added constructor `Map.fromEntries`.
- * Added `MapEntry` class used by, e.g., `Map.entries`.
- * Changed `LinkedHashMap` to not implement `HashMap`, and `LinkedHashSet`
- to not implement `HashSet`. The "unlinked" version is a different
- implementation class than the linked version, not an abstract interface
- that the two share.
-
-* `dart:convert`
- * `Utf8Decoder` when compiled with dart2js uses the browser's `TextDecoder` in
- some common cases for faster decoding.
- * Renamed `ASCII`, `BASE64`, `BASE64URI`, `JSON`, `LATIN1` and `UTF8` to
- `ascii`, `base64`, `base64Uri`, `json`, `latin1` and `utf8`.
- * Renamed the `HtmlEscapeMode` constants `UNKNOWN`, `ATTRIBUTE`,
- `SQ_ATTRIBUTE` and `ELEMENT` to `unknown`, `attribute`, `sqAttribute` and
- `elements`.
- * Changed return type of `Base64Codec.decode` to `Uint8List`.
* `dart:developer`
* `Timeline.startSync` and `Timeline.timeSync` now accept an optional
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
index ee2f5b0..915c706 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
@@ -1646,7 +1646,9 @@
DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
builder.addReplacement(range.node(widgetExpr), (DartEditBuilder builder) {
- builder.write('new ');
+ if (!driver.analysisOptions.previewDart2) {
+ builder.write('new ');
+ }
if (parentClassElement == null) {
builder.addSimpleLinkedEdit('WIDGET', 'widget');
} else {
@@ -1722,7 +1724,9 @@
DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
builder.addReplacement(selectedRange, (DartEditBuilder builder) {
- builder.write('new ');
+ if (!driver.analysisOptions.previewDart2) {
+ builder.write('new ');
+ }
builder.writeType(parentClassElement.type);
builder.write('(');
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 46227d3..9448811 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -374,6 +374,7 @@
}
if (errorCode == StaticTypeWarningCode.UNDEFINED_FUNCTION) {
await _addFix_importLibrary_withFunction();
+ await _addFix_importLibrary_withType();
await _addFix_undefinedFunction_useSimilar();
await _addFix_undefinedFunction_create();
}
@@ -1847,6 +1848,10 @@
typeName,
const [ElementKind.CLASS, ElementKind.FUNCTION_TYPE_ALIAS],
TopLevelDeclarationKind.type);
+ } else if (_mayBeImplicitConstructor(node)) {
+ String typeName = (node as SimpleIdentifier).name;
+ await _addFix_importLibrary_withElement(
+ typeName, const [ElementKind.CLASS], TopLevelDeclarationKind.type);
}
}
@@ -3276,6 +3281,20 @@
}
/**
+ * Return `true` if the given [node] is in a location where an implicit
+ * constructor invocation would be allowed.
+ */
+ static bool _mayBeImplicitConstructor(AstNode node) {
+ if (node is SimpleIdentifier) {
+ AstNode parent = node.parent;
+ if (parent is MethodInvocation) {
+ return parent.realTarget == null;
+ }
+ }
+ return false;
+ }
+
+ /**
* Returns `true` if [node] is a type name.
*/
static bool _mayBeTypeIdentifier(AstNode node) {
diff --git a/pkg/analysis_server/test/analysis/get_errors_test.dart b/pkg/analysis_server/test/analysis/get_errors_test.dart
index af094d1..67eddd3 100644
--- a/pkg/analysis_server/test/analysis/get_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/get_errors_test.dart
@@ -44,8 +44,8 @@
}
test_errorInPart() async {
- String libPath = '$testFolder/main.dart';
- String partPath = '$testFolder/main_part.dart';
+ String libPath = join(testFolder, 'main.dart');
+ String partPath = join(testFolder, 'main_part.dart');
newFile(libPath, content: r'''
library main;
part 'main_part.dart';
diff --git a/pkg/analysis_server/test/analysis/notification_errors_test.dart b/pkg/analysis_server/test/analysis/notification_errors_test.dart
index dbe5ac0..bdfc83c 100644
--- a/pkg/analysis_server/test/analysis/notification_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_errors_test.dart
@@ -45,8 +45,8 @@
}
test_analysisOptionsFile() async {
- String analysisOptionsFile =
- newFile('$projectPath/analysis_options.yaml', content: '''
+ String filePath = join(projectPath, 'analysis_options.yaml');
+ String analysisOptionsFile = newFile(filePath, content: '''
linter:
rules:
- invalid_lint_rule_name
@@ -63,7 +63,7 @@
List<AnalysisError> errors = filesErrors[analysisOptionsFile];
expect(errors, hasLength(1));
AnalysisError error = errors[0];
- expect(error.location.file, '/project/analysis_options.yaml');
+ expect(error.location.file, filePath);
expect(error.severity, AnalysisErrorSeverity.WARNING);
expect(error.type, AnalysisErrorType.STATIC_WARNING);
}
@@ -89,7 +89,7 @@
test_lintError() async {
var camelCaseTypesLintName = 'camel_case_types';
- newFile('$projectPath/.analysis_options', content: '''
+ newFile(join(projectPath, '.analysis_options'), content: '''
linter:
rules:
- $camelCaseTypesLintName
@@ -115,7 +115,7 @@
List<AnalysisError> errors = filesErrors[testFile];
expect(errors, hasLength(1));
AnalysisError error = errors[0];
- expect(error.location.file, '/project/bin/test.dart');
+ expect(error.location.file, join(projectPath, 'bin', 'test.dart'));
expect(error.severity, AnalysisErrorSeverity.INFO);
expect(error.type, AnalysisErrorType.LINT);
expect(error.message, lint.description);
@@ -142,7 +142,7 @@
List<AnalysisError> errors = filesErrors[testFile];
expect(errors, hasLength(1));
AnalysisError error = errors[0];
- expect(error.location.file, '/project/bin/test.dart');
+ expect(error.location.file, join(projectPath, 'bin', 'test.dart'));
expect(error.location.offset, isPositive);
expect(error.location.length, isNonNegative);
expect(error.severity, AnalysisErrorSeverity.ERROR);
@@ -151,7 +151,8 @@
}
test_pubspecFile() async {
- String pubspecFile = newFile('$projectPath/pubspec.yaml', content: '''
+ String filePath = join(projectPath, 'pubspec.yaml');
+ String pubspecFile = newFile(filePath, content: '''
version: 1.3.2
''').path;
@@ -166,7 +167,7 @@
List<AnalysisError> errors = filesErrors[pubspecFile];
expect(errors, hasLength(1));
AnalysisError error = errors[0];
- expect(error.location.file, '/project/pubspec.yaml');
+ expect(error.location.file, filePath);
expect(error.severity, AnalysisErrorSeverity.WARNING);
expect(error.type, AnalysisErrorType.STATIC_WARNING);
//
diff --git a/pkg/analysis_server/test/analysis/notification_highlights_test.dart b/pkg/analysis_server/test/analysis/notification_highlights_test.dart
index 931a9ca..b24014c 100644
--- a/pkg/analysis_server/test/analysis/notification_highlights_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_highlights_test.dart
@@ -956,7 +956,7 @@
}
void _addLibraryForTestPart() {
- newFile('$testFolder/my_lib.dart', content: '''
+ newFile(join(testFolder, 'my_lib.dart'), content: '''
library lib;
part 'test.dart';
''');
diff --git a/pkg/analysis_server/test/analysis/notification_highlights_test2.dart b/pkg/analysis_server/test/analysis/notification_highlights_test2.dart
index 9ba96bc..6a65d19 100644
--- a/pkg/analysis_server/test/analysis/notification_highlights_test2.dart
+++ b/pkg/analysis_server/test/analysis/notification_highlights_test2.dart
@@ -1107,7 +1107,7 @@
}
void _addLibraryForTestPart() {
- newFile('$testFolder/my_lib.dart', content: '''
+ newFile(join(testFolder, 'my_lib.dart'), content: '''
library lib;
part 'test.dart';
''');
diff --git a/pkg/analysis_server/test/analysis/notification_implemented_test.dart b/pkg/analysis_server/test/analysis/notification_implemented_test.dart
index 7a6e597..ebcd3a7 100644
--- a/pkg/analysis_server/test/analysis/notification_implemented_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_implemented_test.dart
@@ -271,7 +271,7 @@
}
test_method_withMethod_private_differentLib() async {
- newFile('$testFolder/lib.dart', content: r'''
+ newFile(join(testFolder, 'lib.dart'), content: r'''
import 'test.dart';
class B extends A {
void _m() {}
diff --git a/pkg/analysis_server/test/analysis/notification_navigation_test.dart b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
index 075acf7..1c84171 100644
--- a/pkg/analysis_server/test/analysis/notification_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
@@ -229,7 +229,7 @@
}
test_annotationConstructor_importPrefix() async {
- newFile('$testFolder/my_annotation.dart', content: r'''
+ newFile(join(testFolder, 'my_annotation.dart'), content: r'''
library an;
class MyAnnotation {
const MyAnnotation();
@@ -304,7 +304,7 @@
}
test_annotationField_importPrefix() async {
- newFile('$testFolder/mayn.dart', content: r'''
+ newFile(join(testFolder, 'mayn.dart'), content: r'''
library an;
const myan = new Object();
''');
diff --git a/pkg/analysis_server/test/analysis/notification_overrides_test.dart b/pkg/analysis_server/test/analysis/notification_overrides_test.dart
index 86cac68..774062e 100644
--- a/pkg/analysis_server/test/analysis/notification_overrides_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_overrides_test.dart
@@ -232,7 +232,7 @@
}
test_BAD_privateByPrivate_inDifferentLib() async {
- newFile('$testFolder/lib.dart', content: r'''
+ newFile(join(testFolder, 'lib.dart'), content: r'''
class A {
void _m() {}
}
diff --git a/pkg/analysis_server/test/analysis/update_content_test.dart b/pkg/analysis_server/test/analysis/update_content_test.dart
index a4fc364..b6dfc25 100644
--- a/pkg/analysis_server/test/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/analysis/update_content_test.dart
@@ -61,6 +61,8 @@
}
test_multiple_contexts() async {
+ String project1path = convertPath('/project1');
+ String project2path = convertPath('/project2');
String fooPath = newFile('/project1/foo.dart', content: '''
library foo;
import '../project2/baz.dart';
@@ -74,7 +76,7 @@
f(int i) {}
''').path;
Request request =
- new AnalysisSetAnalysisRootsParams(['/project1', '/project2'], [])
+ new AnalysisSetAnalysisRootsParams([project1path, project2path], [])
.toRequest('0');
handleSuccessfulRequest(request);
{
@@ -126,7 +128,7 @@
}
test_overlayOnly() async {
- String filePath = '/User/project1/test.dart';
+ String filePath = convertPath('/User/project1/test.dart');
Folder folder1 = newFolder('/User/project1');
Folder folder2 = newFolder('/User/project2');
Request request =
@@ -254,7 +256,7 @@
List<String> _getUserSources(AnalysisDriver driver) {
List<String> sources = <String>[];
driver.addedFiles.forEach((path) {
- if (path.startsWith('/User/')) {
+ if (path.startsWith(convertPath('/User/'))) {
sources.add(path);
}
});
diff --git a/pkg/analysis_server/test/analysis_server_test.dart b/pkg/analysis_server/test/analysis_server_test.dart
index bbb3807..f40ac66 100644
--- a/pkg/analysis_server/test/analysis_server_test.dart
+++ b/pkg/analysis_server/test/analysis_server_test.dart
@@ -99,7 +99,7 @@
resourceProvider,
packageMapProvider,
new AnalysisServerOptions(),
- new DartSdkManager('/', false),
+ new DartSdkManager(convertPath('/'), false),
InstrumentationService.NULL_SERVICE);
}
@@ -114,10 +114,12 @@
Future test_serverStatusNotifications() {
server.serverServices.add(ServerService.STATUS);
- newFolder('/pkg');
- newFolder('/pkg/lib');
- newFile('/pkg/lib/test.dart', content: 'class C {}');
- server.setAnalysisRoots('0', ['/pkg'], [], {});
+ var pkgFolder = convertPath('/pkg');
+ newFolder(pkgFolder);
+ newFolder(join(pkgFolder, 'lib'));
+ newFile(join(pkgFolder, 'lib', 'test.dart'),
+ content: 'class C {}');
+ server.setAnalysisRoots('0', [pkgFolder], [], {});
// Pump the event queue to make sure the server has finished any
// analysis.
return pumpEventQueue(times: 5000).then((_) {
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index c014701..d63240c 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -171,7 +171,7 @@
expect(count, equals(1));
var source = sourceFactory.forUri('dart:foobar');
expect(source, isNotNull);
- expect(source.fullName, '/my/proj/sdk_ext/entry.dart');
+ expect(source.fullName, convertPath('/my/proj/sdk_ext/entry.dart'));
// We can't find dart:core because we didn't list it in our
// embedded_libs map.
expect(sourceFactory.forUri('dart:core'), isNull);
@@ -200,15 +200,16 @@
void test_isInAnalysisRoot_excluded() {
// prepare paths
- String project = '/project';
- String excludedFolder = '$project/excluded';
+ String project = convertPath('/project');
+ String excludedFolder = convertPath('$project/excluded');
// set roots
resourceProvider.newFolder(project);
resourceProvider.newFolder(excludedFolder);
manager.setRoots(
<String>[project], <String>[excludedFolder], <String, String>{});
// verify
- expect(manager.isInAnalysisRoot('$excludedFolder/test.dart'), isFalse);
+ expect(manager.isInAnalysisRoot(convertPath('$excludedFolder/test.dart')),
+ isFalse);
}
void test_isInAnalysisRoot_inNestedContext() {
@@ -260,7 +261,7 @@
// Verify that ignored files were ignored.
Iterable<String> filePaths = callbacks.currentFilePaths;
expect(filePaths, hasLength(1));
- expect(filePaths, contains('/my/proj/lib/main.dart'));
+ expect(filePaths, contains(convertPath('/my/proj/lib/main.dart')));
}
test_refresh_folder_with_packagespec() {
@@ -285,10 +286,10 @@
test_refresh_folder_with_packagespec_subfolders() {
// Create a folder with no .packages file, containing two subfolders with
// .packages files.
- String subdir1Path = path.posix.join(projPath, 'subdir1');
- String subdir2Path = path.posix.join(projPath, 'subdir2');
- String packagespec1Path = path.posix.join(subdir1Path, '.packages');
- String packagespec2Path = path.posix.join(subdir2Path, '.packages');
+ String subdir1Path = join(projPath, 'subdir1');
+ String subdir2Path = join(projPath, 'subdir2');
+ String packagespec1Path = join(subdir1Path, '.packages');
+ String packagespec2Path = join(subdir2Path, '.packages');
resourceProvider.newFile(packagespec1Path, '');
resourceProvider.newFile(packagespec2Path, '');
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
@@ -326,10 +327,10 @@
test_refresh_folder_with_pubspec_subfolders() {
// Create a folder with no pubspec.yaml, containing two subfolders with
// pubspec.yaml files.
- String subdir1Path = path.posix.join(projPath, 'subdir1');
- String subdir2Path = path.posix.join(projPath, 'subdir2');
- String pubspec1Path = path.posix.join(subdir1Path, 'pubspec.yaml');
- String pubspec2Path = path.posix.join(subdir2Path, 'pubspec.yaml');
+ String subdir1Path = join(projPath, 'subdir1');
+ String subdir2Path = join(projPath, 'subdir2');
+ String pubspec1Path = join(subdir1Path, 'pubspec.yaml');
+ String pubspec2Path = join(subdir2Path, 'pubspec.yaml');
resourceProvider.newFile(pubspec1Path, 'pubspec');
resourceProvider.newFile(pubspec2Path, 'pubspec');
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
@@ -350,12 +351,12 @@
test_refresh_oneContext() {
// create two contexts with pubspec.yaml files
- String pubspecPath = path.posix.join(projPath, 'pubspec.yaml');
+ String pubspecPath = join(projPath, 'pubspec.yaml');
resourceProvider.newFile(pubspecPath, 'pubspec1');
- String proj2Path = '/my/proj2';
+ String proj2Path = convertPath('/my/proj2');
resourceProvider.newFolder(proj2Path);
- String pubspec2Path = path.posix.join(proj2Path, 'pubspec.yaml');
+ String pubspec2Path = join(proj2Path, 'pubspec.yaml');
resourceProvider.newFile(pubspec2Path, 'pubspec2');
List<String> roots = <String>[projPath, proj2Path];
@@ -398,11 +399,11 @@
.numberOfContextsInAnalysisRoot(resourceProvider.newFolder(projPath));
expect(count, equals(1));
var source = sourceFactory.forUri('dart:foobar');
- expect(source.fullName, equals('/my/proj/sdk_ext/entry.dart'));
+ expect(source.fullName, equals(convertPath('/my/proj/sdk_ext/entry.dart')));
}
void test_setRoots_addFolderWithDartFile() {
- String filePath = path.posix.join(projPath, 'foo.dart');
+ String filePath = resourceProvider.pathContext.join(projPath, 'foo.dart');
resourceProvider.newFile(filePath, 'contents');
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// verify
@@ -418,7 +419,7 @@
}
void test_setRoots_addFolderWithDartFileInSubfolder() {
- String filePath = path.posix.join(projPath, 'foo', 'bar.dart');
+ String filePath = join(projPath, 'foo', 'bar.dart');
resourceProvider.newFile(filePath, 'contents');
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// verify
@@ -428,7 +429,7 @@
}
void test_setRoots_addFolderWithDummyLink() {
- String filePath = path.posix.join(projPath, 'foo.dart');
+ String filePath = join(projPath, 'foo.dart');
resourceProvider.newDummyLink(filePath);
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
// verify
@@ -436,8 +437,9 @@
}
void test_setRoots_addFolderWithNestedPackageSpec() {
- String examplePath = '$projPath/${ContextManagerTest.EXAMPLE_NAME}';
- String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+ String examplePath =
+ convertPath('$projPath/${ContextManagerTest.EXAMPLE_NAME}');
+ String libPath = convertPath('$projPath/${ContextManagerTest.LIB_NAME}');
newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}');
newFile('$libPath/main.dart');
@@ -455,18 +457,20 @@
expect(callbacks.currentContextRoots, contains(projPath));
Iterable<Source> projSources = callbacks.currentFileSources(projPath);
expect(projSources, hasLength(1));
- expect(projSources.first.uri.toString(), 'file:///my/proj/lib/main.dart');
+ expect(projSources.first.uri.toString(),
+ (new Uri.file(join(libPath, 'main.dart')).toString()));
expect(callbacks.currentContextRoots, contains(examplePath));
Iterable<Source> exampleSources = callbacks.currentFileSources(examplePath);
expect(exampleSources, hasLength(1));
expect(exampleSources.first.uri.toString(),
- 'file:///my/proj/example/example.dart');
+ (new Uri.file(join(examplePath, 'example.dart')).toString()));
}
void test_setRoots_addFolderWithNestedPubspec() {
- String examplePath = '$projPath/${ContextManagerTest.EXAMPLE_NAME}';
- String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
+ String examplePath =
+ convertPath('$projPath/${ContextManagerTest.EXAMPLE_NAME}');
+ String libPath = convertPath('$projPath/${ContextManagerTest.LIB_NAME}');
newFile('$projPath/${ContextManagerImpl.PUBSPEC_NAME}');
newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
@@ -488,7 +492,7 @@
Iterable<Source> exampleSources = callbacks.currentFileSources(examplePath);
expect(exampleSources, hasLength(1));
expect(exampleSources.first.uri.toString(),
- 'file:///my/proj/example/example.dart');
+ (new Uri.file('$examplePath/example.dart').toString()));
}
void test_setRoots_addFolderWithoutPubspec() {
@@ -500,12 +504,11 @@
}
void test_setRoots_addFolderWithPackagespec() {
- String packagespecPath = path.posix.join(projPath, '.packages');
+ String packagespecPath = join(projPath, '.packages');
resourceProvider.newFile(packagespecPath,
'unittest:file:///home/somebody/.pub/cache/unittest-0.9.9/lib/');
String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
- File mainFile =
- resourceProvider.newFile(path.posix.join(libPath, 'main.dart'), '');
+ File mainFile = resourceProvider.newFile(join(libPath, 'main.dart'), '');
Source source = mainFile.createSource();
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
@@ -518,8 +521,10 @@
Source resolvedSource =
sourceFactory.resolveUri(source, 'package:unittest/unittest.dart');
expect(resolvedSource, isNotNull);
- expect(resolvedSource.fullName,
- equals('/home/somebody/.pub/cache/unittest-0.9.9/lib/unittest.dart'));
+ expect(
+ resolvedSource.fullName,
+ equals(convertPath(
+ '/home/somebody/.pub/cache/unittest-0.9.9/lib/unittest.dart')));
}
void test_setRoots_addFolderWithPackagespecAndPackageRoot() {
@@ -574,20 +579,20 @@
expect(sources, hasLength(4));
List<String> uris =
sources.map((Source source) => source.uri.toString()).toList();
- expect(uris, contains('file://$appPath'));
+ expect(uris, contains((new Uri.file(appPath)).toString()));
expect(uris, contains('package:proj/main.dart'));
expect(uris, contains('package:proj/src/internal.dart'));
- expect(uris, contains('file://$testFilePath'));
+ expect(uris, contains((new Uri.file(testFilePath)).toString()));
}
void test_setRoots_addFolderWithPubspecAndPackagespecFolders() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String subProjectA = '$root/sub/aaa';
- String subProjectB = '$root/sub/sub2/bbb';
- String subProjectA_file = '$subProjectA/bin/a.dart';
- String subProjectB_file = '$subProjectB/bin/b.dart';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String subProjectA = convertPath('$root/sub/aaa');
+ String subProjectB = convertPath('$root/sub/sub2/bbb');
+ String subProjectA_file = convertPath('$subProjectA/bin/a.dart');
+ String subProjectB_file = convertPath('$subProjectB/bin/b.dart');
// create files
resourceProvider.newFile('$subProjectA/pubspec.yaml', 'pubspec');
resourceProvider.newFile('$subProjectB/pubspec.yaml', 'pubspec');
@@ -609,14 +614,14 @@
void test_setRoots_addFolderWithPubspecFolders() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String projectA = '$root/sub/aaa';
- String projectALib = '$root/sub/aaa/lib';
- String subProjectA_file = '$projectA/bin/a.dart';
- String projectB = '$root/sub/sub2/bbb';
- String projectBLib = '$root/sub/sub2/bbb/lib';
- String subProjectB_file = '$projectB/bin/b.dart';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String projectA = convertPath('$root/sub/aaa');
+ String projectALib = convertPath('$root/sub/aaa/lib');
+ String subProjectA_file = convertPath('$projectA/bin/a.dart');
+ String projectB = convertPath('$root/sub/sub2/bbb');
+ String projectBLib = convertPath('$root/sub/sub2/bbb/lib');
+ String subProjectB_file = convertPath('$projectB/bin/b.dart');
// create files
newFile('$projectA/${ContextManagerImpl.PUBSPEC_NAME}');
newFile('$projectA/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
@@ -649,8 +654,8 @@
}
void test_setRoots_addPackageRoot() {
- String packagePathFoo = '/package1/foo';
- String packageRootPath = '/package2/foo';
+ String packagePathFoo = convertPath('/package1/foo');
+ String packageRootPath = convertPath('/package2/foo');
newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
content: 'foo:file:///package1/foo');
Folder packageFolder = resourceProvider.newFolder(packagePathFoo);
@@ -682,9 +687,9 @@
void test_setRoots_exclude_newRoot_withExcludedFile() {
// prepare paths
- String project = '/project';
- String file1 = '$project/file1.dart';
- String file2 = '$project/file2.dart';
+ String project = convertPath('/project');
+ String file1 = convertPath('$project/file1.dart');
+ String file2 = convertPath('$project/file2.dart');
// create files
resourceProvider.newFile(file1, '// 1');
resourceProvider.newFile(file2, '// 2');
@@ -696,11 +701,11 @@
void test_setRoots_exclude_newRoot_withExcludedFolder() {
// prepare paths
- String project = '/project';
- String folderA = '$project/aaa';
- String folderB = '$project/bbb';
- String fileA = '$folderA/a.dart';
- String fileB = '$folderB/b.dart';
+ String project = convertPath('/project');
+ String folderA = convertPath('$project/aaa');
+ String folderB = convertPath('$project/bbb');
+ String fileA = convertPath('$folderA/a.dart');
+ String fileB = convertPath('$folderB/b.dart');
// create files
resourceProvider.newFile(fileA, 'library a;');
resourceProvider.newFile(fileB, 'library b;');
@@ -712,9 +717,9 @@
void test_setRoots_exclude_sameRoot_addExcludedFile() {
// prepare paths
- String project = '/project';
- String file1 = '$project/file1.dart';
- String file2 = '$project/file2.dart';
+ String project = convertPath('/project');
+ String file1 = convertPath('$project/file1.dart');
+ String file2 = convertPath('$project/file2.dart');
// create files
resourceProvider.newFile(file1, '// 1');
resourceProvider.newFile(file2, '// 2');
@@ -730,11 +735,11 @@
void test_setRoots_exclude_sameRoot_addExcludedFolder() {
// prepare paths
- String project = '/project';
- String folderA = '$project/aaa';
- String folderB = '$project/bbb';
- String fileA = '$folderA/a.dart';
- String fileB = '$folderB/b.dart';
+ String project = convertPath('/project');
+ String folderA = convertPath('$project/aaa');
+ String folderB = convertPath('$project/bbb');
+ String fileA = convertPath('$folderA/a.dart');
+ String fileB = convertPath('$folderB/b.dart');
// create files
resourceProvider.newFile(fileA, 'library a;');
resourceProvider.newFile(fileB, 'library b;');
@@ -750,9 +755,9 @@
void test_setRoots_exclude_sameRoot_removeExcludedFile() {
// prepare paths
- String project = '/project';
- String file1 = '$project/file1.dart';
- String file2 = '$project/file2.dart';
+ String project = convertPath('/project');
+ String file1 = convertPath('$project/file1.dart');
+ String file2 = convertPath('$project/file2.dart');
// create files
resourceProvider.newFile(file1, '// 1');
resourceProvider.newFile(file2, '// 2');
@@ -768,9 +773,9 @@
void test_setRoots_exclude_sameRoot_removeExcludedFile_inFolder() {
// prepare paths
- String project = '/project';
- String file1 = '$project/bin/file1.dart';
- String file2 = '$project/bin/file2.dart';
+ String project = convertPath('/project');
+ String file1 = convertPath('$project/bin/file1.dart');
+ String file2 = convertPath('$project/bin/file2.dart');
// create files
resourceProvider.newFile(file1, '// 1');
resourceProvider.newFile(file2, '// 2');
@@ -786,11 +791,11 @@
void test_setRoots_exclude_sameRoot_removeExcludedFolder() {
// prepare paths
- String project = '/project';
- String folderA = '$project/aaa';
- String folderB = '$project/bbb';
- String fileA = '$folderA/a.dart';
- String fileB = '$folderB/b.dart';
+ String project = convertPath('/project');
+ String folderA = convertPath('$project/aaa');
+ String folderB = convertPath('$project/bbb');
+ String fileA = convertPath('$folderA/a.dart');
+ String fileB = convertPath('$folderB/b.dart');
// create files
resourceProvider.newFile(fileA, 'library a;');
resourceProvider.newFile(fileB, 'library b;');
@@ -805,10 +810,10 @@
}
void test_setRoots_ignoreDocFolder() {
- String project = '/project';
- String fileA = '$project/foo.dart';
- String fileB = '$project/lib/doc/bar.dart';
- String fileC = '$project/doc/bar.dart';
+ String project = convertPath('/project');
+ String fileA = convertPath('$project/foo.dart');
+ String fileB = convertPath('$project/lib/doc/bar.dart');
+ String fileC = convertPath('$project/doc/bar.dart');
resourceProvider.newFile(fileA, '');
resourceProvider.newFile(fileB, '');
resourceProvider.newFile(fileC, '');
@@ -818,10 +823,10 @@
}
void test_setRoots_nested_includedByOuter_innerFirst() {
- String project = '/project';
- String projectPubspec = '$project/pubspec.yaml';
- String example = '$project/example';
- String examplePubspec = '$example/pubspec.yaml';
+ String project = convertPath('/project');
+ String projectPubspec = convertPath('$project/pubspec.yaml');
+ String example = convertPath('$project/example');
+ String examplePubspec = convertPath('$example/pubspec.yaml');
// create files
resourceProvider.newFile(projectPubspec, 'name: project');
resourceProvider.newFile(examplePubspec, 'name: example');
@@ -846,9 +851,9 @@
}
void test_setRoots_nested_includedByOuter_outerPubspec() {
- String project = '/project';
- String projectPubspec = '$project/pubspec.yaml';
- String example = '$project/example';
+ String project = convertPath('/project');
+ String projectPubspec = convertPath('$project/pubspec.yaml');
+ String example = convertPath('$project/example');
// create files
resourceProvider.newFile(projectPubspec, 'name: project');
resourceProvider.newFolder(example);
@@ -868,10 +873,10 @@
}
void test_setRoots_nested_includedByOuter_twoPubspecs() {
- String project = '/project';
- String projectPubspec = '$project/pubspec.yaml';
- String example = '$project/example';
- String examplePubspec = '$example/pubspec.yaml';
+ String project = convertPath('/project');
+ String projectPubspec = convertPath('$project/pubspec.yaml');
+ String example = convertPath('$project/example');
+ String examplePubspec = convertPath('$example/pubspec.yaml');
// create files
resourceProvider.newFile(projectPubspec, 'name: project');
resourceProvider.newFile(examplePubspec, 'name: example');
@@ -903,7 +908,7 @@
}
void test_setRoots_newlyAddedFoldersGetProperPackageMap() {
- String packagePath = '/package/foo';
+ String packagePath = convertPath('/package/foo');
newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
content: 'foo:file:///package/foo');
Folder packageFolder = resourceProvider.newFolder(packagePath);
@@ -917,9 +922,9 @@
void test_setRoots_noContext_excludedFolder() {
// prepare paths
- String project = '/project';
- String excludedFolder = '$project/excluded';
- String excludedPubspec = '$excludedFolder/pubspec.yaml';
+ String project = convertPath('/project');
+ String excludedFolder = convertPath('$project/excluded');
+ String excludedPubspec = convertPath('$excludedFolder/pubspec.yaml');
// create files
resourceProvider.newFile(excludedPubspec, 'name: ignore-me');
// set "/project", and exclude "/project/excluded"
@@ -949,7 +954,7 @@
}
void test_setRoots_packageResolver() {
- String filePath = path.posix.join(projPath, 'lib', 'foo.dart');
+ String filePath = join(projPath, 'lib', 'foo.dart');
newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
content: 'foo:lib/');
resourceProvider.newFile(filePath, 'contents');
@@ -966,9 +971,9 @@
void test_setRoots_pathContainsDotFile() {
// If the path to a file (relative to the context root) contains a folder
// whose name begins with '.', then the file is ignored.
- String project = '/project';
- String fileA = '$project/foo.dart';
- String fileB = '$project/.pub/bar.dart';
+ String project = convertPath('/project');
+ String fileA = convertPath('$project/foo.dart');
+ String fileB = convertPath('$project/.pub/bar.dart');
resourceProvider.newFile(fileA, '');
resourceProvider.newFile(fileB, '');
manager.setRoots(<String>[project], <String>[], <String, String>{});
@@ -1004,16 +1009,16 @@
void test_setRoots_removeFolderWithPackagespecFolder() {
// prepare paths
- String projectA = '/projectA';
- String projectB = '/projectB';
- String subProjectA = '$projectA/sub';
- String subProjectB = '$projectB/sub';
- String projectA_file = '$projectA/a.dart';
- String projectB_file = '$projectB/a.dart';
- String subProjectA_pubspec = '$subProjectA/.packages';
- String subProjectB_pubspec = '$subProjectB/.packages';
- String subProjectA_file = '$subProjectA/bin/sub_a.dart';
- String subProjectB_file = '$subProjectB/bin/sub_b.dart';
+ String projectA = convertPath('/projectA');
+ String projectB = convertPath('/projectB');
+ String subProjectA = convertPath('$projectA/sub');
+ String subProjectB = convertPath('$projectB/sub');
+ String projectA_file = convertPath('$projectA/a.dart');
+ String projectB_file = convertPath('$projectB/a.dart');
+ String subProjectA_pubspec = convertPath('$subProjectA/.packages');
+ String subProjectB_pubspec = convertPath('$subProjectB/.packages');
+ String subProjectA_file = convertPath('$subProjectA/bin/sub_a.dart');
+ String subProjectB_file = convertPath('$subProjectB/bin/sub_b.dart');
// create files
resourceProvider.newFile(projectA_file, '// a');
resourceProvider.newFile(projectB_file, '// b');
@@ -1052,16 +1057,16 @@
void test_setRoots_removeFolderWithPubspecFolder() {
// prepare paths
- String projectA = '/projectA';
- String projectB = '/projectB';
- String subProjectA = '$projectA/sub';
- String subProjectB = '$projectB/sub';
- String projectA_file = '$projectA/a.dart';
- String projectB_file = '$projectB/a.dart';
- String subProjectA_pubspec = '$subProjectA/pubspec.yaml';
- String subProjectB_pubspec = '$subProjectB/pubspec.yaml';
- String subProjectA_file = '$subProjectA/bin/sub_a.dart';
- String subProjectB_file = '$subProjectB/bin/sub_b.dart';
+ String projectA = convertPath('/projectA');
+ String projectB = convertPath('/projectB');
+ String subProjectA = convertPath('$projectA/sub');
+ String subProjectB = convertPath('$projectB/sub');
+ String projectA_file = convertPath('$projectA/a.dart');
+ String projectB_file = convertPath('$projectB/a.dart');
+ String subProjectA_pubspec = convertPath('$subProjectA/pubspec.yaml');
+ String subProjectB_pubspec = convertPath('$subProjectB/pubspec.yaml');
+ String subProjectA_file = convertPath('$subProjectA/bin/sub_a.dart');
+ String subProjectB_file = convertPath('$subProjectB/bin/sub_b.dart');
// create files
resourceProvider.newFile(projectA_file, '// a');
resourceProvider.newFile(projectB_file, '// b');
@@ -1086,8 +1091,8 @@
}
void test_setRoots_removePackageRoot() {
- String packagePathFoo = '/package1/foo';
- String packageRootPath = '/package2/foo';
+ String packagePathFoo = convertPath('/package1/foo');
+ String packageRootPath = convertPath('/package2/foo');
Folder packageFolder = resourceProvider.newFolder(packagePathFoo);
newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
content: 'foo:file:///package1/foo');
@@ -1108,8 +1113,8 @@
// If the path to the context root itself contains a folder whose name
// begins with '.', then that is not sufficient to cause any files in the
// context to be ignored.
- String project = '/.pub/project';
- String fileA = '$project/foo.dart';
+ String project = convertPath('/.pub/project');
+ String fileA = convertPath('$project/foo.dart');
resourceProvider.newFile(fileA, '');
manager.setRoots(<String>[project], <String>[], <String, String>{});
callbacks.assertContextPaths([project]);
@@ -1134,7 +1139,7 @@
// empty folder initially
expect(callbacks.currentFilePaths, hasLength(0));
// add file
- String filePath = path.posix.join(projPath, 'foo.dart');
+ String filePath = join(projPath, 'foo.dart');
resourceProvider.newFile(filePath, 'contents');
// the file was added
return pumpEventQueue().then((_) {
@@ -1146,11 +1151,11 @@
test_watch_addFile_excluded() {
// prepare paths
- String project = '/project';
- String folderA = '$project/aaa';
- String folderB = '$project/bbb';
- String fileA = '$folderA/a.dart';
- String fileB = '$folderB/b.dart';
+ String project = convertPath('/project');
+ String folderA = convertPath('$project/aaa');
+ String folderB = convertPath('$project/bbb');
+ String fileA = convertPath('$folderA/a.dart');
+ String fileB = convertPath('$folderB/b.dart');
// create files
resourceProvider.newFile(fileA, 'library a;');
// set roots
@@ -1167,9 +1172,9 @@
test_watch_addFile_inDocFolder_inner() {
// prepare paths
- String project = '/project';
- String fileA = '$project/a.dart';
- String fileB = '$project/lib/doc/b.dart';
+ String project = convertPath('/project');
+ String fileA = convertPath('$project/a.dart');
+ String fileB = convertPath('$project/lib/doc/b.dart');
// create files
resourceProvider.newFile(fileA, '');
// set roots
@@ -1186,9 +1191,9 @@
test_watch_addFile_inDocFolder_topLevel() {
// prepare paths
- String project = '/project';
- String fileA = '$project/a.dart';
- String fileB = '$project/doc/b.dart';
+ String project = convertPath('/project');
+ String fileA = convertPath('$project/a.dart');
+ String fileB = convertPath('$project/doc/b.dart');
// create files
resourceProvider.newFile(fileA, '');
// set roots
@@ -1206,9 +1211,9 @@
test_watch_addFile_pathContainsDotFile() async {
// If a file is added and the path to it (relative to the context root)
// contains a folder whose name begins with '.', then the file is ignored.
- String project = '/project';
- String fileA = '$project/foo.dart';
- String fileB = '$project/.pub/bar.dart';
+ String project = convertPath('/project');
+ String fileA = convertPath('$project/foo.dart');
+ String fileB = convertPath('$project/.pub/bar.dart');
resourceProvider.newFile(fileA, '');
manager.setRoots(<String>[project], <String>[], <String, String>{});
callbacks.assertContextPaths([project]);
@@ -1222,9 +1227,9 @@
test_watch_addFile_rootPathContainsDotFile() async {
// If a file is added and the path to the context contains a folder whose
// name begins with '.', then the file is not ignored.
- String project = '/.pub/project';
- String fileA = '$project/foo.dart';
- String fileB = '$project/bar/baz.dart';
+ String project = convertPath('/.pub/project');
+ String fileA = convertPath('$project/foo.dart');
+ String fileB = convertPath('$project/bar/baz.dart');
resourceProvider.newFile(fileA, '');
manager.setRoots(<String>[project], <String>[], <String, String>{});
callbacks.assertContextPaths([project]);
@@ -1240,7 +1245,7 @@
// empty folder initially
expect(callbacks.currentFilePaths, hasLength(0));
// add file in subfolder
- String filePath = path.posix.join(projPath, 'foo', 'bar.dart');
+ String filePath = join(projPath, 'foo', 'bar.dart');
resourceProvider.newFile(filePath, 'contents');
// the file was added
return pumpEventQueue().then((_) {
@@ -1252,9 +1257,9 @@
test_watch_addPackagespec_toRoot() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String rootPackagespec = '$root/.packages';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String rootPackagespec = convertPath('$root/.packages');
// create files
resourceProvider.newFile(rootFile, 'library root;');
// set roots
@@ -1274,11 +1279,11 @@
test_watch_addPackagespec_toSubFolder() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String subProject = '$root/sub/aaa';
- String subPubspec = '$subProject/.packages';
- String subFile = '$subProject/bin/a.dart';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String subProject = convertPath('$root/sub/aaa');
+ String subPubspec = convertPath('$subProject/.packages');
+ String subFile = convertPath('$subProject/bin/a.dart');
// create files
resourceProvider.newFile(rootFile, 'library root;');
resourceProvider.newFile(subFile, 'library a;');
@@ -1298,12 +1303,12 @@
test_watch_addPackagespec_toSubFolder_ofSubFolder() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String subProject = '$root/sub';
- String subPubspec = '$subProject/.packages';
- String subFile = '$subProject/bin/sub.dart';
- String subSubPubspec = '$subProject/subsub/.packages';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String subProject = convertPath('$root/sub');
+ String subPubspec = convertPath('$subProject/.packages');
+ String subFile = convertPath('$subProject/bin/sub.dart');
+ String subSubPubspec = convertPath('$subProject/subsub/.packages');
// create files
resourceProvider.newFile(rootFile, 'library root;');
resourceProvider.newFile(subPubspec, '');
@@ -1324,12 +1329,12 @@
test_watch_addPackagespec_toSubFolder_withPubspec() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String subProject = '$root/sub/aaa';
- String subPackagespec = '$subProject/.packages';
- String subPubspec = '$subProject/pubspec.yaml';
- String subFile = '$subProject/bin/a.dart';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String subProject = convertPath('$root/sub/aaa');
+ String subPackagespec = convertPath('$subProject/.packages');
+ String subPubspec = convertPath('$subProject/pubspec.yaml');
+ String subFile = convertPath('$subProject/bin/a.dart');
// create files
resourceProvider.newFile(subPubspec, 'pubspec');
resourceProvider.newFile(rootFile, 'library root;');
@@ -1353,9 +1358,9 @@
test_watch_addPubspec_toRoot() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String rootPubspec = '$root/pubspec.yaml';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String rootPubspec = convertPath('$root/pubspec.yaml');
// create files
resourceProvider.newFile(rootFile, 'library root;');
// set roots
@@ -1373,11 +1378,11 @@
test_watch_addPubspec_toSubFolder() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String subProject = '$root/sub/aaa';
- String subPubspec = '$subProject/pubspec.yaml';
- String subFile = '$subProject/bin/a.dart';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String subProject = convertPath('$root/sub/aaa');
+ String subPubspec = convertPath('$subProject/pubspec.yaml');
+ String subFile = convertPath('$subProject/bin/a.dart');
// create files
resourceProvider.newFile(rootFile, 'library root;');
resourceProvider.newFile(subFile, 'library a;');
@@ -1397,12 +1402,12 @@
test_watch_addPubspec_toSubFolder_ofSubFolder() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String subProject = '$root/sub';
- String subPubspec = '$subProject/pubspec.yaml';
- String subFile = '$subProject/bin/sub.dart';
- String subSubPubspec = '$subProject/subsub/pubspec.yaml';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String subProject = convertPath('$root/sub');
+ String subPubspec = convertPath('$subProject/pubspec.yaml');
+ String subFile = convertPath('$subProject/bin/sub.dart');
+ String subSubPubspec = convertPath('$subProject/subsub/pubspec.yaml');
// create files
resourceProvider.newFile(rootFile, 'library root;');
resourceProvider.newFile(subPubspec, 'pubspec');
@@ -1422,7 +1427,7 @@
}
test_watch_deleteFile() {
- String filePath = path.posix.join(projPath, 'foo.dart');
+ String filePath = join(projPath, 'foo.dart');
// add root with a file
File file = resourceProvider.newFile(filePath, 'contents');
Folder projFolder = file.parent;
@@ -1443,7 +1448,7 @@
}
test_watch_deleteFolder() {
- String filePath = path.posix.join(projPath, 'foo.dart');
+ String filePath = join(projPath, 'foo.dart');
// add root with a file
File file = resourceProvider.newFile(filePath, 'contents');
Folder projFolder = file.parent;
@@ -1465,9 +1470,9 @@
test_watch_deletePackagespec_fromRoot() {
// prepare paths
- String root = '/root';
- String rootPubspec = '$root/.packages';
- String rootFile = '$root/root.dart';
+ String root = convertPath('/root');
+ String rootPubspec = convertPath('$root/.packages');
+ String rootFile = convertPath('$root/root.dart');
// create files
resourceProvider.newFile(rootPubspec, '');
resourceProvider.newFile(rootFile, 'library root;');
@@ -1485,11 +1490,11 @@
test_watch_deletePackagespec_fromSubFolder() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String subProject = '$root/sub/aaa';
- String subPubspec = '$subProject/.packages';
- String subFile = '$subProject/bin/a.dart';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String subProject = convertPath('$root/sub/aaa');
+ String subPubspec = convertPath('$subProject/.packages');
+ String subFile = convertPath('$subProject/bin/a.dart');
// create files
resourceProvider.newFile(subPubspec, '');
resourceProvider.newFile(rootFile, 'library root;');
@@ -1520,12 +1525,12 @@
// bin
// a.dart
//
- String root = '/root';
- String rootFile = '$root/root.dart';
- String subProject = '$root/sub/aaa';
- String subPackagespec = '$subProject/.packages';
- String subPubspec = '$subProject/pubspec.yaml';
- String subFile = '$subProject/bin/a.dart';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String subProject = convertPath('$root/sub/aaa');
+ String subPackagespec = convertPath('$subProject/.packages');
+ String subPubspec = convertPath('$subProject/pubspec.yaml');
+ String subFile = convertPath('$subProject/bin/a.dart');
// create files
resourceProvider.newFile(subPackagespec, '');
resourceProvider.newFile(subPubspec, 'pubspec');
@@ -1548,9 +1553,9 @@
test_watch_deletePubspec_fromRoot() {
// prepare paths
- String root = '/root';
- String rootPubspec = '$root/pubspec.yaml';
- String rootFile = '$root/root.dart';
+ String root = convertPath('/root');
+ String rootPubspec = convertPath('$root/pubspec.yaml');
+ String rootFile = convertPath('$root/root.dart');
// create files
resourceProvider.newFile(rootPubspec, 'pubspec');
resourceProvider.newFile(rootFile, 'library root;');
@@ -1568,11 +1573,11 @@
test_watch_deletePubspec_fromSubFolder() {
// prepare paths
- String root = '/root';
- String rootFile = '$root/root.dart';
- String subProject = '$root/sub/aaa';
- String subPubspec = '$subProject/pubspec.yaml';
- String subFile = '$subProject/bin/a.dart';
+ String root = convertPath('/root');
+ String rootFile = convertPath('$root/root.dart');
+ String subProject = convertPath('$root/sub/aaa');
+ String subPubspec = convertPath('$subProject/pubspec.yaml');
+ String subFile = convertPath('$subProject/bin/a.dart');
// create files
resourceProvider.newFile(subPubspec, 'pubspec');
resourceProvider.newFile(rootFile, 'library root;');
@@ -1592,7 +1597,7 @@
}
test_watch_modifyFile() {
- String filePath = path.posix.join(projPath, 'foo.dart');
+ String filePath = join(projPath, 'foo.dart');
// add root with a file
resourceProvider.newFile(filePath, 'contents');
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
@@ -1611,11 +1616,11 @@
test_watch_modifyPackageMapDependency_fail() async {
// create a dependency file
- String dependencyPath = path.posix.join(projPath, 'dep');
+ String dependencyPath = join(projPath, 'dep');
resourceProvider.newFile(dependencyPath, 'contents');
packageMapProvider.dependencies.add(dependencyPath);
// create a Dart file
- String dartFilePath = path.posix.join(projPath, 'main.dart');
+ String dartFilePath = join(projPath, 'main.dart');
resourceProvider.newFile(dartFilePath, 'contents');
// the created context has the expected empty package map
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
@@ -1630,8 +1635,8 @@
}
test_watch_modifyPackagespec() {
- String packagesPath = '$projPath/.packages';
- String filePath = '$projPath/bin/main.dart';
+ String packagesPath = convertPath('$projPath/.packages');
+ String filePath = convertPath('$projPath/bin/main.dart');
resourceProvider.newFile(packagesPath, '');
resourceProvider.newFile(filePath, 'library main;');
@@ -1701,7 +1706,7 @@
UriResolver packageResolver = null;
- String projPath = '/my/proj';
+ String projPath = null;
AnalysisError missing_required_param = new AnalysisError(
new TestSource(), 0, 1, HintCode.MISSING_REQUIRED_PARAM, [
@@ -1765,11 +1770,12 @@
void setUp() {
processRequiredPlugins();
+ projPath = convertPath('/my/proj');
resourceProvider.newFolder(projPath);
packageMapProvider = new MockPackageMapProvider();
// Create an SDK in the mock file system.
new MockSdk(generateSummaryFiles: true, resourceProvider: resourceProvider);
- DartSdkManager sdkManager = new DartSdkManager('/', true);
+ DartSdkManager sdkManager = new DartSdkManager(convertPath('/'), true);
manager = new ContextManagerImpl(
resourceProvider,
new FileContentOverlay(),
@@ -2274,8 +2280,8 @@
Folder projectFolder = resourceProvider.newFolder(projPath);
var drivers = manager.getDriversInAnalysisRoot(projectFolder);
expect(drivers, hasLength(2));
- expect(drivers[0].name, equals('/my/proj'));
- expect(drivers[1].name, equals('/my/proj/lib'));
+ expect(drivers[0].name, equals(convertPath('/my/proj')));
+ expect(drivers[1].name, equals(convertPath('/my/proj/lib')));
}
test_path_filter_recursive_wildcard_child_contexts_option() async {
@@ -2305,8 +2311,8 @@
Folder projectFolder = resourceProvider.newFolder(projPath);
var drivers = manager.getDriversInAnalysisRoot(projectFolder);
expect(drivers, hasLength(2));
- expect(drivers[0].name, equals('/my/proj'));
- expect(drivers[1].name, equals('/my/proj/lib'));
+ expect(drivers[0].name, equals(convertPath('/my/proj')));
+ expect(drivers[1].name, equals(convertPath('/my/proj/lib')));
}
test_path_filter_wildcard_child_contexts_option() async {
@@ -2334,15 +2340,15 @@
Folder projectFolder = resourceProvider.newFolder(projPath);
var drivers = manager.getDriversInAnalysisRoot(projectFolder);
expect(drivers, hasLength(2));
- expect(drivers[0].name, equals('/my/proj'));
- expect(drivers[1].name, equals('/my/proj/lib'));
+ expect(drivers[0].name, equals(convertPath('/my/proj')));
+ expect(drivers[1].name, equals(convertPath('/my/proj/lib')));
}
void test_setRoots_nested_excludedByOuter() {
- String project = '/project';
- String projectPubspec = '$project/pubspec.yaml';
- String example = '$project/example';
- String examplePubspec = '$example/pubspec.yaml';
+ String project = convertPath('/project');
+ String projectPubspec = convertPath('$project/pubspec.yaml');
+ String example = convertPath('$project/example');
+ String examplePubspec = convertPath('$example/pubspec.yaml');
// create files
resourceProvider.newFile(projectPubspec, 'name: project');
resourceProvider.newFile(examplePubspec, 'name: example');
@@ -2373,10 +2379,10 @@
}
void test_setRoots_nested_excludedByOuter_deep() {
- String a = '/a';
- String c = '$a/b/c';
- String aPubspec = '$a/pubspec.yaml';
- String cPubspec = '$c/pubspec.yaml';
+ String a = convertPath('/a');
+ String c = convertPath('$a/b/c');
+ String aPubspec = convertPath('$a/pubspec.yaml');
+ String cPubspec = convertPath('$c/pubspec.yaml');
// create files
resourceProvider.newFile(aPubspec, 'name: aaa');
resourceProvider.newFile(cPubspec, 'name: ccc');
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index 66f1a23..5e9e26f 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -51,14 +51,15 @@
test_setAnalysisRoots_excludedFolder() async {
newFile('/project/aaa/a.dart', content: '// a');
newFile('/project/bbb/b.dart', content: '// b');
- var response = testSetAnalysisRoots(['/project'], ['/project/bbb']);
+ var excludedPath = join(projectPath, 'bbb');
+ var response = testSetAnalysisRoots([projectPath], [excludedPath]);
expect(response, isResponseSuccess('0'));
}
test_setAnalysisRoots_included_newFolder() async {
newFile('/project/pubspec.yaml', content: 'name: project');
String file = newFile('/project/bin/test.dart', content: 'main() {}').path;
- var response = testSetAnalysisRoots(['/project'], []);
+ var response = testSetAnalysisRoots([projectPath], []);
var serverRef = server;
expect(response, isResponseSuccess('0'));
// verify that unit is resolved eventually
@@ -68,8 +69,10 @@
}
test_setAnalysisRoots_included_nonexistentFolder() async {
+ String projectA = convertPath('/project_a');
+ String projectB = convertPath('/project_b');
String fileB = newFile('/project_b/b.dart', content: '// b').path;
- var response = testSetAnalysisRoots(['/project_a', '/project_b'], []);
+ var response = testSetAnalysisRoots([projectA, projectB], []);
var serverRef = server;
expect(response, isResponseSuccess('0'));
// Non-existence of /project_a should not prevent files in /project_b
@@ -111,12 +114,17 @@
}
test_setPriorityFiles_valid() {
- newFile('/p1/a.dart', content: 'library a;');
- newFile('/p2/b.dart', content: 'library b;');
- newFile('/p2/c.dart', content: 'library c;');
+ var p1 = convertPath('/p1');
+ var p2 = convertPath('/p2');
+ var aPath = convertPath('/p1/a.dart');
+ var bPath = convertPath('/p2/b.dart');
+ var cPath = convertPath('/p2/c.dart');
+ newFile(aPath, content: 'library a;');
+ newFile(bPath, content: 'library b;');
+ newFile(cPath, content: 'library c;');
var setRootsRequest =
- new AnalysisSetAnalysisRootsParams(['/p1', '/p2'], []).toRequest('0');
+ new AnalysisSetAnalysisRootsParams([p1, p2], []).toRequest('0');
var setRootsResponse = handler.handleRequest(setRootsRequest);
expect(setRootsResponse, isResponseSuccess('0'));
@@ -129,8 +137,8 @@
// expect(server.getPriorityFiles(), unorderedEquals(fileList));
}
- setPriorityFiles(['/p1/a.dart', '/p2/b.dart']);
- setPriorityFiles(['/p2/b.dart', '/p2/c.dart']);
+ setPriorityFiles([aPath, bPath]);
+ setPriorityFiles([bPath, cPath]);
setPriorityFiles([]);
}
@@ -341,10 +349,13 @@
Map<String, List<HighlightRegion>> filesHighlights = {};
Map<String, List<NavigationRegion>> filesNavigation = {};
- String testFile = '/project/bin/test.dart';
+ String projectPath;
+ String testFile;
String testCode;
AnalysisTestHelper() {
+ projectPath = convertPath('/project');
+ testFile = convertPath('/project/bin/test.dart');
processRequiredPlugins();
serverChannel = new MockServerChannel();
// Create an SDK in the mock file system.
@@ -354,7 +365,7 @@
resourceProvider,
new MockPackageMapProvider(),
new AnalysisServerOptions()..previewDart2 = true,
- new DartSdkManager('/', false),
+ new DartSdkManager(convertPath('/'), false),
InstrumentationService.NULL_SERVICE);
handler = new AnalysisDomainHandler(server);
// listen for notifications
@@ -411,9 +422,9 @@
* Creates an empty project `/project`.
*/
void createEmptyProject() {
- newFolder('/project');
+ newFolder(projectPath);
Request request =
- new AnalysisSetAnalysisRootsParams(['/project'], []).toRequest('0');
+ new AnalysisSetAnalysisRootsParams([projectPath], []).toRequest('0');
handleSuccessfulRequest(request);
}
@@ -423,10 +434,10 @@
*/
void createSingleFileProject(code) {
this.testCode = _getCodeString(code);
- newFolder('/project');
+ newFolder(projectPath);
newFile(testFile, content: testCode);
Request request =
- new AnalysisSetAnalysisRootsParams(['/project'], []).toRequest('0');
+ new AnalysisSetAnalysisRootsParams([projectPath], []).toRequest('0');
handleSuccessfulRequest(request);
}
@@ -603,8 +614,8 @@
}
test_afterAnalysis_packageFile_inRoot() async {
- String pkgA = '/pkgA';
- String pkgB = '/pkgA';
+ String pkgA = convertPath('/pkgA');
+ String pkgB = convertPath('/pkgA');
String pkgFileA = newFile('$pkgA/lib/libA.dart', content: '''
library lib_a;
class A {}
@@ -654,7 +665,7 @@
}
test_afterAnalysis_sdkFile() async {
- String file = '/lib/core/core.dart';
+ String file = convertPath('/lib/core/core.dart');
addTestFile('// no matter');
createProject();
// wait for analysis, no results initially
diff --git a/pkg/analysis_server/test/edit/organize_directives_test.dart b/pkg/analysis_server/test/edit/organize_directives_test.dart
index 351891f..ed87cba 100644
--- a/pkg/analysis_server/test/edit/organize_directives_test.dart
+++ b/pkg/analysis_server/test/edit/organize_directives_test.dart
@@ -84,8 +84,8 @@
}
Future test_OK_remove_unresolvedDirectives() {
- newFile('$testFolder/existing_part1.dart', content: 'part of lib;');
- newFile('$testFolder/existing_part2.dart', content: 'part of lib;');
+ newFile(join(testFolder, 'existing_part1.dart'), content: 'part of lib;');
+ newFile(join(testFolder, 'existing_part2.dart'), content: 'part of lib;');
addTestFile('''
library lib;
diff --git a/pkg/analysis_server/test/edit/refactoring_test.dart b/pkg/analysis_server/test/edit/refactoring_test.dart
index d5a61dc..fb7caed 100644
--- a/pkg/analysis_server/test/edit/refactoring_test.dart
+++ b/pkg/analysis_server/test/edit/refactoring_test.dart
@@ -280,7 +280,7 @@
test_analysis_onlyOneFile() async {
shouldWaitForFullAnalysis = false;
- newFile('$testFolder/other.dart', content: r'''
+ newFile(join(testFolder, 'other.dart'), content: r'''
foo(int myName) {}
''');
addTestFile('''
@@ -452,7 +452,7 @@
}
test_resetOnAnalysisSetChanged_watch_otherFile() async {
- String otherFile = '$testFolder/other.dart';
+ String otherFile = join(testFolder, 'other.dart');
newFile(otherFile, content: '// other 1');
addTestFile('''
main() {
@@ -987,7 +987,7 @@
class InlineLocalTest extends _AbstractGetRefactoring_Test {
test_analysis_onlyOneFile() async {
shouldWaitForFullAnalysis = false;
- String otherFile = '$testFolder/other.dart';
+ String otherFile = join(testFolder, 'other.dart');
newFile(otherFile, content: r'''
foo(int p) {}
''');
@@ -1056,7 +1056,7 @@
}
test_resetOnAnalysisSetChanged() async {
- newFile('$testFolder/other.dart', content: '// other 1');
+ newFile(join(testFolder, 'other.dart'), content: '// other 1');
addTestFile('''
main() {
int res = 1 + 2;
@@ -1761,7 +1761,7 @@
}
test_library_partOfDirective() {
- newFile('$testFolder/my_lib.dart', content: '''
+ newFile(join(testFolder, 'my_lib.dart'), content: '''
library aaa.bbb.ccc;
part 'test.dart';
''');
diff --git a/pkg/analysis_server/test/mock_sdk.dart b/pkg/analysis_server/test/mock_sdk.dart
index 438b035..86252cd 100644
--- a/pkg/analysis_server/test/mock_sdk.dart
+++ b/pkg/analysis_server/test/mock_sdk.dart
@@ -275,7 +275,8 @@
resource.ResourceProvider resourceProvider})
: provider = resourceProvider ?? new resource.MemoryResourceProvider() {
LIBRARIES.forEach((SdkLibrary library) {
- provider.newFile(library.path, (library as MockSdkLibrary).content);
+ provider.newFile(provider.convertPath(library.path),
+ (library as MockSdkLibrary).content);
});
provider.newFile(
provider.convertPath(
@@ -386,7 +387,7 @@
String path = uriToPath[dartUri];
if (path != null) {
- resource.File file = provider.getResource(path);
+ resource.File file = provider.getResource(provider.convertPath(path));
Uri uri = new Uri(scheme: 'dart', path: dartUri.substring(5));
return file.createSource(uri);
}
diff --git a/pkg/analysis_server/test/search/type_hierarchy_test.dart b/pkg/analysis_server/test/search/type_hierarchy_test.dart
index 19e5b52..c3132ab 100644
--- a/pkg/analysis_server/test/search/type_hierarchy_test.dart
+++ b/pkg/analysis_server/test/search/type_hierarchy_test.dart
@@ -695,7 +695,7 @@
}
test_member_method_private_differentLib() async {
- newFile('$testFolder/lib.dart', content: r'''
+ newFile(join(testFolder, 'lib.dart'), content: r'''
import 'test.dart';
class A {
void _m() {}
diff --git a/pkg/analysis_server/test/services/correction/assist_test.dart b/pkg/analysis_server/test/services/correction/assist_test.dart
index 6865152..4a49744 100644
--- a/pkg/analysis_server/test/services/correction/assist_test.dart
+++ b/pkg/analysis_server/test/services/correction/assist_test.dart
@@ -3257,6 +3257,28 @@
''');
}
+ test_flutterWrapCenter_OK_implicitNew() async {
+ _configurePreviewDart2();
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/widgets.dart';
+class FakeFlutter {
+ main() {
+ return /*caret*/Container();
+ }
+}
+''');
+ _setCaretLocation();
+ await assertHasAssist(DartAssistKind.FLUTTER_WRAP_CENTER, '''
+import 'package:flutter/widgets.dart';
+class FakeFlutter {
+ main() {
+ return /*caret*/Center(child: Container());
+ }
+}
+''');
+ }
+
test_flutterWrapColumn_OK_coveredByWidget() async {
addFlutterPackage();
await resolveTestUnit('''
@@ -3329,6 +3351,34 @@
''');
}
+ test_flutterWrapColumn_OK_implicitNew() async {
+ _configurePreviewDart2();
+ addFlutterPackage();
+ await resolveTestUnit('''
+import 'package:flutter/widgets.dart';
+
+main() {
+ return Container(
+ child: /*caret*/Text('aaa'),
+ );
+}
+''');
+ _setCaretLocation();
+ await assertHasAssist(DartAssistKind.FLUTTER_WRAP_COLUMN, '''
+import 'package:flutter/widgets.dart';
+
+main() {
+ return Container(
+ child: /*caret*/Column(
+ children: <Widget>[
+ Text('aaa'),
+ ],
+ ),
+ );
+}
+''');
+ }
+
test_flutterWrapPadding_BAD_onPadding() async {
addFlutterPackage();
await resolveTestUnit('''
@@ -5280,6 +5330,12 @@
return await processor.compute();
}
+ void _configurePreviewDart2() {
+ driver.configure(
+ analysisOptions: new AnalysisOptionsImpl.from(driver.analysisOptions)
+ ..previewDart2 = true);
+ }
+
List<Position> _findResultPositions(List<String> searchStrings) {
List<Position> positions = <Position>[];
for (String search in searchStrings) {
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index e3d6398..be00f2c 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -3631,27 +3631,6 @@
''');
}
- test_importLibraryProject_withClass_constInstanceCreation() async {
- testFile = '/project/lib/test.dart';
- addSource('/project/lib/lib.dart', '''
-class Test {
- const Test();
-}
-''');
- await resolveTestUnit('''
-main() {
- const Test();
-}
-''');
- await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, '''
-import 'lib.dart';
-
-main() {
- const Test();
-}
-''');
- }
-
test_importLibraryProject_withClass_hasOtherLibraryWithPrefix() async {
testFile = '/project/bin/test.dart';
addSource('/project/bin/a.dart', '''
@@ -3740,6 +3719,69 @@
''');
}
+ test_importLibraryProject_withClass_instanceCreation_const() async {
+ testFile = '/project/lib/test.dart';
+ addSource('/project/lib/lib.dart', '''
+class Test {
+ const Test();
+}
+''');
+ await resolveTestUnit('''
+main() {
+ return const Test();
+}
+''');
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, '''
+import 'lib.dart';
+
+main() {
+ return const Test();
+}
+''');
+ }
+
+ test_importLibraryProject_withClass_instanceCreation_implicit() async {
+ testFile = '/project/lib/test.dart';
+ addSource('/project/lib/lib.dart', '''
+class Test {
+ const Test();
+}
+''');
+ await resolveTestUnit('''
+main() {
+ return Test();
+}
+''');
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, '''
+import 'lib.dart';
+
+main() {
+ return Test();
+}
+''');
+ }
+
+ test_importLibraryProject_withClass_instanceCreation_new() async {
+ testFile = '/project/lib/test.dart';
+ addSource('/project/lib/lib.dart', '''
+class Test {
+ const Test();
+}
+''');
+ await resolveTestUnit('''
+main() {
+ return new Test();
+}
+''');
+ await assertHasFix(DartFixKind.IMPORT_LIBRARY_PROJECT1, '''
+import 'lib.dart';
+
+main() {
+ return new Test();
+}
+''');
+ }
+
test_importLibraryProject_withFunction() async {
testFile = '/project/lib/test.dart';
addSource('/project/lib/lib.dart', '''
diff --git a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
index 1da0f30..56dc78a 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
@@ -69,7 +69,7 @@
await indexTestUnit('''
class Test {}
''');
- await indexUnit('/lib.dart', '''
+ await indexUnit(convertPath('/lib.dart'), '''
library my.lib;
import 'test.dart';
@@ -109,7 +109,7 @@
await indexTestUnit('''
class Test {}
''');
- await indexUnit('/lib.dart', '''
+ await indexUnit(convertPath('/lib.dart'), '''
library my.lib;
import 'test.dart';
class A {
diff --git a/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart b/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart
index f66cf97..55c106b 100644
--- a/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/imported_elements_computer_test.dart
@@ -43,7 +43,7 @@
ImportedElements elements2 = elementsList[1];
ImportedElements asyncElements;
ImportedElements coreElements;
- if (elements1.path == '/lib/core/core.dart') {
+ if (elements1.path == convertPath('/lib/core/core.dart')) {
coreElements = elements1;
asyncElements = elements2;
} else {
@@ -51,12 +51,12 @@
asyncElements = elements1;
}
expect(coreElements, isNotNull);
- expect(coreElements.path, '/lib/core/core.dart');
+ expect(coreElements.path, convertPath('/lib/core/core.dart'));
expect(coreElements.prefix, '');
expect(coreElements.elements, unorderedEquals(['String']));
expect(asyncElements, isNotNull);
- expect(asyncElements.path, '/lib/async/async.dart');
+ expect(asyncElements.path, convertPath('/lib/async/async.dart'));
expect(asyncElements.prefix, '');
expect(asyncElements.elements, unorderedEquals(['Future']));
}
@@ -77,7 +77,7 @@
ImportedElements elements2 = elementsList[1];
ImportedElements asyncElements;
ImportedElements coreElements;
- if (elements1.path == '/lib/core/core.dart') {
+ if (elements1.path == convertPath('/lib/core/core.dart')) {
coreElements = elements1;
asyncElements = elements2;
} else {
@@ -85,12 +85,12 @@
asyncElements = elements1;
}
expect(coreElements, isNotNull);
- expect(coreElements.path, '/lib/core/core.dart');
+ expect(coreElements.path, convertPath('/lib/core/core.dart'));
expect(coreElements.prefix, '');
expect(coreElements.elements, unorderedEquals(['String']));
expect(asyncElements, isNotNull);
- expect(asyncElements.path, '/lib/async/async.dart');
+ expect(asyncElements.path, convertPath('/lib/async/async.dart'));
expect(asyncElements.prefix, 'a');
expect(asyncElements.elements, unorderedEquals(['Future']));
}
@@ -108,7 +108,7 @@
expect(elementsList, hasLength(1));
ImportedElements elements = elementsList[0];
expect(elements, isNotNull);
- expect(elements.path, '/lib/core/core.dart');
+ expect(elements.path, convertPath('/lib/core/core.dart'));
expect(elements.prefix, '');
expect(elements.elements, unorderedEquals(['String']));
}
@@ -127,7 +127,7 @@
expect(elementsList, hasLength(1));
ImportedElements elements = elementsList[0];
expect(elements, isNotNull);
- expect(elements.path, '/lib/core/core.dart');
+ expect(elements.path, convertPath('/lib/core/core.dart'));
expect(elements.prefix, 'core');
expect(elements.elements, unorderedEquals(['String']));
}
@@ -146,7 +146,7 @@
expect(elementsList, hasLength(1));
ImportedElements elements = elementsList[0];
expect(elements, isNotNull);
- expect(elements.path, '/lib/math/math.dart');
+ expect(elements.path, convertPath('/lib/math/math.dart'));
expect(elements.prefix, '');
expect(elements.elements, unorderedEquals(['Random']));
}
@@ -170,13 +170,13 @@
ImportedElements mathElements = elementsList[0];
expect(mathElements, isNotNull);
- expect(mathElements.path, '/lib/math/math.dart');
+ expect(mathElements.path, convertPath('/lib/math/math.dart'));
expect(mathElements.prefix, '');
expect(mathElements.elements, unorderedEquals(['Random']));
ImportedElements coreElements = elementsList[1];
expect(coreElements, isNotNull);
- expect(coreElements.path, '/lib/core/core.dart');
+ expect(coreElements.path, convertPath('/lib/core/core.dart'));
expect(coreElements.prefix, '');
expect(coreElements.elements, unorderedEquals(['String', 'print']));
}
@@ -256,7 +256,7 @@
expect(elementsList, hasLength(1));
ImportedElements elements = elementsList[0];
expect(elements, isNotNull);
- expect(elements.path, '/pubcache/foo/lib/foo.dart');
+ expect(elements.path, convertPath('/pubcache/foo/lib/foo.dart'));
expect(elements.prefix, '');
expect(elements.elements, unorderedEquals(['A', 'B']));
}
@@ -279,7 +279,7 @@
expect(elementsList, hasLength(1));
ImportedElements elements = elementsList[0];
expect(elements, isNotNull);
- expect(elements.path, '/pubcache/foo/lib/foo.dart');
+ expect(elements.path, convertPath('/pubcache/foo/lib/foo.dart'));
expect(elements.prefix, '');
expect(elements.elements, unorderedEquals(['Foo']));
}
@@ -302,7 +302,7 @@
expect(elementsList, hasLength(1));
ImportedElements elements = elementsList[0];
expect(elements, isNotNull);
- expect(elements.path, '/pubcache/foo/lib/foo.dart');
+ expect(elements.path, convertPath('/pubcache/foo/lib/foo.dart'));
expect(elements.prefix, 'f');
expect(elements.elements, unorderedEquals(['Foo']));
}
@@ -325,7 +325,7 @@
expect(elementsList, hasLength(1));
ImportedElements elements = elementsList[0];
expect(elements, isNotNull);
- expect(elements.path, '/pubcache/foo/lib/foo.dart');
+ expect(elements.path, convertPath('/pubcache/foo/lib/foo.dart'));
expect(elements.prefix, '');
expect(elements.elements, unorderedEquals(['Foo']));
}
@@ -362,12 +362,12 @@
}
expect(notPrefixedElements, isNotNull);
- expect(notPrefixedElements.path, '/pubcache/foo/lib/foo.dart');
+ expect(notPrefixedElements.path, convertPath('/pubcache/foo/lib/foo.dart'));
expect(notPrefixedElements.prefix, '');
expect(notPrefixedElements.elements, unorderedEquals(['Foo']));
expect(prefixedElements, isNotNull);
- expect(prefixedElements.path, '/pubcache/foo/lib/foo.dart');
+ expect(prefixedElements.path, convertPath('/pubcache/foo/lib/foo.dart'));
expect(prefixedElements.prefix, 'f');
expect(prefixedElements.elements, unorderedEquals(['Foo']));
}
diff --git a/pkg/analyzer/lib/dart/analysis/analysis_context.dart b/pkg/analyzer/lib/dart/analysis/analysis_context.dart
new file mode 100644
index 0000000..a075b09
--- /dev/null
+++ b/pkg/analyzer/lib/dart/analysis/analysis_context.dart
@@ -0,0 +1,63 @@
+// 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:analyzer/dart/analysis/session.dart';
+import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
+
+/**
+ * A representation of a body of code and the context in which the code is to be
+ * analyzed.
+ *
+ * The body of code is represented as a collection of files and directories, as
+ * defined by the list of [includedPaths]. If the list of included paths
+ * contains one or more directories, then zero or more files or directories
+ * within the included directories can be excluded from analysis, as defined by
+ * the list of [excludedPaths].
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class AnalysisContext {
+ /**
+ * The analysis options used to control the way the code is analyzed.
+ */
+ AnalysisOptions get analysisOptions;
+
+ /**
+ * Return the currently active analysis session.
+ */
+ AnalysisSession get currentSession;
+
+ /**
+ * A list of the absolute, normalized paths of files and directories that
+ * will not be analyzed.
+ */
+ List<String> get excludedPaths;
+
+ /**
+ * A list of the absolute, normalized paths of files and directories that
+ * will be analyzed. If a path in the list represents a file, then that file
+ * will be analyzed, even if it is in the list of [excludedPaths]. If path in
+ * the list represents a directory, then all of the files contained in that
+ * directory, either directly or indirectly, and that are not explicitly
+ * excluded by the list of [excludedPaths] will be analyzed.
+ */
+ List<String> get includedPaths;
+
+ /**
+ * Return the absolute, normalized paths of all of the files that are
+ * contained in this context. These are all of the files that are included
+ * directly or indirectly by one or more of the [includedPaths] and that are
+ * not excluded by any of the [excludedPaths].
+ */
+ Iterable<String> analyzedFiles();
+
+ /**
+ * Return `true` if the file or directory with the given [path] will be
+ * analyzed in this context. A file (or directory) will be analyzed if it is
+ * either the same as or contained in one of the [includedPaths] and, if it is
+ * is contained in one of the [includedPaths], is not the same as or contained
+ * in one of the [excludedPaths].
+ */
+ bool isAnalyzed(String path);
+}
diff --git a/pkg/analyzer/lib/dart/analysis/context_locator.dart b/pkg/analyzer/lib/dart/analysis/context_locator.dart
new file mode 100644
index 0000000..9c7f979
--- /dev/null
+++ b/pkg/analyzer/lib/dart/analysis/context_locator.dart
@@ -0,0 +1,41 @@
+// 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:analyzer/dart/analysis/analysis_context.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/dart/analysis/context_locator.dart';
+import 'package:meta/meta.dart';
+
+/**
+ * Determines the list of analysis contexts that can be used to analyze the
+ * files and folders that should be analyzed given a list of included files and
+ * folders and a list of excluded files and folders.
+ */
+abstract class ContextLocator {
+ /**
+ * Initialize a newly created context locator. If a [resourceProvider] is
+ * supplied, it will be used to access the file system. Otherwise the default
+ * resource provider will be used.
+ */
+ factory ContextLocator({ResourceProvider resourceProvider}) =
+ ContextLocatorImpl;
+
+ /**
+ * Return a list of the analysis contexts that should be used to analyze the
+ * files that are included by the list of [includedPaths] and not excluded by
+ * the list of [excludedPaths].
+ *
+ * If the [packagesFile] is specified, then it is assumed to be the path to
+ * the `.packages` file that should be used in place of the one that would be
+ * found by looking in the directories containing the context roots.
+ *
+ * If the [sdkPath] is specified, then it is used as the path to the root of
+ * the SDK that should be used during analysis.
+ */
+ List<AnalysisContext> locateContexts(
+ {@required List<String> includedPaths,
+ List<String> excludedPaths: const <String>[],
+ String packagesFile: null,
+ String sdkPath: null});
+}
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 6a89cad..87a0ee4 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -276,7 +276,9 @@
HintCode.MISSING_RETURN,
HintCode.MUST_BE_IMMUTABLE,
HintCode.MUST_CALL_SUPER,
+ HintCode.NULL_AWARE_BEFORE_OPERATOR,
HintCode.NULL_AWARE_IN_CONDITION,
+ HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR,
HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE,
HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD,
HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER,
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
new file mode 100644
index 0000000..0a7ca25
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
@@ -0,0 +1,338 @@
+// 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 'dart:collection';
+
+import 'package:analyzer/context/context_root.dart' as old;
+import 'package:analyzer/dart/analysis/analysis_context.dart';
+import 'package:analyzer/dart/analysis/context_locator.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/file_system/physical_file_system.dart'
+ show PhysicalResourceProvider;
+import 'package:analyzer/src/context/builder.dart'
+ show ContextBuilder, ContextBuilderOptions;
+import 'package:analyzer/src/dart/analysis/driver.dart'
+ show AnalysisDriver, AnalysisDriverScheduler;
+import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
+import 'package:analyzer/src/dart/analysis/file_state.dart'
+ show FileContentOverlay;
+import 'package:analyzer/src/dart/sdk/sdk.dart' show FolderBasedDartSdk;
+import 'package:analyzer/src/generated/sdk.dart' show DartSdkManager;
+import 'package:analyzer/src/generated/source.dart' show ContentCache;
+import 'package:front_end/src/base/performance_logger.dart' show PerformanceLog;
+import 'package:front_end/src/byte_store/byte_store.dart' show MemoryByteStore;
+import 'package:meta/meta.dart';
+
+/**
+ * An implementation of a context locator.
+ */
+class ContextLocatorImpl implements ContextLocator {
+ /**
+ * The name of the analysis options file.
+ */
+ static const String ANALYSIS_OPTIONS_NAME = 'analysis_options.yaml';
+
+ /**
+ * The old name of the analysis options file.
+ */
+ static const String OLD_ANALYSIS_OPTIONS_NAME = '.analysis_options';
+
+ /**
+ * The name of the packages folder.
+ */
+ static const String PACKAGES_DIR_NAME = 'packages';
+
+ /**
+ * The name of the packages file.
+ */
+ static const String PACKAGES_FILE_NAME = '.packages';
+
+ /**
+ * The resource provider used to access the file system.
+ */
+ final ResourceProvider resourceProvider;
+
+ /**
+ * Initialize a newly created context locator. If a [resourceProvider] is
+ * supplied, it will be used to access the file system. Otherwise the default
+ * resource provider will be used.
+ */
+ ContextLocatorImpl({ResourceProvider resourceProvider})
+ : this.resourceProvider =
+ resourceProvider ?? PhysicalResourceProvider.INSTANCE;
+
+ /**
+ * Return the path to the default location of the SDK.
+ */
+ String get _defaultSdkPath =>
+ FolderBasedDartSdk.defaultSdkDirectory(resourceProvider).path;
+
+ @override
+ List<AnalysisContext> locateContexts(
+ {@required List<String> includedPaths,
+ List<String> excludedPaths: null,
+ String packagesFile: null,
+ String sdkPath: null}) {
+ if (includedPaths == null || includedPaths.isEmpty) {
+ throw new ArgumentError('There must be at least one included path');
+ }
+ List<AnalysisContext> contextList = <AnalysisContext>[];
+ List<ContextRoot> roots =
+ locateRoots(includedPaths, excludedPaths: excludedPaths);
+ PerformanceLog performanceLog = new PerformanceLog(new StringBuffer());
+ AnalysisDriverScheduler scheduler =
+ new AnalysisDriverScheduler(performanceLog);
+ DartSdkManager sdkManager =
+ new DartSdkManager(sdkPath ?? _defaultSdkPath, true);
+ scheduler.start();
+ ContextBuilderOptions options = new ContextBuilderOptions();
+ ContextBuilder builder = new ContextBuilder(
+ resourceProvider, sdkManager, new ContentCache(),
+ options: options);
+ if (packagesFile != null) {
+ options.defaultPackageFilePath = packagesFile;
+ }
+ builder.analysisDriverScheduler = scheduler;
+ builder.byteStore = new MemoryByteStore();
+ builder.fileContentOverlay = new FileContentOverlay();
+ builder.performanceLog = performanceLog;
+ for (ContextRoot root in roots) {
+ old.ContextRoot contextRoot =
+ new old.ContextRoot(root.root.path, root.excludedPaths);
+ AnalysisDriver driver = builder.buildDriver(contextRoot);
+ DriverBasedAnalysisContext context =
+ new DriverBasedAnalysisContext(resourceProvider, driver);
+ context.includedPaths = root.includedPaths;
+ context.excludedPaths = root.excludedPaths;
+ contextList.add(context);
+ }
+ return contextList;
+ }
+
+ /**
+ * Return a list of the context roots that should be used to analyze the files
+ * that are included by the list of [includedPaths] and not excluded by the
+ * list of [excludedPaths].
+ */
+ @visibleForTesting
+ List<ContextRoot> locateRoots(List<String> includedPaths,
+ {List<String> excludedPaths}) {
+ //
+ // Compute the list of folders and files that are to be included.
+ //
+ List<Folder> includedFolders = <Folder>[];
+ List<File> includedFiles = <File>[];
+ _resourcesFromPaths(includedPaths, includedFolders, includedFiles);
+ //
+ // Compute the list of folders and files that are to be excluded.
+ //
+ List<Folder> excludedFolders = <Folder>[];
+ List<File> excludedFiles = <File>[];
+ _resourcesFromPaths(
+ excludedPaths ?? const <String>[], excludedFolders, excludedFiles);
+ //
+ // Use the excluded folders and files to filter the included folders and
+ // files.
+ //
+ includedFolders = includedFolders
+ .where((Folder includedFolder) =>
+ !_containedInAny(excludedFolders, includedFolder) &&
+ !_containedInAny(includedFolders, includedFolder))
+ .toList();
+ includedFiles = includedFiles
+ .where((File includedFile) =>
+ !_containedInAny(excludedFolders, includedFile) &&
+ !excludedFiles.contains(includedFile) &&
+ !_containedInAny(includedFolders, includedFile))
+ .toList();
+ //
+ // We now have a list of all of the files and folders that need to be
+ // analyzed. For each, walk the directory structure and figure out where to
+ // create context roots.
+ //
+ List<ContextRoot> roots = <ContextRoot>[];
+ for (Folder folder in includedFolders) {
+ _createContextRoots(roots, folder, excludedFolders, null);
+ }
+ for (File file in includedFiles) {
+ Folder parent = file.parent;
+ ContextRoot root = new ContextRoot(file);
+ root.packagesFile = _findPackagesFile(parent);
+ root.optionsFile = _findOptionsFile(parent);
+ root.included.add(file);
+ roots.add(root);
+ }
+
+ return roots;
+ }
+
+ /**
+ * Return `true` if the given [resource] is contained in one or more of the
+ * given [folders].
+ */
+ bool _containedInAny(Iterable<Folder> folders, Resource resource) =>
+ folders.any((Folder folder) => folder.contains(resource.path));
+
+ void _createContextRoots(List<ContextRoot> roots, Folder folder,
+ List<Folder> excludedFolders, ContextRoot containingRoot) {
+ //
+ // Create a context root for the given [folder] is appropriate.
+ //
+ if (containingRoot == null) {
+ ContextRoot root = new ContextRoot(folder);
+ root.packagesFile = _findPackagesFile(folder);
+ root.optionsFile = _findOptionsFile(folder);
+ root.included.add(folder);
+ roots.add(root);
+ containingRoot = root;
+ } else {
+ File packagesFile = _getPackagesFile(folder);
+ File optionsFile = _getOptionsFile(folder);
+ if (packagesFile != null || optionsFile != null) {
+ ContextRoot root = new ContextRoot(folder);
+ root.packagesFile = packagesFile ?? containingRoot.packagesFile;
+ root.optionsFile = optionsFile ?? containingRoot.optionsFile;
+ root.included.add(folder);
+ containingRoot.excluded.add(folder);
+ roots.add(root);
+ containingRoot = root;
+ }
+ }
+ //
+ // Check each of the subdirectories to see whether a context root needs to
+ // be added for it.
+ //
+ try {
+ for (Resource child in folder.getChildren()) {
+ if (child is Folder) {
+ if (excludedFolders.contains(folder) ||
+ folder.shortName.startsWith('.') ||
+ folder.shortName == PACKAGES_DIR_NAME) {
+ containingRoot.excluded.add(folder);
+ } else {
+ _createContextRoots(roots, child, excludedFolders, containingRoot);
+ }
+ }
+ }
+ } on FileSystemException {
+ // The directory either doesn't exist or cannot be read. Either way, there
+ // are no subdirectories that need to be added.
+ }
+ }
+
+ /**
+ * Return the analysis options file to be used to analyze files in the given
+ * [folder], or `null` if there is no analysis options file in the given
+ * folder or any parent folder.
+ */
+ File _findOptionsFile(Folder folder) {
+ while (folder != null) {
+ File packagesFile = _getOptionsFile(folder);
+ if (packagesFile != null) {
+ return packagesFile;
+ }
+ folder = folder.parent;
+ }
+ return null;
+ }
+
+ /**
+ * Return the packages file to be used to analyze files in the given [folder],
+ * or `null` if there is no packages file in the given folder or any parent
+ * folder.
+ */
+ File _findPackagesFile(Folder folder) {
+ while (folder != null) {
+ File packagesFile = _getPackagesFile(folder);
+ if (packagesFile != null) {
+ return packagesFile;
+ }
+ folder = folder.parent;
+ }
+ return null;
+ }
+
+ /**
+ * If the given [directory] contains a file with the given [name], then return
+ * the file. Otherwise, return `null`.
+ */
+ File _getFile(Folder directory, String name) {
+ Resource resource = directory.getChild(name);
+ if (resource is File && resource.exists) {
+ return resource;
+ }
+ return null;
+ }
+
+ /**
+ * Return the analysis options file in the given [folder], or `null` if the
+ * folder does not contain an analysis options file.
+ */
+ File _getOptionsFile(Folder folder) =>
+ _getFile(folder, ANALYSIS_OPTIONS_NAME) ??
+ _getFile(folder, OLD_ANALYSIS_OPTIONS_NAME);
+
+ /**
+ * Return the packages file in the given [folder], or `null` if the folder
+ * does not contain a packages file.
+ */
+ File _getPackagesFile(Folder folder) => _getFile(folder, PACKAGES_FILE_NAME);
+
+ /**
+ * Add to the given lists of [folders] and [files] all of the resources in the
+ * given list of [paths] that exist and are not contained within one of the
+ * folders.
+ */
+ void _resourcesFromPaths(
+ List<String> paths, List<Folder> folders, List<File> files) {
+ for (String path in _uniqueSortedPaths(paths)) {
+ Resource resource = resourceProvider.getResource(path);
+ if (resource.exists && !_containedInAny(folders, resource)) {
+ if (resource is Folder) {
+ folders.add(resource);
+ } else if (resource is File) {
+ files.add(resource);
+ } else {
+ // Internal error: unhandled kind of resource.
+ }
+ }
+ }
+ }
+
+ /**
+ * Return a list of paths that contains all of the unique elements from the
+ * given list of [paths], sorted such that shorter paths are first.
+ */
+ List<String> _uniqueSortedPaths(List<String> paths) {
+ Set<String> uniquePaths = new HashSet<String>.from(paths);
+ List<String> sortedPaths = uniquePaths.toList();
+ sortedPaths.sort((a, b) => a.length - b.length);
+ return sortedPaths;
+ }
+}
+
+@visibleForTesting
+class ContextRoot {
+ final Resource root;
+ final List<Resource> included = <Resource>[];
+ final List<Resource> excluded = <Resource>[];
+ File packagesFile;
+ File optionsFile;
+
+ ContextRoot(this.root);
+
+ List<String> get excludedPaths =>
+ excluded.map((Resource folder) => folder.path).toList();
+
+ @override
+ int get hashCode => root.path.hashCode;
+
+ List<String> get includedPaths =>
+ included.map((Resource folder) => folder.path).toList();
+
+ @override
+ bool operator ==(Object other) {
+ return other is ContextRoot && root.path == other.root.path;
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart b/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
new file mode 100644
index 0000000..03356db
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
@@ -0,0 +1,120 @@
+// 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:analyzer/dart/analysis/analysis_context.dart';
+import 'package:analyzer/dart/analysis/session.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart' hide AnalysisResult;
+import 'package:analyzer/src/generated/engine.dart' show AnalysisOptions;
+import 'package:path/src/context.dart';
+
+/**
+ * An analysis context whose implementation is based on an analysis driver.
+ */
+class DriverBasedAnalysisContext implements AnalysisContext {
+ /**
+ * The resource provider used to access the file system.
+ */
+ final ResourceProvider resourceProvider;
+
+ /**
+ * The driver on which this context is based.
+ */
+ final AnalysisDriver driver;
+
+ @override
+ List<String> includedPaths;
+
+ @override
+ List<String> excludedPaths;
+
+ /**
+ * Initialize a newly created context that uses the given [resourceProvider]
+ * to access the file system and that is based on the given analysis [driver].
+ */
+ DriverBasedAnalysisContext(this.resourceProvider, this.driver);
+
+ @override
+ AnalysisOptions get analysisOptions => driver.analysisOptions;
+
+ @override
+ AnalysisSession get currentSession => driver.currentSession;
+
+ @override
+ Iterable<String> analyzedFiles() sync* {
+ for (String path in includedPaths) {
+ Resource resource = resourceProvider.getResource(path);
+ if (resource is File) {
+ yield path;
+ } else if (resource is Folder) {
+ yield* _includedFilesInFolder(resource);
+ } else {
+ Type type = resource.runtimeType;
+ throw new StateError('Unknown resource at path "$path" ($type)');
+ }
+ }
+ }
+
+ @override
+ bool isAnalyzed(String path) {
+ return _isIncluded(path) && !_isExcluded(path);
+ }
+
+ /**
+ * Return the absolute paths of all of the files that are included in the
+ * given [folder].
+ */
+ Iterable<String> _includedFilesInFolder(Folder folder) sync* {
+ for (Resource resource in folder.getChildren()) {
+ if (resource is File) {
+ yield resource.path;
+ } else if (resource is Folder) {
+ yield* _includedFilesInFolder(resource);
+ } else {
+ String path = resource.path;
+ Type type = resource.runtimeType;
+ throw new StateError('Unknown resource at path "$path" ($type)');
+ }
+ }
+ }
+
+ /**
+ * Return `true` if the given [path] is either the same as or inside of one of
+ * the [excludedPaths].
+ */
+ bool _isExcluded(String path) {
+ Context context = resourceProvider.pathContext;
+ for (String excludedPath in excludedPaths) {
+ if (context.isAbsolute(excludedPath)) {
+ if (context.isWithin(excludedPath, path)) {
+ return true;
+ }
+ } else {
+ // The documentation claims that [excludedPaths] only contains absolute
+ // paths, so we shouldn't be able to reach this point.
+ for (String includedPath in includedPaths) {
+ if (context.isWithin(
+ context.join(includedPath, excludedPath), path)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return `true` if the given [path] is either the same as or inside of one of
+ * the [includedPaths].
+ */
+ bool _isIncluded(String path) {
+ Context context = resourceProvider.pathContext;
+ for (String includedPath in includedPaths) {
+ if (context.isWithin(includedPath, path)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 57b6b01..0ec3a44 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -4179,17 +4179,10 @@
if (parent is TypedLiteralImpl && parent.constKeyword != null) {
// Inside an explicitly `const` list or map literal.
return true;
- } else if (parent is InstanceCreationExpression) {
- if (parent.keyword?.keyword == Keyword.CONST) {
- // Inside an explicitly `const` instance creation expression.
- return true;
- } else if (parent.keyword?.keyword == Keyword.NEW) {
- // Inside an explicitly non-`const` instance creation expression.
- return false;
- }
- // We need to ask the parent because it might be `const` just because
- // it's possible for it to be.
- return parent.isConst;
+ } else if (parent is InstanceCreationExpression &&
+ parent.keyword?.keyword == Keyword.CONST) {
+ // Inside an explicitly `const` instance creation expression.
+ return true;
} else if (parent is Annotation) {
// Inside an annotation.
return true;
@@ -6568,10 +6561,43 @@
* can be computationally expensive.
*/
bool canBeConst() {
+ //
+ // Verify that the invoked constructor is a const constructor.
+ //
ConstructorElement element = staticElement;
if (element == null || !element.isConst) {
return false;
}
+ //
+ // Verify that all of the arguments are, or could be, constant expressions.
+ //
+ for (Expression argument in argumentList.arguments) {
+ if (argument is InstanceCreationExpression) {
+ if (!argument.isConst) {
+ return false;
+ }
+ } else if (argument is TypedLiteral) {
+ if (!argument.isConst) {
+ return false;
+ }
+ } else if (argument is LiteralImpl) {
+ if (argument is StringInterpolation) {
+ return false;
+ } else if (argument is AdjacentStrings) {
+ for (StringLiteral string in (argument as AdjacentStrings).strings) {
+ if (string is StringInterpolation) {
+ return false;
+ }
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+ //
+ // Verify that the evaluation of the constructor would not produce an
+ // exception.
+ //
Token oldKeyword = keyword;
ConstantAnalysisErrorListener listener =
new ConstantAnalysisErrorListener();
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
index 824b3cb..7d315d4 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
@@ -406,6 +406,14 @@
"but does not invoke the overridden method.");
/**
+ * When the left operand of a binary expression uses '?.' operator, it can be
+ * `null`.
+ */
+ static const HintCode NULL_AWARE_BEFORE_OPERATOR = const HintCode(
+ 'NULL_AWARE_BEFORE_OPERATOR',
+ "The left operand uses '?.', so its value can be null.");
+
+ /**
* A condition in a control flow statement could evaluate to `null` because it
* uses the null-aware '?.' operator.
*/
@@ -417,6 +425,15 @@
"necessary.");
/**
+ * A condition in operands of a logical operator could evaluate to `null`
+ * because it uses the null-aware '?.' operator.
+ */
+ static const HintCode NULL_AWARE_IN_LOGICAL_OPERATOR = const HintCode(
+ 'NULL_AWARE_IN_LOGICAL_OPERATOR',
+ "The value of the '?.' operator can be 'null', which isn't appropriate "
+ "as an operand of a logical operator.");
+
+ /**
* Hint for classes that override equals, but not hashCode.
*
* Parameters:
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 7bc0435..2fad14c 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -151,18 +151,6 @@
}
@override
- Object visitAssertInitializer(AssertInitializer node) {
- _checkForPossibleNullCondition(node.condition);
- return super.visitAssertInitializer(node);
- }
-
- @override
- Object visitAssertStatement(AssertStatement node) {
- _checkForPossibleNullCondition(node.condition);
- return super.visitAssertStatement(node);
- }
-
- @override
Object visitAssignmentExpression(AssignmentExpression node) {
TokenType operatorType = node.operator.type;
if (operatorType == TokenType.EQ) {
@@ -201,12 +189,6 @@
}
@override
- Object visitConditionalExpression(ConditionalExpression node) {
- _checkForPossibleNullCondition(node.condition);
- return super.visitConditionalExpression(node);
- }
-
- @override
Object visitConstructorDeclaration(ConstructorDeclaration node) {
if (resolutionMap.elementDeclaredByConstructorDeclaration(node).isFactory) {
if (node.body is BlockFunctionBody) {
@@ -221,12 +203,6 @@
}
@override
- Object visitDoStatement(DoStatement node) {
- _checkForPossibleNullCondition(node.condition);
- return super.visitDoStatement(node);
- }
-
- @override
Object visitExportDirective(ExportDirective node) {
_checkForDeprecatedMemberUse(node.uriElement, node);
return super.visitExportDirective(node);
@@ -239,12 +215,6 @@
}
@override
- Object visitForStatement(ForStatement node) {
- _checkForPossibleNullCondition(node.condition);
- return super.visitForStatement(node);
- }
-
- @override
Object visitFunctionDeclaration(FunctionDeclaration node) {
bool wasInDeprecatedMember = inDeprecatedMember;
ExecutableElement element = node.element;
@@ -260,12 +230,6 @@
}
@override
- Object visitIfStatement(IfStatement node) {
- _checkForPossibleNullCondition(node.condition);
- return super.visitIfStatement(node);
- }
-
- @override
Object visitImportDirective(ImportDirective node) {
_checkForDeprecatedMemberUse(node.uriElement, node);
ImportElement importElement = node.element;
@@ -315,8 +279,7 @@
Object visitMethodInvocation(MethodInvocation node) {
Expression realTarget = node.realTarget;
_checkForAbstractSuperMemberReference(realTarget, node.methodName);
- _checkForCanBeNullAfterNullAware(
- realTarget, node.operator, null, node.methodName);
+ _checkForNullAwareHints(node, node.operator);
DartType staticInvokeType = node.staticInvokeType;
if (staticInvokeType is InterfaceType) {
MethodElement methodElement = staticInvokeType.lookUpMethod(
@@ -342,8 +305,7 @@
Object visitPropertyAccess(PropertyAccess node) {
Expression realTarget = node.realTarget;
_checkForAbstractSuperMemberReference(realTarget, node.propertyName);
- _checkForCanBeNullAfterNullAware(
- realTarget, node.operator, node.propertyName, null);
+ _checkForNullAwareHints(node, node.operator);
return super.visitPropertyAccess(node);
}
@@ -373,12 +335,6 @@
return super.visitVariableDeclaration(node);
}
- @override
- Object visitWhileStatement(WhileStatement node) {
- _checkForPossibleNullCondition(node.condition);
- return super.visitWhileStatement(node);
- }
-
/**
* Check for the passed is expression for the unnecessary type check hint codes as well as null
* checks expressed using an is expression.
@@ -591,44 +547,6 @@
}
/**
- * Produce a hint if the given [target] could have a value of `null`, and
- * [identifier] is not a name of a getter or a method that exists in the
- * class [Null].
- */
- void _checkForCanBeNullAfterNullAware(Expression target, Token operator,
- SimpleIdentifier propertyName, SimpleIdentifier methodName) {
- if (operator?.type == TokenType.QUESTION_PERIOD) {
- return;
- }
- bool isNullTypeMember() {
- if (propertyName != null) {
- String name = propertyName.name;
- return _nullType.lookUpGetter(name, _currentLibrary) != null;
- }
- if (methodName != null) {
- String name = methodName.name;
- return _nullType.lookUpMethod(name, _currentLibrary) != null;
- }
- return false;
- }
-
- target = target?.unParenthesized;
- if (target is MethodInvocation) {
- if (target.operator?.type == TokenType.QUESTION_PERIOD &&
- !isNullTypeMember()) {
- _errorReporter.reportErrorForNode(
- HintCode.CAN_BE_NULL_AFTER_NULL_AWARE, target);
- }
- } else if (target is PropertyAccess) {
- if (target.operator.type == TokenType.QUESTION_PERIOD &&
- !isNullTypeMember()) {
- _errorReporter.reportErrorForNode(
- HintCode.CAN_BE_NULL_AFTER_NULL_AWARE, target);
- }
- }
- }
-
- /**
* Given some [Element], look at the associated metadata and report the use of the member if
* it is declared as deprecated.
*
@@ -1088,57 +1006,74 @@
}
/**
- * Produce a hint if the given [condition] could have a value of `null`.
+ * Produce several null-aware related hints.
*/
- void _checkForPossibleNullCondition(Expression condition) {
- condition = condition?.unParenthesized;
- if (condition is BinaryExpression) {
- _checkForPossibleNullConditionInBinaryExpression(condition);
- } else if (condition is PrefixExpression) {
- _checkForPossibleNullConditionInPrefixExpression(condition);
- } else {
- _checkForPossibleNullConditionInSimpleExpression(condition);
+ void _checkForNullAwareHints(Expression node, Token operator) {
+ if (operator == null || operator.type != TokenType.QUESTION_PERIOD) {
+ return;
}
- }
- /**
- * Produce a hint if any of the parts of the given binary [condition] could
- * have a value of `null`.
- */
- void _checkForPossibleNullConditionInBinaryExpression(
- BinaryExpression condition) {
- TokenType type = condition.operator?.type;
- if (type == TokenType.AMPERSAND_AMPERSAND || type == TokenType.BAR_BAR) {
- _checkForPossibleNullCondition(condition.leftOperand);
- _checkForPossibleNullCondition(condition.rightOperand);
+ // childOfParent is used to know from which branch node comes.
+ var childOfParent = node;
+ var parent = node.parent;
+ while (parent is ParenthesizedExpression) {
+ childOfParent = parent;
+ parent = parent.parent;
}
- }
- /**
- * Produce a hint if the operand of the given prefix [condition] could
- * have a value of `null`.
- */
- void _checkForPossibleNullConditionInPrefixExpression(
- PrefixExpression condition) {
- if (condition.operator?.type == TokenType.BANG) {
- _checkForPossibleNullCondition(condition.operand);
+ // CAN_BE_NULL_AFTER_NULL_AWARE
+ if (parent is MethodInvocation &&
+ parent.operator.type != TokenType.QUESTION_PERIOD &&
+ _nullType.lookUpMethod(parent.methodName.name, _currentLibrary) ==
+ null) {
+ _errorReporter.reportErrorForNode(
+ HintCode.CAN_BE_NULL_AFTER_NULL_AWARE, childOfParent);
+ return;
}
- }
+ if (parent is PropertyAccess &&
+ parent.operator.type != TokenType.QUESTION_PERIOD &&
+ _nullType.lookUpGetter(parent.propertyName.name, _currentLibrary) ==
+ null) {
+ _errorReporter.reportErrorForNode(
+ HintCode.CAN_BE_NULL_AFTER_NULL_AWARE, childOfParent);
+ return;
+ }
+ if (parent is CascadeExpression && parent.target == childOfParent) {
+ _errorReporter.reportErrorForNode(
+ HintCode.CAN_BE_NULL_AFTER_NULL_AWARE, childOfParent);
+ return;
+ }
- /**
- * Produce a hint if the given [condition] could have a value of `null`.
- */
- void _checkForPossibleNullConditionInSimpleExpression(Expression condition) {
- if (condition is MethodInvocation) {
- if (condition.operator?.type == TokenType.QUESTION_PERIOD) {
- _errorReporter.reportErrorForNode(
- HintCode.NULL_AWARE_IN_CONDITION, condition);
- }
- } else if (condition is PropertyAccess) {
- if (condition.operator?.type == TokenType.QUESTION_PERIOD) {
- _errorReporter.reportErrorForNode(
- HintCode.NULL_AWARE_IN_CONDITION, condition);
- }
+ // NULL_AWARE_IN_CONDITION
+ if (parent is IfStatement && parent.condition == childOfParent ||
+ parent is ForStatement && parent.condition == childOfParent ||
+ parent is DoStatement && parent.condition == childOfParent ||
+ parent is WhileStatement && parent.condition == childOfParent ||
+ parent is ConditionalExpression && parent.condition == childOfParent ||
+ parent is AssertStatement && parent.condition == childOfParent) {
+ _errorReporter.reportErrorForNode(
+ HintCode.NULL_AWARE_IN_CONDITION, childOfParent);
+ return;
+ }
+
+ // NULL_AWARE_IN_LOGICAL_OPERATOR
+ if (parent is PrefixExpression && parent.operator.type == TokenType.BANG ||
+ parent is BinaryExpression &&
+ [TokenType.BAR_BAR, TokenType.AMPERSAND_AMPERSAND]
+ .contains(parent.operator.type)) {
+ _errorReporter.reportErrorForNode(
+ HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR, childOfParent);
+ return;
+ }
+
+ // NULL_AWARE_BEFORE_OPERATOR
+ if (parent is BinaryExpression &&
+ ![TokenType.EQ_EQ, TokenType.BANG_EQ, TokenType.QUESTION_QUESTION]
+ .contains(parent.operator.type) &&
+ parent.leftOperand == childOfParent) {
+ _errorReporter.reportErrorForNode(
+ HintCode.NULL_AWARE_BEFORE_OPERATOR, childOfParent);
+ return;
}
}
diff --git a/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart b/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
index 051b47d..852f5ef 100644
--- a/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
+++ b/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
@@ -52,4 +52,17 @@
String convertedPath = resourceProvider.convertPath(path);
return resourceProvider.newFolder(convertedPath);
}
+
+ String join(String part1,
+ [String part2,
+ String part3,
+ String part4,
+ String part5,
+ String part6,
+ String part7,
+ String part8]) =>
+ resourceProvider.pathContext
+ .join(part1, part2, part3, part4, part5, part6, part7, part8);
+
+ String convertPath(String path) => resourceProvider.convertPath(path);
}
diff --git a/pkg/analyzer/test/generated/hint_code_kernel_test.dart b/pkg/analyzer/test/generated/hint_code_kernel_test.dart
index 76f0dc1..9f7c1e0 100644
--- a/pkg/analyzer/test/generated/hint_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_kernel_test.dart
@@ -64,6 +64,13 @@
@failingTest
@override
+ test_canBeNullAfterNullAware_after_cascade() async {
+ // Expected 1 errors of type HintCode.CAN_BE_NULL_AFTER_NULL_AWARE, found 0
+ return super.test_canBeNullAfterNullAware_after_cascade();
+ }
+
+ @failingTest
+ @override
test_deadCode_deadBlock_else() async {
// Expected 1 errors of type HintCode.DEAD_CODE, found 0
return super.test_deadCode_deadBlock_else();
diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
index d5c7d92..69042ff 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -266,6 +266,52 @@
verify([source]);
}
+ test_canBeNullAfterNullAware_after_cascade() async {
+ Source source = addSource(r'''
+m(x) {
+ x..a?.b.c;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+ verify([source]);
+ }
+
+ test_canBeNullAfterNullAware_before_cascade() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a..m();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+ verify([source]);
+ }
+
+ test_canBeNullAfterNullAware_cascade_parenthesis() async {
+ Source source = addSource(r'''
+m(x) {
+ (x?.a)..m();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+ verify([source]);
+ }
+
+ test_canBeNullAfterNullAware_several() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a
+ ..m()
+ ..m();
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
+ verify([source]);
+ }
+
test_deadCode_deadBlock_conditionalElse() async {
Source source = addSource(r'''
f() {
@@ -2535,83 +2581,6 @@
verify([source]);
}
- test_nullAwareInCondition_if_conditionalAnd_first() async {
- Source source = addSource(r'''
-m(x) {
- if (x?.a && x.b) {}
-}
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
- verify([source]);
- }
-
- test_nullAwareInCondition_if_conditionalAnd_second() async {
- Source source = addSource(r'''
-m(x) {
- if (x.a && x?.b) {}
-}
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
- verify([source]);
- }
-
- test_nullAwareInCondition_if_conditionalAnd_third() async {
- Source source = addSource(r'''
-m(x) {
- if (x.a && x.b && x?.c) {}
-}
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
- verify([source]);
- }
-
- test_nullAwareInCondition_if_conditionalOr_first() async {
- Source source = addSource(r'''
-m(x) {
- if (x?.a || x.b) {}
-}
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
- verify([source]);
- }
-
- test_nullAwareInCondition_if_conditionalOr_second() async {
- Source source = addSource(r'''
-m(x) {
- if (x.a || x?.b) {}
-}
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
- verify([source]);
- }
-
- test_nullAwareInCondition_if_conditionalOr_third() async {
- Source source = addSource(r'''
-m(x) {
- if (x.a || x.b || x?.c) {}
-}
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
- verify([source]);
- }
-
- test_nullAwareInCondition_if_not() async {
- Source source = addSource(r'''
-m(x) {
- if (!x?.a) {}
-}
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
- verify([source]);
- }
-
test_nullAwareInCondition_if_parenthesized() async {
Source source = addSource(r'''
m(x) {
@@ -2634,6 +2603,160 @@
verify([source]);
}
+ test_nullAwareInLogicalOperator_conditionalAnd_first() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a && x.b;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR]);
+ verify([source]);
+ }
+
+ test_nullAwareInLogicalOperator_conditionalAnd_second() async {
+ Source source = addSource(r'''
+m(x) {
+ x.a && x?.b;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR]);
+ verify([source]);
+ }
+
+ test_nullAwareInLogicalOperator_conditionalAnd_third() async {
+ Source source = addSource(r'''
+m(x) {
+ x.a && x.b && x?.c;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR]);
+ verify([source]);
+ }
+
+ test_nullAwareInLogicalOperator_conditionalOr_first() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a || x.b;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR]);
+ verify([source]);
+ }
+
+ test_nullAwareInLogicalOperator_conditionalOr_second() async {
+ Source source = addSource(r'''
+m(x) {
+ x.a || x?.b;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR]);
+ verify([source]);
+ }
+
+ test_nullAwareInLogicalOperator_conditionalOr_third() async {
+ Source source = addSource(r'''
+m(x) {
+ x.a || x.b || x?.c;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR]);
+ verify([source]);
+ }
+
+ test_nullAwareInLogicalOperator_not() async {
+ Source source = addSource(r'''
+m(x) {
+ !x?.a;
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.NULL_AWARE_IN_LOGICAL_OPERATOR]);
+ verify([source]);
+ }
+
+ test_nullAwareBeforeOperator_minus() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a - '';
+}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.NULL_AWARE_BEFORE_OPERATOR]);
+ verify([source]);
+ }
+
+ test_nullAwareBeforeOperator_ok_equal_equal() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a == '';
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ test_nullAwareBeforeOperator_ok_not_equal() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a != '';
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ test_nullAwareBeforeOperator_ok_question_question() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a ?? true;
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ test_nullAwareBeforeOperator_ok_assignment() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a = '';
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ test_nullAwareBeforeOperator_ok_is() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a is String;
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ test_nullAwareBeforeOperator_ok_is_not() async {
+ Source source = addSource(r'''
+m(x) {
+ x?.a is! String;
+}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
@failingTest
test_overrideEqualsButNotHashCode() async {
Source source = addSource(r'''
diff --git a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
index 7f4695e..f3bbd6c 100644
--- a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
@@ -273,6 +273,18 @@
bool get useCFE => true;
@override
+ test_dynamicObjectGetter_hashCode() async {
+ // Fails with non-kernel analyzer but works correctly with kernel.
+ await super.test_dynamicObjectGetter_hashCode();
+ }
+
+ @override
+ test_dynamicObjectMethod_toString() async {
+ // Fails with non-kernel analyzer but works correctly with kernel.
+ await super.test_dynamicObjectMethod_toString();
+ }
+
+ @override
test_futureOr_promotion3() async {
// Test passes even though the overridden method fails.
await super.test_futureOr_promotion3();
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 4644244..8feaf44 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -2750,6 +2750,7 @@
resetWith(options: options);
}
+ @failingTest // https://github.com/dart-lang/sdk/issues/32173
test_dynamicObjectGetter_hashCode() async {
String code = r'''
main() {
@@ -2758,9 +2759,10 @@
}
''';
await resolveTestUnit(code);
- expectInitializerType('foo', 'int', isNull);
+ expectInitializerType('foo', 'dynamic', isNull);
}
+ @failingTest // https://github.com/dart-lang/sdk/issues/32173
test_dynamicObjectMethod_toString() async {
String code = r'''
main() {
@@ -2769,7 +2771,7 @@
}
''';
await resolveTestUnit(code);
- expectInitializerType('foo', 'String', isNull);
+ expectInitializerType('foo', 'dynamic', isNull);
}
test_futureOr_promotion1() async {
diff --git a/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart b/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart
new file mode 100644
index 0000000..029ad6b
--- /dev/null
+++ b/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart
@@ -0,0 +1,415 @@
+// 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:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/dart/analysis/context_locator.dart';
+import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(ContextLocatorImplTest);
+ });
+}
+
+@reflectiveTest
+class ContextLocatorImplTest extends Object with ResourceProviderMixin {
+ ContextLocatorImpl contextLocator;
+
+ ContextRoot findRoot(List<ContextRoot> roots, Resource rootFolder) {
+ for (ContextRoot root in roots) {
+ if (root.root == rootFolder) {
+ return root;
+ }
+ }
+ StringBuffer buffer = new StringBuffer();
+ buffer.write('Could not find "');
+ buffer.write(rootFolder.path);
+ buffer.write('" in');
+ for (ContextRoot root in roots) {
+ buffer.writeln();
+ buffer.write(' ');
+ buffer.write(root.root);
+ }
+ fail(buffer.toString());
+ }
+
+ File newOptionsFile(String directoryPath) {
+ return newFile(resourceProvider.pathContext
+ .join(directoryPath, ContextLocatorImpl.ANALYSIS_OPTIONS_NAME));
+ }
+
+ File newPackagesFile(String directoryPath) {
+ return newFile(resourceProvider.pathContext
+ .join(directoryPath, ContextLocatorImpl.PACKAGES_FILE_NAME));
+ }
+
+ void setUp() {
+ contextLocator = new ContextLocatorImpl(resourceProvider: resourceProvider);
+ }
+
+ void test_locateRoots_multiple_dirAndNestedDir() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ Folder innerRootFolder = newFolder('/test/outer/examples/inner');
+
+ List<ContextRoot> roots = contextLocator
+ .locateRoots([outerRootFolder.path, innerRootFolder.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, isEmpty);
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+ }
+
+ void test_locateRoots_multiple_dirAndNestedFile() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ File testFile = newFile('/test/outer/examples/inner/test.dart');
+
+ List<ContextRoot> roots =
+ contextLocator.locateRoots([outerRootFolder.path, testFile.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, isEmpty);
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+ }
+
+ void test_locateRoots_multiple_dirAndSiblingDir() {
+ Folder outer1RootFolder = newFolder('/test/outer1');
+ File outer1OptionsFile = newOptionsFile('/test/outer1');
+ File outer1PackagesFile = newPackagesFile('/test/outer1');
+
+ Folder outer2RootFolder = newFolder('/test/outer2');
+ File outer2OptionsFile = newOptionsFile('/test/outer2');
+ File outer2PackagesFile = newPackagesFile('/test/outer2');
+
+ List<ContextRoot> roots = contextLocator
+ .locateRoots([outer1RootFolder.path, outer2RootFolder.path]);
+ expect(roots, hasLength(2));
+
+ ContextRoot outer1Root = findRoot(roots, outer1RootFolder);
+ expect(outer1Root.includedPaths, unorderedEquals([outer1RootFolder.path]));
+ expect(outer1Root.excludedPaths, isEmpty);
+ expect(outer1Root.optionsFile, outer1OptionsFile);
+ expect(outer1Root.packagesFile, outer1PackagesFile);
+
+ ContextRoot outer2Root = findRoot(roots, outer2RootFolder);
+ expect(outer2Root.includedPaths, unorderedEquals([outer2RootFolder.path]));
+ expect(outer2Root.excludedPaths, isEmpty);
+ expect(outer2Root.optionsFile, outer2OptionsFile);
+ expect(outer2Root.packagesFile, outer2PackagesFile);
+ }
+
+ void test_locateRoots_multiple_dirAndSiblingFile() {
+ Folder outer1RootFolder = newFolder('/test/outer1');
+ File outer1OptionsFile = newOptionsFile('/test/outer1');
+ File outer1PackagesFile = newPackagesFile('/test/outer1');
+
+ File outer2OptionsFile = newOptionsFile('/test/outer2');
+ File outer2PackagesFile = newPackagesFile('/test/outer2');
+ File testFile = newFile('/test/outer2/test.dart');
+
+ List<ContextRoot> roots =
+ contextLocator.locateRoots([outer1RootFolder.path, testFile.path]);
+ expect(roots, hasLength(2));
+
+ ContextRoot outer1Root = findRoot(roots, outer1RootFolder);
+ expect(outer1Root.includedPaths, unorderedEquals([outer1RootFolder.path]));
+ expect(outer1Root.excludedPaths, isEmpty);
+ expect(outer1Root.optionsFile, outer1OptionsFile);
+ expect(outer1Root.packagesFile, outer1PackagesFile);
+
+ ContextRoot outer2Root = findRoot(roots, testFile);
+ expect(outer2Root.includedPaths, unorderedEquals([testFile.path]));
+ expect(outer2Root.excludedPaths, isEmpty);
+ expect(outer2Root.optionsFile, outer2OptionsFile);
+ expect(outer2Root.packagesFile, outer2PackagesFile);
+ }
+
+ void test_locateRoots_multiple_fileAndSiblingFile() {
+ ContextRoot findRootFromIncluded(
+ List<ContextRoot> roots, String includedPath) {
+ for (ContextRoot root in roots) {
+ if (root.includedPaths.contains(includedPath)) {
+ return root;
+ }
+ }
+ StringBuffer buffer = new StringBuffer();
+ buffer.write('Could not find "');
+ buffer.write(includedPath);
+ buffer.write('" in');
+ for (ContextRoot root in roots) {
+ buffer.writeln();
+ buffer.write(' ');
+ buffer.write(root.root);
+ }
+ fail(buffer.toString());
+ }
+
+ File optionsFile = newOptionsFile('/test/root');
+ File packagesFile = newPackagesFile('/test/root');
+ File testFile1 = newFile('/test/root/test1.dart');
+ File testFile2 = newFile('/test/root/test2.dart');
+
+ List<ContextRoot> roots =
+ contextLocator.locateRoots([testFile1.path, testFile2.path]);
+ expect(roots, hasLength(2));
+
+ ContextRoot outer1Root = findRootFromIncluded(roots, testFile1.path);
+ expect(outer1Root.includedPaths, unorderedEquals([testFile1.path]));
+ expect(outer1Root.excludedPaths, isEmpty);
+ expect(outer1Root.optionsFile, optionsFile);
+ expect(outer1Root.packagesFile, packagesFile);
+
+ ContextRoot outer2Root = findRootFromIncluded(roots, testFile2.path);
+ expect(outer2Root.includedPaths, unorderedEquals([testFile2.path]));
+ expect(outer2Root.excludedPaths, isEmpty);
+ expect(outer2Root.optionsFile, optionsFile);
+ expect(outer2Root.packagesFile, packagesFile);
+ }
+
+ void test_locateRoots_nested_excluded_dot() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ Folder excludedFolder = newFolder('/test/outer/.examples');
+ newOptionsFile('/test/outer/.examples/inner');
+
+ List<ContextRoot> roots =
+ contextLocator.locateRoots([outerRootFolder.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, unorderedEquals([excludedFolder.path]));
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+ }
+
+ void test_locateRoots_nested_excluded_explicit() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ Folder excludedFolder = newFolder('/test/outer/examples');
+ newOptionsFile('/test/outer/examples/inner');
+
+ List<ContextRoot> roots = contextLocator.locateRoots([outerRootFolder.path],
+ excludedPaths: [excludedFolder.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, unorderedEquals([excludedFolder.path]));
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+ }
+
+ void test_locateRoots_nested_excluded_packages() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ Folder excludedFolder = newFolder('/test/outer/packages');
+ newOptionsFile('/test/outer/packages/inner');
+
+ List<ContextRoot> roots =
+ contextLocator.locateRoots([outerRootFolder.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, unorderedEquals([excludedFolder.path]));
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+ }
+
+ void test_locateRoots_nested_multiple() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ Folder inner1RootFolder = newFolder('/test/outer/examples/inner1');
+ File inner1OptionsFile = newOptionsFile('/test/outer/examples/inner1');
+ Folder inner2RootFolder = newFolder('/test/outer/examples/inner2');
+ File inner2PackagesFile = newPackagesFile('/test/outer/examples/inner2');
+
+ List<ContextRoot> roots =
+ contextLocator.locateRoots([outerRootFolder.path]);
+ expect(roots, hasLength(3));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths,
+ unorderedEquals([inner1RootFolder.path, inner2RootFolder.path]));
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+
+ ContextRoot inner1Root = findRoot(roots, inner1RootFolder);
+ expect(inner1Root.includedPaths, unorderedEquals([inner1RootFolder.path]));
+ expect(inner1Root.excludedPaths, isEmpty);
+ expect(inner1Root.optionsFile, inner1OptionsFile);
+ expect(inner1Root.packagesFile, outerPackagesFile);
+
+ ContextRoot inner2Root = findRoot(roots, inner2RootFolder);
+ expect(inner2Root.includedPaths, unorderedEquals([inner2RootFolder.path]));
+ expect(inner2Root.excludedPaths, isEmpty);
+ expect(inner2Root.optionsFile, outerOptionsFile);
+ expect(inner2Root.packagesFile, inner2PackagesFile);
+ }
+
+ void test_locateRoots_nested_options() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ Folder innerRootFolder = newFolder('/test/outer/examples/inner');
+ File innerOptionsFile = newOptionsFile('/test/outer/examples/inner');
+
+ List<ContextRoot> roots =
+ contextLocator.locateRoots([outerRootFolder.path]);
+ expect(roots, hasLength(2));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+
+ ContextRoot innerRoot = findRoot(roots, innerRootFolder);
+ expect(innerRoot.includedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(innerRoot.excludedPaths, isEmpty);
+ expect(innerRoot.optionsFile, innerOptionsFile);
+ expect(innerRoot.packagesFile, outerPackagesFile);
+ }
+
+ void test_locateRoots_nested_optionsAndPackages() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ Folder innerRootFolder = newFolder('/test/outer/examples/inner');
+ File innerOptionsFile = newOptionsFile('/test/outer/examples/inner');
+ File innerPackagesFile = newPackagesFile('/test/outer/examples/inner');
+
+ List<ContextRoot> roots =
+ contextLocator.locateRoots([outerRootFolder.path]);
+ expect(roots, hasLength(2));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+
+ ContextRoot innerRoot = findRoot(roots, innerRootFolder);
+ expect(innerRoot.includedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(innerRoot.excludedPaths, isEmpty);
+ expect(innerRoot.optionsFile, innerOptionsFile);
+ expect(innerRoot.packagesFile, innerPackagesFile);
+ }
+
+ void test_locateRoots_nested_packages() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ Folder innerRootFolder = newFolder('/test/outer/examples/inner');
+ File innerPackagesFile = newPackagesFile('/test/outer/examples/inner');
+
+ List<ContextRoot> roots =
+ contextLocator.locateRoots([outerRootFolder.path]);
+ expect(roots, hasLength(2));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+
+ ContextRoot innerRoot = findRoot(roots, innerRootFolder);
+ expect(innerRoot.includedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(innerRoot.excludedPaths, isEmpty);
+ expect(innerRoot.optionsFile, outerOptionsFile);
+ expect(innerRoot.packagesFile, innerPackagesFile);
+ }
+
+ void test_locateRoots_single_dir_directOptions_directPackages() {
+ Folder rootFolder = newFolder('/test/root');
+ File optionsFile = newOptionsFile('/test/root');
+ File packagesFile = newPackagesFile('/test/root');
+
+ List<ContextRoot> roots = contextLocator.locateRoots([rootFolder.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot package1Root = findRoot(roots, rootFolder);
+ expect(package1Root.includedPaths, unorderedEquals([rootFolder.path]));
+ expect(package1Root.excludedPaths, isEmpty);
+ expect(package1Root.optionsFile, optionsFile);
+ expect(package1Root.packagesFile, packagesFile);
+ }
+
+ void test_locateRoots_single_dir_directOptions_inheritedPackages() {
+ Folder rootFolder = newFolder('/test/root');
+ File optionsFile = newOptionsFile('/test/root');
+ File packagesFile = newPackagesFile('/test');
+
+ List<ContextRoot> roots = contextLocator.locateRoots([rootFolder.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot package1Root = findRoot(roots, rootFolder);
+ expect(package1Root.includedPaths, unorderedEquals([rootFolder.path]));
+ expect(package1Root.excludedPaths, isEmpty);
+ expect(package1Root.optionsFile, optionsFile);
+ expect(package1Root.packagesFile, packagesFile);
+ }
+
+ void test_locateRoots_single_dir_inheritedOptions_directPackages() {
+ Folder rootFolder = newFolder('/test/root');
+ File optionsFile = newOptionsFile('/test');
+ File packagesFile = newPackagesFile('/test/root');
+
+ List<ContextRoot> roots = contextLocator.locateRoots([rootFolder.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot package1Root = findRoot(roots, rootFolder);
+ expect(package1Root.includedPaths, unorderedEquals([rootFolder.path]));
+ expect(package1Root.excludedPaths, isEmpty);
+ expect(package1Root.optionsFile, optionsFile);
+ expect(package1Root.packagesFile, packagesFile);
+ }
+
+ void test_locateRoots_single_dir_inheritedOptions_inheritedPackages() {
+ Folder rootFolder = newFolder('/test/root');
+ File optionsFile = newOptionsFile('/test');
+ File packagesFile = newPackagesFile('/test');
+
+ List<ContextRoot> roots = contextLocator.locateRoots([rootFolder.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot package1Root = findRoot(roots, rootFolder);
+ expect(package1Root.includedPaths, unorderedEquals([rootFolder.path]));
+ expect(package1Root.excludedPaths, isEmpty);
+ expect(package1Root.optionsFile, optionsFile);
+ expect(package1Root.packagesFile, packagesFile);
+ }
+
+ void test_locateRoots_single_file_inheritedOptions_directPackages() {
+ File optionsFile = newOptionsFile('/test');
+ File packagesFile = newPackagesFile('/test/root');
+ File testFile = newFile('/test/root/test.dart');
+
+ List<ContextRoot> roots = contextLocator.locateRoots([testFile.path]);
+ expect(roots, hasLength(1));
+
+ ContextRoot package1Root = findRoot(roots, testFile);
+ expect(package1Root.includedPaths, unorderedEquals([testFile.path]));
+ expect(package1Root.excludedPaths, isEmpty);
+ expect(package1Root.optionsFile, optionsFile);
+ expect(package1Root.packagesFile, packagesFile);
+ }
+}
diff --git a/pkg/analyzer/test/src/dart/ast/ast_test.dart b/pkg/analyzer/test/src/dart/ast/ast_test.dart
index 60e2002..bf5cf49 100644
--- a/pkg/analyzer/test/src/dart/ast/ast_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/ast_test.dart
@@ -462,19 +462,7 @@
testUnit = await resolveSource2('/test.dart', source);
}
- void test_isConst_instanceCreation_notExplicit_notInContext() async {
- enablePreviewDart2();
- await resolve('''
-f() => <Object>[C()];
-class C {
- const C();
-}
-''');
- assertInContext("C()", true);
- }
-
- void
- test_isConst_instanceCreation_notExplicit_notInContext_nonConstConstructor() async {
+ void test_isConst_implicit_notInContext_nonConstConstructor() async {
enablePreviewDart2();
await resolve('''
f() => <Object>[C()];
@@ -485,8 +473,25 @@
assertInContext("C()", false);
}
- void
- test_isConst_instanceCreation_notExplicit_notInContext_nonConstParam() async {
+ void test_isConst_implicit_notInContext_nonConstParam_implicitNew() async {
+ enablePreviewDart2();
+ await resolve('''
+f() {
+ return A(B());
+}
+
+class A {
+ const A(B b);
+}
+
+class B {
+ B();
+}
+''');
+ assertInContext("B())", false);
+ }
+
+ void test_isConst_implicit_notInContext_nonConstParam_int() async {
enablePreviewDart2();
await resolve('''
f(int i) => <Object>[C(i)];
@@ -497,6 +502,17 @@
''');
assertInContext("C(i)", false);
}
+
+ void test_isConst_notExplicit_notInContext() async {
+ enablePreviewDart2();
+ await resolve('''
+f() => <Object>[C()];
+class C {
+ const C();
+}
+''');
+ assertInContext("C()", true);
+ }
}
@reflectiveTest
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index 742cadb..5424157 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -42,7 +42,7 @@
import '../compiler/type_utilities.dart';
import '../js_ast/js_ast.dart' as JS;
import '../js_ast/js_ast.dart' show js;
-import '../js_ast/source_map_printer.dart' show NodeEnd, NodeSpan;
+import '../js_ast/source_map_printer.dart' show NodeEnd, NodeSpan, HoverComment;
import 'ast_builder.dart';
import 'module_compiler.dart' show BuildUnit, CompilerOptions, JSModuleFile;
import 'element_helpers.dart';
@@ -2458,28 +2458,48 @@
/// 4. initialize fields not covered in 1-3
JS.Statement _initializeFields(List<VariableDeclaration> fieldDecls,
[ConstructorDeclaration ctor]) {
- // Run field initializers if they can have side-effects.
Set<FieldElement> ctorFields;
- if (ctor != null) {
- ctorFields = ctor.initializers
- .map((c) => c is ConstructorFieldInitializer
- ? c.fieldName.staticElement as FieldElement
- : null)
- .toSet()
- ..remove(null);
- }
-
- var body = <JS.Statement>[];
emitFieldInit(FieldElement f, Expression initializer, AstNode hoverInfo) {
+ ctorFields?.add(f);
var access =
_classProperties.virtualFields[f] ?? _declareMemberName(f.getter);
var jsInit = _visitInitializer(initializer, f);
- body.add(jsInit
+ return jsInit
.toAssignExpression(js.call('this.#', [access])
..sourceInformation = _nodeSpan(hoverInfo))
- .toStatement());
+ .toStatement();
}
+ var body = <JS.Statement>[];
+ if (ctor != null) {
+ ctorFields = new HashSet<FieldElement>();
+
+ // Run constructor parameter initializers such as `this.foo`
+ for (var p in ctor.parameters.parameters) {
+ var element = p.element;
+ if (element is FieldFormalParameterElement) {
+ body.add(emitFieldInit(element.field, p.identifier, p.identifier));
+ }
+ }
+
+ // Run constructor field initializers such as `: foo = bar.baz`
+ for (var init in ctor.initializers) {
+ if (init is ConstructorFieldInitializer) {
+ var field = init.fieldName;
+ body.add(emitFieldInit(field.staticElement, init.expression, field));
+ } else if (init is AssertInitializer) {
+ body.add(_emitAssert(init.condition, init.message));
+ }
+ }
+ }
+
+ // Run field initializers if needed.
+ //
+ // We can skip fields where the initializer doesn't have side effects
+ // (for example, it's a literal value such as implicit `null`) and where
+ // there's another explicit initialization (either in the initializer list
+ // like `field = value`, or via a `this.field` parameter).
+ var fieldInit = <JS.Statement>[];
for (var field in fieldDecls) {
var f = field.element;
if (f.isStatic) continue;
@@ -2488,30 +2508,11 @@
_constants.isFieldInitConstant(field)) {
continue;
}
- emitFieldInit(f, field.initializer, field.name);
+ fieldInit.add(emitFieldInit(f, field.initializer, field.name));
}
-
- if (ctor != null) {
- // Run constructor parameter initializers such as `this.foo`
- for (var p in ctor.parameters.parameters) {
- var element = p.element;
- if (element is FieldFormalParameterElement) {
- emitFieldInit(element.field, p.identifier, p.identifier);
- }
- }
-
- // Run constructor field initializers such as `: foo = bar.baz`
- for (var init in ctor.initializers) {
- if (init is ConstructorFieldInitializer) {
- var field = init.fieldName;
- emitFieldInit(field.staticElement, init.expression, field);
- } else if (init is AssertInitializer) {
- body.add(_emitAssert(init.condition, init.message));
- }
- }
- }
-
- return JS.Statement.from(body);
+ // Run field initializers before the other ones.
+ fieldInit.addAll(body);
+ return JS.Statement.from(fieldInit);
}
/// Emits argument initializers, which handles optional/named args, as well
@@ -3018,10 +3019,18 @@
/// Emits a simple identifier, including handling an inferred generic
/// function instantiation.
@override
- JS.Expression visitSimpleIdentifier(SimpleIdentifier node) {
+ JS.Expression visitSimpleIdentifier(SimpleIdentifier node,
+ [SimpleIdentifier libraryPrefix]) {
var typeArgs = _getTypeArgs(node.staticElement, node.staticType);
var simpleId = _emitSimpleIdentifier(node)
..sourceInformation = _nodeSpan(node);
+ if (libraryPrefix != null &&
+ // Check that the JS AST is for a Dart property and not JS interop.
+ simpleId is JS.PropertyAccess &&
+ simpleId.receiver is JS.Identifier) {
+ // Attach the span to the library prefix.
+ simpleId.receiver.sourceInformation = _nodeSpan(libraryPrefix);
+ }
if (typeArgs == null) return simpleId;
return _callHelper('gbind(#, #)', [simpleId, typeArgs]);
}
@@ -3674,7 +3683,13 @@
..sourceInformation = _nodeSpan(target);
}
}
- return _visitExpression(target);
+ var result = _visitExpression(target);
+ if (target == _cascadeTarget) {
+ // Don't attach source information to a cascade target, as that would
+ // result in marking the same location from different lines.
+ result.sourceInformation = null;
+ }
+ return result;
}
/// Emits the [JS.PropertyAccess] for accessors or method calls to
@@ -3687,7 +3702,13 @@
} else {
result = new JS.PropertyAccess(jsTarget, jsName);
}
- if (node != null) result.sourceInformation = _nodeEnd(node);
+ if (node != null) {
+ // Use the full span for a cascade property so we can hover over `bar` in
+ // `..bar()` and see the `bar` method.
+ var cascade = _cascadeTarget;
+ var isCascade = cascade != null && _getTarget(node.parent) == cascade;
+ result.sourceInformation = isCascade ? _nodeSpan(node) : _nodeEnd(node);
+ }
return result;
}
@@ -4247,6 +4268,11 @@
JS.Statement _emitLazyFields(
Element target, List<VariableDeclaration> fields) {
var accessors = <JS.Method>[];
+
+ var objExpr = target is ClassElement
+ ? _emitTopLevelName(target)
+ : emitLibraryName(target);
+
for (var node in fields) {
var name = node.name.name;
var element = node.element;
@@ -4260,7 +4286,9 @@
access,
js.call('function() { return #; }',
_visitInitializer(node.initializer, node.element)) as JS.Fun,
- isGetter: true),
+ isGetter: true)
+ ..sourceInformation = _hoverComment(
+ new JS.PropertyAccess(objExpr, access), node.name),
_findAccessor(element, getter: true),
node));
@@ -4274,10 +4302,6 @@
}
}
- var objExpr = target is ClassElement
- ? _emitTopLevelName(target)
- : emitLibraryName(target);
-
return _callHelperStatement('defineLazy(#, { # });', [objExpr, accessors]);
}
@@ -4309,7 +4333,8 @@
DartType type,
SimpleIdentifier name,
ArgumentList argumentList,
- bool isConst) {
+ bool isConst,
+ [ConstructorName ctorNode]) {
if (element == null) {
return _throwUnsafe('unresolved constructor: ${type?.name ?? '<null>'}'
'.${name?.name ?? '<unnamed>'}');
@@ -4354,6 +4379,7 @@
}
// Native factory constructors are JS constructors - use new here.
var ctor = _emitConstructorName(element, type);
+ if (ctorNode != null) ctor.sourceInformation = _nodeSpan(ctorNode);
return element.isFactory && !_isJSNative(classElem)
? new JS.Call(ctor, args)
: new JS.New(ctor, args);
@@ -4447,8 +4473,7 @@
}
return _emitInstanceCreationExpression(element, getType(constructor.type),
- name, node.argumentList, node.isConst)
- ..sourceInformation = _nodeStart(node.constructorName);
+ name, node.argumentList, node.isConst, constructor);
}
bool isPrimitiveType(DartType t) => _typeRep.isPrimitive(t);
@@ -5077,13 +5102,11 @@
return _callHelper('loadLibrary');
}
- JS.Expression result;
if (isLibraryPrefix(node.prefix)) {
- result = _visitExpression(node.identifier);
+ return visitSimpleIdentifier(node.identifier, node.prefix);
} else {
- result = _emitAccess(node.prefix, node.identifier, node.staticType);
+ return _emitAccess(node.prefix, node.identifier, node.staticType);
}
- return result;
}
@override
@@ -5247,11 +5270,16 @@
/// Gets the target of a [PropertyAccess], [IndexExpression], or
/// [MethodInvocation]. These three nodes can appear in a [CascadeExpression].
- Expression _getTarget(node) {
- assert(node is IndexExpression ||
- node is PropertyAccess ||
- node is MethodInvocation);
- return node.isCascaded ? _cascadeTarget : node.target;
+ Expression _getTarget(Expression node) {
+ if (node is IndexExpression) {
+ return node.isCascaded ? _cascadeTarget : node.target;
+ } else if (node is PropertyAccess) {
+ return node.isCascaded ? _cascadeTarget : node.target;
+ } else if (node is MethodInvocation) {
+ return node.isCascaded ? _cascadeTarget : node.target;
+ } else {
+ return null;
+ }
}
@override
@@ -5766,6 +5794,20 @@
return start != null && end != null ? new NodeSpan(start, end) : null;
}
+ /// Adds a hover comment for Dart [node] using JS expression [expr], where
+ /// that expression would not otherwise not be generated into source code.
+ ///
+ /// For example, top-level and static fields are defined as lazy properties,
+ /// on the library/class, so their access expressions do not appear in the
+ /// source code.
+ HoverComment _hoverComment(JS.Expression expr, AstNode node) {
+ var start = _getLocation(node.offset);
+ var end = _getLocation(node.end);
+ return start != null && end != null
+ ? new HoverComment(expr, start, end)
+ : null;
+ }
+
SourceLocation _getLocation(int offset) {
if (offset == -1) return null;
var unit = _currentCompilationUnit;
diff --git a/pkg/dev_compiler/lib/src/js_ast/printer.dart b/pkg/dev_compiler/lib/src/js_ast/printer.dart
index 2e42e50..d787256 100644
--- a/pkg/dev_compiler/lib/src/js_ast/printer.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/printer.dart
@@ -41,6 +41,8 @@
/// Callback after printing the last character representing [node].
void exitNode(Node node) {}
+
+ Printer printer;
}
/// A simple implementation of [JavaScriptPrintingContext] suitable for tests.
@@ -86,7 +88,9 @@
context = context,
shouldCompressOutput = options.shouldCompressOutput,
danglingElseVisitor = new DanglingElseVisitor(context),
- localNamer = determineRenamer(localNamer, options);
+ localNamer = determineRenamer(localNamer, options) {
+ context.printer = this;
+ }
static LocalNamer determineRenamer(
LocalNamer localNamer, JavaScriptPrintingOptions options) {
diff --git a/pkg/dev_compiler/lib/src/js_ast/source_map_printer.dart b/pkg/dev_compiler/lib/src/js_ast/source_map_printer.dart
index d33d6ad..4474cae 100644
--- a/pkg/dev_compiler/lib/src/js_ast/source_map_printer.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/source_map_printer.dart
@@ -9,11 +9,20 @@
class NodeEnd {
final SourceLocation end;
NodeEnd(this.end);
+ toString() => '#<NodeEnd $end>';
}
class NodeSpan {
final SourceLocation start, end;
NodeSpan(this.start, this.end);
+ toString() => '#<NodeSpan $start to $end>';
+}
+
+class HoverComment {
+ final SourceLocation start, end;
+ final Expression expression;
+ HoverComment(this.expression, this.start, this.end);
+ toString() => '#<HoverComment `$expression` @ $start to $end>';
}
class SourceMapPrintingContext extends SimpleJavaScriptPrintingContext {
@@ -59,6 +68,12 @@
dartStart = srcInfo;
} else if (srcInfo is NodeSpan) {
dartStart = srcInfo.start;
+ } else if (srcInfo is HoverComment) {
+ emit('/*');
+ _mark(srcInfo.start);
+ srcInfo.expression.accept(printer);
+ _mark(srcInfo.end);
+ emit('*/');
} else if (srcInfo is! NodeEnd) {
throw new StateError(
'wrong kind of source map data: `$srcInfo` <${srcInfo.runtimeType}>');
@@ -85,7 +100,7 @@
dartEnd = srcInfo.end;
} else if (srcInfo is NodeEnd) {
dartEnd = srcInfo.end;
- } else if (srcInfo is! SourceLocation) {
+ } else if (srcInfo is! SourceLocation && srcInfo is! HoverComment) {
throw new StateError(
'wrong kind of source map data: `$srcInfo` <${srcInfo.runtimeType}>');
}
@@ -100,11 +115,9 @@
// the output.
var jsEnd = new SourceLocation(buffer.length - 1,
line: _line, column: column);
- _flushPendingMarks();
_mark(dartEnd, jsEnd);
}
} else {
- _flushPendingMarks();
_mark(dartEnd);
}
}
@@ -135,15 +148,19 @@
void _flushPendingMarks() {
var pending = _pendingDartOffset;
if (pending != null) {
- _mark(pending, _pendingJSLocation);
+ _markInternal(pending, _pendingJSLocation);
_pendingDartOffset = null;
_pendingJSLocation = null;
}
}
void _mark(SourceLocation dartLocation, [SourceLocation jsLocation]) {
+ _flushPendingMarks();
jsLocation ??= _getJSLocation();
+ _markInternal(dartLocation, jsLocation);
+ }
+ void _markInternal(SourceLocation dartLocation, SourceLocation jsLocation) {
// Don't mark the same JS location to two different Dart locations.
if (_previousDartOffset == dartLocation.offset) return;
_previousDartOffset = dartLocation.offset;
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index c8494bd..99b102e 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -18,7 +18,7 @@
import '../compiler/module_builder.dart' show pathToJSIdentifier;
import '../js_ast/js_ast.dart' as JS;
import '../js_ast/js_ast.dart' show js;
-import '../js_ast/source_map_printer.dart' show NodeEnd, NodeSpan;
+import '../js_ast/source_map_printer.dart' show NodeEnd, NodeSpan, HoverComment;
import 'js_interop.dart';
import 'js_typerep.dart';
import 'kernel_helpers.dart';
@@ -2131,12 +2131,19 @@
var accessors = <JS.Method>[];
var savedUri = _currentUri;
+ var objExpr =
+ target is Class ? _emitTopLevelName(target) : emitLibraryName(target);
+
for (var field in fields) {
_currentUri = field.fileUri;
var name = field.name.name;
var access = _emitStaticMemberName(name);
accessors.add(new JS.Method(access, _emitStaticFieldInitializer(field),
- isGetter: true));
+ isGetter: true)
+ ..sourceInformation = _hoverComment(
+ new JS.PropertyAccess(objExpr, access),
+ field.fileOffset,
+ name.length));
// TODO(jmesserly): currently uses a dummy setter to indicate writable.
if (!field.isFinal && !field.isConst) {
@@ -2146,9 +2153,6 @@
}
_currentUri = _currentLibrary.fileUri;
- var objExpr =
- target is Class ? _emitTopLevelName(target) : emitLibraryName(target);
-
_currentUri = savedUri;
return _callHelperStatement('defineLazy(#, { # });', [objExpr, accessors]);
}
@@ -3164,6 +3168,20 @@
sourceUrl: fileUri, line: loc.line - 1, column: loc.column - 1);
}
+ /// Adds a hover comment for Dart node using JS expression [expr], where
+ /// that expression would not otherwise not be generated into source code.
+ ///
+ /// For example, top-level and static fields are defined as lazy properties,
+ /// on the library/class, so their access expressions do not appear in the
+ /// source code.
+ HoverComment _hoverComment(JS.Expression expr, int offset, int nameLength) {
+ var start = _getLocation(offset);
+ var end = _getLocation(offset + nameLength);
+ return start != null && end != null
+ ? new HoverComment(expr, start, end)
+ : null;
+ }
+
@override
defaultStatement(Statement node) => _emitInvalidNode(node).toStatement();
diff --git a/pkg/dev_compiler/test/nullable_inference_test.dart b/pkg/dev_compiler/test/nullable_inference_test.dart
index 4324353..3d9348e 100644
--- a/pkg/dev_compiler/test/nullable_inference_test.dart
+++ b/pkg/dev_compiler/test/nullable_inference_test.dart
@@ -125,9 +125,9 @@
'main() { 1.compareTo(2); 1.remainder(2); 1.abs(); 1.toInt(); '
'1.ceil(); 1.floor(); 1.truncate(); 1.round(); 1.ceilToDouble(); '
'1.floorToDouble(); 1.truncateToDouble(); 1.roundToDouble(); '
- '1.toDouble(); 1.clamp(2); 1.toStringAsFixed(2); '
+ '1.toDouble(); 1.clamp(2, 2); 1.toStringAsFixed(2); '
'1.toStringAsExponential(); 1.toStringAsPrecision(2); 1.toString(); '
- '1.toRadixString(2); 1.toUnsigned(2); 1.toSigned(2); 1.modPow(2); '
+ '1.toRadixString(2); 1.toUnsigned(2); 1.toSigned(2); 1.modPow(2, 2); '
'1.modInverse(2); 1.gcd(2); }');
});
});
@@ -153,7 +153,7 @@
'(1.0).toInt(); (1.0).ceil(); (1.0).floor(); (1.0).truncate(); '
'(1.0).round(); (1.0).ceilToDouble(); (1.0).floorToDouble(); '
'(1.0).truncateToDouble(); (1.0).roundToDouble(); (1.0).toDouble(); '
- '(1.0).clamp(2.0); (1.0).toStringAsFixed(2); (1.0).toString(); '
+ '(1.0).clamp(2.0, 2.0); (1.0).toStringAsFixed(2); (1.0).toString(); '
'(1.0).toStringAsExponential(); (1.0).toStringAsPrecision(2); }');
});
});
@@ -179,7 +179,7 @@
'n.toInt(); n.ceil(); n.floor(); n.truncate(); '
'n.round(); n.ceilToDouble(); n.floorToDouble(); '
'n.truncateToDouble(); n.roundToDouble(); n.toDouble(); '
- 'n.clamp(n); n.toStringAsFixed(n); n.toString(); '
+ 'n.clamp(n, n); n.toStringAsFixed(n); n.toString(); '
'n.toStringAsExponential(); n.toStringAsPrecision(n); }');
});
});
@@ -215,7 +215,7 @@
s.replaceFirstMapped(s, (_) => s);
s.replaceRange(1, 2, s);
s.split(s);
- s.splitMapJoin(s, (_) => s, (_) => s);
+ s.splitMapJoin(s, onMatch: (_) => s, onNonMatch: (_) => s);
s.startsWith(s);
s.substring(1);
s.toLowerCase();
diff --git a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_constructor.dart b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_constructor.dart
index 3d6c5e3..9ef071d 100644
--- a/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_constructor.dart
+++ b/pkg/dev_compiler/test/sourcemap/stacktrace_testfiles/throw_in_constructor.dart
@@ -4,7 +4,7 @@
main() {
// ignore: UNUSED_LOCAL_VARIABLE
- var c = new /*1:main*/ Class();
+ var c = /*ddc.1:main*/ new /*ddk.1:main*/ Class();
}
class Class {
diff --git a/pkg/dev_compiler/test/sourcemap/testfiles/call_on_field_in_class.dart b/pkg/dev_compiler/test/sourcemap/testfiles/call_on_field_in_class.dart
index a6b1f9e..785c76b 100644
--- a/pkg/dev_compiler/test/sourcemap/testfiles/call_on_field_in_class.dart
+++ b/pkg/dev_compiler/test/sourcemap/testfiles/call_on_field_in_class.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
main() {
- /* bl */ var foo = new /*s:1*/ Foo();
+ /* bl */ var foo = new /*sl:1*/ Foo();
foo.foo = foo. /*sl:2*/ fooMethod;
foo /*sl:3*/ .fooMethod();
// Stepping into this doesn't really work because what it does is something
diff --git a/pkg/dev_compiler/test/sourcemap/testfiles/printing_class_fields_step_into.dart b/pkg/dev_compiler/test/sourcemap/testfiles/printing_class_fields_step_into.dart
index f450855..f4f9d6f 100644
--- a/pkg/dev_compiler/test/sourcemap/testfiles/printing_class_fields_step_into.dart
+++ b/pkg/dev_compiler/test/sourcemap/testfiles/printing_class_fields_step_into.dart
@@ -5,7 +5,7 @@
/*nb*/
main() {
/*bl*/
- Foo foo = new /*s:1*/ Foo(1, 2);
+ Foo foo = new /*sl:1*/ Foo(1, 2);
/*s:5*/ print(foo.x);
/*s:6*/ print(foo.y);
/*s:7*/ print(foo.z);
diff --git a/pkg/dev_compiler/tool/ddb b/pkg/dev_compiler/tool/ddb
index 4bead5f..b42781e 100755
--- a/pkg/dev_compiler/tool/ddb
+++ b/pkg/dev_compiler/tool/ddb
@@ -91,7 +91,7 @@
'--modules=$mod',
'--dart-sdk-summary=$ddcSdk',
'-o',
- '$basename.js',
+ '$libRoot/$basename.js',
entry
]);
} else {
@@ -99,7 +99,7 @@
'--modules=$mod',
'--library-root=$libRoot',
'-o',
- '$basename.js',
+ '$libRoot/$basename.js',
entry
]);
}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart
index 50c35e1..ea298ee 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart
@@ -134,7 +134,7 @@
'trapRuntimeErrors' in settings ? settings.trapRuntimeErrors : false);
$ignoreWhitelistedErrors(
'ignoreWhitelistedErrors' in settings ?
- settings.ignoreWhitelistedErrors : true);
+ settings.ignoreWhitelistedErrors : false);
$ignoreAllErrors(
'ignoreAllErrors' in settings ? settings.ignoreAllErrors : false);
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index a2aa3c9..4346164 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -346,7 +346,8 @@
Program program = new Program(nameRoot: nameRoot);
// TODO(ahe): Pass file name to BinaryBuilder.
// TODO(ahe): Control lazy loading via an option.
- new BinaryBuilder(bytes, null, false).readProgram(program);
+ new BinaryBuilder(bytes, filename: null, disableLazyReading: false)
+ .readProgram(program);
return program;
}
diff --git a/pkg/front_end/lib/src/fasta/builder_graph.dart b/pkg/front_end/lib/src/fasta/builder_graph.dart
index 9f77242..b78d5f9 100644
--- a/pkg/front_end/lib/src/fasta/builder_graph.dart
+++ b/pkg/front_end/lib/src/fasta/builder_graph.dart
@@ -4,12 +4,12 @@
library fasta.builder_graph;
+import 'package:kernel/util/graph.dart' show Graph;
+
import 'builder/builder.dart' show LibraryBuilder;
import 'export.dart' show Export;
-import 'graph/graph.dart' show Graph;
-
import 'import.dart' show Import;
import 'dill/dill_library_builder.dart' show DillLibraryBuilder;
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index ccddabe..fadbf55 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -758,6 +758,30 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(String name)>
+ templateConstructorHasNoSuchNamedParameter =
+ const Template<Message Function(String name)>(
+ messageTemplate:
+ r"""Constructor has no named parameter with the name '#name'.""",
+ withArguments: _withArgumentsConstructorHasNoSuchNamedParameter);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name)>
+ codeConstructorHasNoSuchNamedParameter =
+ const Code<Message Function(String name)>(
+ "ConstructorHasNoSuchNamedParameter",
+ templateConstructorHasNoSuchNamedParameter,
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsConstructorHasNoSuchNamedParameter(String name) {
+ return new Message(codeConstructorHasNoSuchNamedParameter,
+ message: """Constructor has no named parameter with the name '$name'.""",
+ arguments: {'name': name});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)> templateConstructorNotFound =
const Template<Message Function(String name)>(
messageTemplate: r"""Couldn't find constructor '#name'.""",
@@ -2067,6 +2091,27 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(String name)> templateFunctionHasNoSuchNamedParameter =
+ const Template<Message Function(String name)>(
+ messageTemplate:
+ r"""Function has no named parameter with the name '#name'.""",
+ withArguments: _withArgumentsFunctionHasNoSuchNamedParameter);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name)> codeFunctionHasNoSuchNamedParameter =
+ const Code<Message Function(String name)>("FunctionHasNoSuchNamedParameter",
+ templateFunctionHasNoSuchNamedParameter,
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsFunctionHasNoSuchNamedParameter(String name) {
+ return new Message(codeFunctionHasNoSuchNamedParameter,
+ message: """Function has no named parameter with the name '$name'.""",
+ arguments: {'name': name});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeFunctionTypeDefaultValue = messageFunctionTypeDefaultValue;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -2250,6 +2295,37 @@
tip: r"""Try moving the with clause before the implements clause.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ DartType
+ _type)> templateImplicitCallOfNonMethod = const Template<
+ Message Function(DartType _type)>(
+ messageTemplate:
+ r"""Can't invoke the type '#type' because its declaration of `.call` is not a method.""",
+ tipTemplate: r"""Change .call to a method or explicitly invoke .call.""",
+ withArguments: _withArgumentsImplicitCallOfNonMethod);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(DartType _type)> codeImplicitCallOfNonMethod =
+ const Code<Message Function(DartType _type)>(
+ "ImplicitCallOfNonMethod", templateImplicitCallOfNonMethod,
+ severity: Severity.error);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsImplicitCallOfNonMethod(DartType _type) {
+ NameSystem nameSystem = new NameSystem();
+ StringBuffer buffer = new StringBuffer();
+ new Printer(buffer, syntheticNames: nameSystem).writeNode(_type);
+ String type = '$buffer';
+
+ return new Message(codeImplicitCallOfNonMethod,
+ message:
+ """Can't invoke the type '$type' because its declaration of `.call` is not a method.""",
+ tip: """Change .call to a method or explicitly invoke .call.""",
+ arguments: {'type': _type});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeImportAfterPart = messageImportAfterPart;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -3211,6 +3287,27 @@
message: r"""An annotation (metadata) can't use type arguments.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(String name)> templateMethodHasNoSuchNamedParameter =
+ const Template<Message Function(String name)>(
+ messageTemplate:
+ r"""Method has no named parameter with the name '#name'.""",
+ withArguments: _withArgumentsMethodHasNoSuchNamedParameter);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name)> codeMethodHasNoSuchNamedParameter =
+ const Code<Message Function(String name)>(
+ "MethodHasNoSuchNamedParameter", templateMethodHasNoSuchNamedParameter,
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsMethodHasNoSuchNamedParameter(String name) {
+ return new Message(codeMethodHasNoSuchNamedParameter,
+ message: """Method has no named parameter with the name '$name'.""",
+ arguments: {'name': name});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)> templateMethodNotFound =
const Template<Message Function(String name)>(
messageTemplate: r"""Method not found: '#name'.""",
@@ -3594,6 +3691,34 @@
r"""Try removing the other directives, or moving them to the library for which this is a part.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ String name,
+ String
+ name2)> templateNotAPrefixInTypeAnnotation = const Template<
+ Message Function(String name, String name2)>(
+ messageTemplate:
+ r"""'#name.#name2' can't be used as a type because '#name' doesn't refer to an import prefix.""",
+ withArguments: _withArgumentsNotAPrefixInTypeAnnotation);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name, String name2)>
+ codeNotAPrefixInTypeAnnotation =
+ const Code<Message Function(String name, String name2)>(
+ "NotAPrefixInTypeAnnotation", templateNotAPrefixInTypeAnnotation,
+ analyzerCode: "NOT_A_TYPE",
+ dart2jsCode: "*ignored*",
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsNotAPrefixInTypeAnnotation(String name, String name2) {
+ return new Message(codeNotAPrefixInTypeAnnotation,
+ message:
+ """'$name.$name2' can't be used as a type because '$name' doesn't refer to an import prefix.""",
+ arguments: {'name': name, 'name2': name2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)> templateNotAType =
const Template<Message Function(String name)>(
messageTemplate: r"""'#name' isn't a type.""",
@@ -4853,6 +4978,162 @@
message: r"""Expected identifier, but got 'this'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ int count,
+ int
+ count2)> templateTooFewArgumentsToConstructor = const Template<
+ Message Function(int count, int count2)>(
+ messageTemplate:
+ r"""Too few positional arguments to constructor: #count required, #count2 given.""",
+ withArguments: _withArgumentsTooFewArgumentsToConstructor);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(int count, int count2)>
+ codeTooFewArgumentsToConstructor =
+ const Code<Message Function(int count, int count2)>(
+ "TooFewArgumentsToConstructor", templateTooFewArgumentsToConstructor,
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsTooFewArgumentsToConstructor(int count, int count2) {
+ return new Message(codeTooFewArgumentsToConstructor,
+ message:
+ """Too few positional arguments to constructor: $count required, $count2 given.""",
+ arguments: {'count': count, 'count2': count2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ int count,
+ int
+ count2)> templateTooFewArgumentsToFunction = const Template<
+ Message Function(int count, int count2)>(
+ messageTemplate:
+ r"""Too few positional arguments to function: #count required, #count2 given.""",
+ withArguments: _withArgumentsTooFewArgumentsToFunction);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(int count, int count2)>
+ codeTooFewArgumentsToFunction =
+ const Code<Message Function(int count, int count2)>(
+ "TooFewArgumentsToFunction", templateTooFewArgumentsToFunction,
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsTooFewArgumentsToFunction(int count, int count2) {
+ return new Message(codeTooFewArgumentsToFunction,
+ message:
+ """Too few positional arguments to function: $count required, $count2 given.""",
+ arguments: {'count': count, 'count2': count2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ int count,
+ int
+ count2)> templateTooFewArgumentsToMethod = const Template<
+ Message Function(int count, int count2)>(
+ messageTemplate:
+ r"""Too few positional arguments to method: #count required, #count2 given.""",
+ withArguments: _withArgumentsTooFewArgumentsToMethod);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(int count, int count2)>
+ codeTooFewArgumentsToMethod =
+ const Code<Message Function(int count, int count2)>(
+ "TooFewArgumentsToMethod", templateTooFewArgumentsToMethod,
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsTooFewArgumentsToMethod(int count, int count2) {
+ return new Message(codeTooFewArgumentsToMethod,
+ message:
+ """Too few positional arguments to method: $count required, $count2 given.""",
+ arguments: {'count': count, 'count2': count2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ int count,
+ int
+ count2)> templateTooManyArgumentsToConstructor = const Template<
+ Message Function(int count, int count2)>(
+ messageTemplate:
+ r"""Too many positional arguments to constructor: #count allowed, #count2 given.""",
+ withArguments: _withArgumentsTooManyArgumentsToConstructor);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(int count, int count2)>
+ codeTooManyArgumentsToConstructor =
+ const Code<Message Function(int count, int count2)>(
+ "TooManyArgumentsToConstructor", templateTooManyArgumentsToConstructor,
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsTooManyArgumentsToConstructor(int count, int count2) {
+ return new Message(codeTooManyArgumentsToConstructor,
+ message:
+ """Too many positional arguments to constructor: $count allowed, $count2 given.""",
+ arguments: {'count': count, 'count2': count2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ int count,
+ int
+ count2)> templateTooManyArgumentsToFunction = const Template<
+ Message Function(int count, int count2)>(
+ messageTemplate:
+ r"""Too many positional arguments to function: #count allowed, #count2 given.""",
+ withArguments: _withArgumentsTooManyArgumentsToFunction);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(int count, int count2)>
+ codeTooManyArgumentsToFunction =
+ const Code<Message Function(int count, int count2)>(
+ "TooManyArgumentsToFunction", templateTooManyArgumentsToFunction,
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsTooManyArgumentsToFunction(int count, int count2) {
+ return new Message(codeTooManyArgumentsToFunction,
+ message:
+ """Too many positional arguments to function: $count allowed, $count2 given.""",
+ arguments: {'count': count, 'count2': count2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ int count,
+ int
+ count2)> templateTooManyArgumentsToMethod = const Template<
+ Message Function(int count, int count2)>(
+ messageTemplate:
+ r"""Too many positional arguments to method: #count allowed, #count2 given.""",
+ withArguments: _withArgumentsTooManyArgumentsToMethod);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(int count, int count2)>
+ codeTooManyArgumentsToMethod =
+ const Code<Message Function(int count, int count2)>(
+ "TooManyArgumentsToMethod", templateTooManyArgumentsToMethod,
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsTooManyArgumentsToMethod(int count, int count2) {
+ return new Message(codeTooManyArgumentsToMethod,
+ message:
+ """Too many positional arguments to method: $count allowed, $count2 given.""",
+ arguments: {'count': count, 'count2': count2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeTopLevelOperator = messageTopLevelOperator;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -5153,6 +5434,36 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ String name,
+ String
+ name2)> templateUnresolvedPrefixInTypeAnnotation = const Template<
+ Message Function(String name, String name2)>(
+ messageTemplate:
+ r"""'#name.#name2' can't be used as a type because '#name' isn't defined.""",
+ withArguments: _withArgumentsUnresolvedPrefixInTypeAnnotation);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name, String name2)>
+ codeUnresolvedPrefixInTypeAnnotation =
+ const Code<Message Function(String name, String name2)>(
+ "UnresolvedPrefixInTypeAnnotation",
+ templateUnresolvedPrefixInTypeAnnotation,
+ analyzerCode: "NOT_A_TYPE",
+ dart2jsCode: "*ignored*",
+ severity: Severity.errorLegacyWarning);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsUnresolvedPrefixInTypeAnnotation(
+ String name, String name2) {
+ return new Message(codeUnresolvedPrefixInTypeAnnotation,
+ message:
+ """'$name.$name2' can't be used as a type because '$name' isn't defined.""",
+ arguments: {'name': name, 'name2': name2});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String string)> templateUnspecified =
const Template<Message Function(String string)>(
messageTemplate: r"""#string""",
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 70e3a76..6886d9b 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -6,8 +6,9 @@
import 'dart:async' show Future;
-import 'package:kernel/kernel.dart'
- show loadProgramFromBytes, Library, Procedure, Program, Source;
+import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
+
+import 'package:kernel/kernel.dart' show Library, Procedure, Program, Source;
import '../api_prototype/incremental_kernel_generator.dart'
show IncrementalKernelGenerator;
@@ -71,7 +72,9 @@
Program program;
if (summaryBytes != null) {
ticker.logMs("Read ${c.options.sdkSummary}");
- program = loadProgramFromBytes(summaryBytes);
+ program = new Program();
+ new BinaryBuilder(summaryBytes, disableLazyReading: false)
+ .readProgram(program);
ticker.logMs("Deserialized ${c.options.sdkSummary}");
bytesLength += summaryBytes.length;
}
@@ -87,10 +90,15 @@
ticker.logMs("Read $bootstrapDill");
bool bootstrapFailed = false;
try {
- loadProgramFromBytes(bootstrapBytes, program);
+ // We're going to output all we read here so lazy loading it
+ // doesn't make sense.
+ new BinaryBuilder(bootstrapBytes, disableLazyReading: true)
+ .readProgram(program);
} catch (e) {
bootstrapFailed = true;
- program = loadProgramFromBytes(summaryBytes);
+ program = new Program();
+ new BinaryBuilder(summaryBytes, disableLazyReading: false)
+ .readProgram(program);
}
if (!bootstrapFailed) {
bootstrapSuccess = true;
@@ -174,18 +182,14 @@
// For now ensure original order of libraries to produce bit-perfect
// output.
- List<Library> librariesOriginalOrder =
- new List<Library>.filled(libraries.length, null, growable: true);
- int lastOpen = libraries.length;
- for (Library lib in libraries) {
- int order = importUriToOrder[lib.importUri];
- if (order != null) {
- librariesOriginalOrder[order] = lib;
- } else {
- librariesOriginalOrder[--lastOpen] = lib;
- }
- }
- libraries = librariesOriginalOrder;
+ libraries.sort((a, b) {
+ int aOrder = importUriToOrder[a.importUri];
+ int bOrder = importUriToOrder[b.importUri];
+ if (aOrder != null && bOrder != null) return aOrder - bOrder;
+ if (aOrder != null) return -1;
+ if (bOrder != null) return 1;
+ return 0;
+ });
}
// This is the incremental program.
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 269228d..c2c73e1 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -9,13 +9,7 @@
import '../fasta_codes.dart' as fasta;
-import '../fasta_codes.dart'
- show
- LocatedMessage,
- Message,
- messageNativeClauseShouldBeAnnotation,
- messageSetterWithWrongNumberOfFormals,
- messageSuperAsExpression;
+import '../fasta_codes.dart' show LocatedMessage, Message, Template;
import '../messages.dart' as messages show getLocationFromUri;
@@ -243,7 +237,8 @@
return deprecated_buildCompileTimeError(
"A library can't be used as an expression.");
} else if (node is SuperInitializer) {
- return buildCompileTimeError(messageSuperAsExpression, node.fileOffset);
+ return buildCompileTimeError(
+ fasta.messageSuperAsExpression, node.fileOffset);
} else if (node is ProblemBuilder) {
return buildProblemExpression(node, -1);
} else {
@@ -650,7 +645,7 @@
body = new Block(statements)..fileOffset = charOffset;
}
body = wrapInCompileTimeErrorStatement(
- body, messageSetterWithWrongNumberOfFormals);
+ body, fasta.messageSetterWithWrongNumberOfFormals);
}
}
if (!builder.isExternal) {
@@ -706,8 +701,12 @@
Initializer initializer;
Arguments arguments = new Arguments.empty();
if (superTarget == null ||
- !checkArguments(
- superTarget.function, arguments, const <TypeParameter>[])) {
+ checkArguments(
+ new FunctionTypeAccessor.fromNode(superTarget.function),
+ arguments,
+ CalleeDesignation.Constructor,
+ builder.charOffset, const <TypeParameter>[]) !=
+ null) {
String superclass = classBuilder.supertype.fullNameForErrors;
String message = superTarget == null
? "'$superclass' doesn't have an unnamed constructor."
@@ -1000,7 +999,8 @@
bool isSuper: false,
bool isGetter: false,
bool isSetter: false,
- bool isStatic: false}) {
+ bool isStatic: false,
+ LocatedMessage argMessage}) {
Message message;
Name kernelName = new Name(name, library.library);
LocatedMessage context;
@@ -1029,13 +1029,16 @@
reportWarning: !constantExpressionRequired,
context: context);
} else {
- // TODO(ahe): This might be a constructor, and we need to provide a
- // better error message in that case. Currently we say "method", not
- // "constructor" and the unnamed constructor is simply referred to as ''.
- message = warnUnresolvedMethod(kernelName, charOffset,
- isSuper: isSuper,
- reportWarning: !constantExpressionRequired,
- context: context);
+ if (argMessage != null) {
+ message = argMessage.messageObject;
+ charOffset = argMessage.charOffset;
+ addProblemErrorIfConst(message, charOffset, 1, context: context);
+ } else {
+ message = warnUnresolvedMethod(kernelName, charOffset,
+ isSuper: isSuper,
+ reportWarning: !constantExpressionRequired,
+ context: context);
+ }
}
if (constantExpressionRequired) {
// TODO(ahe): Use [error] below instead of building a compile-time error,
@@ -1856,6 +1859,9 @@
if (prefix is PrefixBuilder) {
name = scopeLookup(prefix.exportScope, suffix.name, beginToken,
isQualified: true, prefix: prefix);
+ } else if (prefix is ErrorAccessor) {
+ push(prefix.buildErroneousTypeNotAPrefix(suffix));
+ return;
} else {
String displayName = debugName(getNodeName(prefix), suffix.name);
addProblem(fasta.templateNotAType.withArguments(displayName),
@@ -2380,10 +2386,19 @@
assert(!target.enclosingClass.isAbstract);
typeParameters = target.enclosingClass.typeParameters;
}
- if (!checkArguments(target.function, arguments, typeParameters)) {
+ CalleeDesignation calleeKind = target is Constructor
+ ? CalleeDesignation.Constructor
+ : CalleeDesignation.Method;
+ LocatedMessage argMessage = checkArguments(
+ new FunctionTypeAccessor.fromNode(target.function),
+ arguments,
+ calleeKind,
+ charOffset,
+ typeParameters);
+ if (argMessage != null) {
return throwNoSuchMethodError(new NullLiteral()..fileOffset = charOffset,
target.name.name, arguments, charOffset,
- candidate: target);
+ candidate: target, argMessage: argMessage);
}
if (target is Constructor) {
if (isConst && !target.isConst) {
@@ -2414,36 +2429,79 @@
}
@override
- bool checkArguments(FunctionNode function, Arguments arguments,
- List<TypeParameter> typeParameters) {
- if (arguments.positional.length < function.requiredParameterCount ||
- arguments.positional.length > function.positionalParameters.length) {
- return false;
- }
- Map<String, VariableDeclaration> names;
- if (function.namedParameters.isNotEmpty) {
- names = <String, VariableDeclaration>{};
- for (VariableDeclaration parameter in function.namedParameters) {
- names[parameter.name] = parameter;
+ LocatedMessage checkArguments(FunctionTypeAccessor function,
+ Arguments arguments, CalleeDesignation calleeKind, int offset,
+ [List<TypeParameter> typeParameters]) {
+ if (arguments.positional.length < function.requiredParameterCount) {
+ Template<Message Function(int count, int count2)> template;
+ switch (calleeKind) {
+ case CalleeDesignation.Function:
+ template = fasta.templateTooFewArgumentsToFunction;
+ break;
+ case CalleeDesignation.Method:
+ template = fasta.templateTooFewArgumentsToMethod;
+ break;
+ case CalleeDesignation.Constructor:
+ template = fasta.templateTooFewArgumentsToConstructor;
+ break;
}
+ return template
+ .withArguments(
+ function.requiredParameterCount, arguments.positional.length)
+ .withLocation(uri, offset);
+ }
+ if (arguments.positional.length > function.positionalParameterCount) {
+ Template<Message Function(int count, int count2)> template;
+ switch (calleeKind) {
+ case CalleeDesignation.Function:
+ template = fasta.templateTooManyArgumentsToFunction;
+ break;
+ case CalleeDesignation.Method:
+ template = fasta.templateTooManyArgumentsToMethod;
+ break;
+ case CalleeDesignation.Constructor:
+ template = fasta.templateTooManyArgumentsToConstructor;
+ break;
+ }
+ return template
+ .withArguments(
+ function.positionalParameterCount, arguments.positional.length)
+ .withLocation(uri, offset);
}
if (arguments.named.isNotEmpty) {
- if (names == null) return false;
+ Set<String> names = function.namedParameterNames;
for (NamedExpression argument in arguments.named) {
- VariableDeclaration parameter = names.remove(argument.name);
- if (parameter == null) {
- return false;
+ if (!names.remove(argument.name)) {
+ Template<Message Function(String name)> template;
+ switch (calleeKind) {
+ case CalleeDesignation.Function:
+ template = fasta.templateFunctionHasNoSuchNamedParameter;
+ break;
+ case CalleeDesignation.Method:
+ template = fasta.templateMethodHasNoSuchNamedParameter;
+ break;
+ case CalleeDesignation.Constructor:
+ template = fasta.templateConstructorHasNoSuchNamedParameter;
+ break;
+ }
+ return template
+ .withArguments(argument.name)
+ .withLocation(uri, argument.fileOffset);
}
}
}
- if (typeParameters.length != arguments.types.length) {
+
+ if (typeParameters != null &&
+ typeParameters.length != arguments.types.length) {
+ // TODO(paulberry): Report error in this case as well,
+ // after https://github.com/dart-lang/sdk/issues/32130 is fixed.
arguments.types.clear();
for (int i = 0; i < typeParameters.length; i++) {
arguments.types.add(const DynamicType());
}
}
- return true;
+ return null;
}
@override
@@ -3375,7 +3433,7 @@
@override
void handleRecoverableError(
Message message, Token startToken, Token endToken) {
- if (message == messageNativeClauseShouldBeAnnotation) {
+ if (message == fasta.messageNativeClauseShouldBeAnnotation) {
// TODO(danrubel): Ignore this error until we deprecate `native` support.
return;
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
index 27d8092..1651606 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
@@ -8,12 +8,15 @@
import '../fasta_codes.dart'
show
+ LocatedMessage,
messageInvalidInitializer,
messageLoadLibraryTakesNoArguments,
messageSuperAsExpression,
templateDeferredTypeAnnotation,
templateIntegerLiteralIsOutOfRange,
- templateNotAType;
+ templateNotAPrefixInTypeAnnotation,
+ templateNotAType,
+ templateUnresolvedPrefixInTypeAnnotation;
import '../messages.dart' show Message;
@@ -25,6 +28,8 @@
import '../type_inference/type_promotion.dart' show TypePromoter;
+import 'body_builder.dart' show Identifier;
+
import 'forest.dart' show Forest;
import 'frontend_accessors.dart' as kernel
@@ -125,10 +130,12 @@
bool isSuper,
bool isGetter,
bool isSetter,
- bool isStatic});
+ bool isStatic,
+ LocatedMessage argMessage});
- bool checkArguments(FunctionNode function, Arguments arguments,
- List<TypeParameter> typeParameters);
+ LocatedMessage checkArguments(FunctionTypeAccessor function,
+ Arguments arguments, CalleeDesignation calleeKind, int offset,
+ [List<TypeParameter> typeParameters]);
StaticGet makeStaticGet(Member readTarget, Token token,
{String prefixName, int targetOffset: -1, Class targetClass});
@@ -173,6 +180,35 @@
void warnTypeArgumentsMismatch(String name, int expected, int charOffset);
}
+// The name used to refer to a call target kind
+enum CalleeDesignation { Function, Method, Constructor }
+
+// Abstraction over FunctionNode and FunctionType to access the
+// number and names of parameters.
+class FunctionTypeAccessor {
+ int requiredParameterCount;
+ int positionalParameterCount;
+
+ List _namedParameters;
+
+ Set<String> get namedParameterNames {
+ return new Set.from(_namedParameters.map((a) => a.name));
+ }
+
+ factory FunctionTypeAccessor.fromNode(FunctionNode node) {
+ return new FunctionTypeAccessor._(node.requiredParameterCount,
+ node.positionalParameters.length, node.namedParameters);
+ }
+
+ factory FunctionTypeAccessor.fromType(FunctionType type) {
+ return new FunctionTypeAccessor._(type.requiredParameterCount,
+ type.positionalParameters.length, type.namedParameters);
+ }
+
+ FunctionTypeAccessor._(this.requiredParameterCount,
+ this.positionalParameterCount, this._namedParameters);
+}
+
abstract class FastaAccessor implements Accessor {
BuilderHelper get helper;
@@ -240,13 +276,15 @@
bool isSetter: false,
bool isStatic: false,
String name,
- int offset}) {
+ int offset,
+ LocatedMessage argMessage}) {
return helper.throwNoSuchMethodError(receiver, name ?? plainNameForWrite,
arguments, offset ?? offsetForToken(this.token),
isGetter: isGetter,
isSetter: isSetter,
isSuper: isSuper,
- isStatic: isStatic);
+ isStatic: isStatic,
+ argMessage: argMessage);
}
bool get isThisPropertyAccessor => false;
@@ -263,6 +301,8 @@
Expression buildError(Arguments arguments,
{bool isGetter: false, bool isSetter: false, int offset});
+ DartType buildErroneousTypeNotAPrefix(Identifier suffix);
+
Name get name => unsupported("name", offsetForToken(token), uri);
@override
@@ -294,7 +334,8 @@
bool isSetter: false,
bool isStatic: false,
String name,
- int offset}) {
+ int offset,
+ LocatedMessage argMessage}) {
return this;
}
@@ -444,13 +485,22 @@
Initializer buildConstructorInitializer(
int offset, Name name, Arguments arguments) {
Constructor constructor = helper.lookupConstructor(name, isSuper: isSuper);
- if (constructor == null ||
- !helper.checkArguments(
- constructor.function, arguments, <TypeParameter>[])) {
+ LocatedMessage argMessage;
+ if (constructor != null) {
+ argMessage = helper.checkArguments(
+ new FunctionTypeAccessor.fromNode(constructor.function),
+ arguments,
+ CalleeDesignation.Constructor,
+ offset, <TypeParameter>[]);
+ }
+ if (constructor == null || argMessage != null) {
return helper.buildInvalidInitializer(
buildThrowNoSuchMethodError(
new NullLiteral()..fileOffset = offset, arguments,
- isSuper: isSuper, name: name.name, offset: offset),
+ isSuper: isSuper,
+ name: name.name,
+ offset: offset,
+ argMessage: argMessage),
offset);
} else if (isSuper) {
return helper.buildSuperInitializer(
@@ -534,6 +584,15 @@
}
@override
+ DartType buildErroneousTypeNotAPrefix(Identifier suffix) {
+ helper.addProblem(
+ templateNotAPrefixInTypeAnnotation.withArguments(
+ token.lexeme, suffix.name),
+ offsetForToken(token));
+ return const InvalidType();
+ }
+
+ @override
doInvocation(int offset, Arguments arguments) => this;
}
@@ -1068,6 +1127,7 @@
LargeIntAccessor(BuilderHelper helper, Token token) : super(helper, token);
+ @override
Expression buildError() => helper.buildCompileTimeError(
templateIntegerLiteralIsOutOfRange.withArguments(token),
token.charOffset);
@@ -1310,6 +1370,15 @@
}
@override
+ DartType buildErroneousTypeNotAPrefix(Identifier suffix) {
+ helper.addProblem(
+ templateUnresolvedPrefixInTypeAnnotation.withArguments(
+ name.name, suffix.name),
+ offsetForToken(token));
+ return const InvalidType();
+ }
+
+ @override
Expression buildError(Arguments arguments,
{bool isGetter: false, bool isSetter: false, int offset}) {
offset ??= offsetForToken(this.token);
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 6951f55..152af57 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -62,7 +62,8 @@
import '../fasta_codes.dart';
-import '../kernel/fasta_accessors.dart' show BuilderHelper;
+import '../kernel/fasta_accessors.dart'
+ show BuilderHelper, CalleeDesignation, FunctionTypeAccessor;
import '../kernel/kernel_shadow_ast.dart'
show
@@ -387,7 +388,9 @@
/// possible without knowing the identity of the type parameters. It defers to
/// abstract methods for everything else.
abstract class TypeInferrerImpl extends TypeInferrer {
- static final FunctionType _functionReturningDynamic =
+ /// Marker object to indicate that a function takes an unknown number
+ /// of arguments.
+ static final FunctionType unknownFunction =
new FunctionType(const [], const DynamicType());
final TypeInferenceEngineImpl engine;
@@ -467,7 +470,7 @@
if (actualType is InterfaceType) {
var classNode = (actualType as InterfaceType).classNode;
var callMember = classHierarchy.getInterfaceMember(classNode, callName);
- if (callMember != null) {
+ if (callMember is Procedure && callMember.kind == ProcedureKind.Method) {
if (_shouldTearOffCall(expectedType, actualType)) {
var parent = expression.parent;
var tearOff = new PropertyGet(expression, callName, callMember)
@@ -536,15 +539,18 @@
return 'call';
}
- Class classNode = receiverType is InterfaceType
- ? receiverType.classNode
- : coreTypes.objectClass;
-
- var interfaceMember = _getInterfaceMember(classNode, name, setter);
- if (!silent && interfaceMember != null) {
- instrumentation?.record(uri, fileOffset, 'target',
- new InstrumentationValueForMember(interfaceMember));
+ Member interfaceMember;
+ if (receiverType is! DynamicType) {
+ Class classNode = receiverType is InterfaceType
+ ? receiverType.classNode
+ : coreTypes.objectClass;
+ interfaceMember = _getInterfaceMember(classNode, name, setter);
+ if (!silent && interfaceMember != null) {
+ instrumentation?.record(uri, fileOffset, 'target',
+ new InstrumentationValueForMember(interfaceMember));
+ }
}
+
if (!isTopLevel &&
interfaceMember == null &&
receiverType is! DynamicType &&
@@ -664,12 +670,12 @@
return type;
} else if (followCall && type is InterfaceType) {
var member = _getInterfaceMember(type.classNode, callName, false);
- var callType = member?.getterType;
+ var callType = getCalleeType(member, type);
if (callType is FunctionType) {
return callType;
}
}
- return _functionReturningDynamic;
+ return unknownFunction;
}
DartType getCalleeType(Object interfaceMember, DartType receiverType) {
@@ -1068,19 +1074,32 @@
arguments.types.clear();
arguments.types.addAll(inferredTypes);
}
- if (typeChecksNeeded) {
- int numPositionalArgs = arguments.positional.length;
- for (int i = 0; i < formalTypes.length; i++) {
- var formalType = formalTypes[i];
- var expectedType = substitution != null
- ? substitution.substituteType(formalType)
- : formalType;
- var actualType = actualTypes[i];
- var expression = i < numPositionalArgs
- ? arguments.positional[i]
- : arguments.named[i - numPositionalArgs].value;
- ensureAssignable(
- expectedType, actualType, expression, expression.fileOffset);
+ if (typeChecksNeeded && !identical(calleeType, unknownFunction)) {
+ CalleeDesignation calleeKind = receiverType is FunctionType
+ ? CalleeDesignation.Function
+ : CalleeDesignation.Method;
+ LocatedMessage argMessage = helper.checkArguments(
+ new FunctionTypeAccessor.fromType(calleeType),
+ arguments,
+ calleeKind,
+ offset);
+ if (argMessage != null) {
+ helper.addProblem(argMessage.messageObject, argMessage.charOffset);
+ } else {
+ // Argument counts and names match. Compare types.
+ int numPositionalArgs = arguments.positional.length;
+ for (int i = 0; i < formalTypes.length; i++) {
+ var formalType = formalTypes[i];
+ var expectedType = substitution != null
+ ? substitution.substituteType(formalType)
+ : formalType;
+ var actualType = actualTypes[i];
+ var expression = i < numPositionalArgs
+ ? arguments.positional[i]
+ : arguments.named[i - numPositionalArgs].value;
+ ensureAssignable(
+ expectedType, actualType, expression, expression.fileOffset);
+ }
}
}
DartType inferredType;
@@ -1287,12 +1306,27 @@
typeContext, fileOffset, calleeType, calleeType.returnType, arguments,
isOverloadedArithmeticOperator: isOverloadedArithmeticOperator,
receiverType: receiverType);
+ if (methodName.name == '==') {
+ inferredType = coreTypes.boolClass.rawType;
+ }
handleInvocationContravariance(checkKind, desugaredInvocation, arguments,
expression, inferredType, calleeType, fileOffset);
if (identical(interfaceMember, 'call')) {
listener.methodInvocationExitCall(expression, arguments, isImplicitCall,
lastCalleeType, lastInferredSubstitution, inferredType);
} else {
+ if (strongMode &&
+ isImplicitCall &&
+ interfaceMember != null &&
+ !(interfaceMember is Procedure &&
+ interfaceMember.kind == ProcedureKind.Method) &&
+ receiverType is! DynamicType &&
+ receiverType != typeSchemaEnvironment.rawFunctionType) {
+ var parent = expression.parent;
+ var errorNode = helper.wrapInCompileTimeError(expression,
+ templateImplicitCallOfNonMethod.withArguments(receiverType));
+ parent?.replaceChild(expression, errorNode);
+ }
listener.methodInvocationExit(
expression,
arguments,
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 5d2fa20..b1c9e87 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -949,6 +949,42 @@
CandidateFoundIsDefaultConstructor:
template: "The class '#name' has a constructor that takes no arguments."
+TooFewArgumentsToFunction:
+ template: "Too few positional arguments to function: #count required, #count2 given."
+ severity: ERROR_LEGACY_WARNING
+
+TooFewArgumentsToMethod:
+ template: "Too few positional arguments to method: #count required, #count2 given."
+ severity: ERROR_LEGACY_WARNING
+
+TooFewArgumentsToConstructor:
+ template: "Too few positional arguments to constructor: #count required, #count2 given."
+ severity: ERROR_LEGACY_WARNING
+
+TooManyArgumentsToFunction:
+ template: "Too many positional arguments to function: #count allowed, #count2 given."
+ severity: ERROR_LEGACY_WARNING
+
+TooManyArgumentsToMethod:
+ template: "Too many positional arguments to method: #count allowed, #count2 given."
+ severity: ERROR_LEGACY_WARNING
+
+TooManyArgumentsToConstructor:
+ template: "Too many positional arguments to constructor: #count allowed, #count2 given."
+ severity: ERROR_LEGACY_WARNING
+
+FunctionHasNoSuchNamedParameter:
+ template: "Function has no named parameter with the name '#name'."
+ severity: ERROR_LEGACY_WARNING
+
+MethodHasNoSuchNamedParameter:
+ template: "Method has no named parameter with the name '#name'."
+ severity: ERROR_LEGACY_WARNING
+
+ConstructorHasNoSuchNamedParameter:
+ template: "Constructor has no named parameter with the name '#name'."
+ severity: ERROR_LEGACY_WARNING
+
AbstractClassInstantiation:
template: "The class '#name' is abstract and can't be instantiated."
severity: ERROR_LEGACY_WARNING
@@ -985,6 +1021,18 @@
analyzerCode: NOT_A_TYPE
dart2jsCode: "*ignored*"
+NotAPrefixInTypeAnnotation:
+ template: "'#name.#name2' can't be used as a type because '#name' doesn't refer to an import prefix."
+ severity: ERROR_LEGACY_WARNING
+ analyzerCode: NOT_A_TYPE
+ dart2jsCode: "*ignored*"
+
+UnresolvedPrefixInTypeAnnotation:
+ template: "'#name.#name2' can't be used as a type because '#name' isn't defined."
+ severity: ERROR_LEGACY_WARNING
+ analyzerCode: NOT_A_TYPE
+ dart2jsCode: "*ignored*"
+
FastaUsageShort:
template: |
Frequently used options:
@@ -1909,3 +1957,8 @@
Type parameters could not be inferred for the mixin '#name' because
'#name2' does not implement the mixin's supertype constraint '#type'.
severity: ERROR
+
+ImplicitCallOfNonMethod:
+ template: "Can't invoke the type '#type' because its declaration of `.call` is not a method."
+ tip: "Change .call to a method or explicitly invoke .call."
+ severity: ERROR
diff --git a/pkg/front_end/test/fasta/bootstrap_test.dart b/pkg/front_end/test/fasta/bootstrap_test.dart
index 7a57bfc..524ec46 100644
--- a/pkg/front_end/test/fasta/bootstrap_test.dart
+++ b/pkg/front_end/test/fasta/bootstrap_test.dart
@@ -80,8 +80,8 @@
}
Program programA = new Program();
Program programB = new Program();
- new BinaryBuilder(bytesA, a.toFilePath()).readProgram(programA);
- new BinaryBuilder(bytesB, b.toFilePath()).readProgram(programB);
+ new BinaryBuilder(bytesA, filename: a.toFilePath()).readProgram(programA);
+ new BinaryBuilder(bytesB, filename: b.toFilePath()).readProgram(programB);
RegExp splitLines = new RegExp('^', multiLine: true);
List<String> linesA = programToString(programA).split(splitLines);
List<String> linesB = programToString(programB).split(splitLines);
diff --git a/pkg/front_end/test/fasta/graph_test.dart b/pkg/front_end/test/fasta/graph_test.dart
index f9732b1..b8bc6f1 100644
--- a/pkg/front_end/test/fasta/graph_test.dart
+++ b/pkg/front_end/test/fasta/graph_test.dart
@@ -9,7 +9,7 @@
import 'package:test_reflective_loader/test_reflective_loader.dart'
show defineReflectiveSuite, defineReflectiveTests, reflectiveTest;
-import 'package:front_end/src/fasta/graph/graph.dart';
+import 'package:kernel/util/graph.dart';
import '../src/dependency_walker_test.dart' show DependencyWalkerTest;
@@ -23,57 +23,9 @@
Iterable<String> neighborsOf(String vertex) => graph[vertex];
}
-void test(String expected, Map<String, List<String>> graph) {
- List<List<String>> result = computeStrongComponents(new TestGraph(graph));
- Expect.stringEquals(expected, "$result");
-}
-
main() {
- test("[[B, A], [C], [D]]", {
- "A": ["B"],
- "B": ["A"],
- "C": ["A"],
- "D": ["C"],
- });
-
- test("[]", {});
-
- test("[[A], [B], [C], [D]]", {
- "A": [],
- "B": [],
- "C": [],
- "D": [],
- });
-
- test("[[B, A], [C], [D]]", {
- "D": ["C"],
- "C": ["A"],
- "B": ["A"],
- "A": ["B"],
- });
-
- test("[[D], [C], [B], [A]]", {
- "A": ["B"],
- "B": ["C"],
- "C": ["D"],
- "D": [],
- });
-
- test("[[D], [C], [B], [A]]", {
- "D": [],
- "C": ["D"],
- "B": ["C"],
- "A": ["B"],
- });
-
- test("[[A], [B], [C], [D]]", {
- "A": [],
- "B": ["A"],
- "C": ["A"],
- "D": ["B", "C"],
- });
-
- // TODO(ahe): Move the tests from DependencyWalkerTest here.
+ // TODO(ahe): Delete this file and move DependencyWalkerTest to
+ // pkg/kernel/test/graph_test.dart.
defineReflectiveSuite(() {
defineReflectiveTests(GraphTest);
});
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 6a9403f..99fe3f2 100644
--- a/pkg/front_end/test/incremental_load_from_dill_test.dart
+++ b/pkg/front_end/test/incremental_load_from_dill_test.dart
@@ -14,66 +14,198 @@
show computePlatformBinariesLocation;
import 'package:front_end/src/fasta/incremental_compiler.dart'
show IncrementalCompiler;
-import 'package:front_end/src/fasta/kernel/utils.dart' show writeProgramToFile;
+import 'package:front_end/src/fasta/kernel/utils.dart'
+ show writeProgramToFile, serializeProgram;
+import "package:front_end/src/api_prototype/memory_file_system.dart"
+ show MemoryFileSystem;
-final Uri dart2jsUrl = Uri.base.resolve("pkg/compiler/bin/dart2js.dart");
-final Uri invalidateUri = Uri.parse("package:compiler/src/filenames.dart");
Directory outDir;
-Uri normalDill;
-Uri bootstrappedDill;
main() async {
outDir =
Directory.systemTemp.createTempSync("incremental_load_from_dill_test");
- normalDill = outDir.uri.resolve("dart2js.full.dill");
- bootstrappedDill = outDir.uri.resolve("dart2js.bootstrap.dill");
- Uri nonexisting = outDir.uri.resolve("dart2js.nonexisting.dill");
- Uri nonLoadable = outDir.uri.resolve("dart2js.nonloadable.dill");
try {
- // Compile dart2js without bootstrapping.
- Stopwatch stopwatch = new Stopwatch()..start();
- await normalCompile();
- print("Normal compile took ${stopwatch.elapsedMilliseconds} ms");
-
- // Create a file that cannot be (fully) loaded as a dill file.
- List<int> corruptData = new File.fromUri(normalDill).readAsBytesSync();
- for (int i = 10 * (corruptData.length ~/ 16);
- i < 15 * (corruptData.length ~/ 16);
- ++i) {
- corruptData[i] = 42;
- }
- new File.fromUri(nonLoadable).writeAsBytesSync(corruptData);
-
- // Compile dart2js, bootstrapping from the just-compiled dill.
- for (List<Object> bootstrapData in [
- [normalDill, true],
- [nonexisting, false],
- // [nonLoadable, false] // disabled for now
- ]) {
- Uri bootstrapWith = bootstrapData[0];
- bool bootstrapExpect = bootstrapData[1];
- stopwatch.reset();
- bool bootstrapResult = await bootstrapCompile(bootstrapWith);
- Expect.equals(bootstrapExpect, bootstrapResult);
- print("Bootstrapped compile(s) from ${bootstrapWith.pathSegments.last} "
- "took ${stopwatch.elapsedMilliseconds} ms");
-
- // Compare the two files.
- List<int> normalDillData = new File.fromUri(normalDill).readAsBytesSync();
- List<int> bootstrappedDillData =
- new File.fromUri(bootstrappedDill).readAsBytesSync();
- Expect.equals(normalDillData.length, bootstrappedDillData.length);
- for (int i = 0; i < normalDillData.length; ++i) {
- if (normalDillData[i] != bootstrappedDillData[i]) {
- Expect.fail("Normally compiled and bootstrapped compile differs.");
- }
- }
- }
+ await testDart2jsCompile();
+ await testDisappearingLibrary();
+ await testDeferredLibrary();
} finally {
outDir.deleteSync(recursive: true);
}
}
+/// Test loading from a dill file with a deferred library.
+/// This is done by bootstrapping with no changes.
+void testDeferredLibrary() async {
+ final Uri input = outDir.uri.resolve("testDeferredLibrary_main.dart");
+ final Uri b = outDir.uri.resolve("testDeferredLibrary_b.dart");
+ Uri output = outDir.uri.resolve("testDeferredLibrary_full.dill");
+ Uri bootstrappedOutput =
+ outDir.uri.resolve("testDeferredLibrary_full_from_bootstrap.dill");
+ new File.fromUri(input).writeAsStringSync("""
+ import 'testDeferredLibrary_b.dart' deferred as b;
+
+ void main() {
+ print(b.foo());
+ }
+ """);
+ new File.fromUri(b).writeAsStringSync("""
+ String foo() => "hello from foo in b";
+ """);
+
+ Stopwatch stopwatch = new Stopwatch()..start();
+ await normalCompile(input, output);
+ print("Normal compile took ${stopwatch.elapsedMilliseconds} ms");
+
+ stopwatch.reset();
+ bool bootstrapResult = await bootstrapCompile(
+ input, bootstrappedOutput, output, [],
+ performSizeTests: false);
+ print("Bootstrapped compile(s) from ${output.pathSegments.last} "
+ "took ${stopwatch.elapsedMilliseconds} ms");
+ Expect.isTrue(bootstrapResult);
+
+ // Compare the two files.
+ List<int> normalDillData = new File.fromUri(output).readAsBytesSync();
+ List<int> bootstrappedDillData =
+ new File.fromUri(bootstrappedOutput).readAsBytesSync();
+ checkBootstrappedIsEqual(normalDillData, bootstrappedDillData);
+}
+
+void testDart2jsCompile() async {
+ final Uri dart2jsUrl = Uri.base.resolve("pkg/compiler/bin/dart2js.dart");
+ final Uri invalidateUri = Uri.parse("package:compiler/src/filenames.dart");
+ Uri normalDill = outDir.uri.resolve("dart2js.full.dill");
+ Uri bootstrappedDill = outDir.uri.resolve("dart2js.bootstrap.dill");
+ Uri nonexisting = outDir.uri.resolve("dart2js.nonexisting.dill");
+ Uri nonLoadable = outDir.uri.resolve("dart2js.nonloadable.dill");
+
+ // Compile dart2js without bootstrapping.
+ Stopwatch stopwatch = new Stopwatch()..start();
+ await normalCompile(dart2jsUrl, normalDill);
+ print("Normal compile took ${stopwatch.elapsedMilliseconds} ms");
+
+ // Create a file that cannot be (fully) loaded as a dill file.
+ List<int> corruptData = new File.fromUri(normalDill).readAsBytesSync();
+ for (int i = 10 * (corruptData.length ~/ 16);
+ i < 15 * (corruptData.length ~/ 16);
+ ++i) {
+ corruptData[i] = 42;
+ }
+ new File.fromUri(nonLoadable).writeAsBytesSync(corruptData);
+
+ // Compile dart2js, bootstrapping from the just-compiled dill,
+ // a nonexisting file and a dill file that isn't valid.
+ for (List<Object> bootstrapData in [
+ [normalDill, true],
+ [nonexisting, false],
+ // [nonLoadable, false] // disabled for now
+ ]) {
+ Uri bootstrapWith = bootstrapData[0];
+ bool bootstrapExpect = bootstrapData[1];
+ stopwatch.reset();
+ bool bootstrapResult = await bootstrapCompile(
+ dart2jsUrl, bootstrappedDill, bootstrapWith, [invalidateUri]);
+ Expect.equals(bootstrapExpect, bootstrapResult);
+ print("Bootstrapped compile(s) from ${bootstrapWith.pathSegments.last} "
+ "took ${stopwatch.elapsedMilliseconds} ms");
+
+ // Compare the two files.
+ List<int> normalDillData = new File.fromUri(normalDill).readAsBytesSync();
+ List<int> bootstrappedDillData =
+ new File.fromUri(bootstrappedDill).readAsBytesSync();
+ checkBootstrappedIsEqual(normalDillData, bootstrappedDillData);
+ }
+}
+
+void checkBootstrappedIsEqual(
+ List<int> normalDillData, List<int> bootstrappedDillData) {
+ Expect.equals(normalDillData.length, bootstrappedDillData.length);
+ for (int i = 0; i < normalDillData.length; ++i) {
+ if (normalDillData[i] != bootstrappedDillData[i]) {
+ Expect.fail("Normally compiled and bootstrapped compile differs.");
+ }
+ }
+}
+
+/// Compile an application with n libraries, then
+/// compile "the same" application, but with m < n libraries,
+/// where (at least one) of the missing libraries are "in the middle"
+/// of the library list --- bootstrapping from the dill with n libarries.
+void testDisappearingLibrary() async {
+ final Uri base = Uri.parse("org-dartlang-test:///");
+ final Uri sdkSummary = base.resolve("vm_platform.dill");
+ final Uri main = base.resolve("main.dart");
+ final Uri b = base.resolve("b.dart");
+ final Uri bootstrap = base.resolve("bootstrapFrom.dill");
+ final List<int> sdkSummaryData = await new File.fromUri(
+ computePlatformBinariesLocation().resolve("vm_platform.dill"))
+ .readAsBytes();
+
+ List<int> libCount2;
+ {
+ MemoryFileSystem fs = new MemoryFileSystem(base);
+ fs.entityForUri(sdkSummary).writeAsBytesSync(sdkSummaryData);
+
+ fs.entityForUri(main).writeAsStringSync("""
+ library mainLibrary;
+ import "b.dart" as b;
+
+ main() {
+ b.foo();
+ }
+ """);
+
+ fs.entityForUri(b).writeAsStringSync("""
+ library bLibrary;
+
+ foo() {
+ print("hello from b.dart foo!");
+ }
+ """);
+
+ CompilerOptions options = getOptions();
+ options.fileSystem = fs;
+ options.sdkRoot = null;
+ options.sdkSummary = sdkSummary;
+ IncrementalCompiler compiler =
+ new IncrementalKernelGenerator(options, main);
+ var program = await compiler.computeDelta();
+ libCount2 = serializeProgram(program);
+ if (program.libraries.length != 2) {
+ throw "Expected 2 libraries, got ${program.libraries.length}";
+ }
+ if (program.libraries[0].fileUri != main) {
+ throw "Expected the first library to have uri $main but was "
+ "${program.libraries[0].fileUri}";
+ }
+ }
+
+ {
+ MemoryFileSystem fs = new MemoryFileSystem(base);
+ fs.entityForUri(sdkSummary).writeAsBytesSync(sdkSummaryData);
+ fs.entityForUri(bootstrap).writeAsBytesSync(libCount2);
+ fs.entityForUri(b).writeAsStringSync("""
+ library bLibrary;
+
+ main() {
+ print("hello from b!");
+ }
+ """);
+ CompilerOptions options = getOptions();
+ options.fileSystem = fs;
+ options.sdkRoot = null;
+ options.sdkSummary = sdkSummary;
+ IncrementalCompiler compiler =
+ new IncrementalKernelGenerator(options, b, bootstrap);
+ compiler.invalidate(main);
+ compiler.invalidate(b);
+ var program = await compiler.computeDelta();
+ if (program.libraries.length != 1) {
+ throw "Expected 1 library, got ${program.libraries.length}";
+ }
+ }
+}
+
CompilerOptions getOptions() {
final Uri sdkRoot = computePlatformBinariesLocation();
var options = new CompilerOptions()
@@ -83,24 +215,29 @@
return options;
}
-Future<bool> normalCompile() async {
+Future<bool> normalCompile(Uri input, Uri output) async {
CompilerOptions options = getOptions();
- IncrementalCompiler compiler =
- new IncrementalKernelGenerator(options, dart2jsUrl);
+ IncrementalCompiler compiler = new IncrementalKernelGenerator(options, input);
var y = await compiler.computeDelta();
- await writeProgramToFile(y, normalDill);
+ await writeProgramToFile(y, output);
return compiler.bootstrapSuccess;
}
-Future<bool> bootstrapCompile(Uri bootstrapWith) async {
+Future<bool> bootstrapCompile(
+ Uri input, Uri output, Uri bootstrapWith, List<Uri> invalidateUris,
+ {bool performSizeTests: true}) async {
CompilerOptions options = getOptions();
IncrementalCompiler compiler =
- new IncrementalKernelGenerator(options, dart2jsUrl, bootstrapWith);
- compiler.invalidate(invalidateUri);
+ new IncrementalKernelGenerator(options, input, bootstrapWith);
+ for (Uri invalidateUri in invalidateUris) {
+ compiler.invalidate(invalidateUri);
+ }
var bootstrappedProgram = await compiler.computeDelta();
bool result = compiler.bootstrapSuccess;
- await writeProgramToFile(bootstrappedProgram, bootstrappedDill);
- compiler.invalidate(invalidateUri);
+ await writeProgramToFile(bootstrappedProgram, output);
+ for (Uri invalidateUri in invalidateUris) {
+ compiler.invalidate(invalidateUri);
+ }
var partialProgram = await compiler.computeDelta();
var emptyProgram = await compiler.computeDelta();
@@ -112,9 +249,11 @@
var emptyLibUris =
emptyProgram.libraries.map((lib) => lib.importUri).toList();
- Expect.isTrue(fullLibUris.length > partialLibUris.length);
- Expect.isTrue(partialLibUris.isNotEmpty);
- Expect.isTrue(emptyLibUris.isEmpty);
+ if (performSizeTests) {
+ Expect.isTrue(fullLibUris.length > partialLibUris.length);
+ Expect.isTrue(partialLibUris.isNotEmpty);
+ Expect.isTrue(emptyLibUris.isEmpty);
+ }
return result;
}
diff --git a/pkg/front_end/test/subpackage_relationships_test.dart b/pkg/front_end/test/subpackage_relationships_test.dart
index 3875706..ddacabc 100644
--- a/pkg/front_end/test/subpackage_relationships_test.dart
+++ b/pkg/front_end/test/subpackage_relationships_test.dart
@@ -70,7 +70,6 @@
'lib/src/base',
'lib/src/fasta/builder',
'lib/src/fasta/dill',
- 'lib/src/fasta/graph',
'lib/src/fasta/kernel',
'lib/src/fasta/parser',
'lib/src/fasta/scanner',
@@ -88,7 +87,6 @@
'lib/src/fasta',
'lib/src/fasta/kernel',
]),
- 'lib/src/fasta/graph': new SubpackageRules(),
'lib/src/fasta/kernel': new SubpackageRules(allowedDependencies: [
'lib/src/api_prototype',
'lib/src/fasta',
diff --git a/pkg/front_end/testcases/ast_builder.status b/pkg/front_end/testcases/ast_builder.status
index 6d175ad..6fd0d80 100644
--- a/pkg/front_end/testcases/ast_builder.status
+++ b/pkg/front_end/testcases/ast_builder.status
@@ -71,6 +71,7 @@
inference/instantiate_tearoff_after_contravariance_check: Crash
inference/instantiate_tearoff_of_call: Crash
inference/lambda_does_not_have_propagated_type_hint: Crash
+inference/override_equals: Crash
inference/super_initializer: Crash
inference/super_initializer_substitution: Crash
inference/top_level_return_and_yield: Fail
@@ -152,6 +153,7 @@
regress/issue_31213: Crash
regress/issue_31299: Crash
regress/issue_31766: Crash
+regress/issue_31846: Crash
reorder_super: Crash
runtime_checks/call_method_implicit_tear_off: Crash
runtime_checks/call_method_implicit_tear_off_future_or: Crash
diff --git a/pkg/front_end/testcases/inference/call_corner_cases.dart b/pkg/front_end/testcases/inference/call_corner_cases.dart
index 694c620..41a5eb4 100644
--- a/pkg/front_end/testcases/inference/call_corner_cases.dart
+++ b/pkg/front_end/testcases/inference/call_corner_cases.dart
@@ -22,7 +22,6 @@
main() {
var /*@type=int*/ callA = new A() /*@target=A::call*/ ();
- var /*@type=dynamic*/ callB = new B() /*@target=B::call*/ ();
var /*@type=int*/ callFieldA = new D(). /*@target=D::fieldA*/ fieldA();
var /*@type=int*/ callGetA = new D(). /*@target=D::getA*/ getA();
var /*@type=dynamic*/ callFieldB = new D(). /*@target=D::fieldB*/ fieldB();
diff --git a/pkg/front_end/testcases/inference/call_corner_cases.dart.direct.expect b/pkg/front_end/testcases/inference/call_corner_cases.dart.direct.expect
index b98b3c2..8283021 100644
--- a/pkg/front_end/testcases/inference/call_corner_cases.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/call_corner_cases.dart.direct.expect
@@ -29,7 +29,6 @@
}
static method main() → dynamic {
dynamic callA = new self::A::•().call();
- dynamic callB = new self::B::•().call();
dynamic callFieldA = new self::D::•().fieldA();
dynamic callGetA = new self::D::•().getA();
dynamic callFieldB = new self::D::•().fieldB();
diff --git a/pkg/front_end/testcases/inference/call_corner_cases.dart.strong.expect b/pkg/front_end/testcases/inference/call_corner_cases.dart.strong.expect
index 644b203..6457f6f 100644
--- a/pkg/front_end/testcases/inference/call_corner_cases.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/call_corner_cases.dart.strong.expect
@@ -29,7 +29,6 @@
}
static method main() → dynamic {
core::int callA = new self::A::•().{self::A::call}();
- dynamic callB = new self::B::•().{self::B::call}();
core::int callFieldA = new self::D::•().{self::D::fieldA}();
core::int callGetA = new self::D::•().{self::D::getA}();
dynamic callFieldB = new self::D::•().{self::D::fieldB}();
diff --git a/pkg/front_end/testcases/inference/callable_generic_class.dart b/pkg/front_end/testcases/inference/callable_generic_class.dart
new file mode 100644
index 0000000..9d3408c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/callable_generic_class.dart
@@ -0,0 +1,26 @@
+// 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.
+
+/*@testedFeatures=inference*/
+library test;
+
+class ActionDispatcher<P> {
+ void call([P value]) {}
+}
+
+class Bar {}
+
+class FooActions {
+ ActionDispatcher<Bar> get foo => new ActionDispatcher<Bar>();
+}
+
+void main() {
+ new FooActions(). /*@target=FooActions::foo*/ foo(new Bar());
+ new FooActions()
+ . /*@target=FooActions::foo*/ foo
+ . /*@target=ActionDispatcher::call*/ call(new Bar());
+ (new FooActions()
+ . /*@target=FooActions::foo*/ foo) /*@target=ActionDispatcher::call*/ (
+ new Bar());
+}
diff --git a/pkg/front_end/testcases/inference/callable_generic_class.dart.direct.expect b/pkg/front_end/testcases/inference/callable_generic_class.dart.direct.expect
new file mode 100644
index 0000000..b1b2544
--- /dev/null
+++ b/pkg/front_end/testcases/inference/callable_generic_class.dart.direct.expect
@@ -0,0 +1,27 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class ActionDispatcher<P extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call([self::ActionDispatcher::P value = null]) → void {}
+}
+class Bar extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class FooActions extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get foo() → self::ActionDispatcher<self::Bar>
+ return new self::ActionDispatcher::•<self::Bar>();
+}
+static method main() → void {
+ new self::FooActions::•().foo(new self::Bar::•());
+ new self::FooActions::•().foo.call(new self::Bar::•());
+ new self::FooActions::•().foo.call(new self::Bar::•());
+}
diff --git a/pkg/front_end/testcases/inference/callable_generic_class.dart.outline.expect b/pkg/front_end/testcases/inference/callable_generic_class.dart.outline.expect
new file mode 100644
index 0000000..edb733d
--- /dev/null
+++ b/pkg/front_end/testcases/inference/callable_generic_class.dart.outline.expect
@@ -0,0 +1,22 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class ActionDispatcher<P extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method call([self::ActionDispatcher::P value]) → void
+ ;
+}
+class Bar extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class FooActions extends core::Object {
+ synthetic constructor •() → void
+ ;
+ get foo() → self::ActionDispatcher<self::Bar>
+ ;
+}
+static method main() → void
+ ;
diff --git a/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.expect b/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.expect
new file mode 100644
index 0000000..3e59656
--- /dev/null
+++ b/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.expect
@@ -0,0 +1,27 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class ActionDispatcher<P extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method call([generic-covariant-impl generic-covariant-interface self::ActionDispatcher::P value = null]) → void {}
+}
+class Bar extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class FooActions extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get foo() → self::ActionDispatcher<self::Bar>
+ return new self::ActionDispatcher::•<self::Bar>();
+}
+static method main() → void {
+ new self::FooActions::•().{self::FooActions::foo}(new self::Bar::•());
+ new self::FooActions::•().{self::FooActions::foo}.{self::ActionDispatcher::call}(new self::Bar::•());
+ new self::FooActions::•().{self::FooActions::foo}.{self::ActionDispatcher::call}(new self::Bar::•());
+}
diff --git a/pkg/front_end/testcases/inference/dynamic_methods.dart b/pkg/front_end/testcases/inference/dynamic_methods.dart
new file mode 100644
index 0000000..76fc820
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dynamic_methods.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=inference*/
+library test;
+
+class Foo {
+ int foo(int x) => x;
+}
+
+test() {
+ dynamic d = new Foo();
+ var /*@type=dynamic*/ get_hashCode = d.hashCode;
+ var /*@type=dynamic*/ call_hashCode = d.hashCode();
+ var /*@type=dynamic*/ call_toString = d.toString();
+ var /*@type=dynamic*/ call_toStringArg = d.toString(color: "pink");
+ var /*@type=dynamic*/ call_foo0 = d.foo();
+ var /*@type=dynamic*/ call_foo1 = d.foo(1);
+ var /*@type=dynamic*/ call_foo2 = d.foo(1, 2);
+ var /*@type=dynamic*/ call_nsm0 = d.noSuchMethod();
+ var /*@type=dynamic*/ call_nsm1 = d.noSuchMethod(null);
+ var /*@type=dynamic*/ call_nsm2 = d.noSuchMethod(null, null);
+ var /*@type=bool*/ equals_self = d == d;
+ var /*@type=bool*/ equals_null = d == null;
+ var /*@type=bool*/ null_equals = null /*@target=Object::==*/ == d;
+ var /*@type=bool*/ not_equals_self = d != d;
+ var /*@type=bool*/ not_equals_null = d != null;
+ var /*@type=bool*/ null_not_equals = null /*@target=Object::==*/ != d;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/dynamic_methods.dart.direct.expect b/pkg/front_end/testcases/inference/dynamic_methods.dart.direct.expect
new file mode 100644
index 0000000..d6018e5
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dynamic_methods.dart.direct.expect
@@ -0,0 +1,31 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo(core::int x) → core::int
+ return x;
+}
+static method test() → dynamic {
+ dynamic d = new self::Foo::•();
+ dynamic get_hashCode = d.hashCode;
+ dynamic call_hashCode = d.hashCode();
+ dynamic call_toString = d.toString();
+ dynamic call_toStringArg = d.toString(color: "pink");
+ dynamic call_foo0 = d.foo();
+ dynamic call_foo1 = d.foo(1);
+ dynamic call_foo2 = d.foo(1, 2);
+ dynamic call_nsm0 = d.noSuchMethod();
+ dynamic call_nsm1 = d.noSuchMethod(null);
+ dynamic call_nsm2 = d.noSuchMethod(null, null);
+ dynamic equals_self = d.==(d);
+ dynamic equals_null = d.==(null);
+ dynamic null_equals = null.==(d);
+ dynamic not_equals_self = !d.==(d);
+ dynamic not_equals_null = !d.==(null);
+ dynamic null_not_equals = !null.==(d);
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/dynamic_methods.dart.outline.expect b/pkg/front_end/testcases/inference/dynamic_methods.dart.outline.expect
new file mode 100644
index 0000000..7ae4070
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dynamic_methods.dart.outline.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo(core::int x) → core::int
+ ;
+}
+static method test() → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/dynamic_methods.dart.strong.expect b/pkg/front_end/testcases/inference/dynamic_methods.dart.strong.expect
new file mode 100644
index 0000000..97bedda
--- /dev/null
+++ b/pkg/front_end/testcases/inference/dynamic_methods.dart.strong.expect
@@ -0,0 +1,31 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo(core::int x) → core::int
+ return x;
+}
+static method test() → dynamic {
+ dynamic d = new self::Foo::•();
+ dynamic get_hashCode = d.hashCode;
+ dynamic call_hashCode = d.hashCode();
+ dynamic call_toString = d.toString();
+ dynamic call_toStringArg = d.toString(color: "pink");
+ dynamic call_foo0 = d.foo();
+ dynamic call_foo1 = d.foo(1);
+ dynamic call_foo2 = d.foo(1, 2);
+ dynamic call_nsm0 = d.noSuchMethod();
+ dynamic call_nsm1 = d.noSuchMethod(null);
+ dynamic call_nsm2 = d.noSuchMethod(null, null);
+ core::bool equals_self = d.==(d);
+ core::bool equals_null = d.==(null);
+ core::bool null_equals = null.{core::Object::==}(d);
+ core::bool not_equals_self = !d.==(d);
+ core::bool not_equals_null = !d.==(null);
+ core::bool null_not_equals = !null.{core::Object::==}(d);
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/override_equals.dart b/pkg/front_end/testcases/inference/override_equals.dart
new file mode 100644
index 0000000..3037654
--- /dev/null
+++ b/pkg/front_end/testcases/inference/override_equals.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/*@testedFeatures=inference*/
+library test;
+
+class NullEquality {
+ @override
+ Null operator ==(Object other) => null;
+}
+
+class SubNullEquality extends NullEquality {
+ void test() {
+ var /*@type=bool*/ super_equals_self =
+ super /*@target=NullEquality::==*/ == this;
+ var /*@type=bool*/ super_equals_null =
+ super /*@target=NullEquality::==*/ == null;
+ var /*@type=bool*/ super_not_equals_self =
+ super /*@target=NullEquality::==*/ != this;
+ var /*@type=bool*/ super_not_equals_null =
+ super /*@target=NullEquality::==*/ != null;
+ }
+}
+
+test() {
+ NullEquality n = new NullEquality();
+ var /*@type=bool*/ equals_self = n /*@target=NullEquality::==*/ == n;
+ var /*@type=bool*/ equals_null = n /*@target=NullEquality::==*/ == null;
+ var /*@type=bool*/ null_equals = null /*@target=Object::==*/ == n;
+ var /*@type=bool*/ not_equals_self = n /*@target=NullEquality::==*/ != n;
+ var /*@type=bool*/ not_equals_null = n /*@target=NullEquality::==*/ != null;
+ var /*@type=bool*/ null_not_equals = null /*@target=Object::==*/ != n;
+}
+
+main() {
+ test();
+ new SubNullEquality(). /*@target=SubNullEquality::test*/ test();
+}
diff --git a/pkg/front_end/testcases/inference/override_equals.dart.direct.expect b/pkg/front_end/testcases/inference/override_equals.dart.direct.expect
new file mode 100644
index 0000000..6ffe3a7
--- /dev/null
+++ b/pkg/front_end/testcases/inference/override_equals.dart.direct.expect
@@ -0,0 +1,36 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class NullEquality extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ @core::override
+ operator ==(core::Object other) → core::Null
+ return null;
+}
+class SubNullEquality extends self::NullEquality {
+ synthetic constructor •() → void
+ : super self::NullEquality::•()
+ ;
+ method test() → void {
+ dynamic super_equals_self = super.{self::NullEquality::==}(this);
+ dynamic super_equals_null = super.{self::NullEquality::==}(null);
+ dynamic super_not_equals_self = !super.{self::NullEquality::==}(this);
+ dynamic super_not_equals_null = !super.{self::NullEquality::==}(null);
+ }
+}
+static method test() → dynamic {
+ self::NullEquality n = new self::NullEquality::•();
+ dynamic equals_self = n.==(n);
+ dynamic equals_null = n.==(null);
+ dynamic null_equals = null.==(n);
+ dynamic not_equals_self = !n.==(n);
+ dynamic not_equals_null = !n.==(null);
+ dynamic null_not_equals = !null.==(n);
+}
+static method main() → dynamic {
+ self::test();
+ new self::SubNullEquality::•().test();
+}
diff --git a/pkg/front_end/testcases/inference/override_equals.dart.outline.expect b/pkg/front_end/testcases/inference/override_equals.dart.outline.expect
new file mode 100644
index 0000000..2123d29
--- /dev/null
+++ b/pkg/front_end/testcases/inference/override_equals.dart.outline.expect
@@ -0,0 +1,20 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class NullEquality extends core::Object {
+ synthetic constructor •() → void
+ ;
+ operator ==(core::Object other) → core::Null
+ ;
+}
+class SubNullEquality extends self::NullEquality {
+ synthetic constructor •() → void
+ ;
+ method test() → void
+ ;
+}
+static method test() → dynamic
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/override_equals.dart.strong.expect b/pkg/front_end/testcases/inference/override_equals.dart.strong.expect
new file mode 100644
index 0000000..5f3bb3f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/override_equals.dart.strong.expect
@@ -0,0 +1,36 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class NullEquality extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ @core::override
+ operator ==(core::Object other) → core::Null
+ return null;
+}
+class SubNullEquality extends self::NullEquality {
+ synthetic constructor •() → void
+ : super self::NullEquality::•()
+ ;
+ method test() → void {
+ core::bool super_equals_self = super.{self::NullEquality::==}(this);
+ core::bool super_equals_null = super.{self::NullEquality::==}(null);
+ core::bool super_not_equals_self = !super.{self::NullEquality::==}(this);
+ core::bool super_not_equals_null = !super.{self::NullEquality::==}(null);
+ }
+}
+static method test() → dynamic {
+ self::NullEquality n = new self::NullEquality::•();
+ core::bool equals_self = n.{self::NullEquality::==}(n);
+ core::bool equals_null = n.{self::NullEquality::==}(null);
+ core::bool null_equals = null.{core::Object::==}(n);
+ core::bool not_equals_self = !n.{self::NullEquality::==}(n);
+ core::bool not_equals_null = !n.{self::NullEquality::==}(null);
+ core::bool null_not_equals = !null.{core::Object::==}(n);
+}
+static method main() → dynamic {
+ self::test();
+ new self::SubNullEquality::•().{self::SubNullEquality::test}();
+}
diff --git a/pkg/front_end/testcases/rasta/super.dart.strong.expect b/pkg/front_end/testcases/rasta/super.dart.strong.expect
index b24414b..45abd32 100644
--- a/pkg/front_end/testcases/rasta/super.dart.strong.expect
+++ b/pkg/front_end/testcases/rasta/super.dart.strong.expect
@@ -179,30 +179,30 @@
self::use(super.m = 42);
super.{self::A::n} = 42;
self::use(super.{self::A::n} = 42);
- super.{self::A::a}.{core::Object::==}(null) ?{dynamic} super.{self::A::a} = 42 : null;
- self::use(let final dynamic #t46 = super.{self::A::a} in #t46.{core::Object::==}(null) ?{dynamic} super.{self::A::a} = 42 : #t46);
- super.{self::B::b}.{core::Object::==}(null) ?{dynamic} super.{self::A::b} = 42 : null;
- self::use(let final dynamic #t47 = super.{self::B::b} in #t47.{core::Object::==}(null) ?{dynamic} super.{self::A::b} = 42 : #t47);
- super.{self::A::c}.{core::Object::==}(null) ?{dynamic} super.{self::B::c} = 42 : null;
- self::use(let final dynamic #t48 = super.{self::A::c} in #t48.{core::Object::==}(null) ?{dynamic} super.{self::B::c} = 42 : #t48);
- super.{self::B::d}.{core::Object::==}(null) ?{dynamic} super.{self::A::d} = 42 : null;
- self::use(let final dynamic #t49 = super.{self::B::d} in #t49.{core::Object::==}(null) ?{dynamic} super.{self::A::d} = 42 : #t49);
- super.{self::A::e}.{core::Object::==}(null) ?{dynamic} super.e = 42 : null;
- self::use(let final dynamic #t50 = super.{self::A::e} in #t50.{core::Object::==}(null) ?{dynamic} super.e = 42 : #t50);
- super.{self::A::f}.{core::Object::==}(null) ?{dynamic} super.f = 42 : null;
- self::use(let final dynamic #t51 = super.{self::A::f} in #t51.{core::Object::==}(null) ?{dynamic} super.f = 42 : #t51);
- super.g.{core::Object::==}(null) ?{dynamic} super.{self::A::g} = 42 : null;
- self::use(let final dynamic #t52 = super.g in #t52.{core::Object::==}(null) ?{dynamic} super.{self::A::g} = 42 : #t52);
- super.{self::A::h}.{core::Object::==}(null) ?{dynamic} super.{self::A::h} = 42 : null;
- self::use(let final dynamic #t53 = super.{self::A::h} in #t53.{core::Object::==}(null) ?{dynamic} super.{self::A::h} = 42 : #t53);
- super.{self::A::i}.{core::Object::==}(null) ?{dynamic} super.{self::B::i} = 42 : null;
- self::use(let final dynamic #t54 = super.{self::A::i} in #t54.{core::Object::==}(null) ?{dynamic} super.{self::B::i} = 42 : #t54);
- let final core::int #t55 = 87 in super.{self::A::[]}(#t55).{core::Object::==}(null) ?{dynamic} let final core::int #t56 = 42 in let final void #t57 = super.{self::A::[]=}(#t55, #t56) in #t56 : null;
- self::use(let final core::int #t58 = 87 in let final dynamic #t59 = super.{self::A::[]}(#t58) in #t59.{core::Object::==}(null) ?{dynamic} let final core::int #t60 = 42 in let final void #t61 = super.{self::A::[]=}(#t58, #t60) in #t60 : #t59);
- super.{self::A::m}.{core::Object::==}(null) ?{core::Object} super.m = 42 : null;
- self::use(let final () → void #t62 = super.{self::A::m} in #t62.{core::Object::==}(null) ?{core::Object} super.m = 42 : #t62);
- super.{self::A::n}.{core::Object::==}(null) ?{core::Object} super.{self::A::n} = 42 : null;
- self::use(let final () → void #t63 = super.{self::A::n} in #t63.{core::Object::==}(null) ?{core::Object} super.{self::A::n} = 42 : #t63);
+ super.{self::A::a}.==(null) ?{dynamic} super.{self::A::a} = 42 : null;
+ self::use(let final dynamic #t46 = super.{self::A::a} in #t46.==(null) ?{dynamic} super.{self::A::a} = 42 : #t46);
+ super.{self::B::b}.==(null) ?{dynamic} super.{self::A::b} = 42 : null;
+ self::use(let final dynamic #t47 = super.{self::B::b} in #t47.==(null) ?{dynamic} super.{self::A::b} = 42 : #t47);
+ super.{self::A::c}.==(null) ?{dynamic} super.{self::B::c} = 42 : null;
+ self::use(let final dynamic #t48 = super.{self::A::c} in #t48.==(null) ?{dynamic} super.{self::B::c} = 42 : #t48);
+ super.{self::B::d}.==(null) ?{dynamic} super.{self::A::d} = 42 : null;
+ self::use(let final dynamic #t49 = super.{self::B::d} in #t49.==(null) ?{dynamic} super.{self::A::d} = 42 : #t49);
+ super.{self::A::e}.==(null) ?{dynamic} super.e = 42 : null;
+ self::use(let final dynamic #t50 = super.{self::A::e} in #t50.==(null) ?{dynamic} super.e = 42 : #t50);
+ super.{self::A::f}.==(null) ?{dynamic} super.f = 42 : null;
+ self::use(let final dynamic #t51 = super.{self::A::f} in #t51.==(null) ?{dynamic} super.f = 42 : #t51);
+ super.g.==(null) ?{dynamic} super.{self::A::g} = 42 : null;
+ self::use(let final dynamic #t52 = super.g in #t52.==(null) ?{dynamic} super.{self::A::g} = 42 : #t52);
+ super.{self::A::h}.==(null) ?{dynamic} super.{self::A::h} = 42 : null;
+ self::use(let final dynamic #t53 = super.{self::A::h} in #t53.==(null) ?{dynamic} super.{self::A::h} = 42 : #t53);
+ super.{self::A::i}.==(null) ?{dynamic} super.{self::B::i} = 42 : null;
+ self::use(let final dynamic #t54 = super.{self::A::i} in #t54.==(null) ?{dynamic} super.{self::B::i} = 42 : #t54);
+ let final core::int #t55 = 87 in super.{self::A::[]}(#t55).==(null) ?{dynamic} let final core::int #t56 = 42 in let final void #t57 = super.{self::A::[]=}(#t55, #t56) in #t56 : null;
+ self::use(let final core::int #t58 = 87 in let final dynamic #t59 = super.{self::A::[]}(#t58) in #t59.==(null) ?{dynamic} let final core::int #t60 = 42 in let final void #t61 = super.{self::A::[]=}(#t58, #t60) in #t60 : #t59);
+ super.{self::A::m}.==(null) ?{core::Object} super.m = 42 : null;
+ self::use(let final () → void #t62 = super.{self::A::m} in #t62.==(null) ?{core::Object} super.m = 42 : #t62);
+ super.{self::A::n}.==(null) ?{core::Object} super.{self::A::n} = 42 : null;
+ self::use(let final () → void #t63 = super.{self::A::n} in #t63.==(null) ?{core::Object} super.{self::A::n} = 42 : #t63);
super.{self::A::a} = super.{self::A::a}.+(42);
self::use(super.{self::A::a} = super.{self::A::a}.+(42));
super.{self::A::b} = super.{self::B::b}.+(42);
@@ -253,9 +253,9 @@
self::use(super.{self::A::n} = let final dynamic #t79 = super.{self::A::n} in let dynamic _ = null in invalid-expression "pkg/front_end/testcases/rasta/super.dart:250:17: Error: The method '-' isn't defined for the class '() \u8594 void'.\nTry correcting the name to the name of an existing method, or defining a method named '-'.\n use(super.n -= 42);\n ^");
}
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/rasta/super.dart:43:5: Error: '+' is not a prefix operator.\nTry removing '+'.\n +super;\n ^", "pkg/front_end/testcases/rasta/super.dart:43:5: Error: Getter not found: ''.\n +super;\n ^", "pkg/front_end/testcases/rasta/super.dart:44:9: Error: '+' is not a prefix operator.\nTry removing '+'.\n use(+super);\n ^", "pkg/front_end/testcases/rasta/super.dart:44:9: Error: Getter not found: ''.\n use(+super);\n ^", "pkg/front_end/testcases/rasta/super.dart:62:11: Error: Superclass has no getter named 'g'.\n super.g;\n ^", "pkg/front_end/testcases/rasta/super.dart:63:15: Error: Superclass has no getter named 'g'.\n use(super.g);\n ^", "pkg/front_end/testcases/rasta/super.dart:83:11: Error: Superclass has no setter named 'e'.\n super.e++;\n ^", "pkg/front_end/testcases/rasta/super.dart:84:15: Error: Superclass has no setter named 'e'.\n use(super.e++);\n ^", "pkg/front_end/testcases/rasta/super.dart:85:11: Error: Superclass has no setter named 'f'.\n super.f++;\n ^", "pkg/front_end/testcases/rasta/super.dart:86:15: Error: Superclass has no setter named 'f'.\n use(super.f++);\n ^", "pkg/front_end/testcases/rasta/super.dart:87:11: Error: Superclass has no getter named 'g'.\n super.g++;\n ^", "pkg/front_end/testcases/rasta/super.dart:88:15: Error: Superclass has no getter named 'g'.\n use(super.g++);\n ^", "pkg/front_end/testcases/rasta/super.dart:95:11: Error: Superclass has no setter named 'm'.\n super.m++;\n ^", "pkg/front_end/testcases/rasta/super.dart:96:15: Error: Superclass has no setter named 'm'.\n use(super.m++);\n ^", "pkg/front_end/testcases/rasta/super.dart:108:13: Error: Superclass has no setter named 'e'.\n ++super.e;\n ^", "pkg/front_end/testcases/rasta/super.dart:109:17: Error: Superclass has no setter named 'e'.\n use(++super.e);\n ^", "pkg/front_end/testcases/rasta/super.dart:110:13: Error: Superclass has no setter named 'f'.\n ++super.f;\n ^", "pkg/front_end/testcases/rasta/super.dart:111:17: Error: Superclass has no setter named 'f'.\n use(++super.f);\n ^", "pkg/front_end/testcases/rasta/super.dart:112:13: Error: Superclass has no getter named 'g'.\n ++super.g;\n ^", "pkg/front_end/testcases/rasta/super.dart:113:17: Error: Superclass has no getter named 'g'.\n use(++super.g);\n ^", "pkg/front_end/testcases/rasta/super.dart:120:13: Error: Superclass has no setter named 'm'.\n ++super.m;\n ^", "pkg/front_end/testcases/rasta/super.dart:121:17: Error: Superclass has no setter named 'm'.\n use(++super.m);\n ^", "pkg/front_end/testcases/rasta/super.dart:137:11: Error: Superclass has no method named 'g'.\n super.g();\n ^", "pkg/front_end/testcases/rasta/super.dart:138:15: Error: Superclass has no method named 'g'.\n use(super.g());\n ^", "pkg/front_end/testcases/rasta/super.dart:160:11: Error: Superclass has no setter named 'e'.\n super.e = 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:161:15: Error: Superclass has no setter named 'e'.\n use(super.e = 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:162:11: Error: Superclass has no setter named 'f'.\n super.f = 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:163:15: Error: Superclass has no setter named 'f'.\n use(super.f = 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:172:11: Error: Superclass has no setter named 'm'.\n super.m = 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:173:15: Error: Superclass has no setter named 'm'.\n use(super.m = 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:185:11: Error: Superclass has no setter named 'e'.\n super.e ??= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:186:15: Error: Superclass has no setter named 'e'.\n use(super.e ??= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:187:11: Error: Superclass has no setter named 'f'.\n super.f ??= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:188:15: Error: Superclass has no setter named 'f'.\n use(super.f ??= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:189:11: Error: Superclass has no getter named 'g'.\n super.g ??= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:190:15: Error: Superclass has no getter named 'g'.\n use(super.g ??= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:197:11: Error: Superclass has no setter named 'm'.\n super.m ??= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:198:15: Error: Superclass has no setter named 'm'.\n use(super.m ??= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:210:11: Error: Superclass has no setter named 'e'.\n super.e += 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:211:15: Error: Superclass has no setter named 'e'.\n use(super.e += 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:212:11: Error: Superclass has no setter named 'f'.\n super.f += 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:213:15: Error: Superclass has no setter named 'f'.\n use(super.f += 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:214:11: Error: Superclass has no getter named 'g'.\n super.g += 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:215:15: Error: Superclass has no getter named 'g'.\n use(super.g += 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:222:11: Error: Superclass has no setter named 'm'.\n super.m += 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:223:15: Error: Superclass has no setter named 'm'.\n use(super.m += 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:235:11: Error: Superclass has no setter named 'e'.\n super.e -= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:236:15: Error: Superclass has no setter named 'e'.\n use(super.e -= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:237:11: Error: Superclass has no setter named 'f'.\n super.f -= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:238:15: Error: Superclass has no setter named 'f'.\n use(super.f -= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:239:11: Error: Superclass has no getter named 'g'.\n super.g -= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:240:15: Error: Superclass has no getter named 'g'.\n use(super.g -= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:247:11: Error: Superclass has no setter named 'm'.\n super.m -= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:248:15: Error: Superclass has no setter named 'm'.\n use(super.m -= 42);\n ^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/rasta/super.dart:43:5: Error: '+' is not a prefix operator.\nTry removing '+'.\n +super;\n ^", "pkg/front_end/testcases/rasta/super.dart:43:5: Error: Getter not found: ''.\n +super;\n ^", "pkg/front_end/testcases/rasta/super.dart:44:9: Error: '+' is not a prefix operator.\nTry removing '+'.\n use(+super);\n ^", "pkg/front_end/testcases/rasta/super.dart:44:9: Error: Getter not found: ''.\n use(+super);\n ^", "pkg/front_end/testcases/rasta/super.dart:62:11: Error: Superclass has no getter named 'g'.\n super.g;\n ^", "pkg/front_end/testcases/rasta/super.dart:63:15: Error: Superclass has no getter named 'g'.\n use(super.g);\n ^", "pkg/front_end/testcases/rasta/super.dart:83:11: Error: Superclass has no setter named 'e'.\n super.e++;\n ^", "pkg/front_end/testcases/rasta/super.dart:84:15: Error: Superclass has no setter named 'e'.\n use(super.e++);\n ^", "pkg/front_end/testcases/rasta/super.dart:85:11: Error: Superclass has no setter named 'f'.\n super.f++;\n ^", "pkg/front_end/testcases/rasta/super.dart:86:15: Error: Superclass has no setter named 'f'.\n use(super.f++);\n ^", "pkg/front_end/testcases/rasta/super.dart:87:11: Error: Superclass has no getter named 'g'.\n super.g++;\n ^", "pkg/front_end/testcases/rasta/super.dart:88:15: Error: Superclass has no getter named 'g'.\n use(super.g++);\n ^", "pkg/front_end/testcases/rasta/super.dart:95:11: Error: Superclass has no setter named 'm'.\n super.m++;\n ^", "pkg/front_end/testcases/rasta/super.dart:96:15: Error: Superclass has no setter named 'm'.\n use(super.m++);\n ^", "pkg/front_end/testcases/rasta/super.dart:108:13: Error: Superclass has no setter named 'e'.\n ++super.e;\n ^", "pkg/front_end/testcases/rasta/super.dart:109:17: Error: Superclass has no setter named 'e'.\n use(++super.e);\n ^", "pkg/front_end/testcases/rasta/super.dart:110:13: Error: Superclass has no setter named 'f'.\n ++super.f;\n ^", "pkg/front_end/testcases/rasta/super.dart:111:17: Error: Superclass has no setter named 'f'.\n use(++super.f);\n ^", "pkg/front_end/testcases/rasta/super.dart:112:13: Error: Superclass has no getter named 'g'.\n ++super.g;\n ^", "pkg/front_end/testcases/rasta/super.dart:113:17: Error: Superclass has no getter named 'g'.\n use(++super.g);\n ^", "pkg/front_end/testcases/rasta/super.dart:120:13: Error: Superclass has no setter named 'm'.\n ++super.m;\n ^", "pkg/front_end/testcases/rasta/super.dart:121:17: Error: Superclass has no setter named 'm'.\n use(++super.m);\n ^", "pkg/front_end/testcases/rasta/super.dart:137:11: Error: Superclass has no method named 'g'.\n super.g();\n ^", "pkg/front_end/testcases/rasta/super.dart:138:15: Error: Superclass has no method named 'g'.\n use(super.g());\n ^", "pkg/front_end/testcases/rasta/super.dart:160:11: Error: Superclass has no setter named 'e'.\n super.e = 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:161:15: Error: Superclass has no setter named 'e'.\n use(super.e = 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:162:11: Error: Superclass has no setter named 'f'.\n super.f = 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:163:15: Error: Superclass has no setter named 'f'.\n use(super.f = 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:172:11: Error: Superclass has no setter named 'm'.\n super.m = 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:173:15: Error: Superclass has no setter named 'm'.\n use(super.m = 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:185:11: Error: Superclass has no setter named 'e'.\n super.e ??= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:186:15: Error: Superclass has no setter named 'e'.\n use(super.e ??= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:187:11: Error: Superclass has no setter named 'f'.\n super.f ??= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:188:15: Error: Superclass has no setter named 'f'.\n use(super.f ??= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:189:11: Error: Superclass has no getter named 'g'.\n super.g ??= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:190:15: Error: Superclass has no getter named 'g'.\n use(super.g ??= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:197:11: Error: Superclass has no setter named 'm'.\n super.m ??= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:198:15: Error: Superclass has no setter named 'm'.\n use(super.m ??= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:210:11: Error: Superclass has no setter named 'e'.\n super.e += 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:211:15: Error: Superclass has no setter named 'e'.\n use(super.e += 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:212:11: Error: Superclass has no setter named 'f'.\n super.f += 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:213:15: Error: Superclass has no setter named 'f'.\n use(super.f += 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:214:11: Error: Superclass has no getter named 'g'.\n super.g += 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:215:15: Error: Superclass has no getter named 'g'.\n use(super.g += 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:222:11: Error: Superclass has no setter named 'm'.\n super.m += 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:223:15: Error: Superclass has no setter named 'm'.\n use(super.m += 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:235:11: Error: Superclass has no setter named 'e'.\n super.e -= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:236:15: Error: Superclass has no setter named 'e'.\n use(super.e -= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:237:11: Error: Superclass has no setter named 'f'.\n super.f -= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:238:15: Error: Superclass has no setter named 'f'.\n use(super.f -= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:239:11: Error: Superclass has no getter named 'g'.\n super.g -= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:240:15: Error: Superclass has no getter named 'g'.\n use(super.g -= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:247:11: Error: Superclass has no setter named 'm'.\n super.m -= 42;\n ^", "pkg/front_end/testcases/rasta/super.dart:248:15: Error: Superclass has no setter named 'm'.\n use(super.m -= 42);\n ^", "pkg/front_end/testcases/rasta/super.dart:147:11: Error: Too many positional arguments to method: 0 allowed, 1 given.\n super.m(87);\n ^", "pkg/front_end/testcases/rasta/super.dart:148:15: Error: Too many positional arguments to method: 0 allowed, 1 given.\n use(super.m(87));\n ^", "pkg/front_end/testcases/rasta/super.dart:149:11: Error: Too many positional arguments to method: 0 allowed, 1 given.\n super.n(87);\n ^", "pkg/front_end/testcases/rasta/super.dart:150:15: Error: Too many positional arguments to method: 0 allowed, 1 given.\n use(super.n(87));\n ^"]/* from null */;
static method use(dynamic x) → dynamic {
- if(x.{core::Object::==}(new core::DateTime::now().{core::DateTime::millisecondsSinceEpoch}))
+ if(x.==(new core::DateTime::now().{core::DateTime::millisecondsSinceEpoch}))
throw "Shouldn't happen";
}
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/regress/issue_29945.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29945.dart.strong.expect
index 6b2f5d7..538d3be 100644
--- a/pkg/front_end/testcases/regress/issue_29945.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29945.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29945.dart:6:3: Error: 's.bool' isn't a type.\n s.bool x = null;\n ^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29945.dart:6:3: Error: 's.bool' can't be used as a type because 's' isn't defined.\n s.bool x = null;\n ^"]/* from null */;
static method main() → dynamic {
invalid-type x = null;
}
diff --git a/pkg/front_end/testcases/regress/issue_29980.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29980.dart.strong.expect
index 7489747..80d956e 100644
--- a/pkg/front_end/testcases/regress/issue_29980.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29980.dart.strong.expect
@@ -1,7 +1,7 @@
library;
import self as self;
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29980.dart:6:3: Error: 'x.y' isn't a type.\n x.y z;\n ^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29980.dart:6:3: Error: 'x.y' can't be used as a type because 'x' isn't defined.\n x.y z;\n ^"]/* from null */;
static method main() → dynamic {
invalid-type z;
}
diff --git a/pkg/front_end/testcases/regress/issue_30981.dart b/pkg/front_end/testcases/regress/issue_30981.dart
new file mode 100644
index 0000000..09e7fd8
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_30981.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class A {
+ get A {
+ print("Actually, I'm a getter, not a constructor.");
+ }
+}
+
+main() {
+ new A();
+}
diff --git a/pkg/front_end/testcases/regress/issue_30981.dart.direct.expect b/pkg/front_end/testcases/regress/issue_30981.dart.direct.expect
new file mode 100644
index 0000000..5fec1e0
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_30981.dart.direct.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get A() → dynamic {
+ core::print("Actually, I'm a getter, not a constructor.");
+ }
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_30981.dart:6:7: Error: A class member can't have the same name as the enclosing class.\n get A {\n ^"]/* from null */;
+static method main() → dynamic {
+ new self::A::•();
+}
diff --git a/pkg/front_end/testcases/regress/issue_30981.dart.outline.expect b/pkg/front_end/testcases/regress/issue_30981.dart.outline.expect
new file mode 100644
index 0000000..f1cbbf4
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_30981.dart.outline.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ ;
+ get A() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/regress/issue_30981.dart.strong.expect b/pkg/front_end/testcases/regress/issue_30981.dart.strong.expect
new file mode 100644
index 0000000..5fec1e0
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_30981.dart.strong.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ get A() → dynamic {
+ core::print("Actually, I'm a getter, not a constructor.");
+ }
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_30981.dart:6:7: Error: A class member can't have the same name as the enclosing class.\n get A {\n ^"]/* from null */;
+static method main() → dynamic {
+ new self::A::•();
+}
diff --git a/pkg/front_end/testcases/regress/issue_31299.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31299.dart.strong.expect
index d8441ee..8f2b5ef 100644
--- a/pkg/front_end/testcases/regress/issue_31299.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31299.dart.strong.expect
@@ -13,7 +13,7 @@
method foo(core::int a, core::int b) → core::int
return a.{core::num::+}(b.{core::num::*}(this.{self::A::m}));
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_31299.dart:10:3: Error: Conflicts with member 'foo'.\n A.foo() : m = 2;\n ^", "pkg/front_end/testcases/regress/issue_31299.dart:11:7: Error: Conflicts with constructor 'A.foo'.\n int foo(int a, int b) => a + b * m;\n ^", "pkg/front_end/testcases/regress/issue_31299.dart:18:7: Error: Method not found: 'foo'.\n new A.foo(1, 2);\n ^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_31299.dart:10:3: Error: Conflicts with member 'foo'.\n A.foo() : m = 2;\n ^", "pkg/front_end/testcases/regress/issue_31299.dart:11:7: Error: Conflicts with constructor 'A.foo'.\n int foo(int a, int b) => a + b * m;\n ^", "pkg/front_end/testcases/regress/issue_31299.dart:18:7: Error: Too many positional arguments to constructor: 0 allowed, 2 given.\n new A.foo(1, 2);\n ^", "pkg/front_end/testcases/regress/issue_31299.dart:15:11: Error: Too few positional arguments to method: 2 required, 0 given.\n new A().foo();\n ^"]/* from null */;
static method test() → dynamic {
new self::A::•().{self::A::foo}();
new self::A::•().{self::A::foo}(1, 2);
diff --git a/pkg/front_end/testcases/regress/issue_31846.dart b/pkg/front_end/testcases/regress/issue_31846.dart
new file mode 100644
index 0000000..6ec5564
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_31846.dart
@@ -0,0 +1,10 @@
+// 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.
+
+main() {
+ print(main is Function());
+ print((<T>(T x) => x).runtimeType);
+ print((<T extends num>(T x) => x).runtimeType);
+ print((<T extends Comparable<T>>(T x) => x).runtimeType);
+}
diff --git a/pkg/front_end/testcases/regress/issue_31846.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31846.dart.direct.expect
new file mode 100644
index 0000000..960d4d1
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_31846.dart.direct.expect
@@ -0,0 +1,10 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ core::print(self::main is () → dynamic);
+ core::print((<T extends core::Object>(T x) → dynamic => x).runtimeType);
+ core::print((<T extends core::num>(T x) → dynamic => x).runtimeType);
+ core::print((<T extends core::Comparable<T>>(T x) → dynamic => x).runtimeType);
+}
diff --git a/pkg/front_end/testcases/regress/issue_31846.dart.outline.expect b/pkg/front_end/testcases/regress/issue_31846.dart.outline.expect
new file mode 100644
index 0000000..6a28c0d
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_31846.dart.outline.expect
@@ -0,0 +1,5 @@
+library;
+import self as self;
+
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/regress/issue_31846.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31846.dart.strong.expect
new file mode 100644
index 0000000..8a842f2
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_31846.dart.strong.expect
@@ -0,0 +1,10 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static method main() → dynamic {
+ core::print(self::main is () → dynamic);
+ core::print((<T extends core::Object>(T x) → T => x).{core::Object::runtimeType});
+ core::print((<T extends core::num>(T x) → T => x).{core::Object::runtimeType});
+ core::print((<T extends core::Comparable<T>>(T x) → T => x).{core::Object::runtimeType});
+}
diff --git a/pkg/front_end/testcases/regress/issue_32200.dart b/pkg/front_end/testcases/regress/issue_32200.dart
new file mode 100644
index 0000000..efdc4a0
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_32200.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.
+
+import "issue_32200.dart" as self;
+
+class Foo {
+ self.Foo self;
+}
+
+main() {
+ self.Foo instance = new Foo();
+ instance.self = instance;
+}
diff --git a/pkg/front_end/testcases/regress/issue_32200.dart.direct.expect b/pkg/front_end/testcases/regress/issue_32200.dart.direct.expect
new file mode 100644
index 0000000..9857054
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_32200.dart.direct.expect
@@ -0,0 +1,14 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ field self::Foo self = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::Foo instance = new self::Foo::•();
+ instance.self = instance;
+}
diff --git a/pkg/front_end/testcases/regress/issue_32200.dart.outline.expect b/pkg/front_end/testcases/regress/issue_32200.dart.outline.expect
new file mode 100644
index 0000000..f1fcdb9
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_32200.dart.outline.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ field self::Foo self;
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/regress/issue_32200.dart.strong.expect b/pkg/front_end/testcases/regress/issue_32200.dart.strong.expect
new file mode 100644
index 0000000..efdc0dc
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_32200.dart.strong.expect
@@ -0,0 +1,15 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ field self::Foo self = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_32200.dart:8:3: Error: 'self.Foo' can't be used as a type because 'self' doesn't refer to an import prefix.\n self.Foo self;\n ^"]/* from null */;
+static method main() → dynamic {
+ self::Foo instance = new self::Foo::•();
+ instance.{self::Foo::self} = instance;
+}
diff --git a/pkg/front_end/testcases/return_with_unknown_type_in_context.dart.strong.expect b/pkg/front_end/testcases/return_with_unknown_type_in_context.dart.strong.expect
index 47fe398..31007c6 100644
--- a/pkg/front_end/testcases/return_with_unknown_type_in_context.dart.strong.expect
+++ b/pkg/front_end/testcases/return_with_unknown_type_in_context.dart.strong.expect
@@ -5,6 +5,6 @@
static method f(core::List<dynamic> x) → core::bool {
return x.{core::Iterable::expand}<dynamic>((dynamic y) → core::Iterable<dynamic> {
return y.split(",") as{TypeError} core::Iterable<dynamic>;
- }).{core::Iterable::any}((dynamic y) → core::bool => y.{core::Object::==}("z"));
+ }).{core::Iterable::any}((dynamic y) → core::bool => y.==("z"));
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/super_rasta_copy.dart.strong.expect b/pkg/front_end/testcases/super_rasta_copy.dart.strong.expect
index c40c044..94b1e5d 100644
--- a/pkg/front_end/testcases/super_rasta_copy.dart.strong.expect
+++ b/pkg/front_end/testcases/super_rasta_copy.dart.strong.expect
@@ -165,28 +165,28 @@
self::use(let final core::int #t35 = 87 in let final core::int #t36 = 42 in let final void #t37 = super.{self::A::[]=}(#t35, #t36) in #t36);
super.m = 42;
self::use(super.m = 42);
- super.{self::A::a}.{core::Object::==}(null) ?{dynamic} super.{self::A::a} = 42 : null;
- self::use(let final dynamic #t38 = super.{self::A::a} in #t38.{core::Object::==}(null) ?{dynamic} super.{self::A::a} = 42 : #t38);
- super.{self::B::b}.{core::Object::==}(null) ?{dynamic} super.{self::A::b} = 42 : null;
- self::use(let final dynamic #t39 = super.{self::B::b} in #t39.{core::Object::==}(null) ?{dynamic} super.{self::A::b} = 42 : #t39);
- super.{self::A::c}.{core::Object::==}(null) ?{dynamic} super.{self::B::c} = 42 : null;
- self::use(let final dynamic #t40 = super.{self::A::c} in #t40.{core::Object::==}(null) ?{dynamic} super.{self::B::c} = 42 : #t40);
- super.{self::B::d}.{core::Object::==}(null) ?{dynamic} super.{self::A::d} = 42 : null;
- self::use(let final dynamic #t41 = super.{self::B::d} in #t41.{core::Object::==}(null) ?{dynamic} super.{self::A::d} = 42 : #t41);
- super.{self::A::e}.{core::Object::==}(null) ?{dynamic} super.e = 42 : null;
- self::use(let final dynamic #t42 = super.{self::A::e} in #t42.{core::Object::==}(null) ?{dynamic} super.e = 42 : #t42);
- super.{self::A::f}.{core::Object::==}(null) ?{dynamic} super.f = 42 : null;
- self::use(let final dynamic #t43 = super.{self::A::f} in #t43.{core::Object::==}(null) ?{dynamic} super.f = 42 : #t43);
- super.g.{core::Object::==}(null) ?{dynamic} super.{self::A::g} = 42 : null;
- self::use(let final dynamic #t44 = super.g in #t44.{core::Object::==}(null) ?{dynamic} super.{self::A::g} = 42 : #t44);
- super.{self::A::h}.{core::Object::==}(null) ?{dynamic} super.{self::A::h} = 42 : null;
- self::use(let final dynamic #t45 = super.{self::A::h} in #t45.{core::Object::==}(null) ?{dynamic} super.{self::A::h} = 42 : #t45);
- super.{self::A::i}.{core::Object::==}(null) ?{dynamic} super.{self::B::i} = 42 : null;
- self::use(let final dynamic #t46 = super.{self::A::i} in #t46.{core::Object::==}(null) ?{dynamic} super.{self::B::i} = 42 : #t46);
- let final core::int #t47 = 87 in super.{self::A::[]}(#t47).{core::Object::==}(null) ?{dynamic} let final core::int #t48 = 42 in let final void #t49 = super.{self::A::[]=}(#t47, #t48) in #t48 : null;
- self::use(let final core::int #t50 = 87 in let final dynamic #t51 = super.{self::A::[]}(#t50) in #t51.{core::Object::==}(null) ?{dynamic} let final core::int #t52 = 42 in let final void #t53 = super.{self::A::[]=}(#t50, #t52) in #t52 : #t51);
- super.{self::A::m}.{core::Object::==}(null) ?{core::Object} super.m = 42 : null;
- self::use(let final () → void #t54 = super.{self::A::m} in #t54.{core::Object::==}(null) ?{core::Object} super.m = 42 : #t54);
+ super.{self::A::a}.==(null) ?{dynamic} super.{self::A::a} = 42 : null;
+ self::use(let final dynamic #t38 = super.{self::A::a} in #t38.==(null) ?{dynamic} super.{self::A::a} = 42 : #t38);
+ super.{self::B::b}.==(null) ?{dynamic} super.{self::A::b} = 42 : null;
+ self::use(let final dynamic #t39 = super.{self::B::b} in #t39.==(null) ?{dynamic} super.{self::A::b} = 42 : #t39);
+ super.{self::A::c}.==(null) ?{dynamic} super.{self::B::c} = 42 : null;
+ self::use(let final dynamic #t40 = super.{self::A::c} in #t40.==(null) ?{dynamic} super.{self::B::c} = 42 : #t40);
+ super.{self::B::d}.==(null) ?{dynamic} super.{self::A::d} = 42 : null;
+ self::use(let final dynamic #t41 = super.{self::B::d} in #t41.==(null) ?{dynamic} super.{self::A::d} = 42 : #t41);
+ super.{self::A::e}.==(null) ?{dynamic} super.e = 42 : null;
+ self::use(let final dynamic #t42 = super.{self::A::e} in #t42.==(null) ?{dynamic} super.e = 42 : #t42);
+ super.{self::A::f}.==(null) ?{dynamic} super.f = 42 : null;
+ self::use(let final dynamic #t43 = super.{self::A::f} in #t43.==(null) ?{dynamic} super.f = 42 : #t43);
+ super.g.==(null) ?{dynamic} super.{self::A::g} = 42 : null;
+ self::use(let final dynamic #t44 = super.g in #t44.==(null) ?{dynamic} super.{self::A::g} = 42 : #t44);
+ super.{self::A::h}.==(null) ?{dynamic} super.{self::A::h} = 42 : null;
+ self::use(let final dynamic #t45 = super.{self::A::h} in #t45.==(null) ?{dynamic} super.{self::A::h} = 42 : #t45);
+ super.{self::A::i}.==(null) ?{dynamic} super.{self::B::i} = 42 : null;
+ self::use(let final dynamic #t46 = super.{self::A::i} in #t46.==(null) ?{dynamic} super.{self::B::i} = 42 : #t46);
+ let final core::int #t47 = 87 in super.{self::A::[]}(#t47).==(null) ?{dynamic} let final core::int #t48 = 42 in let final void #t49 = super.{self::A::[]=}(#t47, #t48) in #t48 : null;
+ self::use(let final core::int #t50 = 87 in let final dynamic #t51 = super.{self::A::[]}(#t50) in #t51.==(null) ?{dynamic} let final core::int #t52 = 42 in let final void #t53 = super.{self::A::[]=}(#t50, #t52) in #t52 : #t51);
+ super.{self::A::m}.==(null) ?{core::Object} super.m = 42 : null;
+ self::use(let final () → void #t54 = super.{self::A::m} in #t54.==(null) ?{core::Object} super.m = 42 : #t54);
super.{self::A::a} = super.{self::A::a}.+(42);
self::use(super.{self::A::a} = super.{self::A::a}.+(42));
super.{self::A::b} = super.{self::B::b}.+(42);
@@ -233,9 +233,9 @@
self::use(super.m = let final dynamic #t66 = super.{self::A::m} in let dynamic _ = null in invalid-expression "pkg/front_end/testcases/super_rasta_copy.dart:232:17: Error: The method '-' isn't defined for the class '() \u8594 void'.\nTry correcting the name to the name of an existing method, or defining a method named '-'.\n use(super.m -= 42);\n ^");
}
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/super_rasta_copy.dart:60:11: Error: Superclass has no getter named 'g'.\n super.g;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:61:15: Error: Superclass has no getter named 'g'.\n use(super.g);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:79:11: Error: Superclass has no setter named 'e'.\n super.e++;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:80:15: Error: Superclass has no setter named 'e'.\n use(super.e++);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:81:11: Error: Superclass has no setter named 'f'.\n super.f++;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:82:15: Error: Superclass has no setter named 'f'.\n use(super.f++);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:83:11: Error: Superclass has no getter named 'g'.\n super.g++;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:84:15: Error: Superclass has no getter named 'g'.\n use(super.g++);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:91:11: Error: Superclass has no setter named 'm'.\n super.m++;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:92:15: Error: Superclass has no setter named 'm'.\n use(super.m++);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:102:13: Error: Superclass has no setter named 'e'.\n ++super.e;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:103:17: Error: Superclass has no setter named 'e'.\n use(++super.e);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:104:13: Error: Superclass has no setter named 'f'.\n ++super.f;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:105:17: Error: Superclass has no setter named 'f'.\n use(++super.f);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:106:13: Error: Superclass has no getter named 'g'.\n ++super.g;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:107:17: Error: Superclass has no getter named 'g'.\n use(++super.g);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:114:13: Error: Superclass has no setter named 'm'.\n ++super.m;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:115:17: Error: Superclass has no setter named 'm'.\n use(++super.m);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:129:11: Error: Superclass has no method named 'g'.\n super.g();\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:130:15: Error: Superclass has no method named 'g'.\n use(super.g());\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:150:11: Error: Superclass has no setter named 'e'.\n super.e = 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:151:15: Error: Superclass has no setter named 'e'.\n use(super.e = 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:152:11: Error: Superclass has no setter named 'f'.\n super.f = 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:153:15: Error: Superclass has no setter named 'f'.\n use(super.f = 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:162:11: Error: Superclass has no setter named 'm'.\n super.m = 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:163:15: Error: Superclass has no setter named 'm'.\n use(super.m = 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:173:11: Error: Superclass has no setter named 'e'.\n super.e ??= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:174:15: Error: Superclass has no setter named 'e'.\n use(super.e ??= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:175:11: Error: Superclass has no setter named 'f'.\n super.f ??= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:176:15: Error: Superclass has no setter named 'f'.\n use(super.f ??= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:177:11: Error: Superclass has no getter named 'g'.\n super.g ??= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:178:15: Error: Superclass has no getter named 'g'.\n use(super.g ??= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:185:11: Error: Superclass has no setter named 'm'.\n super.m ??= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:186:15: Error: Superclass has no setter named 'm'.\n use(super.m ??= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:196:11: Error: Superclass has no setter named 'e'.\n super.e += 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:197:15: Error: Superclass has no setter named 'e'.\n use(super.e += 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:198:11: Error: Superclass has no setter named 'f'.\n super.f += 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:199:15: Error: Superclass has no setter named 'f'.\n use(super.f += 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:200:11: Error: Superclass has no getter named 'g'.\n super.g += 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:201:15: Error: Superclass has no getter named 'g'.\n use(super.g += 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:208:11: Error: Superclass has no setter named 'm'.\n super.m += 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:209:15: Error: Superclass has no setter named 'm'.\n use(super.m += 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:219:11: Error: Superclass has no setter named 'e'.\n super.e -= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:220:15: Error: Superclass has no setter named 'e'.\n use(super.e -= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:221:11: Error: Superclass has no setter named 'f'.\n super.f -= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:222:15: Error: Superclass has no setter named 'f'.\n use(super.f -= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:223:11: Error: Superclass has no getter named 'g'.\n super.g -= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:224:15: Error: Superclass has no getter named 'g'.\n use(super.g -= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:231:11: Error: Superclass has no setter named 'm'.\n super.m -= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:232:15: Error: Superclass has no setter named 'm'.\n use(super.m -= 42);\n ^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/super_rasta_copy.dart:60:11: Error: Superclass has no getter named 'g'.\n super.g;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:61:15: Error: Superclass has no getter named 'g'.\n use(super.g);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:79:11: Error: Superclass has no setter named 'e'.\n super.e++;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:80:15: Error: Superclass has no setter named 'e'.\n use(super.e++);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:81:11: Error: Superclass has no setter named 'f'.\n super.f++;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:82:15: Error: Superclass has no setter named 'f'.\n use(super.f++);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:83:11: Error: Superclass has no getter named 'g'.\n super.g++;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:84:15: Error: Superclass has no getter named 'g'.\n use(super.g++);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:91:11: Error: Superclass has no setter named 'm'.\n super.m++;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:92:15: Error: Superclass has no setter named 'm'.\n use(super.m++);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:102:13: Error: Superclass has no setter named 'e'.\n ++super.e;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:103:17: Error: Superclass has no setter named 'e'.\n use(++super.e);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:104:13: Error: Superclass has no setter named 'f'.\n ++super.f;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:105:17: Error: Superclass has no setter named 'f'.\n use(++super.f);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:106:13: Error: Superclass has no getter named 'g'.\n ++super.g;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:107:17: Error: Superclass has no getter named 'g'.\n use(++super.g);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:114:13: Error: Superclass has no setter named 'm'.\n ++super.m;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:115:17: Error: Superclass has no setter named 'm'.\n use(++super.m);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:129:11: Error: Superclass has no method named 'g'.\n super.g();\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:130:15: Error: Superclass has no method named 'g'.\n use(super.g());\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:150:11: Error: Superclass has no setter named 'e'.\n super.e = 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:151:15: Error: Superclass has no setter named 'e'.\n use(super.e = 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:152:11: Error: Superclass has no setter named 'f'.\n super.f = 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:153:15: Error: Superclass has no setter named 'f'.\n use(super.f = 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:162:11: Error: Superclass has no setter named 'm'.\n super.m = 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:163:15: Error: Superclass has no setter named 'm'.\n use(super.m = 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:173:11: Error: Superclass has no setter named 'e'.\n super.e ??= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:174:15: Error: Superclass has no setter named 'e'.\n use(super.e ??= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:175:11: Error: Superclass has no setter named 'f'.\n super.f ??= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:176:15: Error: Superclass has no setter named 'f'.\n use(super.f ??= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:177:11: Error: Superclass has no getter named 'g'.\n super.g ??= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:178:15: Error: Superclass has no getter named 'g'.\n use(super.g ??= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:185:11: Error: Superclass has no setter named 'm'.\n super.m ??= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:186:15: Error: Superclass has no setter named 'm'.\n use(super.m ??= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:196:11: Error: Superclass has no setter named 'e'.\n super.e += 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:197:15: Error: Superclass has no setter named 'e'.\n use(super.e += 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:198:11: Error: Superclass has no setter named 'f'.\n super.f += 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:199:15: Error: Superclass has no setter named 'f'.\n use(super.f += 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:200:11: Error: Superclass has no getter named 'g'.\n super.g += 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:201:15: Error: Superclass has no getter named 'g'.\n use(super.g += 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:208:11: Error: Superclass has no setter named 'm'.\n super.m += 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:209:15: Error: Superclass has no setter named 'm'.\n use(super.m += 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:219:11: Error: Superclass has no setter named 'e'.\n super.e -= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:220:15: Error: Superclass has no setter named 'e'.\n use(super.e -= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:221:11: Error: Superclass has no setter named 'f'.\n super.f -= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:222:15: Error: Superclass has no setter named 'f'.\n use(super.f -= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:223:11: Error: Superclass has no getter named 'g'.\n super.g -= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:224:15: Error: Superclass has no getter named 'g'.\n use(super.g -= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:231:11: Error: Superclass has no setter named 'm'.\n super.m -= 42;\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:232:15: Error: Superclass has no setter named 'm'.\n use(super.m -= 42);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:139:11: Error: Too many positional arguments to method: 0 allowed, 1 given.\n super.m(87);\n ^", "pkg/front_end/testcases/super_rasta_copy.dart:140:15: Error: Too many positional arguments to method: 0 allowed, 1 given.\n use(super.m(87));\n ^"]/* from null */;
static method use(dynamic x) → dynamic {
- if(x.{core::Object::==}(new core::DateTime::now().{core::DateTime::millisecondsSinceEpoch}))
+ if(x.==(new core::DateTime::now().{core::DateTime::millisecondsSinceEpoch}))
throw "Shouldn't happen";
}
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.expect b/pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.expect
index ec385ce..f4b981c 100644
--- a/pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.expect
+++ b/pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart.strong.expect
@@ -11,6 +11,6 @@
static method test(self::C c) → void {
c.{self::C::x} = 1;
let final self::C #t1 = c in #t1.{self::C::x} = (let final dynamic #t2 = #t1 in let dynamic _ = null in invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:13:33: Error: The getter 'x' isn't defined for the class '#lib1::C'.\nTry correcting the name to the name of an existing getter, or defining a getter or field named 'x'.\n c. /*@error=UndefinedGetter*/ x += 1;\n ^").+(1);
- let final self::C #t3 = c in (let final dynamic #t4 = #t3 in let dynamic _ = null in invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:14:33: Error: The getter 'x' isn't defined for the class '#lib1::C'.\nTry correcting the name to the name of an existing getter, or defining a getter or field named 'x'.\n c. /*@error=UndefinedGetter*/ x ??= 1;\n ^").{core::Object::==}(null) ?{dynamic} #t3.{self::C::x} = 1 : null;
+ let final self::C #t3 = c in (let final dynamic #t4 = #t3 in let dynamic _ = null in invalid-expression "pkg/front_end/testcases/undefined_getter_in_compound_assignment.dart:14:33: Error: The getter 'x' isn't defined for the class '#lib1::C'.\nTry correcting the name to the name of an existing getter, or defining a getter or field named 'x'.\n c. /*@error=UndefinedGetter*/ x ??= 1;\n ^").==(null) ?{dynamic} #t3.{self::C::x} = 1 : null;
}
static method main() → dynamic {}
diff --git a/pkg/kernel/bin/count_breakdown.dart b/pkg/kernel/bin/count_breakdown.dart
new file mode 100755
index 0000000..7517816
--- /dev/null
+++ b/pkg/kernel/bin/count_breakdown.dart
@@ -0,0 +1,51 @@
+#!/usr/bin/env dart
+// 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 'dart:io';
+import 'package:kernel/kernel.dart';
+import 'util.dart';
+
+void usage() {
+ print("Enumerates the different node types in the provided dill file");
+ print("and counts them.");
+ print("");
+ print("Usage: dart <script> dillFile.dill");
+ print("The given argument should be an existing file");
+ print("that is valid to load as a dill file.");
+ exit(1);
+}
+
+main(List<String> args) {
+ CommandLineHelper.requireExactlyOneArgument(true, args, usage);
+ Program program = CommandLineHelper.tryLoadDill(args[0], usage);
+ TypeCounter counter = new TypeCounter();
+ program.accept(counter);
+ counter.printStats();
+}
+
+class TypeCounter extends RecursiveVisitor {
+ Map<String, int> _typeCounts = <String, int>{};
+ defaultNode(Node node) {
+ String key = node.runtimeType.toString();
+ _typeCounts[key] ??= 0;
+ _typeCounts[key]++;
+ super.defaultNode(node);
+ }
+
+ printStats() {
+ List<List<Object>> data = [];
+ _typeCounts.forEach((type, count) {
+ data.add([type, count]);
+ });
+ data.sort((a, b) {
+ int aCount = a[1];
+ int bCount = b[1];
+ return bCount - aCount;
+ });
+ for (var entry in data) {
+ print("${entry[0]}: ${entry[1]}");
+ }
+ }
+}
diff --git a/pkg/kernel/bin/dump.dart b/pkg/kernel/bin/dump.dart
index 2400ad5..32a9058 100755
--- a/pkg/kernel/bin/dump.dart
+++ b/pkg/kernel/bin/dump.dart
@@ -3,10 +3,30 @@
// 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:io';
+
import 'package:kernel/kernel.dart';
-main(args) {
- var binary = loadProgramFromBinary(args[0]);
+import 'util.dart';
+
+void usage() {
+ print("Prints a dill file as a textual format.");
+ print("");
+ print("Usage: dart <script> dillFile.dill [output]");
+ print("");
+ print("The first given argument should be an existing file");
+ print("that is valid to load as a dill file.");
+ print("");
+ print("The second argument is optional.");
+ print("If given, output will be written to this file.");
+ print("If not given, output will be written to standard out.");
+ exit(1);
+}
+
+main(List<String> args) {
+ CommandLineHelper.requireVariableArgumentCount([1, 2], args, usage);
+ CommandLineHelper.requireFileExists(args[0], usage);
+ var binary = CommandLineHelper.tryLoadDill(args[0], usage);
writeProgramToText(binary,
path: args.length > 1 ? args[1] : null,
showOffsets: const bool.fromEnvironment("showOffsets"));
diff --git a/pkg/kernel/bin/eval.dart b/pkg/kernel/bin/eval.dart
index d3c6638..bdd3dda 100755
--- a/pkg/kernel/bin/eval.dart
+++ b/pkg/kernel/bin/eval.dart
@@ -3,20 +3,24 @@
// 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:kernel/kernel.dart';
-import 'package:kernel/interpreter/interpreter.dart';
import 'dart:io';
-fail(String message) {
- stderr.writeln(message);
+import 'package:kernel/kernel.dart';
+import 'package:kernel/interpreter/interpreter.dart';
+
+import 'util.dart';
+
+void usage() {
+ print("Interpreter for a dill file.");
+ print("");
+ print("Usage: dart <script> dillFile.dill");
+ print("The given argument should be an existing file");
+ print("that is valid to load as a dill file.");
exit(1);
}
main(List<String> args) {
- if (args.length == 1 && args[0].endsWith('.dill')) {
- var program = loadProgramFromBinary(args[0]);
- new Interpreter(program).run();
- } else {
- return fail('One input binary file should be specified.');
- }
+ CommandLineHelper.requireExactlyOneArgument(true, args, usage);
+ Program program = CommandLineHelper.tryLoadDill(args[0], usage);
+ new Interpreter(program).run();
}
diff --git a/pkg/kernel/bin/size_breakdown.dart b/pkg/kernel/bin/size_breakdown.dart
new file mode 100755
index 0000000..90634e8
--- /dev/null
+++ b/pkg/kernel/bin/size_breakdown.dart
@@ -0,0 +1,85 @@
+#!/usr/bin/env dart
+// 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 'dart:io';
+
+import 'package:kernel/kernel.dart';
+import 'package:kernel/binary/ast_from_binary.dart';
+
+import 'util.dart';
+
+void usage() {
+ print("Gives an overview of which parts of the dill file");
+ print("contributes how many bytes.");
+ print("");
+ print("Usage: dart <script> dillFile.dill");
+ print("The given argument should be an existing file");
+ print("that is valid to load as a dill file.");
+ exit(1);
+}
+
+main(args) {
+ CommandLineHelper.requireExactlyOneArgument(true, args, usage);
+ List<int> bytes = new File(args[0]).readAsBytesSync();
+ try {
+ Program p = new Program();
+ new WrappedBinaryBuilder(bytes).readProgram(p);
+ } catch (e) {
+ print("Argument given isn't a dill file that can be loaded.");
+ usage();
+ }
+}
+
+class WrappedBinaryBuilder extends BinaryBuilder {
+ WrappedBinaryBuilder(var _bytes) : super(_bytes, disableLazyReading: true);
+
+ void readStringTable(List<String> table) {
+ int size = -byteOffset;
+ super.readStringTable(table);
+ size += super.byteOffset;
+ print("String table: ${_bytesToReadable(size)}.");
+ }
+
+ void readLinkTable(CanonicalName linkRoot) {
+ int size = -byteOffset;
+ super.readLinkTable(linkRoot);
+ size += super.byteOffset;
+ print("Link table: ${_bytesToReadable(size)}.");
+ }
+
+ Map<Uri, Source> readUriToSource() {
+ int size = -byteOffset;
+ var result = super.readUriToSource();
+ size += super.byteOffset;
+ print("URI to sources map: ${_bytesToReadable(size)}.");
+ return result;
+ }
+
+ void readConstantTable() {
+ int size = -byteOffset;
+ super.readConstantTable();
+ size += super.byteOffset;
+ print("Constant table: ${_bytesToReadable(size)}.");
+ }
+
+ Library readLibrary(Program program, int endOffset) {
+ int size = -byteOffset;
+ var result = super.readLibrary(program, endOffset);
+ size += super.byteOffset;
+ print("Library '${result.importUri}': ${_bytesToReadable(size)}.");
+ return result;
+ }
+
+ String _bytesToReadable(int size) {
+ const List<String> what = const ["B", "KB", "MB", "GB", "TB"];
+ int idx = 0;
+ double dSize = size + 0.0;
+ while ((idx + 1) < what.length && dSize >= 512) {
+ ++idx;
+ dSize /= 1024;
+ }
+ return "${dSize.toStringAsFixed(1)} ${what[idx]} ($size B)";
+ }
+}
diff --git a/pkg/kernel/bin/split.dart b/pkg/kernel/bin/split.dart
index d5e95a7..f6de5e4 100755
--- a/pkg/kernel/bin/split.dart
+++ b/pkg/kernel/bin/split.dart
@@ -11,8 +11,21 @@
import 'package:kernel/binary/limited_ast_to_binary.dart';
import 'package:kernel/kernel.dart';
+import 'util.dart';
+
+void usage() {
+ print("Split a dill file into separate dill files (one library per file).");
+ print("Dart internal libraries are not included in the output.");
+ print("");
+ print("Usage: dart <script> dillFile.dill");
+ print("The given argument should be an existing file");
+ print("that is valid to load as a dill file.");
+ exit(1);
+}
+
main(args) async {
- Program binary = loadProgramFromBinary(args[0]);
+ CommandLineHelper.requireExactlyOneArgument(true, args, usage);
+ Program binary = CommandLineHelper.tryLoadDill(args[0], usage);
int part = 1;
binary.libraries.forEach((lib) => lib.isExternal = true);
diff --git a/pkg/kernel/bin/type_check.dart b/pkg/kernel/bin/type_check.dart
index 2f926ab..2c062de 100755
--- a/pkg/kernel/bin/type_check.dart
+++ b/pkg/kernel/bin/type_check.dart
@@ -6,11 +6,23 @@
import 'dart:io';
import 'package:kernel/error_formatter.dart';
-import 'package:kernel/kernel.dart';
import 'package:kernel/naive_type_checker.dart';
+import 'util.dart';
+
+void usage() {
+ print("Type checker that can be used to find strong mode");
+ print("violations in the Kernel files.");
+ print("");
+ print("Usage: dart <script> dillFile.dill");
+ print("The given argument should be an existing file");
+ print("that is valid to load as a dill file.");
+ exit(1);
+}
+
void main(List<String> args) {
- final binary = loadProgramFromBinary(args[0]);
+ CommandLineHelper.requireExactlyOneArgument(true, args, usage);
+ final binary = CommandLineHelper.tryLoadDill(args[0], usage);
ErrorFormatter errorFormatter = new ErrorFormatter();
new StrongModeTypeChecker(errorFormatter, binary)..checkProgram(binary);
if (errorFormatter.numberOfFailures > 0) {
diff --git a/pkg/kernel/bin/util.dart b/pkg/kernel/bin/util.dart
index e46e4f5..315869b 100644
--- a/pkg/kernel/bin/util.dart
+++ b/pkg/kernel/bin/util.dart
@@ -4,6 +4,7 @@
import 'dart:io';
+import 'package:kernel/kernel.dart';
import 'package:kernel/transformations/treeshaker.dart';
/// Parses all given [embedderEntryPointManifests] and returns the program roots
@@ -65,3 +66,40 @@
return roots;
}
+
+class CommandLineHelper {
+ static requireExactlyOneArgument(
+ bool requireExistingFile, List<String> args, void Function() usage) {
+ if (args.length != 1) {
+ print("Expected exactly 1 argument, got ${args.length}.");
+ usage();
+ }
+ requireFileExists(args[0], usage);
+ }
+
+ static requireVariableArgumentCount(
+ List<int> ok, List<String> args, void Function() usage) {
+ if (!ok.contains(args.length)) {
+ print(
+ "Expected the argument count to be one of ${ok}, got ${args.length}.");
+ usage();
+ }
+ }
+
+ static requireFileExists(String file, void Function() usage) {
+ if (!new File(file).existsSync()) {
+ print("Argument '$file' isn't an existing file.");
+ usage();
+ }
+ }
+
+ static Program tryLoadDill(String file, void Function() usage) {
+ try {
+ return loadProgramFromBinary(file);
+ } catch (e) {
+ print("Argument '$file' isn't a dill file that can be loaded.");
+ usage();
+ }
+ return null;
+ }
+}
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index af75d44..4782a7d 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -62,13 +62,16 @@
/// will not be resolved correctly.
bool _disableLazyReading = false;
- BinaryBuilder(this._bytes, [this.filename, this._disableLazyReading = false]);
+ BinaryBuilder(this._bytes, {this.filename, disableLazyReading = false})
+ : _disableLazyReading = disableLazyReading;
fail(String message) {
throw new ParseError(message,
byteIndex: _byteOffset, filename: filename, path: debugPath.join('::'));
}
+ int get byteOffset => _byteOffset;
+
int readByte() => _bytes[_byteOffset++];
int readUInt() {
@@ -1107,8 +1110,10 @@
final int programStartOffset = _programStartOffset;
final List<TypeParameter> typeParameters = typeParameterStack.toList();
final List<VariableDeclaration> variables = variableStack.toList();
+ final Library currentLibrary = _currentLibrary;
result.lazyBuilder = () {
_byteOffset = savedByteOffset;
+ _currentLibrary = currentLibrary;
typeParameterStack.clear();
typeParameterStack.addAll(typeParameters);
variableStack.clear();
@@ -1812,7 +1817,8 @@
/// Note: each metadata subsection has its own mapping.
List<Node> _referencedNodes;
- BinaryBuilderWithMetadata(bytes, [filename]) : super(bytes, filename);
+ BinaryBuilderWithMetadata(bytes, [filename])
+ : super(bytes, filename: filename);
@override
bool _readMetadataSection(Program program) {
diff --git a/pkg/front_end/lib/src/fasta/graph/graph.dart b/pkg/kernel/lib/util/graph.dart
similarity index 100%
rename from pkg/front_end/lib/src/fasta/graph/graph.dart
rename to pkg/kernel/lib/util/graph.dart
diff --git a/pkg/kernel/test/binary_bench.dart b/pkg/kernel/test/binary_bench.dart
index 41e9180..92ac93f 100644
--- a/pkg/kernel/test/binary_bench.dart
+++ b/pkg/kernel/test/binary_bench.dart
@@ -162,7 +162,8 @@
Program _fromBinary(List<int> bytes, {eager: true}) {
var program = new Program();
- new BinaryBuilder(bytes, 'filename', eager).readSingleFileProgram(program);
+ new BinaryBuilder(bytes, filename: 'filename', disableLazyReading: eager)
+ .readSingleFileProgram(program);
return program;
}
diff --git a/pkg/kernel/test/graph_test.dart b/pkg/kernel/test/graph_test.dart
new file mode 100644
index 0000000..dd86696e
--- /dev/null
+++ b/pkg/kernel/test/graph_test.dart
@@ -0,0 +1,70 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+library kernel.test.graph_test;
+
+import 'package:expect/expect.dart' show Expect;
+
+import 'package:kernel/util/graph.dart';
+
+class TestGraph implements Graph<String> {
+ final Map<String, List<String>> graph;
+
+ TestGraph(this.graph);
+
+ Iterable<String> get vertices => graph.keys;
+
+ Iterable<String> neighborsOf(String vertex) => graph[vertex];
+}
+
+void test(String expected, Map<String, List<String>> graph) {
+ List<List<String>> result = computeStrongComponents(new TestGraph(graph));
+ Expect.stringEquals(expected, "$result");
+}
+
+main() {
+ test("[[B, A], [C], [D]]", {
+ "A": ["B"],
+ "B": ["A"],
+ "C": ["A"],
+ "D": ["C"],
+ });
+
+ test("[]", {});
+
+ test("[[A], [B], [C], [D]]", {
+ "A": [],
+ "B": [],
+ "C": [],
+ "D": [],
+ });
+
+ test("[[B, A], [C], [D]]", {
+ "D": ["C"],
+ "C": ["A"],
+ "B": ["A"],
+ "A": ["B"],
+ });
+
+ test("[[D], [C], [B], [A]]", {
+ "A": ["B"],
+ "B": ["C"],
+ "C": ["D"],
+ "D": [],
+ });
+
+ test("[[D], [C], [B], [A]]", {
+ "D": [],
+ "C": ["D"],
+ "B": ["C"],
+ "A": ["B"],
+ });
+
+ test("[[A], [B], [C], [D]]", {
+ "A": [],
+ "B": ["A"],
+ "C": ["A"],
+ "D": ["B", "C"],
+ });
+}
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/devirt.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/devirt.dart.expect
index 7f01388..9fd98bb 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/devirt.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/devirt.dart.expect
@@ -49,10 +49,10 @@
[@vm.direct-call.metadata=#lib::C::foo??] aa.{self::A::foo}();
}
static method callerE1([@vm.inferred-type.metadata=!] dynamic x) → void {
- [@vm.direct-call.metadata=dart.core::_StringBase::toString] x.{core::Object::toString}();
+ x.toString();
}
static method callerE2([@vm.inferred-type.metadata=#lib::E] dynamic x) → void {
- [@vm.direct-call.metadata=#lib::E::toString] x.{core::Object::toString}();
+ x.toString();
}
static method main(core::List<core::String> args) → dynamic {
self::callerA1(new self::B::•());
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/no_such_method.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/no_such_method.dart.expect
index 7410cd7..e5c53c7 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/no_such_method.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/no_such_method.dart.expect
@@ -103,5 +103,5 @@
core::print([@vm.inferred-type.metadata=!] yy.twoArg(1, 2, 3));
new self::F::•();
dynamic gg = new self::G::•();
- core::print([@vm.inferred-type.metadata=#lib::T5] gg.{core::Object::noSuchMethod}(null, null));
+ core::print([@vm.inferred-type.metadata=#lib::T5] gg.noSuchMethod(null, null));
}
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index efc087b..27c5806 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -1137,8 +1137,6 @@
sources = [
"builtin_nolib.cc",
- "dfe.cc",
- "dfe.h",
"error_exit.cc",
"error_exit.h",
"run_vm_tests.cc",
diff --git a/runtime/bin/run_vm_tests.cc b/runtime/bin/run_vm_tests.cc
index 9cc4ada..6246c4a 100644
--- a/runtime/bin/run_vm_tests.cc
+++ b/runtime/bin/run_vm_tests.cc
@@ -28,10 +28,6 @@
// TODO(iposva, asiva): This is a placeholder for the real unittest framework.
namespace dart {
-namespace bin {
-DFE dfe;
-}
-
// Defined in vm/os_thread_win.cc
extern bool private_flag_windows_run_tls_destructors;
diff --git a/runtime/lib/errors_patch.dart b/runtime/lib/errors_patch.dart
index 7a331b8..e79dfae 100644
--- a/runtime/lib/errors_patch.dart
+++ b/runtime/lib/errors_patch.dart
@@ -41,7 +41,7 @@
return condition;
}
if (condition is _Closure) {
- return condition();
+ return condition.call();
}
if (condition is Function) {
condition = condition();
diff --git a/runtime/observatory/tests/service/service.status b/runtime/observatory/tests/service/service.status
index d2a54bb..6a0a132 100644
--- a/runtime/observatory/tests/service/service.status
+++ b/runtime/observatory/tests/service/service.status
@@ -59,37 +59,9 @@
dev_fs_http_put_weird_char_test: Skip # Windows disallows carriage returns in paths
dev_fs_weird_char_test: Skip # Windows disallows question mark in paths
-# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
-# are to be triaged. Isolate tests are skipped on purpose due to the usage of
-# batch mode.
-[ $arch == simdbc64 && $compiler == dartk ]
-coverage_optimized_function_test: Crash # Please triage
-get_cpu_profile_timeline_rpc_test: Pass, RuntimeError # http://dartbug.com/31794
-
-[ $arch == simdbc64 && $compiler == dartk && $mode == debug ]
-eval_test: Pass, Slow
-
[ $compiler == dart2analyzer && $strong ]
*: Skip # Issue 28649
-# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
-# are to be triaged. Isolate tests are skipped on purpose due to the usage of
-# batch mode.
-[ $compiler == dartk && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
-async_generator_breakpoint_test: Pass, RuntimeError
-bad_reload_test: Skip # Times out on sim architectures, also RuntimeError.
-complex_reload_test: Skip # Times out on sim architectures, also RuntimeError.
-coverage_leaf_function_test: RuntimeError # Please triage.
-coverage_optimized_function_test: RuntimeError # Please triage.
-get_object_rpc_test: RuntimeError # Please triage.
-get_source_report_test: RuntimeError # Please triage.
-library_dependency_test: RuntimeError # Please triage.
-positive_token_pos_test: Pass, RuntimeError
-reload_sources_test: Timeout, Skip # Please triage.
-rewind_test: Pass, RuntimeError
-set_name_rpc_test: RuntimeError # Please triage.
-unused_changes_in_last_reload_test: Skip # Times out on sim architectures.
-
[ $compiler == none && $runtime == vm && $system == fuchsia ]
*: Skip # Not yet triaged.
@@ -126,4 +98,3 @@
# Skip all service tests because random reloads interfere.
[ $hot_reload || $hot_reload_rollback ]
*: SkipByDesign # The service tests should run without being reloaded.
-
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index df449a1..c0a5c01 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -33,9 +33,14 @@
complex_reload_test: RuntimeError
[ $arch == simdbc64 && $compiler == dartk ]
+coverage_optimized_function_test: Crash # Please triage
+get_cpu_profile_timeline_rpc_test: Pass, RuntimeError # http://dartbug.com/31794
pause_on_unhandled_async_exceptions2_test: RuntimeError, Timeout # Issue 31765
pause_on_unhandled_async_exceptions_test: RuntimeError, Timeout # Issue 31765
+[ $arch == simdbc64 && $compiler == dartk && $mode == debug ]
+eval_test: Pass, Slow
+
[ $compiler == dartk && $mode == debug ]
isolate_lifecycle_test: Skip # Flaky.
pause_idle_isolate_test: Skip # Flaky
@@ -48,7 +53,7 @@
coverage_leaf_function_test: RuntimeError
coverage_optimized_function_test: Skip # Timeout
get_source_report_test: RuntimeError
-get_vm_timeline_rpc_test: Pass, Timeout # Issue 32137.
+get_vm_timeline_rpc_test: Skip # Issue 32137.
issue_25465_test: Skip # Issues 32137 and 32138.
issue_30555_test: Skip # Issues 32137 and 32138.
next_through_assign_call_test: Skip # Issues 32137 and 32138.
@@ -64,20 +69,20 @@
next_through_simple_linear_2_test: Skip # Issues 32137 and 32138.
next_through_simple_linear_test: Skip # Issues 32137 and 32138.
pause_idle_isolate_test: Skip # Issues 32137 and 32138.
-pause_on_start_and_exit_test: Pass, RuntimeError # Issue 32137.
-pause_on_start_and_exit_test: Skip # Issues 32137 and 32138.
-regress_28443_test: Pass, Timeout
+pause_on_start_and_exit_test: Skip # Issues 32225, 32138.
+pause_on_start_then_step_test: Skip # Issue 32225, 32138.
+regress_28443_test: Skip # Times out.
regress_28980_test: Skip # Issues 32137 and 32138.
reload_sources_test: RuntimeError
-set_vm_name_rpc_test: Pass, Timeout # Issue 32137.
+set_vm_name_rpc_test: Skip # Times out. Issue 32137.
step_test: Skip # Issues 32137 and 32138.
step_through_constructor_test: Pass, Slow
step_through_function_2_test: Skip # Issues 32137 and 32138.
step_through_function_test: Skip # Issues 32137 and 32138.
-step_through_property_get_test: Pass, Timeout # Issue 32137.
+step_through_property_get_test: Skip # Times out. Issue 32137.
step_through_setter_test: Skip # Issues 32137 and 32138.
-step_through_switch_test: Pass, Timeout # Issue 32137.
-step_through_switch_with_continue_test: Pass, Timeout # Issue 32137.
+step_through_switch_test: Skip # Times out. Issue 32137.
+step_through_switch_with_continue_test: Skip # Times out. Issue 32137.
[ $compiler == dartk && $system == windows && $strong ]
add_breakpoint_rpc_kernel_test: Skip # Timeout
@@ -115,3 +120,17 @@
[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64) ]
async_single_step_exception_test: RuntimeError
+[ $compiler == dartk && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+async_generator_breakpoint_test: Pass, RuntimeError
+bad_reload_test: Skip # Times out on sim architectures, also RuntimeError.
+complex_reload_test: Skip # Times out on sim architectures, also RuntimeError.
+coverage_leaf_function_test: RuntimeError # Please triage.
+coverage_optimized_function_test: RuntimeError # Please triage.
+get_object_rpc_test: RuntimeError # Please triage.
+get_source_report_test: RuntimeError # Please triage.
+library_dependency_test: RuntimeError # Please triage.
+positive_token_pos_test: Pass, RuntimeError
+reload_sources_test: Skip # Times out.
+rewind_test: Pass, RuntimeError
+set_name_rpc_test: RuntimeError # Please triage.
+unused_changes_in_last_reload_test: Skip # Times out on sim architectures.
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 8f854da..0789457 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -24,10 +24,7 @@
cc/CodeImmutability: Fail, OK # Address Sanitizer turns a crash into a failure.
cc/IsolateReload_DanglingGetter_Class: Fail # Issue 28349
cc/IsolateReload_DanglingGetter_Instance: Fail # Issue 28349
-cc/IsolateReload_DanglingGetter_Library: Fail # Issue 28349
-cc/IsolateReload_DanglingSetter_Class: Fail # Issue 28349
cc/IsolateReload_DanglingSetter_Instance: Fail # Issue 28349
-cc/IsolateReload_DanglingSetter_Library: Fail # Issue 28349
cc/IsolateReload_LiveStack: Fail # Issue 28349
cc/IsolateReload_PendingSuperCall: Fail # Issue 28349
cc/IsolateReload_SmiFastPathStubs: Fail # Issue 28349
@@ -134,19 +131,6 @@
cc/Profiler_TrivialRecordAllocation: Skip
cc/Profiler_TypedArrayAllocation: Skip
-# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
-# are to be triaged. Isolate tests are skipped on purpose due to the usage of
-# batch mode.
-[ $arch == simarm && $compiler == dartk ]
-cc/IsolateReload_ExportedLibModified: Fail # Please triage.
-cc/IsolateReload_ImportedLibModified: Fail # Please triage.
-cc/IsolateReload_ImportedMixinFunction: Fail # Please triage.
-cc/IsolateReload_LibraryHide: Fail # Please triage.
-cc/IsolateReload_LibraryShow: Fail # Please triage.
-cc/IsolateReload_MainLibModified: Fail # Please triage.
-cc/IsolateReload_NoLibsModified: Fail # Please triage.
-cc/IsolateReload_PrefixImportedLibModified: Fail # Please triage.
-
[ $arch == x64 && $system == windows ]
cc/Profiler_BinaryOperatorSourcePositionOptimized: Pass, Fail # Issue 31137
cc/Profiler_ClosureAllocation: Pass, Fail # Issue 31137
@@ -163,7 +147,7 @@
[ $compiler == dartk && $mode == debug && $runtime == vm ]
cc/InjectNativeFields1: Crash
-cc/InjectNativeFields3: Crash
+cc/PrintJSON: Crash
cc/Service_TokenStream: Crash
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
@@ -174,20 +158,18 @@
[ $compiler == dartk && $mode == release && $runtime == vm ]
cc/InjectNativeFields1: Fail
-cc/InjectNativeFields3: Fail
cc/Service_TokenStream: Fail
[ $compiler == dartk && $runtime == vm ]
cc/CanonicalizationInScriptSnapshots: Fail
cc/Class_ComputeEndTokenPos: Crash
+cc/CorelibCompileAll: Crash
+cc/CorelibCompilerStats: Crash
cc/DartAPI_CurrentStackTraceInfo: Fail
-cc/DartAPI_ImplicitNativeFieldAccess: Crash
cc/DartAPI_InjectNativeFields1: Skip
-cc/DartAPI_InjectNativeFields3: Crash
-cc/DartAPI_InjectNativeFields4: Crash
-cc/DartAPI_InjectNativeFieldsSuperClass: Crash
cc/DartAPI_InvokeNoSuchMethod: Fail
cc/DartAPI_Invoke_CrossLibrary: Crash
+cc/DartAPI_IsolateSetCheckedMode: Skip # Checked mode is not relevant for dart 2?
cc/DartAPI_IsolateShutdownRunDartCode: Skip # Flaky
cc/DartAPI_LazyLoadDeoptimizes: Fail
cc/DartAPI_LoadLibrary: Crash
@@ -200,13 +182,11 @@
cc/DartAPI_LoadSource_LateLoad: Crash
cc/DartAPI_LookupLibrary: Crash
cc/DartAPI_NativeFieldAccess: Fail
-cc/DartAPI_NegativeNativeFieldInIsolateMessage: Crash
cc/DartAPI_ParsePatchLibrary: Crash
cc/DartAPI_PropagateError: Fail
cc/DartAPI_StackOverflowStackTraceInfoArrowFunction: Fail
cc/DartAPI_StackOverflowStackTraceInfoBraceFunction1: Fail
cc/DartAPI_StackOverflowStackTraceInfoBraceFunction2: Fail
-cc/DartAPI_TestNativeFieldsAccess: Crash
cc/DebuggerAPI_BreakpointStubPatching: Fail
cc/DebuggerAPI_GetClosureInfo: Fail
cc/DebuggerAPI_InterruptIsolate: SkipSlow
@@ -217,32 +197,21 @@
cc/Debugger_Rewind_Optimized: SkipSlow
cc/Debugger_SetBreakpointInPartOfLibrary: Crash
cc/FunctionSourceFingerprint: Fail
-cc/IsolateReload_DanglingGetter_Library: Fail
-cc/IsolateReload_DanglingSetter_Class: Fail
+cc/GenerateSource: Skip # Cannot generate source from a kernel binary.
cc/IsolateReload_DanglingSetter_Instance: Fail
-cc/IsolateReload_DanglingSetter_Library: Fail
cc/IsolateReload_EnumDelete: Fail
cc/IsolateReload_EnumReorderIdentical: Fail
cc/IsolateReload_EnumToNotEnum: Skip
-cc/IsolateReload_ExportedLibModified: Crash
-cc/IsolateReload_ImportedLibModified: Crash
-cc/IsolateReload_ImportedMixinFunction: Crash
-cc/IsolateReload_LibraryHide: Crash
-cc/IsolateReload_LibraryShow: Crash
cc/IsolateReload_LiveStack: Fail
-cc/IsolateReload_MainLibModified: Crash
-cc/IsolateReload_NoLibsModified: Crash
cc/IsolateReload_NotEnumToEnum: Skip
cc/IsolateReload_NotTypedefToTypedef: Fail
cc/IsolateReload_PendingSuperCall: Fail
-cc/IsolateReload_PrefixImportedLibModified: Crash
cc/IsolateReload_RunNewFieldInitialiazersSuperClass: Skip
cc/IsolateReload_RunNewFieldInitializers: Skip
cc/IsolateReload_RunNewFieldInitializersMutateStaticField: Skip
cc/IsolateReload_RunNewFieldInitializersReferenceStaticField: Skip
cc/IsolateReload_RunNewFieldInitializersThrows: Skip
cc/IsolateReload_RunNewFieldInitializersWithConsts: Skip
-cc/IsolateReload_ShapeChangeRetainsHash: Skip
cc/IsolateReload_SmiFastPathStubs: Fail
cc/IsolateReload_TypedefToNotTypedef: Fail
cc/Parser_AllocateVariables_CaptureLoopVar: Fail
@@ -274,7 +243,7 @@
cc/SourceReport_CallSites_PolymorphicCall: Fail
cc/SourceReport_CallSites_SimpleCall: Fail
cc/SourceReport_Coverage_AllFunctions: Fail
-cc/SourceReport_Coverage_AllFunctions_ForceCompile: Fail
+cc/SourceReport_Coverage_AllFunctions_ForceCompile: Crash
cc/SourceReport_Coverage_ForceCompile: Fail
cc/SourceReport_Coverage_NestedFunctions: Fail
cc/SourceReport_Coverage_NoCalls: Fail
@@ -293,12 +262,9 @@
[ $compiler == dartk && $runtime == vm && $system == macos ]
cc/IsolateReload_DanglingGetter_Class: Crash
cc/IsolateReload_DanglingGetter_Instance: Crash
-cc/IsolateReload_DanglingGetter_Library: Crash
-cc/IsolateReload_DanglingSetter_Class: Crash
cc/IsolateReload_DanglingSetter_Instance: Crash
-cc/IsolateReload_DanglingSetter_Library: Crash
cc/IsolateReload_EnumDelete: Crash
-cc/IsolateReload_LibraryLookup: Crash
+cc/IsolateReload_LibraryLookup: Fail, Crash
cc/IsolateReload_TearOff_AddArguments: Crash
cc/IsolateReload_TearOff_AddArguments2: Crash
cc/IsolateReload_TearOff_Class_Identity: Crash
@@ -314,10 +280,14 @@
cc/Parser_AllocateVariables_NestedCapturedVar: Crash
cc/Parser_AllocateVariables_TwoChains: Crash
+[ $compiler == dartk && $runtime == vm && $strong ]
+cc/IsolateReload_LibraryHide: Crash
+cc/IsolateReload_LibraryShow: Crash
+
[ $compiler == dartk && $system == linux ]
cc/IsolateReload_DanglingGetter_Class: Fail
cc/IsolateReload_DanglingGetter_Instance: Fail
-cc/IsolateReload_LibraryLookup: Fail
+cc/IsolateReload_LibraryLookup: Crash
cc/IsolateReload_TearOff_AddArguments: Fail
cc/IsolateReload_TearOff_AddArguments2: Fail
cc/IsolateReload_TearOff_Class_Identity: Fail
@@ -351,6 +321,19 @@
cc/Service_Code: Fail
[ $compiler == dartk && $strong ]
+cc/DartAPI_ImportLibrary3: Fail # Issue 32190
+cc/DartAPI_LazyLoadDeoptimizes: Crash # Issue 32190
+cc/DartAPI_NativePortPostInteger: Crash # Issue 32190
+cc/DartAPI_NativePortReceiveInteger: Timeout # Issue 32190
+cc/DartAPI_NativePortReceiveNull: Timeout # Issue 32190
+cc/DartAPI_NewNativePort: Crash # Issue 32190
+cc/DartGeneratedArrayLiteralMessages: Crash # Issue 32190
+cc/FullSnapshot1: Crash # Issue 32190
+cc/IsolateReload_LibraryImportAdded: Crash # Issue 32190
+cc/IsolateReload_LibraryImportRemoved: Fail # Issue 32190
+cc/IsolateReload_LibraryLookup: Crash # Issue 32190
+cc/Mixin_PrivateSuperResolutionCrossLibraryShouldFail: Fail # Issue 32190
+cc/StackMapGC: Crash # Issue 32190
dart/optimized_stacktrace_line_and_column_test: CompileTimeError # Issue 31586
dart/optimized_stacktrace_line_test: CompileTimeError # Issue 31586
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index c29a144..84b433b 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -16,13 +16,13 @@
#include "vm/compiler_stats.h"
#include "vm/dart_api_impl.h"
#include "vm/stack_frame.h"
-#include "vm/unit_test.h"
using dart::bin::File;
namespace dart {
DECLARE_FLAG(bool, use_dart_frontend);
+DECLARE_FLAG(bool, strong);
Benchmark* Benchmark::first_ = NULL;
Benchmark* Benchmark::tail_ = NULL;
@@ -92,19 +92,6 @@
}
}
-Dart_Isolate Benchmark::CreateIsolate(const uint8_t* snapshot_data,
- const uint8_t* snapshot_instructions) {
- char* err = NULL;
- Dart_IsolateFlags api_flags;
- Isolate::FlagsInitialize(&api_flags);
- api_flags.use_dart_frontend = FLAG_use_dart_frontend;
- isolate_ = Dart_CreateIsolate(NULL, NULL, snapshot_data,
- snapshot_instructions, &api_flags, NULL, &err);
- EXPECT(isolate_ != NULL);
- free(err);
- return isolate_;
-}
-
//
// Measure compile of all functions in dart core lib classes.
//
@@ -522,13 +509,11 @@
"import 'dart:async';\n"
"import 'dart:core';\n"
"import 'dart:collection';\n"
- "import 'dart:_internal';\n"
"import 'dart:convert';\n"
"import 'dart:math';\n"
"import 'dart:isolate';\n"
"import 'dart:mirrors';\n"
"import 'dart:typed_data';\n"
- "import 'dart:_builtin';\n"
"import 'dart:io';\n"
"import 'dart:cli';\n"
"\n";
diff --git a/runtime/vm/benchmark_test.h b/runtime/vm/benchmark_test.h
index 9285373..58f4eee 100644
--- a/runtime/vm/benchmark_test.h
+++ b/runtime/vm/benchmark_test.h
@@ -13,6 +13,7 @@
#include "vm/isolate.h"
#include "vm/malloc_hooks.h"
#include "vm/object.h"
+#include "vm/unit_test.h"
#include "vm/zone.h"
namespace dart {
@@ -85,9 +86,6 @@
int64_t score() const { return score_; }
Isolate* isolate() const { return reinterpret_cast<Isolate*>(isolate_); }
- Dart_Isolate CreateIsolate(const uint8_t* snapshot_data,
- const uint8_t* snapshot_instructions);
-
void Run() { (*run_)(this); }
void RunBenchmark();
@@ -95,6 +93,11 @@
static void SetExecutable(const char* arg) { executable_ = arg; }
static const char* Executable() { return executable_; }
+ void CreateIsolate() {
+ isolate_ = TestCase::CreateTestIsolate();
+ EXPECT(isolate_ != NULL);
+ }
+
private:
static Benchmark* first_;
static Benchmark* tail_;
@@ -113,8 +116,7 @@
class BenchmarkIsolateScope {
public:
explicit BenchmarkIsolateScope(Benchmark* benchmark) : benchmark_(benchmark) {
- benchmark_->CreateIsolate(bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions);
+ benchmark->CreateIsolate();
Dart_EnterScope(); // Create a Dart API scope for unit benchmarks.
}
~BenchmarkIsolateScope() {
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 0ad0be6..e57816e 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -5586,7 +5586,6 @@
}
void Visit(const Script& script) {
- objects_->Add(&Object::Handle(zone_, script_.tokens()));
kernel_program_info_ = script_.kernel_program_info();
if (!kernel_program_info_.IsNull()) {
objects_->Add(
@@ -5599,6 +5598,8 @@
objects_->Add(
&Object::Handle(zone_, kernel_program_info_.metadata_mappings()));
objects_->Add(&Object::Handle(zone_, kernel_program_info_.constants()));
+ } else {
+ objects_->Add(&Object::Handle(zone_, script_.tokens()));
}
}
diff --git a/runtime/vm/compiler/backend/constant_propagator.cc b/runtime/vm/compiler/backend/constant_propagator.cc
index fc33319..ca96978 100644
--- a/runtime/vm/compiler/backend/constant_propagator.cc
+++ b/runtime/vm/compiler/backend/constant_propagator.cc
@@ -80,6 +80,22 @@
return false;
}
+static bool IsIdenticalConstants(const Object& left, const Object& right) {
+ // This should be kept in line with Identical_comparison (identical.cc)
+ // (=> Instance::IsIdenticalTo in object.cc).
+
+ if (left.raw() == right.raw()) return true;
+ if (left.GetClassId() != right.GetClassId()) return false;
+ if (left.IsInteger()) {
+ return Integer::Cast(left).Equals(Integer::Cast(right));
+ }
+ if (left.IsDouble()) {
+ return Double::Cast(left).BitwiseEqualsToDouble(
+ Double::Cast(right).value());
+ }
+ return false;
+}
+
// Compute the join of two values in the lattice, assign it to the first.
void ConstantPropagator::Join(Object* left, const Object& right) {
// Join(non-constant, X) = non-constant
@@ -94,8 +110,7 @@
}
// Join(X, X) = X
- // TODO(kmillikin): support equality for doubles, mints, etc.
- if (left->raw() == right.raw()) return;
+ if (IsIdenticalConstants(*left, right)) return;
// Join(X, Y) = non-constant
*left = non_constant_.raw();
@@ -433,7 +448,7 @@
}
}
} else if (IsConstant(left) && IsConstant(right)) {
- bool result = (left.raw() == right.raw());
+ bool result = IsIdenticalConstants(left, right);
if (instr->kind() == Token::kNE_STRICT) {
result = !result;
}
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 8100582..41175e8 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -1842,8 +1842,7 @@
intptr_t kernel_offset_no_tag = builder_->ReaderOffset();
VariableDeclarationHelper helper(builder_);
helper.ReadUntilExcluding(VariableDeclarationHelper::kType);
- intptr_t offset_for_type = builder_->ReaderOffset();
- AbstractType& type = T.BuildVariableType(); // read type.
+ AbstractType& type = BuildAndVisitVariableType();
// In case `declaration->IsConst()` the flow graph building will take care of
// evaluating the constant and setting it via
@@ -1851,9 +1850,6 @@
const String& name = (H.StringSize(helper.name_index_) == 0)
? GenerateName(":var", name_index_++)
: H.DartSymbol(helper.name_index_);
- // We also need to visit the type.
- builder_->SetOffset(offset_for_type);
- VisitDartType(); // read type.
Tag tag = builder_->ReadTag(); // read (first part of) initializer.
if (tag == kSomething) {
@@ -1876,6 +1872,14 @@
variable);
}
+AbstractType& StreamingScopeBuilder::BuildAndVisitVariableType() {
+ const intptr_t offset = builder_->ReaderOffset();
+ AbstractType& type = T.BuildVariableType();
+ builder_->SetOffset(offset); // rewind
+ VisitDartType();
+ return type;
+}
+
void StreamingScopeBuilder::VisitDartType() {
Tag tag = builder_->ReadTag();
switch (tag) {
@@ -2074,7 +2078,7 @@
VariableDeclarationHelper helper(builder_);
helper.ReadUntilExcluding(VariableDeclarationHelper::kType);
String& name = H.DartSymbol(helper.name_index_);
- AbstractType& type = T.BuildVariableType(); // read type.
+ AbstractType& type = BuildAndVisitVariableType(); // read type.
helper.SetJustRead(VariableDeclarationHelper::kType);
helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index e51a939..b4dca31 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -717,6 +717,8 @@
void VisitVectorType();
void HandleLocalFunction(intptr_t parent_kernel_offset);
+ AbstractType& BuildAndVisitVariableType();
+
void EnterScope(intptr_t kernel_offset);
void ExitScope(TokenPosition start_position, TokenPosition end_position);
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 0fb4819..d2507e8 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -3287,11 +3287,8 @@
VM_UNIT_TEST_CASE(DartAPI_CurrentIsolateData) {
intptr_t mydata = 12345;
- char* err;
Dart_Isolate isolate =
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL,
- reinterpret_cast<void*>(mydata), &err);
+ TestCase::CreateTestIsolate(NULL, reinterpret_cast<void*>(mydata));
EXPECT(isolate != NULL);
EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_CurrentIsolateData()));
EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_IsolateData(isolate)));
@@ -3338,13 +3335,12 @@
api_flags.enable_error_on_bad_type = true;
api_flags.enable_error_on_bad_override = true;
api_flags.use_dart_frontend = FLAG_use_dart_frontend;
-
char* err;
Dart_Isolate isolate = Dart_CreateIsolate(
NULL, NULL, bin::core_isolate_snapshot_data,
bin::core_isolate_snapshot_instructions, &api_flags, NULL, &err);
if (isolate == NULL) {
- OS::Print("Creation of isolate failed '%s'\n", err);
+ OS::PrintErr("Creation of isolate failed '%s'\n", err);
free(err);
}
EXPECT(isolate != NULL);
@@ -5167,7 +5163,7 @@
" return f;\n"
" }\n"
" static Function method2(int i) {\n"
- " n(int j) => true + i + fld4; \n"
+ " n(int j) { throw new Exception('I am an exception'); return 1; }\n"
" return n;\n"
" }\n"
" int fld1;\n"
@@ -5937,7 +5933,7 @@
"class _B {}\n"
"abstract class _C {}\n"
"\n"
- "_compare(String a, String b) => a.compareTo(b);\n"
+ "int _compare(dynamic a, dynamic b) => a.compareTo(b);\n"
"sort(list) => list.sort(_compare);\n";
Dart_Handle lib = TestCase::LoadTestLibrary("library_url", kLibraryChars);
@@ -5986,7 +5982,7 @@
" var _D2;\n"
"}\n"
"\n"
- "_compare(String a, String b) => a.compareTo(b);\n"
+ "int _compare(dynamic a, dynamic b) => a.compareTo(b);\n"
"sort(list) => list.sort(_compare);\n";
// Get the functions from a library.
@@ -7268,13 +7264,7 @@
Dart_Handle lib;
{
MonitorLocker ml(sync);
- char* error = NULL;
- Dart_IsolateFlags api_flags;
- Isolate::FlagsInitialize(&api_flags);
- api_flags.use_dart_frontend = FLAG_use_dart_frontend;
- shared_isolate = Dart_CreateIsolate(
- NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, &api_flags, NULL, &error);
+ TestCase::CreateTestIsolate();
EXPECT(shared_isolate != NULL);
Dart_EnterScope();
Dart_Handle url = NewString(TestCase::url());
@@ -7318,18 +7308,9 @@
Isolate::SetShutdownCallback(IsolateShutdownTestCallback);
saved_callback_data = NULL;
-
void* my_data = reinterpret_cast<void*>(12345);
-
// Create an isolate.
- char* err;
- Dart_Isolate isolate = Dart_CreateIsolate(
- NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, my_data, &err);
- if (isolate == NULL) {
- OS::Print("Creation of isolate failed '%s'\n", err);
- free(err);
- }
+ Dart_Isolate isolate = TestCase::CreateTestIsolate(NULL, my_data);
EXPECT(isolate != NULL);
// The shutdown callback has not been called.
@@ -7372,17 +7353,7 @@
"}\n";
// Create an isolate.
- char* err;
- Dart_IsolateFlags api_flags;
- Isolate::FlagsInitialize(&api_flags);
- api_flags.use_dart_frontend = FLAG_use_dart_frontend;
- Dart_Isolate isolate = Dart_CreateIsolate(
- NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, &api_flags, NULL, &err);
- if (isolate == NULL) {
- OS::Print("Creation of isolate failed '%s'\n", err);
- free(err);
- }
+ Dart_Isolate isolate = TestCase::CreateTestIsolate();
EXPECT(isolate != NULL);
Isolate::SetShutdownCallback(IsolateShutdownRunDartCodeTestCallback);
diff --git a/runtime/vm/guard_field_test.cc b/runtime/vm/guard_field_test.cc
index 0988255..0feabcc 100644
--- a/runtime/vm/guard_field_test.cc
+++ b/runtime/vm/guard_field_test.cc
@@ -30,7 +30,7 @@
const char* script_chars =
"class A {\n"
" var f1 = 3.0;\n"
- " var f2 = 3;\n"
+ " dynamic f2 = 3;\n"
" var f3 = new List(4);\n"
" foo() {\n"
" f1 = f1 + f1;\n"
@@ -80,7 +80,7 @@
const char* script_chars =
"class A {\n"
" var f1 = 3.0;\n"
- " var f2 = 3;\n"
+ " dynamic f2 = 3;\n"
" final f3 = new List(4);\n"
" foo() {\n"
" f1 = f1 + f1;\n"
@@ -132,7 +132,7 @@
const char* script_chars =
"class A {\n"
" var f1 = 3.0;\n"
- " var f2 = 3;\n"
+ " dynamic f2 = 3;\n"
" final f3 = new List();\n"
" foo() {\n"
" f1 = f1 + f1;\n"
@@ -185,7 +185,7 @@
"import 'dart:typed_data';\n"
"class A {\n"
" var f1 = 3.0;\n"
- " var f2 = 3;\n"
+ " dynamic f2 = 3;\n"
" final f3;\n"
" A(x) : f3 = x;\n"
" foo() {\n"
diff --git a/runtime/vm/isolate_reload_test.cc b/runtime/vm/isolate_reload_test.cc
index 35ff7b2..8ec1d7f 100644
--- a/runtime/vm/isolate_reload_test.cc
+++ b/runtime/vm/isolate_reload_test.cc
@@ -867,7 +867,7 @@
"class C extends B {\n"
" C(name) : super(name);\n"
"}\n"
- "var list = [ new A('a'), new B('b'), new C('c') ];\n"
+ "var list = <dynamic>[ new A('a'), new B('b'), new C('c') ];\n"
"main() {\n"
" return (list.map((x) {\n"
" return '${x.name} is A(${x is A})/ B(${x is B})/ C(${x is C})';\n"
@@ -2844,7 +2844,8 @@
}
static bool MainModifiedCallback(const char* url, int64_t since) {
- if (strcmp(url, "test-lib") == 0) {
+ if ((strcmp(url, "test-lib") == 0) ||
+ (strcmp(url, "file:///test-lib") == 0)) {
return true;
}
return false;
diff --git a/runtime/vm/isolate_test.cc b/runtime/vm/isolate_test.cc
index ef07817..a9d3a85 100644
--- a/runtime/vm/isolate_test.cc
+++ b/runtime/vm/isolate_test.cc
@@ -14,12 +14,8 @@
namespace dart {
VM_UNIT_TEST_CASE(IsolateCurrent) {
- char* error;
- Dart_Isolate isolate = Dart_CreateIsolate(
- NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, &error);
+ Dart_Isolate isolate = TestCase::CreateTestIsolate();
EXPECT_EQ(isolate, Dart_CurrentIsolate());
- EXPECT_EQ(error, static_cast<char*>(NULL));
Dart_ShutdownIsolate();
EXPECT_EQ(reinterpret_cast<Dart_Isolate>(NULL), Dart_CurrentIsolate());
}
diff --git a/runtime/vm/metrics_test.cc b/runtime/vm/metrics_test.cc
index 6d2e69c..1e20866 100644
--- a/runtime/vm/metrics_test.cc
+++ b/runtime/vm/metrics_test.cc
@@ -16,8 +16,7 @@
#ifndef PRODUCT
VM_UNIT_TEST_CASE(Metric_Simple) {
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+ TestCase::CreateTestIsolate();
{
Metric metric;
@@ -45,8 +44,7 @@
};
VM_UNIT_TEST_CASE(Metric_OnDemand) {
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+ TestCase::CreateTestIsolate();
{
Thread* thread = Thread::Current();
StackZone zone(thread);
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 31a980b..ec35e6e 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -2388,9 +2388,10 @@
bool IsInFactoryScope() const;
bool NeedsArgumentTypeChecks(Isolate* I) const {
- return (I->strong() &&
- (!is_static() || kind() == RawFunction::kConstructor)) ||
- I->type_checks();
+ if (I->strong()) {
+ return !(is_static() || (kind() == RawFunction::kConstructor));
+ }
+ return I->type_checks();
}
TokenPosition token_pos() const {
diff --git a/runtime/vm/service_test.cc b/runtime/vm/service_test.cc
index c0aec6d..46424c7 100644
--- a/runtime/vm/service_test.cc
+++ b/runtime/vm/service_test.cc
@@ -655,7 +655,7 @@
"var x = 7;\n"
"main() {\n"
" x = x * x;\n"
- " x = x / 13;\n"
+ " x = (x / 13).floor();\n"
"}";
Dart_RegisterRootServiceRequestCallback("alpha", alpha_callback, NULL);
@@ -692,7 +692,7 @@
"var x = 7;\n"
"main() {\n"
" x = x * x;\n"
- " x = x / 13;\n"
+ " x = (x / 13).floor();\n"
"}";
Dart_RegisterIsolateServiceRequestCallback("alpha", alpha_callback, NULL);
@@ -742,7 +742,7 @@
"var x = 7;\n"
"main() {\n"
" x = x * x;\n"
- " x = x / 13;\n"
+ " x = (x / 13).floor();\n"
"}";
Isolate* isolate = thread->isolate();
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index 30b5dff..3bfe589 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -1879,6 +1879,7 @@
VM_UNIT_TEST_CASE(DartGeneratedMessages) {
static const char* kCustomIsolateScriptCommonChars =
+ "final int kArrayLength = 10;\n"
"getSmi() {\n"
" return 42;\n"
"}\n"
diff --git a/runtime/vm/stack_frame_test.cc b/runtime/vm/stack_frame_test.cc
index e6bcb67..eadc9bf 100644
--- a/runtime/vm/stack_frame_test.cc
+++ b/runtime/vm/stack_frame_test.cc
@@ -279,7 +279,9 @@
" return 5;"
" }"
" static testMain() {"
- " var obj = new StackFrame2Test();"
+ " /* Declare |obj| dynamic so that noSuchMethod can be"
+ " * called in strong mode. */"
+ " dynamic obj = new StackFrame2Test();"
" StackFrame.equals(5, obj.foo(101, 202));"
" }"
"}";
@@ -314,7 +316,9 @@
" return 5;"
" }"
" static testMain() {"
- " var obj = new StackFrame2Test();"
+ " /* Declare |obj| dynamic so that noSuchMethod can be"
+ " * called in strong mode. */"
+ " dynamic obj = new StackFrame2Test();"
" StackFrame.equals(5, obj.foo(101, 202));"
" }"
"}";
diff --git a/runtime/vm/thread_test.cc b/runtime/vm/thread_test.cc
index 4c64822..492e26d 100644
--- a/runtime/vm/thread_test.cc
+++ b/runtime/vm/thread_test.cc
@@ -15,9 +15,7 @@
VM_UNIT_TEST_CASE(Mutex) {
// This unit test case needs a running isolate.
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
-
+ TestCase::CreateTestIsolate();
Mutex* mutex = new Mutex();
mutex->Lock();
EXPECT_EQ(false, mutex->TryLock());
@@ -36,8 +34,7 @@
VM_UNIT_TEST_CASE(Monitor) {
// This unit test case needs a running isolate.
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+ TestCase::CreateTestIsolate();
OSThread* thread = OSThread::Current();
// Thread interrupter interferes with this test, disable interrupts.
thread->DisableThreadInterrupts();
@@ -368,14 +365,12 @@
char* orig_str = orig_zone->PrintToString("foo");
Dart_ExitIsolate();
// Create and enter a new isolate.
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+ TestCase::CreateTestIsolate();
Zone* zone0 = Thread::Current()->zone();
EXPECT(zone0 != orig_zone);
Dart_ShutdownIsolate();
// Create and enter yet another isolate.
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+ TestCase::CreateTestIsolate();
{
// Create a stack resource this time, and exercise it.
StackZone stack_zone(Thread::Current());
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index 85447d38..1d80516 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -27,13 +27,27 @@
using dart::bin::Builtin;
using dart::bin::DartUtils;
+extern "C" {
+extern const uint8_t kPlatformDill[];
+extern const uint8_t kPlatformStrongDill[];
+extern intptr_t kPlatformDillSize;
+extern intptr_t kPlatformStrongDillSize;
+}
+
namespace dart {
+const uint8_t* platform_dill = kPlatformDill;
+const uint8_t* platform_strong_dill = kPlatformStrongDill;
+const intptr_t platform_dill_size = kPlatformDillSize;
+const intptr_t platform_strong_dill_size = kPlatformStrongDillSize;
+
DEFINE_FLAG(bool,
use_dart_frontend,
false,
"Parse scripts with Dart-to-Kernel parser");
+DECLARE_FLAG(bool, strong);
+
TestCaseBase* TestCaseBase::first_ = NULL;
TestCaseBase* TestCaseBase::tail_ = NULL;
@@ -67,21 +81,52 @@
}
}
-Dart_Isolate TestCase::CreateIsolate(const uint8_t* buffer, const char* name) {
+static void NoopRelease(uint8_t* data) {}
+
+Dart_Isolate TestCase::CreateIsolate(const uint8_t* data_buffer,
+ intptr_t len,
+ const uint8_t* instr_buffer,
+ const char* name,
+ void* data) {
char* err;
Dart_IsolateFlags api_flags;
Isolate::FlagsInitialize(&api_flags);
api_flags.use_dart_frontend = FLAG_use_dart_frontend;
- Dart_Isolate isolate =
- Dart_CreateIsolate(name, NULL, buffer, NULL, &api_flags, NULL, &err);
+ Dart_Isolate isolate = NULL;
+ if (len == 0) {
+ isolate = Dart_CreateIsolate(name, NULL, data_buffer, instr_buffer,
+ &api_flags, data, &err);
+ } else {
+ kernel::Program* program = reinterpret_cast<kernel::Program*>(
+ Dart_ReadKernelBinary(data_buffer, len, NoopRelease));
+ if (program != NULL) {
+ isolate = Dart_CreateIsolateFromKernel(name, NULL, program, &api_flags,
+ data, &err);
+ delete program;
+ }
+ }
if (isolate == NULL) {
- OS::Print("Creation of isolate failed '%s'\n", err);
+ OS::PrintErr("Creation of isolate failed '%s'\n", err);
free(err);
}
EXPECT(isolate != NULL);
return isolate;
}
+Dart_Isolate TestCase::CreateTestIsolate(const char* name, void* data) {
+ if (FLAG_use_dart_frontend) {
+ return CreateIsolate(
+ FLAG_strong ? platform_strong_dill : platform_dill,
+ FLAG_strong ? platform_strong_dill_size : platform_dill_size,
+ NULL, /* There is no instr buffer in case of dill buffers. */
+ name, data);
+ } else {
+ return CreateIsolate(bin::core_isolate_snapshot_data,
+ 0 /* Snapshots have length encoded within them. */,
+ bin::core_isolate_snapshot_instructions, name, data);
+ }
+}
+
static const char* kPackageScheme = "package:";
static bool IsPackageSchemeURL(const char* url_name) {
@@ -166,10 +211,6 @@
static ThreadLocalKey script_reload_key = kUnsetThreadLocalKey;
-#ifndef PRODUCT
-static ThreadLocalKey kernel_reload_key = kUnsetThreadLocalKey;
-#endif
-
bool TestCase::UsingDartFrontend() {
return FLAG_use_dart_frontend;
}
@@ -203,7 +244,8 @@
bool incrementally) {
Zone* zone = Thread::Current()->zone();
Dart_KernelCompilationResult compilation_result = Dart_CompileSourcesToKernel(
- url, NULL /* platform binary can be found at the default location */, 0,
+ url, FLAG_strong ? platform_strong_dill : platform_dill,
+ FLAG_strong ? platform_strong_dill_size : platform_dill_size,
sourcefiles_count, sourcefiles, incrementally);
if (compilation_result.status != Dart_KernelCompilationStatus_Ok) {
@@ -340,16 +382,38 @@
return lib;
}
+static intptr_t BuildSourceFilesArray(Dart_SourceFile** sourcefiles,
+ const char* script) {
+ ASSERT(sourcefiles != NULL);
+ ASSERT(script != NULL);
+ ASSERT(FLAG_use_dart_frontend);
+
+ intptr_t num_test_libs = 0;
+ if (test_libs_ != NULL) {
+ num_test_libs = test_libs_->length();
+ }
+
+ *sourcefiles = new Dart_SourceFile[num_test_libs + 1];
+ (*sourcefiles)[0].uri = RESOLVED_USER_TEST_URI;
+ (*sourcefiles)[0].source = script;
+ for (intptr_t i = 0; i < num_test_libs; ++i) {
+ (*sourcefiles)[i + 1].uri = test_libs_->At(i).url;
+ (*sourcefiles)[i + 1].source = test_libs_->At(i).source;
+ }
+ return num_test_libs + 1;
+}
+
Dart_Handle TestCase::LoadTestScript(const char* script,
Dart_NativeEntryResolver resolver,
const char* lib_url,
bool finalize_classes) {
if (FLAG_use_dart_frontend) {
- Dart_SourceFile sourcefiles[] = {
- {OS::SCreate(Thread::Current()->zone(), "file:///%s", lib_url),
- script}};
- return LoadTestScriptWithDFE(sizeof(sourcefiles) / sizeof(Dart_SourceFile),
- sourcefiles, resolver, finalize_classes);
+ Dart_SourceFile* sourcefiles = NULL;
+ intptr_t num_sources = BuildSourceFilesArray(&sourcefiles, script);
+ Dart_Handle result = LoadTestScriptWithDFE(num_sources, sourcefiles,
+ resolver, finalize_classes);
+ delete[] sourcefiles;
+ return result;
} else {
return LoadTestScriptWithVMParser(script, resolver, lib_url,
finalize_classes);
@@ -365,7 +429,6 @@
EXPECT_VALID(result);
void* kernel_pgm = NULL;
int sourcefiles_count = sizeof(sourcefiles) / sizeof(Dart_SourceFile);
- OS::Print("Compiling %s %d\n", sourcefiles[0].uri, sourcefiles_count);
char* error = TestCase::CompileTestScriptWithDFE(
sourcefiles[0].uri, sourcefiles_count, sourcefiles, &kernel_pgm, false);
if (error != NULL) {
@@ -421,16 +484,6 @@
OSThread::SetThreadLocal(script_reload_key, reinterpret_cast<uword>(script));
}
-void TestCase::SetReloadTestKernel(const void* kernel) {
- if (kernel_reload_key == kUnsetThreadLocalKey) {
- kernel_reload_key = OSThread::CreateThreadLocal();
- }
- ASSERT(kernel_reload_key != kUnsetThreadLocalKey);
- ASSERT(OSThread::GetThreadLocal(kernel_reload_key) == 0);
- // Store the new script in TLS.
- OSThread::SetThreadLocal(kernel_reload_key, reinterpret_cast<uword>(kernel));
-}
-
Dart_Handle TestCase::TriggerReload() {
Isolate* isolate = Isolate::Current();
JSONStream js;
@@ -465,9 +518,10 @@
Dart_Handle TestCase::ReloadTestScript(const char* script) {
if (FLAG_use_dart_frontend) {
- Dart_SourceFile sourcefiles[] = {{RESOLVED_USER_TEST_URI, script}};
- KernelIsolate::UpdateInMemorySources(
- sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles);
+ Dart_SourceFile* sourcefiles = NULL;
+ intptr_t num_files = BuildSourceFilesArray(&sourcefiles, script);
+ KernelIsolate::UpdateInMemorySources(num_files, sourcefiles);
+ delete[] sourcefiles;
} else {
SetReloadTestScript(script);
}
@@ -492,8 +546,6 @@
}
Dart_Handle TestCase::ReloadTestKernel(const void* kernel) {
- SetReloadTestKernel(kernel);
-
Dart_Handle result = TriggerReload();
if (Dart_IsError(result)) {
return result;
diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
index 970de8f..2e6221d 100644
--- a/runtime/vm/unit_test.h
+++ b/runtime/vm/unit_test.h
@@ -270,6 +270,11 @@
extern const uint8_t* core_isolate_snapshot_instructions;
} // namespace bin
+extern const uint8_t* platform_dill;
+extern const uint8_t* platform_strong_dill;
+extern const intptr_t platform_dill_size;
+extern const intptr_t platform_strong_dill_size;
+
class TestCaseBase {
public:
explicit TestCaseBase(const char* name);
@@ -334,11 +339,10 @@
static const char* url();
static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer,
const char* name = NULL) {
- return CreateIsolate(buffer, name);
+ return CreateIsolate(buffer, 0, NULL, name);
}
- static Dart_Isolate CreateTestIsolate(const char* name = NULL) {
- return CreateIsolate(bin::core_isolate_snapshot_data, name);
- }
+ static Dart_Isolate CreateTestIsolate(const char* name = NULL,
+ void* data = NULL);
static Dart_Handle library_handler(Dart_LibraryTag tag,
Dart_Handle library,
Dart_Handle url);
@@ -348,7 +352,6 @@
// Sets |script| to be the source used at next reload.
static void SetReloadTestScript(const char* script);
- static void SetReloadTestKernel(const void* kernel);
// Initiates the reload.
static Dart_Handle TriggerReload();
@@ -363,7 +366,16 @@
static const char* GetTestLib(const char* url);
private:
- static Dart_Isolate CreateIsolate(const uint8_t* buffer, const char* name);
+ // |data_buffer| can either be snapshot data, or kernel binary data.
+ // If |data_buffer| is snapshot data, then |len| should be zero as snapshot
+ // size is encoded within them. If |len| is non-zero, then |data_buffer|
+ // will be treated as a kernel binary (but CreateIsolate will not
+ // take ownership of the buffer) and |instr_buffer| will be ignored.
+ static Dart_Isolate CreateIsolate(const uint8_t* data_buffer,
+ intptr_t len,
+ const uint8_t* instr_buffer,
+ const char* name,
+ void* data = NULL);
RunEntry* const run_;
};
diff --git a/runtime/vm/zone_test.cc b/runtime/vm/zone_test.cc
index 4a3aeac..5f8f783 100644
--- a/runtime/vm/zone_test.cc
+++ b/runtime/vm/zone_test.cc
@@ -14,8 +14,7 @@
#if defined(DEBUG)
FLAG_trace_zones = true;
#endif
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+ TestCase::CreateTestIsolate();
Thread* thread = Thread::Current();
EXPECT(thread->zone() == NULL);
{
@@ -75,8 +74,7 @@
#if defined(DEBUG)
FLAG_trace_zones = true;
#endif
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+ TestCase::CreateTestIsolate();
Thread* thread = Thread::Current();
EXPECT(thread->zone() == NULL);
{
@@ -98,8 +96,7 @@
#if defined(DEBUG)
FLAG_trace_zones = true;
#endif
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+ TestCase::CreateTestIsolate();
Thread* thread = Thread::Current();
EXPECT(thread->zone() == NULL);
{
@@ -116,8 +113,7 @@
#if defined(DEBUG)
FLAG_trace_zones = true;
#endif
- Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
- bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+ TestCase::CreateTestIsolate();
Thread* thread = Thread::Current();
EXPECT(thread->zone() == NULL);
static int marker;
diff --git a/sdk/lib/_chrome/dart2js/chrome_dart2js.dart b/sdk/lib/_chrome/dart2js/chrome_dart2js.dart
index a0d483c..023afe4 100644
--- a/sdk/lib/_chrome/dart2js/chrome_dart2js.dart
+++ b/sdk/lib/_chrome/dart2js/chrome_dart2js.dart
@@ -203,16 +203,25 @@
*/
/// Registers an event listener <em>callback</em> to an event.
- void addListener(Function callback) => JS('void', '#.addListener(#)',
- this._jsObject, convertDartClosureToJS(callback, this._callbackArity));
+ void addListener(covariant Function callback) => JS(
+ 'void',
+ '#.addListener(#)',
+ this._jsObject,
+ convertDartClosureToJS(callback, this._callbackArity));
/// Deregisters an event listener <em>callback</em> from an event.
- void removeListener(Function callback) => JS('void', '#.removeListener(#)',
- this._jsObject, convertDartClosureToJS(callback, this._callbackArity));
+ void removeListener(covariant Function callback) => JS(
+ 'void',
+ '#.removeListener(#)',
+ this._jsObject,
+ convertDartClosureToJS(callback, this._callbackArity));
/// Returns True if <em>callback</em> is registered to the event.
- bool hasListener(Function callback) => JS('bool', '#.hasListener(#)',
- this._jsObject, convertDartClosureToJS(callback, this._callbackArity));
+ bool hasListener(covariant Function callback) => JS(
+ 'bool',
+ '#.hasListener(#)',
+ this._jsObject,
+ convertDartClosureToJS(callback, this._callbackArity));
/// Returns true if any event listeners are registered to the event.
bool hasListeners() => JS('bool', '#.hasListeners()', this._jsObject);
diff --git a/sdk/lib/_internal/js_runtime/lib/constant_map.dart b/sdk/lib/_internal/js_runtime/lib/constant_map.dart
index e5413a9..cf0285a3 100644
--- a/sdk/lib/_internal/js_runtime/lib/constant_map.dart
+++ b/sdk/lib/_internal/js_runtime/lib/constant_map.dart
@@ -4,8 +4,9 @@
part of _js_helper;
-class ConstantMapView<K, V> extends UnmodifiableMapView implements ConstantMap {
- ConstantMapView(Map base) : super(base);
+class ConstantMapView<K, V> extends UnmodifiableMapView<K, V>
+ implements ConstantMap<K, V> {
+ ConstantMapView(Map<K, V> base) : super(base);
}
abstract class ConstantMap<K, V> implements Map<K, V> {
@@ -65,7 +66,7 @@
void operator []=(K key, V val) => _throwUnmodifiable();
V putIfAbsent(K key, V ifAbsent()) => _throwUnmodifiable();
- V remove(K key) => _throwUnmodifiable();
+ V remove(Object key) => _throwUnmodifiable();
void clear() => _throwUnmodifiable();
void addAll(Map<K, V> other) => _throwUnmodifiable();
@@ -112,7 +113,7 @@
final List<K> _keys;
int get length => JS('JSUInt31', '#', _length);
- List get _keysArray => JS('JSUnmodifiableArray', '#', _keys);
+ List<K> get _keysArray => JS('JSUnmodifiableArray', '#', _keys);
bool containsValue(Object needle) {
return values.any((V value) => value == needle);
diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
index 53cfa03..e670cc1 100644
--- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
@@ -419,7 +419,8 @@
factory String.fromCharCodes(Iterable<int> charCodes,
[int start = 0, int end]) {
if (charCodes is JSArray) {
- return _stringFromJSArray(charCodes, start, end);
+ JSArray<int> array = charCodes;
+ return _stringFromJSArray(array, start, end);
}
if (charCodes is NativeUint8List) {
return _stringFromUint8List(charCodes, start, end);
diff --git a/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart b/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
index 5df9943..0daec2f 100644
--- a/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
@@ -182,6 +182,8 @@
external IsolateContext JS_CURRENT_ISOLATE_CONTEXT();
abstract class IsolateContext {
+ int get id;
+
/// Holds a (native) JavaScript instance of Isolate, see
/// finishIsolateConstructorFunction in emitter.dart.
get isolateStatics;
diff --git a/sdk/lib/_internal/js_runtime/lib/isolate_serialization.dart b/sdk/lib/_internal/js_runtime/lib/isolate_serialization.dart
index 619ef6a..31574ce 100644
--- a/sdk/lib/_internal/js_runtime/lib/isolate_serialization.dart
+++ b/sdk/lib/_internal/js_runtime/lib/isolate_serialization.dart
@@ -44,7 +44,7 @@
if (x is NativeByteBuffer) return serializeByteBuffer(x);
if (x is NativeTypedData) return serializeTypedData(x);
if (x is JSIndexable) return serializeJSIndexable(x);
- if (x is InternalMap) return serializeMap(x);
+ if (x is InternalMap) return serializeMap(x as dynamic);
if (x is JSObject) return serializeJSObject(x);
diff --git a/sdk/lib/_internal/js_runtime/lib/js_array.dart b/sdk/lib/_internal/js_runtime/lib/js_array.dart
index 1cc7b2a..e8dbab7 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_array.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_array.dart
@@ -427,7 +427,7 @@
if (length == 0) return;
RangeError.checkNotNegative(skipCount, 'skipCount');
- List otherList;
+ List<E> otherList;
int otherStart;
// TODO(floitsch): Make this accept more.
if (iterable is List) {
diff --git a/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart b/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart
index 7024912..db3605e 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart
@@ -215,8 +215,10 @@
bool get isCurrent => JS_CURRENT_ISOLATE_CONTEXT() == _isolateContext;
LibraryMirror get rootLibrary {
- return currentJsMirrorSystem.libraries.values
- .firstWhere((JsLibraryMirror library) => library._isRoot);
+ return currentJsMirrorSystem.libraries.values.firstWhere((LibraryMirror l) {
+ JsLibraryMirror library = l;
+ return library._isRoot;
+ });
}
}
@@ -389,7 +391,7 @@
InstanceMirror setField(Symbol fieldName, Object arg) {
String name = n(fieldName);
if (name.endsWith('=')) throw new ArgumentError('');
- var mirror = __functions[s('$name=')];
+ dynamic mirror = __functions[s('$name=')];
if (mirror == null) mirror = __variables[fieldName];
if (mirror == null) {
throw new NoSuchStaticMethodError.method(
@@ -1360,7 +1362,7 @@
List<TypeMirror> get typeArguments {
if (_cachedTypeArguments != null) return _cachedTypeArguments;
- List result = new List();
+ var result = <TypeMirror>[];
addTypeArgument(String typeArgument) {
int parsedIndex = int.parse(typeArgument, onError: (_) => -1);
@@ -1498,12 +1500,16 @@
var instance = _class._getInvokedInstance(
constructorName, positionalArguments, namedArguments);
return reflect(setRuntimeTypeInfo(
- instance, typeArguments.map((t) => t._asRuntimeType()).toList()));
+ instance, typeArguments.map(_toRuntimeType).toList()));
}
_asRuntimeType() {
- return [_class._jsConstructor]
- .addAll(typeArguments.map((t) => t._asRuntimeType()));
+ return [_class._jsConstructor].addAll(typeArguments.map(_toRuntimeType));
+ }
+
+ static _toRuntimeType(TypeMirror t) {
+ JsTypeMirror typeMirror = t;
+ return typeMirror._asRuntimeType();
}
JsLibraryMirror get owner => _class.owner;
@@ -1744,9 +1750,9 @@
List<VariableMirror> _getFieldsWithOwner(DeclarationMirror fieldOwner) {
var result = <VariableMirror>[];
- var instanceFieldSpecfication = _fieldsDescriptor.split(';')[1];
+ dynamic instanceFieldSpecfication = _fieldsDescriptor.split(';')[1];
if (_fieldsMetadata != null) {
- instanceFieldSpecfication = [instanceFieldSpecfication]
+ instanceFieldSpecfication = <dynamic>[instanceFieldSpecfication]
..addAll(_fieldsMetadata);
}
parseCompactFieldSpecification(
@@ -2071,7 +2077,7 @@
List<TypeVariableMirror> get typeVariables {
if (_cachedTypeVariables != null) return _cachedTypeVariables;
- List result = new List();
+ var result = new List<TypeVariableMirror>();
List typeVariables =
JS('JSExtendableArray|Null', '#.prototype["<>"]', _jsConstructor);
if (typeVariables == null) return result;
@@ -2297,7 +2303,7 @@
Function.apply(reflectee, positionalArguments, namedArguments));
}
- TypeMirror get type {
+ ClassMirror get type {
// Classes that implement [call] do not subclass [Closure], but only
// implement [Function], so are rejected by this test.
if (reflectee is Closure) {
@@ -2403,7 +2409,7 @@
List<InstanceMirror> get metadata {
if (_metadata == null) {
var raw = extractMetadata(_jsFunction);
- var formals = new List(_parameterCount);
+ var formals = new List<ParameterMirror>(_parameterCount);
ReflectionInfo info = new ReflectionInfo(_jsFunction);
if (info != null) {
assert(_parameterCount ==
@@ -2733,7 +2739,7 @@
List<ParameterMirror> get parameters {
if (_cachedParameters != null) return _cachedParameters;
- List result = [];
+ var result = <ParameterMirror>[];
int parameterCount = 0;
if (_hasArguments) {
for (var type in _arguments) {
@@ -2898,7 +2904,7 @@
return 'dynamic';
}
}
- return typeArgument._mangledName;
+ return (typeArgument as dynamic)._mangledName;
}
representation =
@@ -2936,7 +2942,7 @@
return JSArray
.markFixedList(JS('JSExtendableArray',
r'#.$reflectionInfo.splice(#.$metadataIndex)', victim, victim))
- .map((int i) => getMetadata(i))
+ .map((i) => getMetadata(i))
.toList();
}
return const [];
diff --git a/sdk/lib/_internal/js_runtime/lib/js_number.dart b/sdk/lib/_internal/js_runtime/lib/js_number.dart
index 47ce41d..e1b1e07 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_number.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_number.dart
@@ -13,7 +13,7 @@
* Note that none of the methods here delegate to a method defined on JSInt or
* JSDouble. This is exploited in [tryComputeConstantInterceptor].
*/
-class JSNumber extends Interceptor implements num {
+class JSNumber extends Interceptor implements double {
const JSNumber();
int compareTo(num b) {
@@ -50,15 +50,17 @@
bool get isFinite => JS('bool', r'isFinite(#)', this);
- num remainder(num b) {
+ JSNumber remainder(num b) {
if (b is! num) throw argumentErrorValue(b);
return JS('num', r'# % #', this, b);
}
- num abs() => JS('returns:num;effects:none;depends:none;throws:never;gvn:true',
- r'Math.abs(#)', this);
+ JSNumber abs() => JS(
+ 'returns:num;effects:none;depends:none;throws:never;gvn:true',
+ r'Math.abs(#)',
+ this);
- num get sign => this > 0 ? 1 : this < 0 ? -1 : this;
+ JSNumber get sign => this > 0 ? 1 : this < 0 ? -1 : this;
static const int _MIN_INT32 = -0x80000000;
static const int _MAX_INT32 = 0x7FFFFFFF;
@@ -240,33 +242,33 @@
int get hashCode => JS('int', '# & 0x1FFFFFFF', this);
- num operator -() => JS('num', r'-#', this);
+ JSNumber operator -() => JS('num', r'-#', this);
- num operator +(num other) {
+ JSNumber operator +(num other) {
if (other is! num) throw argumentErrorValue(other);
return JS('num', '# + #', this, other);
}
- num operator -(num other) {
+ JSNumber operator -(num other) {
if (other is! num) throw argumentErrorValue(other);
return JS('num', '# - #', this, other);
}
- num operator /(num other) {
+ double operator /(num other) {
if (other is! num) throw argumentErrorValue(other);
return JS('num', '# / #', this, other);
}
- num operator *(num other) {
+ JSNumber operator *(num other) {
if (other is! num) throw argumentErrorValue(other);
return JS('num', '# * #', this, other);
}
- num operator %(num other) {
+ JSNumber operator %(num other) {
if (other is! num) throw argumentErrorValue(other);
// Euclidean Modulo.
num result = JS('num', r'# % #', this, other);
- if (result == 0) return 0; // Make sure we don't return -0.0.
+ if (result == 0) return JS('num', '0'); // Make sure we don't return -0.0.
if (result > 0) return result;
if (JS('num', '#', other) < 0) {
return result - JS('num', '#', other);
@@ -415,9 +417,18 @@
* while we want to treat `2.0` as an integer for some operations, its
* interceptor should answer `true` to `is double`.
*/
-class JSInt extends JSNumber implements int, double {
+class JSInt extends JSNumber implements int {
const JSInt();
+ @override
+ JSInt abs() => super.abs();
+
+ @override
+ JSInt get sign => super.sign;
+
+ @override
+ JSInt operator -() => -super;
+
bool get isEven => (this & 1) == 0;
bool get isOdd => (this & 1) == 1;
@@ -432,7 +443,7 @@
}
int get bitLength {
- int nonneg = this < 0 ? -this - 1 : this;
+ JSInt nonneg = this < 0 ? -this - 1 : this;
int wordBits = 32;
while (nonneg >= 0x100000000) {
nonneg = nonneg ~/ 0x100000000;
diff --git a/sdk/lib/_internal/js_runtime/lib/js_rti.dart b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
index f4c540e..46c77da 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_rti.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
@@ -82,7 +82,10 @@
const TypeVariable(this.owner, this.name, this.bound);
}
-getMangledTypeName(TypeImpl type) => type._typeName;
+getMangledTypeName(Type t) {
+ TypeImpl type = t;
+ return type._typeName;
+}
/// Sets the runtime type information on [target]. [rti] is a type
/// representation of type 4 or 5, that is, either a JavaScript array or `null`.
diff --git a/sdk/lib/_internal/js_runtime/lib/native_typed_data.dart b/sdk/lib/_internal/js_runtime/lib/native_typed_data.dart
index aab98d3..7d99498 100644
--- a/sdk/lib/_internal/js_runtime/lib/native_typed_data.dart
+++ b/sdk/lib/_internal/js_runtime/lib/native_typed_data.dart
@@ -450,7 +450,7 @@
* Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 4` is greater than the length of this object.
*/
- num getFloat32(int byteOffset, [Endian endian = Endian.big]) =>
+ double getFloat32(int byteOffset, [Endian endian = Endian.big]) =>
_getFloat32(byteOffset, Endian.little == endian);
@JSName('getFloat32')
@@ -465,7 +465,7 @@
* Throws [RangeError] if [byteOffset] is negative, or
* `byteOffset + 8` is greater than the length of this object.
*/
- num getFloat64(int byteOffset, [Endian endian = Endian.big]) =>
+ double getFloat64(int byteOffset, [Endian endian = Endian.big]) =>
_getFloat64(byteOffset, Endian.little == endian);
@JSName('getFloat64')
diff --git a/sdk/lib/js/dart2js/js_dart2js.dart b/sdk/lib/js/dart2js/js_dart2js.dart
index f7ef054..5d1e2d3 100644
--- a/sdk/lib/js/dart2js/js_dart2js.dart
+++ b/sdk/lib/js/dart2js/js_dart2js.dart
@@ -190,7 +190,7 @@
// the arguments list passed to apply().
// After that, use the JavaScript 'new' operator which overrides any binding
// of 'this' with the new instance.
- var args = [null]..addAll(arguments.map(_convertToJS));
+ var args = <dynamic>[null]..addAll(arguments.map(_convertToJS));
var factoryFunction = JS('', '#.bind.apply(#, #)', constr, constr, args);
// Without this line, calling factoryFunction as a constructor throws
JS('String', 'String(#)', factoryFunction);
@@ -503,7 +503,8 @@
int length = end - start;
if (length == 0) return;
if (skipCount < 0) throw new ArgumentError(skipCount);
- var args = [start, length]..addAll(iterable.skip(skipCount).take(length));
+ var args = <dynamic>[start, length]
+ ..addAll(iterable.skip(skipCount).take(length));
callMethod('splice', args);
}
diff --git a/sdk/lib/js_util/dart2js/js_util_dart2js.dart b/sdk/lib/js_util/dart2js/js_util_dart2js.dart
index ec6c09a..efc4386 100644
--- a/sdk/lib/js_util/dart2js/js_util_dart2js.dart
+++ b/sdk/lib/js_util/dart2js/js_util_dart2js.dart
@@ -109,7 +109,7 @@
// the arguments list passed to apply().
// After that, use the JavaScript 'new' operator which overrides any binding
// of 'this' with the new instance.
- var args = [null]..addAll(arguments);
+ var args = <dynamic>[null]..addAll(arguments);
var factoryFunction = JS('', '#.bind.apply(#, #)', constr, constr, args);
// Without this line, calling factoryFunction as a constructor throws
JS('String', 'String(#)', factoryFunction);
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 66ca0e5..dffed23 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -3731,7 +3731,7 @@
LayoutTests/fast/css/media-rule-screenDepthPerComponent_t01: RuntimeError # Please triage this failure
LayoutTests/fast/forms/submit-form-attributes_t01: RuntimeError # Please triage this failure
LayoutTests/fast/media/color-does-not-include-alpha_t01: RuntimeError # Issue 31161
-LayoutTests/fast/media/media-query-list_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/media/media-query-list_t01: Pass, RuntimeError # Issue 32257
[ $compiler == dart2js && $runtime == ff && $checked ]
LayoutTests/fast/canvas/webgl/framebuffer-object-attachment_t01: RuntimeError # Please triage this failure
diff --git a/tests/compiler/dart2js/rti/emission/map_literal_checked.dart b/tests/compiler/dart2js/rti/emission/map_literal_checked.dart
index bda462b..c074638 100644
--- a/tests/compiler/dart2js/rti/emission/map_literal_checked.dart
+++ b/tests/compiler/dart2js/rti/emission/map_literal_checked.dart
@@ -6,7 +6,8 @@
/*class: global#LinkedHashMap:*/
/*class: global#JsLinkedHashMap:checks=[$isLinkedHashMap]*/
/*class: global#double:checks=[]*/
-/*class: global#JSDouble:checks=[$isdouble]*/
+/*class: global#JSNumber:checks=[$isdouble,$isnum]*/
+/*class: global#JSDouble:checks=[]*/
main() {
<int, double>{}[0] = 0.5;
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index 400410a..6e20711 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -17,6 +17,7 @@
int_modulo_arith_test/modPow: RuntimeError
int_modulo_arith_test/none: RuntimeError
null_nosuchmethod_test/01: RuntimeError # Issue 32088
+null_test: RuntimeError # Issue 32194
string_from_environment3_test/03: Crash
[ $compiler == precompiler ]
diff --git a/tests/language_2/call_closurization_test.dart b/tests/language_2/call_closurization_test.dart
index d106dbb..683c229 100644
--- a/tests/language_2/call_closurization_test.dart
+++ b/tests/language_2/call_closurization_test.dart
@@ -43,7 +43,12 @@
Expect.equals("4455", named_arg_tearOff.call(x: 44, y: 55));
}
- Expect.throws(() => bar_tearOff.call());
- Expect.throwsNoSuchMethodError(() => opt_arg_tearOff.call(x: "p"));
- Expect.throwsNoSuchMethodError(() => named_arg_tearOff.call("p", "q"));
+ // In order to test runtime behavior of calling with invalid arguments,
+ // we cast to dynamic to make the type system forget about the actual types.
+ dynamic bar_tearOff_d = bar_tearOff;
+ dynamic opt_arg_tearOff_d = opt_arg_tearOff;
+ dynamic named_arg_tearOff_d = named_arg_tearOff;
+ Expect.throws(() => bar_tearOff_d.call());
+ Expect.throwsNoSuchMethodError(() => opt_arg_tearOff_d.call(x: "p"));
+ Expect.throwsNoSuchMethodError(() => named_arg_tearOff_d.call("p", "q"));
}
diff --git a/tests/language_2/call_method_must_not_be_field_test.dart b/tests/language_2/call_method_must_not_be_field_test.dart
new file mode 100644
index 0000000..bc6209d
--- /dev/null
+++ b/tests/language_2/call_method_must_not_be_field_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+class C {
+ void Function() call = () {};
+}
+
+main() {
+ C c = new C();
+ dynamic d = c;
+
+ // The presence of a field named `call` does not permit the class `C` to be
+ // implicitly called.
+ c(); //# 01: compile-time error
+ // Nor does it permit an implicit tear-off of `call`.
+ void Function() f = c; //# 02: compile-time error
+ // Nor does it permit a dynamic invocation of `call`.
+ Expect.throws(() => d()); //# 03: ok
+
+ // However, all these things are possible if `call` is mentioned explicitly.
+ c.call(); //# 04: ok
+ void Function() f = c.call; //# 05: ok
+ d.call(); //# 06: ok
+}
diff --git a/tests/language_2/call_method_must_not_be_getter_test.dart b/tests/language_2/call_method_must_not_be_getter_test.dart
new file mode 100644
index 0000000..d21132b
--- /dev/null
+++ b/tests/language_2/call_method_must_not_be_getter_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+class C {
+ void Function() get call => () {};
+}
+
+main() {
+ C c = new C();
+ dynamic d = c;
+
+ // The presence of a getter named `call` does not permit the class `C` to be
+ // implicitly called.
+ c(); //# 01: compile-time error
+ // Nor does it permit an implicit tear-off of `call`.
+ void Function() f = c; //# 02: compile-time error
+ // Nor does it permit a dynamic invocation of `call`.
+ Expect.throws(() => d()); //# 03: ok
+
+ // However, all these things are possible if `call` is mentioned explicitly.
+ c.call(); //# 04: ok
+ void Function() f = c.call; //# 05: ok
+ d.call(); //# 06: ok
+}
diff --git a/tests/language_2/double_identical_test.dart b/tests/language_2/double_identical_test.dart
new file mode 100644
index 0000000..2004e63
--- /dev/null
+++ b/tests/language_2/double_identical_test.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.
+
+import "package:expect/expect.dart";
+
+main() {
+ Expect.isTrue(identical(42.0, 42.0));
+ Expect.isTrue(identical(-0.0, -0.0));
+ Expect.isTrue(identical(0.0, 0.0));
+ Expect.isTrue(identical(1.234E9, 1.234E9));
+ Expect.isFalse(identical(0.0, -0.0));
+ Expect.isTrue(identical(double.NAN, double.NAN));
+}
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index 92ce014..31ebcc6 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -1272,6 +1272,10 @@
built_in_identifier_type_annotation_test/81: MissingCompileTimeError # Issue 28813
call_method_implicit_tear_off_implements_function_test/03: StaticWarning
call_method_implicit_tear_off_test/03: StaticWarning
+call_method_must_not_be_field_test/01: MissingCompileTimeError # Issue 32264
+call_method_must_not_be_field_test/02: MissingCompileTimeError # Issue 32264
+call_method_must_not_be_getter_test/01: MissingCompileTimeError # Issue 32264
+call_method_must_not_be_getter_test/02: MissingCompileTimeError # Issue 32264
call_method_override_test/01: MissingCompileTimeError
call_method_override_test/02: MissingCompileTimeError
call_type_literal_test: StaticWarning
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 864fec3..80dfdb1 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -3,6 +3,9 @@
# BSD-style license that can be found in the LICENSE file.
# Sections in this file should contain "$compiler == dart2js".
+[ $compiler == dart2js ]
+double_identical_test: RuntimeError # Negative and positive zero are distinct, but not in dart2js; bug #11551.
+
[ $compiler != dart2js ]
minify_closure_variable_collision_test: SkipByDesign # Regression test for dart2js
@@ -311,6 +314,12 @@
call_method_is_check_test/03: RuntimeError
call_method_is_check_test/04: RuntimeError
call_method_is_check_test/05: RuntimeError
+call_method_must_not_be_field_test/01: MissingCompileTimeError
+call_method_must_not_be_field_test/02: MissingCompileTimeError
+call_method_must_not_be_field_test/03: RuntimeError
+call_method_must_not_be_getter_test/01: MissingCompileTimeError
+call_method_must_not_be_getter_test/02: MissingCompileTimeError
+call_method_must_not_be_getter_test/03: RuntimeError
call_method_override_test/01: MissingCompileTimeError
call_method_override_test/02: MissingCompileTimeError
covariant_override/runtime_check_test: RuntimeError
@@ -2154,11 +2163,9 @@
abstract_getter_test/01: MissingCompileTimeError
abstract_override_adds_optional_args_concrete_subclass_test: MissingCompileTimeError
abstract_override_adds_optional_args_concrete_test: MissingCompileTimeError
-abstract_override_adds_optional_args_supercall_test: MissingCompileTimeError
abstract_syntax_test/00: MissingCompileTimeError
additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTimeError
additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError
-additional_interface_adds_optional_args_supercall_test: MissingCompileTimeError
argument_assignability_function_typed_test/03: RuntimeError
argument_assignability_function_typed_test/04: RuntimeError
argument_assignability_function_typed_test/05: RuntimeError
@@ -2215,12 +2222,6 @@
await_for_use_local_test: RuntimeError
await_not_started_immediately_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
await_test: RuntimeError
-bad_named_parameters2_test/01: MissingCompileTimeError
-bad_named_parameters_test/01: MissingCompileTimeError
-bad_named_parameters_test/02: MissingCompileTimeError
-bad_named_parameters_test/03: MissingCompileTimeError
-bad_named_parameters_test/04: MissingCompileTimeError
-bad_named_parameters_test/05: MissingCompileTimeError
bad_override_test/01: MissingCompileTimeError
bad_override_test/02: MissingCompileTimeError
bad_override_test/03: MissingCompileTimeError
@@ -2346,7 +2347,6 @@
field_increment_bailout_test: CompileTimeError
field_initialization_order_test/01: MissingCompileTimeError
field_initialization_order_test/none: RuntimeError
-field_method4_test: MissingCompileTimeError
field_override2_test: MissingCompileTimeError
field_override3_test/00: MissingCompileTimeError
field_override3_test/01: MissingCompileTimeError
@@ -2465,7 +2465,7 @@
invocation_mirror2_test: CompileTimeError
invocation_mirror_invoke_on2_test: CompileTimeError
invocation_mirror_invoke_on_test: CompileTimeError
-invocation_mirror_test: CompileTimeError
+invocation_mirror_test: RuntimeError
issue18628_2_test/01: MissingCompileTimeError
issue21079_test: CompileTimeError
issue23244_test: RuntimeError
@@ -2483,8 +2483,6 @@
library_prefixes_test: CompileTimeError
local_function2_test/none: RuntimeError
local_function3_test/none: RuntimeError
-local_function_test/01: MissingCompileTimeError
-local_function_test/02: MissingCompileTimeError
local_function_test/none: RuntimeError
main_test/03: RuntimeError
main_test/20: RuntimeError
@@ -2633,11 +2631,6 @@
named_constructor_test/01: MissingCompileTimeError
named_parameters_default_eq_test/02: MissingCompileTimeError
named_parameters_default_eq_test/none: RuntimeError
-named_parameters_test/02: MissingCompileTimeError
-named_parameters_test/04: MissingCompileTimeError
-named_parameters_test/06: MissingCompileTimeError
-named_parameters_test/08: MissingCompileTimeError
-named_parameters_test/10: MissingCompileTimeError
nan_identical_test: RuntimeError
nested_generic_closure_test: RuntimeError
no_main_test/01: CompileTimeError
@@ -2652,10 +2645,6 @@
number_identity2_test: RuntimeError
numbers_test: RuntimeError
operator4_test: RuntimeError
-optional_named_parameters_test/02: MissingCompileTimeError
-optional_named_parameters_test/04: MissingCompileTimeError
-optional_named_parameters_test/06: MissingCompileTimeError
-optional_named_parameters_test/08: MissingCompileTimeError
overridden_no_such_method_test: CompileTimeError
override_field_method1_negative_test: Fail
override_field_method2_negative_test: Fail
@@ -2718,7 +2707,6 @@
recursive_generic_test: RuntimeError
redirecting_factory_default_values_test/01: MissingCompileTimeError
redirecting_factory_default_values_test/02: MissingCompileTimeError
-redirecting_factory_default_values_test/03: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
redirecting_factory_malbounded_test/01: MissingCompileTimeError
redirecting_factory_reflection_test: CompileTimeError
@@ -2834,6 +2822,7 @@
vm/regress_23238_test: RuntimeError
vm/regress_27201_test: CompileTimeError
vm/regress_28325_test: RuntimeError
+vm/regress_32204_test: Crash
vm/store_to_load_forwarding_phis_vm_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
vm/type_cast_vm_test: RuntimeError
vm/type_vm_test/28: MissingRuntimeError
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index b300a43..ca259ad 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -4,6 +4,7 @@
# Sections in this file should contain "$compiler == dartdevc" or dartdevk.
[ $compiler == dartdevc ]
+abstract_override_adds_optional_args_supercall_test: MissingCompileTimeError # Issue #30568
accessor_conflict_export2_test: CompileTimeError # Issue 25626
accessor_conflict_export_test: CompileTimeError # Issue 25626
accessor_conflict_import2_test: CompileTimeError # Issue 25626
@@ -38,6 +39,8 @@
call_method_is_check_test/03: RuntimeError
call_method_is_check_test/04: RuntimeError
call_method_is_check_test/05: RuntimeError
+call_method_must_not_be_field_test/03: RuntimeError
+call_method_must_not_be_getter_test/03: RuntimeError
call_method_override_test/01: MissingCompileTimeError
call_method_override_test/02: MissingCompileTimeError
cascaded_forwarding_stubs_generic_test: RuntimeError
@@ -50,6 +53,7 @@
const_types_test/15: MissingCompileTimeError
constant_type_literal_test/01: MissingCompileTimeError # DDC allows type parameter type literals in const expressions.
default_implementation2_test: CompileTimeError # Issue 30855
+double_identical_test: RuntimeError # Negative and positive zero are distinct, but not in ddc
emit_const_fields_test: CompileTimeError
enum_syntax_test/05: MissingCompileTimeError
enum_syntax_test/06: MissingCompileTimeError
@@ -269,7 +273,6 @@
abstract_syntax_test/00: MissingCompileTimeError
additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTimeError
additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError
-additional_interface_adds_optional_args_supercall_test: MissingCompileTimeError
async_await_syntax_test/c10a: MissingCompileTimeError
async_await_syntax_test/d08b: MissingCompileTimeError
async_await_syntax_test/d10a: MissingCompileTimeError
@@ -279,17 +282,12 @@
async_return_types_test/nestedFuture: MissingCompileTimeError
async_return_types_test/tooManyTypeParameters: MissingCompileTimeError
async_return_types_test/wrongReturnType: MissingCompileTimeError
-bad_named_parameters2_test/01: MissingCompileTimeError
-bad_named_parameters_test/01: MissingCompileTimeError
-bad_named_parameters_test/02: MissingCompileTimeError
-bad_named_parameters_test/03: MissingCompileTimeError
-bad_named_parameters_test/04: MissingCompileTimeError
-bad_named_parameters_test/05: MissingCompileTimeError
bad_override_test/01: MissingCompileTimeError
bad_override_test/02: MissingCompileTimeError
bad_override_test/03: MissingCompileTimeError
bad_override_test/04: MissingCompileTimeError
bad_override_test/05: MissingCompileTimeError
+built_in_identifier_type_annotation_test/05: RuntimeError # Issue 32194
built_in_identifier_type_annotation_test/22: Crash # Crashes in Fasta, issue 31416
built_in_identifier_type_annotation_test/52: MissingCompileTimeError
built_in_identifier_type_annotation_test/53: MissingCompileTimeError
@@ -307,6 +305,7 @@
built_in_identifier_type_annotation_test/66: MissingCompileTimeError
built_in_identifier_type_annotation_test/67: MissingCompileTimeError
built_in_identifier_type_annotation_test/68: MissingCompileTimeError
+built_in_identifier_type_annotation_test/none: RuntimeError # Issue 32194
call_method_as_cast_test/01: RuntimeError
call_method_as_cast_test/02: RuntimeError
call_method_as_cast_test/03: RuntimeError
@@ -321,9 +320,12 @@
call_method_is_check_test/03: RuntimeError
call_method_is_check_test/04: RuntimeError
call_method_is_check_test/05: RuntimeError
+call_method_must_not_be_field_test/03: RuntimeError # Issue 32157
+call_method_must_not_be_getter_test/03: RuntimeError # Issue 32157
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
call_with_no_such_method_test: RuntimeError
+cast_test/none: RuntimeError # Issue 32194
check_member_static_test/01: MissingCompileTimeError
check_member_static_test/02: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
@@ -359,6 +361,7 @@
const_syntax_test/05: MissingCompileTimeError
const_types_test/34: MissingCompileTimeError
const_types_test/39: MissingCompileTimeError
+constant_string_interpolation2_test: RuntimeError # Issue 32194
constants_test/05: MissingCompileTimeError
constructor_redirect1_negative_test/01: MissingCompileTimeError
constructor_redirect2_negative_test: MissingCompileTimeError
@@ -380,6 +383,7 @@
deferred_inheritance_constraints_test/redirecting_constructor: MissingCompileTimeError
deferred_load_library_wrong_args_test/01: CompileTimeError
deferred_shared_and_unshared_classes_test: CompileTimeError # Issue 31402 Error: A value of type 'dart.core::List<dynamic>' can't be assigned to a variable of type 'dart.core::Iterable<dart.async::Future<dynamic>>'.
+double_identical_test: RuntimeError # Negative and positive zero are distinct, but not in ddk
duplicate_export_negative_test: Fail
duplicate_implements_test/01: MissingCompileTimeError
duplicate_implements_test/02: MissingCompileTimeError
@@ -395,7 +399,6 @@
fauxverride_test/03: MissingCompileTimeError
fauxverride_test/05: MissingCompileTimeError
field_initialization_order_test/01: MissingCompileTimeError
-field_method4_test: MissingCompileTimeError
field_override2_test: MissingCompileTimeError
field_override3_test/00: MissingCompileTimeError
field_override3_test/01: MissingCompileTimeError
@@ -406,14 +409,9 @@
field_override_test/01: MissingCompileTimeError
function_propagation_test: RuntimeError
function_subtype_closure0_test: RuntimeError # Expect.throws(TypeError) fails: Did not throw
-function_type_call_getter2_test/00: MissingCompileTimeError
-function_type_call_getter2_test/01: MissingCompileTimeError
-function_type_call_getter2_test/02: MissingCompileTimeError
-function_type_call_getter2_test/03: MissingCompileTimeError
function_type_parameter2_negative_test: Fail
function_type_parameter_negative_test: Fail
generic_function_bounds_test: RuntimeError
-generic_methods_bounds_test/01: MissingCompileTimeError
generic_methods_generic_function_result_test/01: MissingCompileTimeError
generic_methods_recursive_bound_test/02: MissingCompileTimeError
generic_no_such_method_dispatcher_simple_test: CompileTimeError # Warning: Superclass has no method named 'foo'.
@@ -434,7 +432,6 @@
implicit_this_test/04: MissingCompileTimeError
initializing_formal_type_annotation_test/01: MissingCompileTimeError
initializing_formal_type_annotation_test/02: MissingCompileTimeError
-instance_call_wrong_argument_count_negative_test: Fail
instantiate_tearoff_of_call_test: CompileTimeError
invocation_mirror_test: CompileTimeError # Issue 31402 Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::Invocation'.
issue18628_2_test/01: MissingCompileTimeError
@@ -450,8 +447,6 @@
library_env_test/has_io_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
library_env_test/has_mirror_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
library_env_test/has_no_html_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
-local_function_test/01: MissingCompileTimeError
-local_function_test/02: MissingCompileTimeError
malbounded_instantiation_test/01: MissingCompileTimeError
malbounded_instantiation_test/02: MissingCompileTimeError
malbounded_instantiation_test/03: MissingCompileTimeError
@@ -566,17 +561,12 @@
multiline_newline_test/06r: MissingCompileTimeError
named_constructor_test/01: MissingCompileTimeError
named_parameters_default_eq_test/02: MissingCompileTimeError
-named_parameters_test/02: MissingCompileTimeError
-named_parameters_test/04: MissingCompileTimeError
-named_parameters_test/06: MissingCompileTimeError
-named_parameters_test/08: MissingCompileTimeError
-named_parameters_test/10: MissingCompileTimeError
nsm5_test: MissingCompileTimeError
+null2_test: RuntimeError # Issue 32194
+null_method_test: RuntimeError # Issue 32194
null_no_such_method_test: CompileTimeError # Issue 31533
-optional_named_parameters_test/02: MissingCompileTimeError
-optional_named_parameters_test/04: MissingCompileTimeError
-optional_named_parameters_test/06: MissingCompileTimeError
-optional_named_parameters_test/08: MissingCompileTimeError
+null_test/none: RuntimeError # Issue 32194
+null_to_string_test: RuntimeError # Issue 32194
override_field_method1_negative_test: Fail
override_field_method2_negative_test: Fail
override_field_method4_negative_test: Fail
@@ -616,7 +606,6 @@
override_method_with_field_test/01: MissingCompileTimeError
redirecting_factory_default_values_test/01: MissingCompileTimeError
redirecting_factory_default_values_test/02: MissingCompileTimeError
-redirecting_factory_default_values_test/03: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
redirecting_factory_malbounded_test/01: MissingCompileTimeError
redirecting_factory_reflection_test: RuntimeError # UnimplementedError: node <InvalidExpression> `invalid-expression`
@@ -637,6 +626,7 @@
setter_override_test/02: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
string_interpolate_test: CompileTimeError # Issue 31533
+string_optimizations_test: RuntimeError # Issue 32194
string_split_test: CompileTimeError # Issue 31616
string_supertype_checked_test: CompileTimeError # Issue 31616
super_bound_closure_test/none: CompileTimeError # Issue 31533
@@ -663,6 +653,7 @@
syntax_test/31: MissingCompileTimeError
syntax_test/32: MissingCompileTimeError
syntax_test/33: MissingCompileTimeError
+tearoff_dynamic_test: RuntimeError # Issue 32194
try_catch_test/01: MissingCompileTimeError
type_literal_test: RuntimeError # Expect.equals(expected: <Func>, actual: <(bool) => int>) fails.
type_promotion_functions_test/02: CompileTimeError # Issue 31537
@@ -754,7 +745,6 @@
[ $compiler == dartdevc || $compiler == dartdevk ]
abstract_override_adds_optional_args_concrete_subclass_test: MissingCompileTimeError # Issue #30568
abstract_override_adds_optional_args_concrete_test: MissingCompileTimeError # Issue #30568
-abstract_override_adds_optional_args_supercall_test: MissingCompileTimeError # Issue #30568
async_star_cancel_while_paused_test: RuntimeError # Issue 29920; Uncaught Expect.listEquals(list length, expected: <4>, actual: <3>) fails: Next element <*3>
async_star_pause_test: RuntimeError # Uncaught Expect.listEquals(at index 2, expected: <0+>, actual: <0!>) fails
async_star_test/02: RuntimeError
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index fe5e5a7..79a1f4a 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -25,11 +25,9 @@
abstract_getter_test/01: MissingCompileTimeError # Issue 32013.
abstract_override_adds_optional_args_concrete_subclass_test: MissingCompileTimeError # Issue 32013.
abstract_override_adds_optional_args_concrete_test: MissingCompileTimeError # Issue 32014.
-abstract_override_adds_optional_args_supercall_test: MissingCompileTimeError # Issue 32014.
abstract_syntax_test/00: MissingCompileTimeError # Issue 32013.
additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTimeError # Issue 32014.
additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError # Issue 32014.
-additional_interface_adds_optional_args_supercall_test: MissingCompileTimeError # Issue 32014.
async_await_syntax_test/c10a: MissingCompileTimeError
async_await_syntax_test/d08b: MissingCompileTimeError
async_await_syntax_test/d10a: MissingCompileTimeError
@@ -39,12 +37,6 @@
async_return_types_test/nestedFuture: MissingCompileTimeError
async_return_types_test/tooManyTypeParameters: MissingCompileTimeError
async_return_types_test/wrongReturnType: MissingCompileTimeError
-bad_named_parameters2_test/01: MissingCompileTimeError
-bad_named_parameters_test/01: MissingCompileTimeError
-bad_named_parameters_test/02: MissingCompileTimeError
-bad_named_parameters_test/03: MissingCompileTimeError
-bad_named_parameters_test/04: MissingCompileTimeError
-bad_named_parameters_test/05: MissingCompileTimeError
bad_override_test/01: MissingCompileTimeError
bad_override_test/02: MissingCompileTimeError
built_in_identifier_type_annotation_test/52: MissingCompileTimeError # Issue 28814
@@ -99,7 +91,6 @@
factory2_test/03: MissingCompileTimeError
factory4_test/00: MissingCompileTimeError
field3_test/01: MissingCompileTimeError
-field_method4_test: MissingCompileTimeError
field_override2_test: MissingCompileTimeError
field_override_test/00: MissingCompileTimeError
field_override_test/01: MissingCompileTimeError
@@ -130,8 +121,6 @@
issue31596_override_test/08: MissingCompileTimeError
issue31596_super_test/02: MissingCompileTimeError
issue31596_super_test/04: MissingCompileTimeError
-local_function_test/01: MissingCompileTimeError
-local_function_test/02: MissingCompileTimeError
malbounded_instantiation_test/01: MissingCompileTimeError
malbounded_instantiation_test/02: MissingCompileTimeError
malbounded_instantiation_test/03: MissingCompileTimeError
@@ -187,16 +176,7 @@
mixin_type_parameters_errors_test/05: MissingCompileTimeError
named_constructor_test/01: MissingCompileTimeError
named_parameters_default_eq_test/02: MissingCompileTimeError # Fasta bug: Default values are not allowed on redirecting factory constructors.
-named_parameters_test/02: MissingCompileTimeError
-named_parameters_test/04: MissingCompileTimeError
-named_parameters_test/06: MissingCompileTimeError
-named_parameters_test/08: MissingCompileTimeError
-named_parameters_test/10: MissingCompileTimeError
nsm5_test: MissingCompileTimeError
-optional_named_parameters_test/02: MissingCompileTimeError
-optional_named_parameters_test/04: MissingCompileTimeError
-optional_named_parameters_test/06: MissingCompileTimeError
-optional_named_parameters_test/08: MissingCompileTimeError
override_field_test/02: MissingCompileTimeError
override_field_test/03: MissingCompileTimeError
override_inheritance_abstract_test/02: MissingCompileTimeError
@@ -524,9 +504,6 @@
mixin_supertype_subclass_test/05: MissingCompileTimeError
[ $compiler == dartk && $mode == debug && $runtime == vm && $strong ]
-bad_named_parameters_test/01: Crash # Issue(http://dartbug.com/31630)
-bad_named_parameters_test/02: Crash # Issue(http://dartbug.com/31630)
-bad_named_parameters_test/04: Crash # Issue(http://dartbug.com/31630)
const_instance_field_test/01: Crash
cyclic_type_variable_test/01: Crash
cyclic_type_variable_test/02: Crash
@@ -534,10 +511,6 @@
cyclic_type_variable_test/04: Crash
cyclic_type_variable_test/none: Crash
deopt_inlined_function_lazy_test: Skip
-optional_named_parameters_test/02: Crash # Issue(http://dartbug.com/31630)
-optional_named_parameters_test/04: Crash # Issue(http://dartbug.com/31630)
-optional_named_parameters_test/06: Crash # Issue(http://dartbug.com/31630)
-optional_named_parameters_test/08: Crash # Issue(http://dartbug.com/31630)
tearoff_dynamic_test: Crash
[ $compiler == dartk && $mode == product && $runtime == vm ]
@@ -621,6 +594,8 @@
async_star_test/02: RuntimeError # Issue 31402 (Invocation arguments)
built_in_identifier_prefix_test: CompileTimeError
built_in_identifier_type_annotation_test/22: DartkCrash # Issue 28814
+call_method_must_not_be_field_test/03: RuntimeError # Issue 32265
+call_method_must_not_be_getter_test/03: RuntimeError # Issue 32265
call_operator_test: RuntimeError, OK
call_with_no_such_method_test: RuntimeError
cha_deopt1_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
@@ -706,12 +681,7 @@
function_subtype_call1_test: RuntimeError
function_subtype_call2_test: RuntimeError
function_subtype_inline2_test: RuntimeError
-function_type2_test: RuntimeError
function_type_alias6_test/none: RuntimeError
-function_type_call_getter2_test/00: MissingCompileTimeError
-function_type_call_getter2_test/01: MissingCompileTimeError
-function_type_call_getter2_test/02: MissingCompileTimeError
-function_type_call_getter2_test/03: MissingCompileTimeError
generic_function_dcall_test: RuntimeError
generic_instanceof2_test: RuntimeError
generic_is_check_test: RuntimeError
@@ -724,7 +694,6 @@
initializing_formal_type_annotation_test/01: MissingCompileTimeError
initializing_formal_type_annotation_test/02: MissingCompileTimeError
instantiate_tearoff_of_call_test: CompileTimeError
-invocation_mirror_test: CompileTimeError # Issue 31402 (Invocation arguments)
issue18628_2_test/01: MissingCompileTimeError
issue31596_super_test/01: CompileTimeError
issue31596_super_test/03: CompileTimeError
@@ -776,7 +745,6 @@
override_inheritance_method_test/28: CompileTimeError
override_inheritance_method_test/29: CompileTimeError
parser_quirks_test: CompileTimeError # Issue 31533
-redirecting_factory_default_values_test/03: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
redirecting_factory_malbounded_test/01: MissingCompileTimeError
regress_22443_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
@@ -855,9 +823,6 @@
least_upper_bound_expansive_test/none: RuntimeError # Please triage.
[ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled && $strong ]
-bad_named_parameters_test/01: Crash
-bad_named_parameters_test/02: Crash
-bad_named_parameters_test/05: Crash
const_instance_field_test/01: Crash
cyclic_type_variable_test/01: Crash
cyclic_type_variable_test/02: Crash
@@ -865,10 +830,6 @@
cyclic_type_variable_test/04: Crash
cyclic_type_variable_test/none: Crash
external_test/13: Crash
-optional_named_parameters_test/02: Crash # Issue 31795
-optional_named_parameters_test/04: Crash # Issue 31795
-optional_named_parameters_test/06: Crash # Issue 31795
-optional_named_parameters_test/08: Crash # Issue 31795
regress_29025_test: Crash
tearoff_dynamic_test: Crash
type_promotion_functions_test/05: Pass
@@ -931,7 +892,6 @@
function_subtype_factory1_test: Pass
function_subtype_inline1_test: Pass
function_subtype_inline2_test: Pass
-function_type2_test: RuntimeError
generic_functions_test: Pass # Issue 25869
generic_local_functions_test: Pass # Issue 25869
generic_methods_function_type_test: Pass # Issue 25869
@@ -996,9 +956,10 @@
async_star_cancel_while_paused_test: RuntimeError
async_star_pause_test: Fail, OK
async_star_test/02: RuntimeError, CompileTimeError # Issue 31402 (Invocation arguments)
-bad_named_parameters_test/04: Crash
built_in_identifier_prefix_test: CompileTimeError
built_in_identifier_type_annotation_test/22: DartkCrash # Issue 28814
+call_method_must_not_be_field_test/03: RuntimeError # Issue 32265
+call_method_must_not_be_getter_test/03: RuntimeError # Issue 32265
call_operator_test: RuntimeError, OK
call_with_no_such_method_test: RuntimeError
cha_deopt1_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
@@ -1085,7 +1046,6 @@
factory3_test/01: Pass
field_increment_bailout_test: SkipByDesign
field_initialization_order_test: Fail, OK
-field_method4_test: Crash
flatten_test/05: MissingRuntimeError
flatten_test/08: MissingRuntimeError
flatten_test/09: MissingRuntimeError
@@ -1097,12 +1057,7 @@
function_subtype_call1_test: RuntimeError
function_subtype_call2_test: RuntimeError
function_subtype_inline2_test: RuntimeError
-function_type2_test: RuntimeError
function_type_alias6_test/none: RuntimeError
-function_type_call_getter2_test/00: MissingCompileTimeError
-function_type_call_getter2_test/01: MissingCompileTimeError
-function_type_call_getter2_test/02: MissingCompileTimeError
-function_type_call_getter2_test/03: MissingCompileTimeError
generic_function_dcall_test: RuntimeError
generic_instanceof2_test: RuntimeError
generic_is_check_test: RuntimeError
@@ -1145,7 +1100,6 @@
invocation_mirror2_test: SkipByDesign
invocation_mirror_invoke_on2_test: SkipByDesign
invocation_mirror_invoke_on_test: SkipByDesign
-invocation_mirror_test: CompileTimeError # Issue 31402 (Invocation arguments)
issue18628_2_test/01: MissingCompileTimeError
issue21079_test: SkipByDesign
issue31596_super_test/01: CompileTimeError
@@ -1204,7 +1158,6 @@
override_inheritance_mixed_test/08: Pass # Correctly passes.
parser_quirks_test: CompileTimeError # Issue 31533
recursive_mixin_test: Crash
-redirecting_factory_default_values_test/03: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
redirecting_factory_malbounded_test/01: MissingCompileTimeError
redirecting_factory_reflection_test: SkipByDesign
@@ -1312,7 +1265,6 @@
map_literal3_test/01: MissingCompileTimeError
map_literal3_test/02: MissingCompileTimeError
map_literal3_test/03: MissingCompileTimeError
-redirecting_factory_default_values_test/03: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
redirecting_factory_malbounded_test/01: MissingCompileTimeError
type_promotion_logical_and_test/01: MissingCompileTimeError
diff --git a/tests/language_2/language_2_precompiled.status b/tests/language_2/language_2_precompiled.status
index 55727a6..b9ea3dc 100644
--- a/tests/language_2/language_2_precompiled.status
+++ b/tests/language_2/language_2_precompiled.status
@@ -111,6 +111,12 @@
call_method_is_check_test/03: RuntimeError
call_method_is_check_test/04: RuntimeError
call_method_is_check_test/05: RuntimeError
+call_method_must_not_be_field_test/01: MissingCompileTimeError
+call_method_must_not_be_field_test/02: MissingCompileTimeError
+call_method_must_not_be_field_test/03: RuntimeError
+call_method_must_not_be_getter_test/01: MissingCompileTimeError
+call_method_must_not_be_getter_test/02: MissingCompileTimeError
+call_method_must_not_be_getter_test/03: RuntimeError
call_method_override_test/01: MissingCompileTimeError
call_method_override_test/02: MissingCompileTimeError
call_non_method_field_test/01: MissingCompileTimeError
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index cac738d..65f1f55 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -201,6 +201,12 @@
call_method_is_check_test/03: RuntimeError
call_method_is_check_test/04: RuntimeError
call_method_is_check_test/05: RuntimeError
+call_method_must_not_be_field_test/01: MissingCompileTimeError
+call_method_must_not_be_field_test/02: MissingCompileTimeError
+call_method_must_not_be_field_test/03: RuntimeError
+call_method_must_not_be_getter_test/01: MissingCompileTimeError
+call_method_must_not_be_getter_test/02: MissingCompileTimeError
+call_method_must_not_be_getter_test/03: RuntimeError
call_method_override_test/01: MissingCompileTimeError
call_method_override_test/02: MissingCompileTimeError
call_non_method_field_test/01: MissingCompileTimeError
diff --git a/tests/language_2/mint_identical_test.dart b/tests/language_2/mint_identical_test.dart
new file mode 100644
index 0000000..a499a9e
--- /dev/null
+++ b/tests/language_2/mint_identical_test.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";
+
+main() {
+ // Smis on 64-bit.
+ Expect.isTrue(identical(2305843009213693952, 2305843009213693952));
+ Expect.isTrue(identical(2305843009213693953, 2305843009213693953));
+ Expect.isTrue(identical(2305843009213693954, 2305843009213693954));
+ Expect.isTrue(identical(4611686018427387903, 4611686018427387903));
+
+ // Mints on 64-bit.
+ Expect.isTrue(identical(4611686018427387904, 4611686018427387904));
+ Expect.isTrue(identical(4611686018427387905, 4611686018427387905));
+}
diff --git a/tests/language_2/vm/regress_32204_test.dart b/tests/language_2/vm/regress_32204_test.dart
new file mode 100644
index 0000000..abfa050
--- /dev/null
+++ b/tests/language_2/vm/regress_32204_test.dart
@@ -0,0 +1,41 @@
+// 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.
+
+// Verify that local functions capture `this` if their arguments refer to
+// type parameters from the enclosing class.
+
+import "package:expect/expect.dart";
+
+typedef void B<T>(T v);
+
+class MyFisk {}
+
+class MyHest {}
+
+class A<T> {
+ var value;
+
+ A(B<T> x) {
+ // This function does not capture `this` explicitly, however it needs
+ // to capture it in order to access T. Verify that we do it correctly.
+ // If `this` is not captured then foo turns into (B<dynamic>) -> Null
+ // which means that foo(x) would throw if T != dynamic.
+ f(B<T> v) {}
+
+ f(x);
+ }
+
+ foo<U>(B<T> x, B<U> y) {
+ // This function does not capture `this` explicitly, verify that it still
+ // can access `T`.
+ f(B<T> v, B<U> y) {}
+
+ f(x, y);
+ }
+}
+
+void main() {
+ new A<MyFisk>((MyFisk v) {});
+ new A<MyFisk>((MyFisk v) {}).foo<MyHest>((MyFisk v) {}, (MyHest v) {});
+}
diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status
index 84514c6..8e0728a 100644
--- a/tests/lib_2/lib_2_dart2js.status
+++ b/tests/lib_2/lib_2_dart2js.status
@@ -103,6 +103,8 @@
html/js_transferrables_test: RuntimeError
html/js_typed_interop_lazy_test/none: RuntimeError
html/js_typed_interop_rename_static_test: RuntimeError
+html/no_linked_scripts_htmltest: Timeout, Pass # Issue 32262
+html/worker_test/functional/functional: RuntimeError # Issue 32261
[ $compiler == dart2js && $runtime == chromeOnAndroid ]
html/audiobuffersourcenode_test/supported: Fail # TODO(dart2js-team): Please triage this failure.
diff --git a/tools/VERSION b/tools/VERSION
index 71e6bbd..91379c8 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 28
+PRERELEASE 29
PRERELEASE_PATCH 0
diff --git a/tools/make_version.py b/tools/make_version.py
index 94d8b34..f1a15e0 100755
--- a/tools/make_version.py
+++ b/tools/make_version.py
@@ -42,11 +42,15 @@
def MakeVersionString(quiet, no_git_hash, custom_for_pub=None):
if custom_for_pub:
+ latest = utils.GetLatestDevTag()
+ if not latest:
+ # If grabbing the dev tag fails, then fall back on the VERSION file.
+ latest = utils.GetSemanticSDKVersion(no_git_hash=True)
if no_git_hash:
- version_string = ("%s-%s" % (utils.GetLatestDevTag(), custom_for_pub))
+ version_string = ("%s.%s" % (latest, custom_for_pub))
else:
- version_string = ("%s-%s-%s" %
- (utils.GetLatestDevTag(), custom_for_pub, utils.GetShortGitHash()))
+ git_hash = utils.GetShortGitHash()
+ version_string = ("%s.%s-%s" % (latest, custom_for_pub, git_hash))
else:
version_string = utils.GetSemanticSDKVersion(no_git_hash=no_git_hash)
if not quiet:
diff --git a/tools/sdks/linux/dart-sdk.tar.gz.sha1 b/tools/sdks/linux/dart-sdk.tar.gz.sha1
index 249421a..f443005 100644
--- a/tools/sdks/linux/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/linux/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-3fde07bb67a56026714d80a368ef103dab2178c7
\ No newline at end of file
+d324de88855f3b114d49b7e6d8062f7b09086def
\ No newline at end of file
diff --git a/tools/sdks/mac/dart-sdk.tar.gz.sha1 b/tools/sdks/mac/dart-sdk.tar.gz.sha1
index 5f44438..ddd536d 100644
--- a/tools/sdks/mac/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/mac/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-5aca8af43c877177661c6474900ab03a076d03a3
\ No newline at end of file
+f660c896556152fdc6870af8a1b5dc9441e2d922
\ No newline at end of file
diff --git a/tools/sdks/win/dart-sdk.tar.gz.sha1 b/tools/sdks/win/dart-sdk.tar.gz.sha1
index a9bcb34..687ceaa 100644
--- a/tools/sdks/win/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/win/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-d205e12e82d9605639bb2f36deb7287ca84bc18e
\ No newline at end of file
+80630eb22ebe2e6c7fcf0dcc464fba9bdc6b94ff
\ No newline at end of file
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index e82a650..8d9b5df 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -494,6 +494,10 @@
args.insert(0, '--dfe=$buildDir/gen/kernel-service.dart.snapshot');
}
+ if (configuration.isStrong) {
+ args.add('--strong');
+ }
+
args.add(testName);
var command = Command.process(
diff --git a/tools/utils.py b/tools/utils.py
index 8d665bb..64f2b6c 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -474,6 +474,7 @@
cwd = DART_DIR)
output, _ = p.communicate()
if p.wait() != 0:
+ print "Warning: Could not get the most recent dev branch tag %s" % output
return None
return output.strip()