Revert "Avoid the deprecated input error in source_loader"
Reverted because of failures on the VM reload tests.
Change-Id: I880523a5f3e14cc6d318d4493f037b79515b1dce
Reviewed-on: https://dart-review.googlesource.com/71401
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
diff --git a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
index dd1b41e..4e30ddc 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
@@ -252,20 +252,9 @@
@override
@failingTest
- test_export_configurations_useDefault() async {
- await super.test_import_configurations_useDefault();
- }
-
- @override
- @failingTest
- test_exportImport_configurations_useDefault() async {
- await super.test_import_configurations_useDefault();
- }
-
- @override
- @failingTest
- test_import_configurations_useDefault() async {
- await super.test_import_configurations_useDefault();
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/33719')
+ test_unresolved_part() async {
+ await super.test_unresolved_part();
}
Future<KernelResynthesizer> _createResynthesizer(Uri testUri) async {
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 4106e03..0b25e2f 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -50,9 +50,11 @@
templateInternalProblemUnsupported,
templateSdkRootNotFound,
templateSdkSpecificationNotFound,
- templateCantReadFile,
templateSdkSummaryNotFound;
+// TODO(ahe): Remove this import.
+import '../fasta/fasta_codes.dart' show templateUnspecified;
+
import '../fasta/messages.dart' show getLocation;
import '../fasta/problems.dart' show DebugAbort, unimplemented;
@@ -636,8 +638,11 @@
return await file.readAsBytes();
} on FileSystemException catch (error) {
report(
- templateCantReadFile
- .withArguments(error.uri, error.message)
+ // TODO(ahe): Change to templateCantReadFile.withArguments(error.uri,
+ // error.message) when CL 63144 has landed.
+ templateUnspecified
+ .withArguments(
+ "Error when reading '${error.uri}': ${error.message}")
.withoutLocation(),
Severity.error);
return new Uint8List(0);
diff --git a/pkg/front_end/lib/src/fasta/builder/library_builder.dart b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
index 5c4b078..5b43657 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -51,8 +51,6 @@
exportScopeBuilder = new ScopeBuilder(exportScope),
super(null, -1, fileUri);
- bool get isSynthetic => false;
-
@override
Declaration get parent => null;
@@ -191,13 +189,7 @@
return 0;
}
- void becomeCoreLibrary() {
- if (scope.local["dynamic"] == null) {
- addSyntheticDeclarationOfDynamic();
- }
- }
-
- void addSyntheticDeclarationOfDynamic();
+ void becomeCoreLibrary(dynamicType);
void forEach(void f(String name, Declaration declaration)) {
scope.forEach((String name, Declaration declaration) {
@@ -226,6 +218,4 @@
if (!isPatch) return;
unsupported("${runtimeType}.applyPatches", -1, fileUri);
}
-
- void recordAccess(int charOffset, int length, Uri fileUri) {}
}
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart b/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart
index d4f7386..c440b0b 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_library_builder.dart
@@ -10,7 +10,6 @@
show
Class,
DartType,
- DynamicType,
Field,
Library,
ListLiteral,
@@ -71,12 +70,14 @@
@override
Library get target => library;
- void addSyntheticDeclarationOfDynamic() {
- addBuilder(
- "dynamic",
- new DynamicTypeBuilder<KernelTypeBuilder, DartType>(
- const DynamicType(), this, -1),
- -1);
+ void becomeCoreLibrary(dynamicType) {
+ if (scope.local["dynamic"] == null) {
+ addBuilder(
+ "dynamic",
+ new DynamicTypeBuilder<KernelTypeBuilder, DartType>(
+ dynamicType, this, -1),
+ -1);
+ }
}
void addClass(Class cls) {
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 7c4430e..d46ccad 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -604,28 +604,6 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<Message Function(Uri uri_, String string)> templateCantReadFile =
- const Template<Message Function(Uri uri_, String string)>(
- messageTemplate: r"""Error when reading '#uri': #string""",
- withArguments: _withArgumentsCantReadFile);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(Uri uri_, String string)> codeCantReadFile =
- const Code<Message Function(Uri uri_, String string)>(
- "CantReadFile", templateCantReadFile,
- analyzerCode: "URI_DOES_NOT_EXIST",
- dart2jsCode: "*fatal*",
- severity: Severity.error);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsCantReadFile(Uri uri_, String string) {
- String uri = relativizeUri(uri_);
- return new Message(codeCantReadFile,
- message: """Error when reading '${uri}': ${string}""",
- arguments: {'uri': uri_, 'string': string});
-}
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
Token
@@ -7518,27 +7496,6 @@
message: r"""Incomplete token.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<Message Function(Uri uri_)> templateUntranslatableUri =
- const Template<Message Function(Uri uri_)>(
- messageTemplate: r"""Not found: '#uri'""",
- withArguments: _withArgumentsUntranslatableUri);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(Uri uri_)> codeUntranslatableUri =
- const Code<Message Function(Uri uri_)>(
- "UntranslatableUri", templateUntranslatableUri,
- analyzerCode: "URI_DOES_NOT_EXIST",
- dart2jsCode: "*fatal*",
- severity: Severity.error);
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsUntranslatableUri(Uri uri_) {
- String uri = relativizeUri(uri_);
- return new Message(codeUntranslatableUri,
- message: """Not found: '${uri}'""", arguments: {'uri': uri_});
-}
-
-// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)>
templateUseOfDeprecatedIdentifier =
const Template<Message Function(String name)>(
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index d16c7c2..399112b 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -431,8 +431,7 @@
assert(dillLoadedData != null && userCode != null);
return await context.runInContext((_) async {
- LibraryBuilder library =
- userCode.loader.read(libraryUri, -1, accessor: userCode.loader.first);
+ LibraryBuilder library = userCode.loader.read(libraryUri, -1);
Class kernelClass;
if (className != null) {
@@ -542,8 +541,8 @@
List<Uri> invalidatedImportUris = <Uri>[];
bool isInvalidated(Uri importUri, Uri fileUri) {
- if (invalidatedUris.contains(importUri)) return true;
- if (importUri != fileUri && invalidatedUris.contains(fileUri)) {
+ if (invalidatedUris.contains(importUri) ||
+ (importUri != fileUri && invalidatedUris.contains(fileUri))) {
return true;
}
if (hasToCheckPackageUris &&
@@ -551,7 +550,6 @@
uriTranslator.translate(importUri, false) != fileUri) {
return true;
}
- if (builders[importUri]?.isSynthetic == true) return true;
return false;
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 323e747..5d79c08 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -12,7 +12,6 @@
Class,
ConstructorInvocation,
DartType,
- DynamicType,
Expression,
Field,
Library,
@@ -166,12 +165,14 @@
Uri get uri => library.importUri;
- Declaration addSyntheticDeclarationOfDynamic() {
- addBuilder(
- "dynamic",
- new DynamicTypeBuilder<KernelTypeBuilder, DartType>(
- const DynamicType(), this, -1),
- -1);
+ void becomeCoreLibrary(dynamicType) {
+ if (scope.local["dynamic"] == null) {
+ addBuilder(
+ "dynamic",
+ new DynamicTypeBuilder<KernelTypeBuilder, DartType>(
+ dynamicType, this, -1),
+ -1);
+ }
}
KernelTypeBuilder addNamedType(
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 650aa12..0715e41 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -15,6 +15,7 @@
Component,
Constructor,
DartType,
+ DynamicType,
EmptyStatement,
Expression,
ExpressionStatement,
@@ -152,7 +153,7 @@
}
void read(Uri uri) {
- loader.read(uri, -1, accessor: loader.first);
+ loader.read(uri, -1);
}
@override
@@ -239,7 +240,7 @@
() async {
loader.createTypeInferenceEngine();
await loader.buildOutlines();
- loader.coreLibrary.becomeCoreLibrary();
+ loader.coreLibrary.becomeCoreLibrary(const DynamicType());
dynamicType.bind(loader.coreLibrary["dynamic"]);
loader.resolveParts();
loader.computeLibraryScopes();
@@ -813,13 +814,13 @@
KernelLibraryBuilder first;
for (Uri patch in patches) {
if (first == null) {
- first = library.loader.read(patch, -1,
- fileUri: patch, origin: library, accessor: library);
+ first =
+ library.loader.read(patch, -1, fileUri: patch, origin: library);
} else {
// If there's more than one patch file, it's interpreted as a part of
// the patch library.
KernelLibraryBuilder part =
- library.loader.read(patch, -1, fileUri: patch, accessor: first);
+ library.loader.read(patch, -1, fileUri: patch);
first.parts.add(part);
part.addPartOf(null, null, "${first.uri}", -1);
}
diff --git a/pkg/front_end/lib/src/fasta/loader.dart b/pkg/front_end/lib/src/fasta/loader.dart
index ae02c44..e37afdc 100644
--- a/pkg/front_end/lib/src/fasta/loader.dart
+++ b/pkg/front_end/lib/src/fasta/loader.dart
@@ -24,7 +24,7 @@
templateInternalProblemMissingSeverity,
templateSourceBodySummary;
-import 'problems.dart' show internalProblem, unhandled;
+import 'problems.dart' show internalProblem;
import 'rewrite_severity.dart' as rewrite_severity;
@@ -38,8 +38,6 @@
import 'type_inference/type_inference_engine.dart' show TypeInferenceEngine;
-const String untranslatableUriScheme = "org-dartlang-untranslatable-uri";
-
abstract class Loader<L> {
final Map<Uri, LibraryBuilder> builders = <Uri, LibraryBuilder>{};
@@ -83,8 +81,6 @@
TypeInferenceEngine get typeInferenceEngine => null;
- bool get isSourceLoader => false;
-
/// Look up a library builder by the name [uri], or if such doesn't
/// exist, create one. The canonical URI of the library is [uri], and its
/// actual location is [fileUri].
@@ -109,10 +105,7 @@
switch (uri.scheme) {
case "package":
case "dart":
- fileUri = target.translateUri(uri) ??
- new Uri(
- scheme: untranslatableUriScheme,
- path: Uri.encodeComponent("$uri"));
+ fileUri = target.translateUri(uri);
break;
default:
@@ -124,11 +117,9 @@
target.createLibraryBuilder(uri, fileUri, origin);
if (uri.scheme == "dart" && uri.path == "core") {
coreLibrary = library;
+ target.loadExtraRequiredLibraries(this);
}
if (library.loader != this) {
- if (coreLibrary == library) {
- target.loadExtraRequiredLibraries(this);
- }
// This library isn't owned by this loader, so not further processing
// should be attempted.
return library;
@@ -141,9 +132,6 @@
firstSourceUri ??= uri;
first ??= library;
}
- if (coreLibrary == library) {
- target.loadExtraRequiredLibraries(this);
- }
if (target.backendTarget.mayDefineRestrictedType(origin?.uri ?? uri)) {
library.mayImplementRestrictedTypes = true;
}
@@ -153,25 +141,19 @@
unparsedLibraries.addLast(library);
return library;
});
- if (accessor == null) {
- if (builder.loader == this && first != builder && isSourceLoader) {
- unhandled("null", "accessor", charOffset, uri);
- }
- } else {
- builder.recordAccess(charOffset, noLength, accessor.fileUri);
- if (!accessor.isPatch &&
- !target.backendTarget
- .allowPlatformPrivateLibraryAccess(accessor.uri, uri)) {
- accessor.addCompileTimeError(messagePlatformPrivateLibraryAccess,
- charOffset, noLength, accessor.fileUri);
- }
+ if (accessor != null &&
+ !accessor.isPatch &&
+ !target.backendTarget
+ .allowPlatformPrivateLibraryAccess(accessor.uri, uri)) {
+ accessor.addCompileTimeError(messagePlatformPrivateLibraryAccess,
+ charOffset, noLength, accessor.fileUri);
}
return builder;
}
void ensureCoreLibrary() {
if (coreLibrary == null) {
- read(Uri.parse("dart:core"), 0, accessor: first);
+ read(Uri.parse("dart:core"), -1);
assert(coreLibrary != null);
}
}
diff --git a/pkg/front_end/lib/src/fasta/rewrite_severity.dart b/pkg/front_end/lib/src/fasta/rewrite_severity.dart
index 60c18a9..6fc8581 100644
--- a/pkg/front_end/lib/src/fasta/rewrite_severity.dart
+++ b/pkg/front_end/lib/src/fasta/rewrite_severity.dart
@@ -53,6 +53,7 @@
case "kernel/kernel_type_variable_builder.dart":
case "source/diet_listener.dart":
case "source/source_library_builder.dart":
+ case "source/source_loader.dart":
case "source/stack_listener.dart":
return severity;
}
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 7c1d989..75ee308 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -39,7 +39,6 @@
import '../fasta_codes.dart'
show
- Message,
messageConstructorWithWrongName,
messageExpectedUri,
messageMemberWithSameNameAsClass,
@@ -49,11 +48,11 @@
noLength,
templateConflictsWithMember,
templateConflictsWithSetter,
- templateConstructorWithWrongNameContext,
templateCouldNotParseUri,
templateDeferredPrefixDuplicated,
templateDeferredPrefixDuplicatedCause,
templateDuplicatedDefinition,
+ templateConstructorWithWrongNameContext,
templateMissingPartOf,
templatePartOfLibraryNameMismatch,
templatePartOfUriMismatch,
@@ -98,8 +97,6 @@
@override
final bool disableTypeInference;
- final List<Object> accessors = <Object>[];
-
String documentationComment;
String name;
@@ -118,10 +115,6 @@
bool canAddImplementationBuilders = false;
- /// Non-null if this library causes an error upon access, that is, there was
- /// an error reading its source.
- Message accessProblem;
-
final OutlineListener outlineListener;
SourceLibraryBuilder(SourceLoader loader, Uri fileUri, Scope scope)
@@ -143,9 +136,6 @@
List<UnresolvedType<T>> get types => libraryDeclaration.types;
- @override
- bool get isSynthetic => accessProblem != null;
-
T addNamedType(Object name, List<T> arguments, int charOffset);
T addMixinApplication(T supertype, List<T> mixins, int charOffset);
@@ -813,28 +803,6 @@
member.instrumentTopLevelInference(instrumentation);
});
}
-
- @override
- void recordAccess(int charOffset, int length, Uri fileUri) {
- accessors.add(fileUri);
- accessors.add(charOffset);
- accessors.add(length);
- if (accessProblem != null) {
- addProblem(accessProblem, charOffset, length, fileUri);
- }
- }
-
- void addProblemAtAccessors(Message message) {
- if (accessProblem == null) {
- for (int i = 0; i < accessors.length; i += 3) {
- Uri accessor = accessors[i];
- int charOffset = accessors[i + 1];
- int length = accessors[i + 2];
- addProblem(message, charOffset, length, accessor);
- }
- accessProblem = message;
- }
- }
}
/// Unlike [Scope], this scope is used during construction of builders to
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index 918fe74..9c65335 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -6,8 +6,6 @@
import 'dart:async' show Future;
-import 'dart:convert' show utf8;
-
import 'dart:typed_data' show Uint8List;
import 'package:kernel/ast.dart'
@@ -49,17 +47,18 @@
import '../combinator.dart';
+import '../deprecated_problems.dart' show deprecated_inputError;
+
import '../export.dart' show Export;
import '../fasta_codes.dart'
show
LocatedMessage,
Message,
+ noLength,
SummaryTemplate,
Template,
- noLength,
templateAmbiguousSupertypes,
- templateCantReadFile,
templateCyclicClassHierarchy,
templateExtendingEnum,
templateExtendingRestricted,
@@ -67,8 +66,7 @@
templateIllegalMixinDueToConstructors,
templateIllegalMixinDueToConstructorsCause,
templateInternalProblemUriMissingScheme,
- templateSourceOutlineSummary,
- templateUntranslatableUri;
+ templateSourceOutlineSummary;
import '../fasta_codes.dart' as fasta_codes;
@@ -81,7 +79,7 @@
import '../kernel/body_builder.dart' show BodyBuilder;
-import '../loader.dart' show Loader, untranslatableUriScheme;
+import '../loader.dart' show Loader;
import '../parser/class_member_parser.dart' show ClassMemberParser;
@@ -144,53 +142,35 @@
Template<SummaryTemplate> get outlineSummaryTemplate =>
templateSourceOutlineSummary;
- bool get isSourceLoader => true;
-
Future<Token> tokenize(SourceLibraryBuilder library,
{bool suppressLexicalErrors: false}) async {
Uri uri = library.fileUri;
-
- // Lookup the file URI in the cache.
- List<int> bytes = sourceBytes[uri];
-
- if (bytes == null) {
- // Error recovery.
- if (uri.scheme == untranslatableUriScheme) {
- Message message = templateUntranslatableUri.withArguments(library.uri);
- library.addProblemAtAccessors(message);
- bytes = synthesizeSourceForMissingFile(library.uri, null);
- } else if (!uri.hasScheme) {
- return internalProblem(
- templateInternalProblemUriMissingScheme.withArguments(uri),
- -1,
- library.uri);
- } else if (uri.scheme == SourceLibraryBuilder.MALFORMED_URI_SCHEME) {
- bytes = synthesizeSourceForMissingFile(library.uri, null);
- }
- if (bytes != null) {
- Uint8List zeroTerminatedBytes = new Uint8List(bytes.length + 1);
- zeroTerminatedBytes.setRange(0, bytes.length, bytes);
- bytes = zeroTerminatedBytes;
- sourceBytes[uri] = bytes;
- }
+ if (uri == null) {
+ return deprecated_inputError(
+ library.uri, -1, "Not found: ${library.uri}.");
+ } else if (!uri.hasScheme) {
+ return internalProblem(
+ templateInternalProblemUriMissingScheme.withArguments(uri),
+ -1,
+ library.uri);
+ } else if (uri.scheme == SourceLibraryBuilder.MALFORMED_URI_SCHEME) {
+ // Simulate empty file
+ return null;
}
+ // Get the library text from the cache, or read from the file system.
+ List<int> bytes = sourceBytes[uri];
if (bytes == null) {
- // If it isn't found in the cache, read the file read from the file
- // system.
- List<int> rawBytes;
try {
- rawBytes = await fileSystem.entityForUri(uri).readAsBytes();
+ List<int> rawBytes = await fileSystem.entityForUri(uri).readAsBytes();
+ Uint8List zeroTerminatedBytes = new Uint8List(rawBytes.length + 1);
+ zeroTerminatedBytes.setRange(0, rawBytes.length, rawBytes);
+ bytes = zeroTerminatedBytes;
+ sourceBytes[uri] = bytes;
+ byteCount += rawBytes.length;
} on FileSystemException catch (e) {
- Message message = templateCantReadFile.withArguments(uri, e.message);
- library.addProblemAtAccessors(message);
- rawBytes = synthesizeSourceForMissingFile(library.uri, message);
+ return deprecated_inputError(uri, -1, e.message);
}
- Uint8List zeroTerminatedBytes = new Uint8List(rawBytes.length + 1);
- zeroTerminatedBytes.setRange(0, rawBytes.length, rawBytes);
- bytes = zeroTerminatedBytes;
- sourceBytes[uri] = bytes;
- byteCount += rawBytes.length;
}
ScannerResult result = scan(bytes, includeComments: includeComments);
@@ -210,19 +190,6 @@
return token;
}
- List<int> synthesizeSourceForMissingFile(Uri uri, Message message) {
- switch ("$uri") {
- case "dart:core":
- return utf8.encode(defaultDartCoreSource);
-
- case "dart:async":
- return utf8.encode(defaultDartAsyncSource);
-
- default:
- return utf8.encode(message == null ? "" : "/* ${message.message} */");
- }
- }
-
List<int> getSource(List<int> bytes) {
// bytes is 0-terminated. We don't want that included.
if (bytes is Uint8List) {
@@ -671,7 +638,7 @@
if (library.loader == this) {
SourceLibraryBuilder sourceLibrary = library;
L target = sourceLibrary.build(coreLibrary);
- if (!library.isPatch && !library.isSynthetic) {
+ if (!library.isPatch) {
libraries.add(target);
}
}
@@ -685,7 +652,6 @@
builders.forEach((Uri uri, LibraryBuilder library) {
if (!library.isPart &&
!library.isPatch &&
- !library.isSynthetic &&
(library.loader == this || library.fileUri.scheme == "dart")) {
if (libraries.add(library.target)) {
workList.add(library.target);
@@ -1022,114 +988,3 @@
}
}
}
-
-const String defaultDartCoreSource = """
-print(object) {}
-
-class Iterator {}
-
-class Iterable {}
-
-class List extends Iterable {
- factory List.unmodifiable(elements) => null;
-}
-
-class Map extends Iterable {
- factory Map.unmodifiable(other) => null;
-}
-
-class NoSuchMethodError {
- NoSuchMethodError.withInvocation(receiver, invocation);
-}
-
-class Null {}
-
-class Object {
- noSuchMethod(invocation) => null;
-}
-
-class String {}
-
-class Symbol {}
-
-class Type {}
-
-class _InvocationMirror {
- _InvocationMirror._withType(_memberName, _type, _typeArguments,
- _positionalArguments, _namedArguments);
-}
-
-class bool {}
-
-class double extends num {}
-
-class int extends num {}
-
-class num {}
-
-class _SyncIterable {}
-
-class _SyncIterator {
- var _current;
- var _yieldEachIterable;
-}
-""";
-
-const String defaultDartAsyncSource = """
-_asyncErrorWrapperHelper(continuation) {}
-
-_asyncStackTraceHelper(async_op) {}
-
-_asyncThenWrapperHelper(continuation) {}
-
-_awaitHelper(object, thenCallback, errorCallback, awaiter) {}
-
-_completeOnAsyncReturn(completer, value) {}
-
-class _AsyncStarStreamController {
- add(event) {}
-
- addError(error, stackTrace) {}
-
- addStream(stream) {}
-
- close() {}
-
- get stream => null;
-}
-
-class Completer {
- factory Completer.sync() => null;
-
- get future;
-
- complete([value]);
-
- completeError(error, [stackTrace]);
-}
-
-class Future {
- factory Future.microtask(computation) => null;
-}
-
-class FutureOr {
-}
-
-class _AsyncAwaitCompleter implements Completer {
- get future => null;
-
- complete([value]) {}
-
- completeError(error, [stackTrace]) {}
-}
-
-class Stream {}
-
-class _StreamIterator {
- get current => null;
-
- moveNext() {}
-
- cancel() {}
-}
-""";
diff --git a/pkg/front_end/lib/src/fasta/target_implementation.dart b/pkg/front_end/lib/src/fasta/target_implementation.dart
index 08581aa..3361321 100644
--- a/pkg/front_end/lib/src/fasta/target_implementation.dart
+++ b/pkg/front_end/lib/src/fasta/target_implementation.dart
@@ -94,14 +94,13 @@
/// type String, which is the name of the native method.
Declaration getNativeAnnotation(Loader loader) {
if (cachedNativeAnnotation != null) return cachedNativeAnnotation;
- LibraryBuilder internal = loader.read(Uri.parse("dart:_internal"), -1,
- accessor: loader.coreLibrary);
+ LibraryBuilder internal = loader.read(Uri.parse("dart:_internal"), -1);
return cachedNativeAnnotation = internal.getConstructor("ExternalName");
}
void loadExtraRequiredLibraries(Loader loader) {
for (String uri in backendTarget.extraRequiredLibraries) {
- loader.read(Uri.parse(uri), 0, accessor: loader.coreLibrary);
+ loader.read(Uri.parse(uri), -1);
}
}
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 666d946..97c4778 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -2951,25 +2951,3 @@
template: "'rethrow' can only be used in catch clauses."
analyzerCode: RETHROW_OUTSIDE_CATCH
dart2jsCode: "*fatal*"
-
-UntranslatableUri:
- template: "Not found: '#uri'"
- dart2jsCode: "*fatal*"
- severity: ERROR
- analyzerCode: URI_DOES_NOT_EXIST
- script: |
- import "dart:non_existing_library";
-
- main() {
- }
-
-CantReadFile:
- template: "Error when reading '#uri': #string"
- analyzerCode: URI_DOES_NOT_EXIST
- dart2jsCode: "*fatal*"
- severity: ERROR
- script: |
- import "non_existing_file.dart";
-
- main() {
- }
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 68f91f0..70f828e 100644
--- a/pkg/front_end/test/incremental_load_from_dill_test.dart
+++ b/pkg/front_end/test/incremental_load_from_dill_test.dart
@@ -35,8 +35,6 @@
import 'package:kernel/target/targets.dart' show TargetFlags;
-import 'package:kernel/text/ast_to_text.dart' show componentToString;
-
import "package:testing/testing.dart"
show Chain, ChainContext, Result, Step, TestDescription, runMe;
@@ -279,7 +277,6 @@
util.throwOnEmptyMixinBodies(component);
print("Compile took ${stopwatch.elapsedMilliseconds} ms");
newestWholeComponent = serializeComponent(component);
- print("*****\n\ncomponent:\n${componentToString(component)}\n\n\n");
if (component.libraries.length != world["expectedLibraryCount"]) {
throw "Expected ${world["expectedLibraryCount"]} libraries, "
"got ${component.libraries.length}";
@@ -320,7 +317,6 @@
performErrorAndWarningCheck(
world, gotError, formattedErrors, gotWarning, formattedWarnings);
List<int> thisWholeComponent = serializeComponent(component2);
- print("*****\n\ncomponent2:\n${componentToString(component2)}\n\n\n");
checkIsEqual(newestWholeComponent, thisWholeComponent);
}
}
diff --git a/pkg/front_end/test/kernel_generator_test.dart b/pkg/front_end/test/kernel_generator_test.dart
index 123aff7..083c293 100644
--- a/pkg/front_end/test/kernel_generator_test.dart
+++ b/pkg/front_end/test/kernel_generator_test.dart
@@ -48,7 +48,7 @@
await compileScript('main() => print("hi");', options: options);
expect(component, isNull);
expect(errors, isNotEmpty);
- }, skip: true);
+ });
test('compiler fails if it cannot find sdk summary', () async {
var errors = [];
@@ -61,7 +61,7 @@
await compileScript('main() => print("hi");', options: options);
expect(component, isNull);
expect(errors, isNotEmpty);
- }, skip: true);
+ });
test('by default component is compiled using the full platform file',
() async {
diff --git a/pkg/front_end/testcases/compile.status b/pkg/front_end/testcases/compile.status
index ca404d3..cd8199e 100644
--- a/pkg/front_end/testcases/compile.status
+++ b/pkg/front_end/testcases/compile.status
@@ -6,16 +6,28 @@
# testing generating Kernel ASTs directly, that is, code in
# pkg/fasta/lib/src/kernel/.
+rasta/unsupported_platform_library: RuntimeError # OK, this must report an error at runtime.
+
DeltaBlue: Fail # Fasta and dartk disagree on static initializers
-ambiguous_exports: RuntimeError # Expected, this file exports two main methods.
bug31124: RuntimeError # Test has an intentional error
call: Fail # Test can't run.
-co19_language_metadata_syntax_t04: RuntimeError # Fasta doesn't recover well
-constructor_const_inference: RuntimeError # Test exercises strong mode semantics. See also Issue #33813.
-external_import: RuntimeError # Expected -- test uses import which doesn't exist.
fallthrough: Fail # Missing FallThroughError.
function_type_recovery: Fail
-incomplete_field_formal_parameter: Fail # Fasta doesn't recover well
+invocations: Fail
+micro: Fail # External method marked abstract.
+named_parameters: Fail # Missing types and unnecessary default values.
+optional: Fail # Unnecessary default values.
+redirecting_factory: Fail # Missing types on constructor parameters.
+redirecting_factory_chain_test: Fail # Missing support for RedirectingFactoryConstructor.
+redirecting_factory_simple_test: Fail # Missing support for RedirectingFactoryConstructor.
+redirecting_factory_typeargs_test: Fail # Missing support for RedirectingFactoryConstructor.
+redirecting_factory_typeparam_test: Fail # Missing support for RedirectingFactoryConstructor.
+redirecting_factory_typeparambounds_test: Fail # Missing support for RedirectingFactoryConstructor.
+statements: Fail # Make async tranformer optional for golden file testing.
+type_variable_as_super: Fail
+uninitialized_fields: Fail # Fasta and dartk disagree on static initializers
+void_methods: Fail # Bad return from setters.
+
inference/bug31436: RuntimeError # Test exercises Dart 2.0 semantics
inference/constructors_too_many_positional_arguments: Fail
inference/downwards_inference_annotations_locals: Fail # Issue #30031
@@ -29,13 +41,11 @@
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1: Fail
inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr1: Fail
inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2: RuntimeError
+
instantiate_to_bound/body_typedef_super_bounded_type: Fail # Issue 33444
instantiate_to_bound/non_simple_class_parametrized_typedef_cycle: RuntimeError # May be related to Issue 33479
instantiate_to_bound/typedef_super_bounded_type: Fail # Issue 33444
-invocations: Fail
-micro: Fail # External method marked abstract.
-named_parameters: Fail # Missing types and unnecessary default values.
-optional: Fail # Unnecessary default values.
+
rasta/abstract_constructor: Fail
rasta/bad_constructor_redirection: Fail
rasta/bad_continue: Fail
@@ -52,10 +62,7 @@
rasta/constant_get_and_invoke: Fail
rasta/deferred_lib: Fail
rasta/deferred_load: Fail
-rasta/duplicated_mixin: RuntimeError # Expected, this file has no main method.
-rasta/export: RuntimeError # Expected, this file has no main method.
rasta/external_factory_redirection: Fail
-rasta/foo: RuntimeError # Expected, this file has no main method.
rasta/for_loop: Fail
rasta/generic_factory: Fail
rasta/issue_000001: Fail
@@ -91,18 +98,13 @@
rasta/unresolved_constructor: Fail
rasta/unresolved_for_in: RuntimeError # Test contains a compile-time error, signaled at run time in the JIT VM
rasta/unresolved_recovery: Fail
-redirecting_factory: Fail # Missing types on constructor parameters.
-redirecting_factory_chain_test: Fail # Missing support for RedirectingFactoryConstructor.
-redirecting_factory_const_inference: RuntimeError # Test exercises strong mode semantics. See also Issue #33813.
-redirecting_factory_simple_test: Fail # Missing support for RedirectingFactoryConstructor.
-redirecting_factory_typeargs_test: Fail # Missing support for RedirectingFactoryConstructor.
-redirecting_factory_typeparam_test: Fail # Missing support for RedirectingFactoryConstructor.
-redirecting_factory_typeparambounds_test: Fail # Missing support for RedirectingFactoryConstructor.
+
regress/issue_29975: Fail # Issue 29975.
regress/issue_29976: RuntimeError # Issue 29976.
regress/issue_29982: Fail # Issue 29982.
regress/issue_30836: RuntimeError # Issue 30836.
regress/issue_33452: RuntimeError # Test has an intentional error
+
runtime_checks/implicit_downcast_constructor_initializer: RuntimeError # Test exercises strong mode semantics
runtime_checks/implicit_downcast_do: RuntimeError # Test exercises strong mode semantics
runtime_checks/implicit_downcast_for_condition: RuntimeError # Test exercises strong mode semantics
@@ -115,9 +117,15 @@
runtime_checks_new/mixin_forwarding_stub_getter: RuntimeError # Test exercises strong mode semantics
runtime_checks_new/mixin_forwarding_stub_setter: RuntimeError # Test exercises strong mode semantics
runtime_checks_new/stub_checked_via_target: RuntimeError # Test exercises strong mode semantics
-statements: Fail # Make async tranformer optional for golden file testing.
-type_variable_as_super: Fail
-uninitialized_fields: Fail # Fasta and dartk disagree on static initializers
-void_methods: Fail # Bad return from setters.
+constructor_const_inference: RuntimeError # Test exercises strong mode semantics. See also Issue #33813.
+redirecting_factory_const_inference: RuntimeError # Test exercises strong mode semantics. See also Issue #33813.
-rasta/unsupported_platform_library: Fail
+ambiguous_exports: RuntimeError # Expected, this file exports two main methods.
+rasta/duplicated_mixin: RuntimeError # Expected, this file has no main method.
+rasta/export: RuntimeError # Expected, this file has no main method.
+rasta/foo: RuntimeError # Expected, this file has no main method.
+
+incomplete_field_formal_parameter: Fail # Fasta doesn't recover well
+
+co19_language_metadata_syntax_t04: RuntimeError # Fasta doesn't recover well
+external_import: RuntimeError # Expected -- test uses import which doesn't exist.
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/deleting_file.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/deleting_file.yaml
index 2933c37..970db47 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/deleting_file.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/deleting_file.yaml
@@ -24,7 +24,7 @@
expectedLibraryCount: 2
- entry: main.dart
errors: true
- warnings: true
+ warnings: false
invalidate:
- b.dart
sources:
@@ -37,7 +37,7 @@
expectedLibraryCount: 1
- entry: main.dart
errors: true
- warnings: true
+ warnings: false
checkInvalidatedFiles: false
worldType: updated
invalidate:
@@ -52,7 +52,7 @@
expectedLibraryCount: 1
- entry: main.dart
errors: true
- warnings: true
+ warnings: false
checkInvalidatedFiles: false
worldType: updated
invalidate:
@@ -64,4 +64,4 @@
print("Hello no. 1");
b();
}
- expectedLibraryCount: 1
+ expectedLibraryCount: 1
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidation_across_compile_time_error.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/invaldation_across_compile_time_error.yaml
similarity index 96%
rename from pkg/front_end/testcases/incremental_initialize_from_dill/invalidation_across_compile_time_error.yaml
rename to pkg/front_end/testcases/incremental_initialize_from_dill/invaldation_across_compile_time_error.yaml
index c627364..f1213e3 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/invalidation_across_compile_time_error.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/invaldation_across_compile_time_error.yaml
@@ -40,7 +40,7 @@
sources:
main.dart: |
import "b.dart";
- import "nonexisting.dart";
+ import "nonexistin.dart";
main() {
print("hello");
b();
@@ -52,7 +52,7 @@
c();
}
errors: true
- expectedLibraryCount: 3
+ expectedLibraryCount: 1
- entry: main.dart
worldType: updated
expectInitializeFromDill: false
@@ -66,4 +66,4 @@
print("hello");
b();
}
- expectedLibraryCount: 3
+ expectedLibraryCount: 3
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/updated_package_4.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/updated_package_4.yaml
index b59c18e..84a4e54 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/updated_package_4.yaml
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/updated_package_4.yaml
@@ -32,5 +32,4 @@
sources:
.packages:
errors: true
- warnings: true
- expectedLibraryCount: 1
+ expectedLibraryCount: 1
\ No newline at end of file
diff --git a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart
index fa8123d..ca1de9b 100644
--- a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart
+++ b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart
@@ -4,5 +4,3 @@
import 'dart:html';
import 'dart:io';
-
-main() {}
diff --git a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.direct.expect b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.direct.expect
index 0c3e32a..7073760 100644
--- a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.direct.expect
+++ b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.direct.expect
@@ -1,10 +1,6 @@
-// Errors:
-//
-// pkg/front_end/testcases/rasta/unsupported_platform_library.dart:5:8: Error: Not found: 'dart:html'
-// import 'dart:html';
-// ^
-
library;
import self as self;
-static method main() → dynamic {}
+static method #main() → dynamic {
+ throw "dart:html:1: Error: Not found: dart:html.";
+}
diff --git a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.direct.transformed.expect b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.direct.transformed.expect
index 0c3e32a..7073760 100644
--- a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.direct.transformed.expect
@@ -1,10 +1,6 @@
-// Errors:
-//
-// pkg/front_end/testcases/rasta/unsupported_platform_library.dart:5:8: Error: Not found: 'dart:html'
-// import 'dart:html';
-// ^
-
library;
import self as self;
-static method main() → dynamic {}
+static method #main() → dynamic {
+ throw "dart:html:1: Error: Not found: dart:html.";
+}
diff --git a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.outline.expect b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.outline.expect
index 6a28c0d..cc97b3e 100644
--- a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.outline.expect
+++ b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.outline.expect
@@ -1,5 +1,2 @@
library;
import self as self;
-
-static method main() → dynamic
- ;
diff --git a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.strong.expect b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.strong.expect
deleted file mode 100644
index 0c3e32a..0000000
--- a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.strong.expect
+++ /dev/null
@@ -1,10 +0,0 @@
-// Errors:
-//
-// pkg/front_end/testcases/rasta/unsupported_platform_library.dart:5:8: Error: Not found: 'dart:html'
-// import 'dart:html';
-// ^
-
-library;
-import self as self;
-
-static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.strong.transformed.expect b/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.strong.transformed.expect
deleted file mode 100644
index 0c3e32a..0000000
--- a/pkg/front_end/testcases/rasta/unsupported_platform_library.dart.strong.transformed.expect
+++ /dev/null
@@ -1,10 +0,0 @@
-// Errors:
-//
-// pkg/front_end/testcases/rasta/unsupported_platform_library.dart:5:8: Error: Not found: 'dart:html'
-// import 'dart:html';
-// ^
-
-library;
-import self as self;
-
-static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index 5efafdf..b5d4f7b 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -191,6 +191,7 @@
rasta/unresolved_constructor: Fail
rasta/unresolved_for_in: Fail
rasta/unresolved_recovery: Fail
+rasta/unsupported_platform_library: Fail
regress/issue_29975: Fail # Issue 29975.
regress/issue_29976: TypeCheckError # Issue 29976.
@@ -219,5 +220,3 @@
co19_language_metadata_syntax_t04: RuntimeError # Fasta doesn't recover well
external_import: RuntimeError # The native extension to import doesn't exist. This is ok.
-
-rasta/unsupported_platform_library: Fail
diff --git a/pkg/front_end/tool/fasta_perf.dart b/pkg/front_end/tool/fasta_perf.dart
index 4b9fb26..ea099cd 100644
--- a/pkg/front_end/tool/fasta_perf.dart
+++ b/pkg/front_end/tool/fasta_perf.dart
@@ -243,7 +243,23 @@
options.sdkSummary = sdkRoot.resolve('outline.dill');
}
- var program = await kernelForComponent([entryUri], options);
+ var entrypoints = [
+ entryUri,
+ // These extra libraries are added to match the same set of libraries
+ // scanned by default by the VM and the other benchmarks.
+ Uri.parse('dart:async'),
+ Uri.parse('dart:collection'),
+ Uri.parse('dart:convert'),
+ Uri.parse('dart:core'),
+ Uri.parse('dart:developer'),
+ Uri.parse('dart:_internal'),
+ Uri.parse('dart:io'),
+ Uri.parse('dart:isolate'),
+ Uri.parse('dart:math'),
+ Uri.parse('dart:mirrors'),
+ Uri.parse('dart:typed_data'),
+ ];
+ var program = await kernelForComponent(entrypoints, options);
timer.stop();
var name = 'kernel_gen_e2e${compileSdk ? "" : "_sum"}';
diff --git a/pkg/vm/test/frontend_server_test.dart b/pkg/vm/test/frontend_server_test.dart
index ab3713d..75c22d1 100644
--- a/pkg/vm/test/frontend_server_test.dart
+++ b/pkg/vm/test/frontend_server_test.dart
@@ -578,7 +578,7 @@
expect(outputFilenameAndErrorCount, isNotNull);
CompilationResult result =
new CompilationResult.parse(outputFilenameAndErrorCount);
- expect(result.errorsCount, equals(0));
+ expect(result.errorsCount, greaterThan(0));
streamController.add('quit\n'.codeUnits);
}
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index b1f90ed..e90e5a5 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -121,7 +121,6 @@
# These are the non-kernel specific versions so skip tests and allow errors.
[ $compiler == dartk ]
add_breakpoint_rpc_test: SkipByDesign # non-kernel specific version of add_breakpoint_rpc_kernel_test.
-bad_reload_test: RuntimeError # Issue 34025
evaluate_activation_in_method_class_test: RuntimeError
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
diff --git a/tests/compiler/dart2js/user_crash_test.dart b/tests/compiler/dart2js/user_crash_test.dart
index 68076d5..e26e508 100644
--- a/tests/compiler/dart2js/user_crash_test.dart
+++ b/tests/compiler/dart2js/user_crash_test.dart
@@ -40,8 +40,8 @@
expectedExceptions: [EXCEPTION]);
List<String> expectedLines = [
- "Error: Input file not found: memory:main.dart.",
- "memory:main.dart:\nError: No 'main' method found.",
+ 'Error: Input file not found: memory:main.dart.',
+ 'memory:main.dart:\nError: Crash-marker',
];
test('Throw in input provider',
await run(memorySourceFiles: new CrashingMap()),
@@ -69,7 +69,7 @@
"Unexpected number of exceptions.");
for (int i = 0; i < expectedLines.length; i++) {
if (expectedLines[i] != null) {
- Expect.stringEquals(expectedLines[i], result.lines[i]);
+ Expect.equals(expectedLines[i], result.lines[i]);
}
}
}