[cfe] Change encoding of supported dart: libraries

This CL changes the way dart: libraries are considered supported when
used in conditional imports or bool.fromEnvironment constant using
the "dart.library.*" values.

Library nodes now has an isUnsupported flag which is set according to
the "supported" property in the libraries specification. Furthermore
the Target now supplies a DartLibrarySupport interface that allows
targets to override whether dart: libraries are unsupported.

This allows the JIT/AOT to use the same platform file but still
consider dart:mirrors unsupported in AOT mode, and dart2js to consider
the internal library `dart:_dart2js_runtime_metrics` supported.

Furthermore, the internal handling is changed so that condition imports
and bool.fromEnvironments constants are computed through the same logic
for "dart.library.*" values, avoiding the need for passing these values
through the environment.

TEST=pkg/front_end/testcases/general/supported_libraries/main

Closes https://github.com/dart-lang/sdk/issues/48057
Closes https://github.com/dart-lang/sdk/issues/47814
Closes https://github.com/dart-lang/sdk/issues/47243
Closes https://github.com/dart-lang/sdk/issues/32657
Closes https://github.com/dart-lang/sdk/issues/36460

Change-Id: Ie8f8dff99167de64ced51b71d89918bf0f3bbd13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227020
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This commit is contained in:
Johnni Winther
2022-01-11 14:52:38 +00:00
parent e4b19f1517
commit 8510f27d37
92 changed files with 1575 additions and 809 deletions
@@ -76,6 +76,9 @@
/// report that such library is still not supported in conditional imports
/// and const `fromEnvironment` expressions.
///
/// Internal libraries are never supported through conditional imports and
/// const `fromEnvironment` expressions.
///
///
/// Note: we currently have several different files that need to be updated
/// when changing libraries, sources, and patch files:
@@ -270,8 +273,10 @@ class LibrariesSpecification {
if (supported is! bool) {
_reportError(messageSupportedIsNotABool(supported));
}
libraries[libraryName] =
new LibraryInfo(libraryName, uri, patches, isSupported: supported);
libraries[libraryName] = new LibraryInfo(libraryName, uri, patches,
// Internal libraries are never supported through conditional
// imports and const `fromEnvironment` expressions.
isSupported: supported && !libraryName.startsWith('_'));
});
currentTargets.remove(targetName);
return targets[targetName] =
+13 -89
View File
@@ -5,10 +5,6 @@
library leg_apiimpl;
import 'dart:async';
import 'dart:convert' show utf8;
import 'package:front_end/src/api_unstable/dart2js.dart'
show getSupportedLibraryNames;
import '../compiler_new.dart' as api;
import 'common/metrics.dart' show Metrics, Metric;
@@ -17,7 +13,6 @@ import 'common.dart';
import 'compiler.dart';
import 'diagnostics/messages.dart' show Message;
import 'environment.dart';
import 'io/source_file.dart';
import 'options.dart' show CompilerOptions;
/// Implements the [Compiler] using a [api.CompilerInput] for supplying the
@@ -58,61 +53,22 @@ class CompilerImpl extends Compiler {
null, null, null, null, message, api.Diagnostic.VERBOSE_INFO);
}
Future setupSdk() {
var future = Future.value(null);
_Environment env = environment;
if (env.supportedLibraries == null) {
future = future.then((_) {
Uri specificationUri = options.librariesSpecificationUri;
Future<String> readJson(Uri uri) async {
api.Input spec = await provider.readFromUri(specificationUri);
String json = null;
// TODO(sigmund): simplify this, we have some API inconsistencies when
// our internal input adds a terminating zero.
if (spec is SourceFile) {
json = spec.slowText();
} else if (spec is Binary) {
json = utf8.decode(spec.data);
}
return json;
}
// TODO(sigmund): would be nice to front-load some of the CFE option
// processing and parse this .json file only once.
return getSupportedLibraryNames(specificationUri,
options.compileForServer ? "dart2js_server" : "dart2js",
readJson: readJson)
.then((libraries) {
env.supportedLibraries = libraries.toSet();
});
});
}
// TODO(johnniwinther): This does not apply anymore.
// The incremental compiler sets up the sdk before run.
// Therefore this will be called a second time.
return future;
}
@override
Future<bool> run() {
Duration setupDuration = measurer.elapsedWallClock;
return selfTask.measureSubtask("impl.run", () {
return setupSdk().then((_) {
return super.run();
}).then((bool success) {
if (options.verbose) {
StringBuffer timings = StringBuffer();
computeTimings(setupDuration, timings);
logVerbose('$timings');
}
if (options.reportPrimaryMetrics || options.reportSecondaryMetrics) {
StringBuffer metrics = StringBuffer();
collectMetrics(metrics);
logInfo('$metrics');
}
return success;
});
return selfTask.measureSubtask("impl.run", () async {
bool success = await super.run();
if (options.verbose) {
StringBuffer timings = StringBuffer();
computeTimings(setupDuration, timings);
logVerbose('$timings');
}
if (options.reportPrimaryMetrics || options.reportSecondaryMetrics) {
StringBuffer metrics = StringBuffer();
collectMetrics(metrics);
logInfo('$metrics');
}
return success;
});
}
@@ -239,50 +195,18 @@ class CompilerImpl extends Compiler {
class _Environment implements Environment {
final Map<String, String> definitions;
Map<String, String> _completeMap;
Set<String> supportedLibraries;
_Environment(this.definitions);
@override
String valueOf(String name) {
if (_completeMap != null) return _completeMap[name];
var result = definitions[name];
if (result != null || definitions.containsKey(name)) return result;
if (!name.startsWith(_dartLibraryEnvironmentPrefix)) return null;
String libraryName = name.substring(_dartLibraryEnvironmentPrefix.length);
// Private libraries are not exposed to the users.
if (libraryName.startsWith("_")) return null;
if (supportedLibraries.contains(libraryName)) return "true";
return null;
}
@override
Map<String, String> toMap() {
if (_completeMap == null) {
_completeMap = Map<String, String>.from(definitions);
for (String libraryName in supportedLibraries) {
if (!libraryName.startsWith("_")) {
String key = '${_dartLibraryEnvironmentPrefix}${libraryName}';
if (!definitions.containsKey(key)) {
_completeMap[key] = "true";
}
}
}
}
return _completeMap;
}
}
/// For every 'dart:' library, a corresponding environment variable is set
/// to "true". The environment variable's name is the concatenation of
/// this prefix and the name (without the 'dart:'.
///
/// For example 'dart:html' has the environment variable 'dart.library.html' set
/// to "true".
const String _dartLibraryEnvironmentPrefix = 'dart.library.';
class _TimingData {
final String description;
final int milliseconds;
-3
View File
@@ -1086,9 +1086,6 @@ class _MapImpactCacheDeleter implements ImpactCacheDeleter {
class _EmptyEnvironment implements Environment {
const _EmptyEnvironment();
@override
String valueOf(String key) => null;
@override
Map<String, String> toMap() => const {};
}
-6
View File
@@ -8,12 +8,6 @@
/// conditional imports, and from `const String.fromEnvironment` and
/// other similar constructors.
abstract class Environment {
/// Return the string value of the given key.
///
/// Note that `bool.fromEnvironment` and `int.fromEnvironment` are also
/// implemented in terms of `String.fromEnvironment`.
String valueOf(String key);
/// Returns the full environment as map.
Map<String, String> toMap();
}
+5 -3
View File
@@ -2,11 +2,11 @@
// 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:front_end/src/api_prototype/constant_evaluator.dart' as ir;
import 'package:front_end/src/api_unstable/dart2js.dart' as ir;
import 'package:kernel/ast.dart' as ir;
import 'package:kernel/src/printer.dart' as ir;
import 'package:kernel/type_environment.dart' as ir;
import 'package:front_end/src/api_prototype/constant_evaluator.dart' as ir;
import 'package:front_end/src/api_unstable/dart2js.dart' as ir;
import '../kernel/dart2js_target.dart';
@@ -18,7 +18,7 @@ class Dart2jsConstantEvaluator extends ir.ConstantEvaluator {
bool requiresConstant;
Dart2jsConstantEvaluator(
Dart2jsConstantEvaluator(ir.Component component,
ir.TypeEnvironment typeEnvironment, ReportErrorFunction reportError,
{Map<String, String> environment = const {},
bool supportReevaluationForTesting = false,
@@ -26,7 +26,9 @@ class Dart2jsConstantEvaluator extends ir.ConstantEvaluator {
: _supportReevaluationForTesting = supportReevaluationForTesting,
assert(evaluationMode != null),
super(
const Dart2jsDartLibrarySupport(),
const Dart2jsConstantsBackend(supportsUnevaluatedConstants: false),
component,
environment,
typeEnvironment,
ErrorReporter(reportError),
@@ -1164,14 +1164,15 @@ class JsKernelToElementMap implements JsToElementMap, IrToElementMap {
}
Dart2jsConstantEvaluator get constantEvaluator {
return _constantEvaluator ??= Dart2jsConstantEvaluator(typeEnvironment,
(ir.LocatedMessage message, List<ir.LocatedMessage> context) {
return _constantEvaluator ??=
Dart2jsConstantEvaluator(programEnv.mainComponent, typeEnvironment,
(ir.LocatedMessage message, List<ir.LocatedMessage> context) {
reportLocatedMessage(reporter, message, context);
},
environment: _environment.toMap(),
evaluationMode: options.useLegacySubtyping
? ir.EvaluationMode.weak
: ir.EvaluationMode.strong);
environment: _environment.toMap(),
evaluationMode: options.useLegacySubtyping
? ir.EvaluationMode.weak
: ir.EvaluationMode.strong);
}
@override
@@ -221,6 +221,10 @@ class Dart2jsTarget extends Target {
@override
ConstantsBackend get constantsBackend =>
const Dart2jsConstantsBackend(supportsUnevaluatedConstants: true);
@override
DartLibrarySupport get dartLibrarySupport =>
const Dart2jsDartLibrarySupport();
}
// TODO(sigmund): this "extraRequiredLibraries" needs to be removed...
@@ -314,3 +318,8 @@ class Dart2jsConstantsBackend extends ConstantsBackend {
@override
NumberSemantics get numberSemantics => NumberSemantics.js;
}
class Dart2jsDartLibrarySupport extends CustomizedDartLibrarySupport {
const Dart2jsDartLibrarySupport()
: super(supported: const {'_dart2js_runtime_metrics'});
}
@@ -812,14 +812,15 @@ class KernelToElementMapImpl implements KernelToElementMap, IrToElementMap {
}
Dart2jsConstantEvaluator get constantEvaluator {
return _constantEvaluator ??= Dart2jsConstantEvaluator(typeEnvironment,
(ir.LocatedMessage message, List<ir.LocatedMessage> context) {
return _constantEvaluator ??=
Dart2jsConstantEvaluator(env.mainComponent, typeEnvironment,
(ir.LocatedMessage message, List<ir.LocatedMessage> context) {
reportLocatedMessage(reporter, message, context);
},
environment: _environment.toMap(),
evaluationMode: options.useLegacySubtyping
? ir.EvaluationMode.weak
: ir.EvaluationMode.strong);
environment: _environment.toMap(),
evaluationMode: options.useLegacySubtyping
? ir.EvaluationMode.weak
: ir.EvaluationMode.strong);
}
@override
@@ -86,7 +86,7 @@ class StaticTypeVisitorBase extends StaticTypeVisitor {
classHierarchy,
new StaticTypeCacheImpl()) {
_constantEvaluator = new Dart2jsConstantEvaluator(
typeEnvironment, const ir.SimpleErrorReporter().report,
component, typeEnvironment, const ir.SimpleErrorReporter().report,
evaluationMode: evaluationMode);
}
@@ -43,7 +43,6 @@ main() {
memorySourceFiles: {'main.dill': kernelBinary},
diagnosticHandler: diagnostics,
outputProvider: output);
await compiler.setupSdk();
KernelResult result = await compiler.kernelLoader.load();
compiler.frontendStrategy.registerLoadedLibraries(result);
@@ -1,146 +0,0 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.7
/// Check that 'dart:' libraries have their corresponding dart.library.X
/// environment variable set.
import 'dart:async';
import '../helpers/memory_compiler.dart';
import '../helpers/memory_source_file_helper.dart';
import "package:async_helper/async_helper.dart";
import 'package:expect/expect.dart' show Expect;
import 'package:compiler/src/null_compiler_output.dart' show NullCompilerOutput;
import 'package:compiler/src/options.dart' show CompilerOptions;
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/io/source_file.dart' show Binary;
import 'package:compiler/compiler_new.dart'
show CompilerInput, CompilerDiagnostics, Input, InputKind;
const String librariesJson = r'''
{
"dart2js": {
"libraries": {
"mock.client": {"uri": "mock1.dart"},
"mock.shared": {"uri": "mock3.dart"},
"collection": {"uri": "collection/collection.dart"},
"html": {"uri": "html/dart2js/html_dart2js.dart"}
}
},
"dart2js_server": {
"libraries": {
"mock.server": {"uri": "mock2.dart"},
"mock.shared": {"uri": "mock3.dart"},
"collection": {"uri": "collection/collection.dart"},
"io": {"uri": "io/io.dart"}
}
}
}
''';
class DummyCompilerInput implements CompilerInput {
const DummyCompilerInput();
@override
Future<Input> readFromUri(Uri uri,
{InputKind inputKind: InputKind.UTF8}) async {
if (uri.path.endsWith("libraries.json")) {
return new Binary(uri, librariesJson.codeUnits);
} else {
throw "should not be needed $uri";
}
}
}
class DummyCompilerDiagnostics implements CompilerDiagnostics {
const DummyCompilerDiagnostics();
@override
report(code, uri, begin, end, text, kind) {
throw "should not be needed";
}
}
class CustomCompiler extends CompilerImpl {
CustomCompiler(List<String> options, Map<String, String> environment)
: super(
const DummyCompilerInput(),
const NullCompilerOutput(),
const DummyCompilerDiagnostics(),
CompilerOptions.parse(
['--platform-binaries=$sdkPlatformBinariesPath']
..addAll(options),
librariesSpecificationUri: sdkLibrariesSpecificationUri)
..environment = environment);
}
runTest() async {
{
final compiler = new CustomCompiler([], {});
await compiler.setupSdk();
final lookup = compiler.environment.valueOf;
// Core libraries are always present.
Expect.equals("true", lookup("dart.library.collection"));
// Non-existing entries in the environment return 'null'.
Expect.isNull(lookup("not in env"));
// Check for client libraries (default if there are no flags to the compiler).
Expect.equals("true", lookup("dart.library.mock.client"));
Expect.equals("true", lookup("dart.library.html"));
// Check for shared libraries..
Expect.equals("true", lookup("dart.library.mock.shared"));
// Check server libraries are not present.
Expect.equals(null, lookup("dart.library.mock.server"));
Expect.equals(null, lookup("dart.library.io"));
}
{
final compiler = new CustomCompiler([Flags.serverMode], {});
await compiler.setupSdk();
final lookup = compiler.environment.valueOf;
// Core libraries are always present.
Expect.equals("true", lookup("dart.library.collection"));
// Non-existing entries in the environment return 'null'.
Expect.isNull(lookup("not in env"));
// Check client libraries are not present.
Expect.equals(null, lookup("dart.library.mock.client"));
Expect.equals(null, lookup("dart.library.html"));
// Check for shared libraries..
Expect.equals("true", lookup("dart.library.mock.shared"));
// Check for server libraries.
Expect.equals("true", lookup("dart.library.mock.server"));
Expect.equals("true", lookup("dart.library.io"));
}
{
// Check that user-defined env-variables win.
final compiler = new CustomCompiler([], {
'dart.library.collection': "false",
'dart.library.mock.client': "foo"
});
await compiler.setupSdk();
final lookup = compiler.environment.valueOf;
Expect.equals("false", lookup("dart.library.collection"));
Expect.equals("foo", lookup("dart.library.mock.client"));
}
}
main() {
asyncStart();
runTest().then((_) {
asyncEnd();
});
}
@@ -44,7 +44,6 @@ main() {
memorySourceFiles: {'a.dill': aDill, 'b.dill': bDill, 'c.dill': cDill},
diagnosticHandler: diagnostics,
outputProvider: output);
await compiler.setupSdk();
KernelResult result = await compiler.kernelLoader.load();
compiler.frontendStrategy.registerLoadedLibraries(result);
@@ -596,9 +596,9 @@ Future testData(TestData data) async {
expectedResults
.forEach((Map<String, String> environment, String expectedText) {
List<String> errors = [];
Dart2jsConstantEvaluator evaluator =
new Dart2jsConstantEvaluator(elementMap.typeEnvironment,
(ir.LocatedMessage message, List<ir.LocatedMessage> context) {
Dart2jsConstantEvaluator evaluator = new Dart2jsConstantEvaluator(
elementMap.env.mainComponent, elementMap.typeEnvironment,
(ir.LocatedMessage message, List<ir.LocatedMessage> context) {
// TODO(johnniwinther): Assert that `message.uri != null`. Currently
// all unevaluated constants have no uri.
// The actual message is a "constant errors starts here" message,
@@ -606,11 +606,11 @@ Future testData(TestData data) async {
errors.add(context.first.code.name);
reportLocatedMessage(elementMap.reporter, message, context);
},
environment: environment,
supportReevaluationForTesting: true,
evaluationMode: compiler.options.useLegacySubtyping
? ir.EvaluationMode.weak
: ir.EvaluationMode.strong);
environment: environment,
supportReevaluationForTesting: true,
evaluationMode: compiler.options.useLegacySubtyping
? ir.EvaluationMode.weak
: ir.EvaluationMode.strong);
ir.Constant evaluatedConstant = evaluator.evaluate(
new ir.StaticTypeContext(node, typeEnvironment), initializer);
@@ -825,10 +825,6 @@ Map<String, String> parseAndRemoveDeclaredVariables(List<String> args) {
}
}
// Add platform defined variables
// TODO(47243) Remove when all code paths read these from the `Target`.
declaredVariables.addAll(sdkLibraryEnvironmentDefines);
return declaredVariables;
}
@@ -25,7 +25,6 @@ import '../../dev_compiler.dart';
import '../compiler/js_names.dart';
import 'asset_file_system.dart';
import 'command.dart';
import 'target.dart' show sdkLibraryEnvironmentDefines;
/// The service that handles expression compilation requests from
/// the debugger.
@@ -231,8 +230,6 @@ class ExpressionCompilerWorker {
..omitPlatform = true
..environmentDefines = {
if (environmentDefines != null) ...environmentDefines,
// TODO(47243) Remove when all code paths read these from the `Target`.
...sdkLibraryEnvironmentDefines
}
..explicitExperimentalFlags = explicitExperimentalFlags
..onDiagnostic = _onDiagnosticHandler(errors, warnings, infos)
@@ -20,34 +20,6 @@ import 'package:kernel/transformations/track_widget_constructor_locations.dart';
import 'constants.dart' show DevCompilerConstantsBackend;
import 'kernel_helpers.dart';
/// Boolean environment variables that indicate which libraries are available in
/// dev compiler.
// TODO(jmesserly): provide an option to compile without dart:html & friends?
const sdkLibraryEnvironmentDefines = {
'dart.isVM': 'false',
'dart.library.async': 'true',
'dart.library.core': 'true',
'dart.library.collection': 'true',
'dart.library.convert': 'true',
// TODO(jmesserly): this is not really supported in dart4web other than
// `debugger()`
'dart.library.developer': 'true',
'dart.library.io': 'false',
'dart.library.isolate': 'false',
'dart.library.js': 'true',
'dart.library.js_util': 'true',
'dart.library.math': 'true',
'dart.library.mirrors': 'false',
'dart.library.typed_data': 'true',
'dart.library.indexed_db': 'true',
'dart.library.html': 'true',
'dart.library.html_common': 'true',
'dart.library.svg': 'true',
'dart.library.ui': 'false',
'dart.library.web_audio': 'true',
'dart.library.web_gl': 'true',
};
/// A kernel [Target] to configure the Dart Front End for dartdevc.
class DevCompilerTarget extends Target {
DevCompilerTarget(this.flags);
@@ -59,10 +31,6 @@ class DevCompilerTarget extends Target {
Map<String, Class>? _nativeClasses;
@override
Map<String, String> updateEnvironmentDefines(Map<String, String> map) =>
map..addAll(sdkLibraryEnvironmentDefines);
@override
bool get enableSuperMixins => true;
@@ -12,9 +12,6 @@ import 'package:_fe_analyzer_shared/src/messages/severity.dart' show Severity;
import 'package:_fe_analyzer_shared/src/scanner/scanner.dart' show StringToken;
import 'package:_fe_analyzer_shared/src/util/libraries_specification.dart'
show LibrariesSpecification;
import 'package:kernel/kernel.dart' show Component;
import 'package:kernel/ast.dart' as ir;
@@ -217,28 +214,6 @@ Future<Component?> compile(
return compilerResult?.component;
}
/// Retrieve the name of the libraries that are supported by [target] according
/// to the libraries specification [json] file.
///
/// Dart2js uses these names to determine the value of library environment
/// constants, such as `const bool.fromEnvironment("dart.library.io")`.
// TODO(sigmund): refactor dart2js so that we can retrieve this data later in
// the compilation pipeline. At that point we can get it from the CFE
// results directly and completely hide the libraries specification file from
// dart2js.
// TODO(sigmund): delete after all constant evaluation is done in the CFE, as
// this data will no longer be needed on the dart2js side.
Future<Iterable<String>> getSupportedLibraryNames(
Uri librariesSpecificationUri, String target,
{required Future<String> readJson(Uri uri)}) async {
return (await LibrariesSpecification.load(
librariesSpecificationUri, readJson))
.specificationFor(target)
.allLibraries
.where((l) => l.isSupported)
.map((l) => l.name);
}
/// Desugar API to determine whether [member] is a redirecting factory
/// constructor.
// TODO(sigmund): Delete this API once `member.isRedirectingFactory`
@@ -69,6 +69,10 @@ abstract class LibraryBuilder implements ModifierBuilder {
/// This is the canonical uri for the library, for instance 'dart:core'.
Uri get importUri;
/// If true, the library is not supported through the 'dart.library.*' value
/// used in conditional imports and `bool.fromEnvironment` constants.
bool get isUnsupported;
Iterator<Builder> get iterator;
NameIterator get nameIterator;
@@ -130,6 +130,9 @@ class DillLibraryBuilder extends LibraryBuilderImpl {
}
}
@override
bool get isUnsupported => library.isUnsupported;
@override
bool get isSynthetic => library.isSynthetic;
@@ -1735,6 +1735,7 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
loader: lastGoodKernelTarget.loader,
scope: libraryBuilder.scope.createNestedScope("expression"),
nameOrigin: libraryBuilder,
isUnsupported: libraryBuilder.isUnsupported,
);
_ticker.logMs("Created debug library");
@@ -39,8 +39,8 @@ import 'constant_int_folder.dart';
part 'constant_collection_builders.dart';
Component transformComponent(
Target target,
Component component,
ConstantsBackend backend,
Map<String, String> environmentDefines,
ErrorReporter errorReporter,
EvaluationMode evaluationMode,
@@ -70,7 +70,7 @@ Component transformComponent(
final TypeEnvironment typeEnvironment =
new TypeEnvironment(coreTypes, hierarchy);
transformLibraries(component.libraries, backend, environmentDefines,
transformLibraries(component, component.libraries, target, environmentDefines,
typeEnvironment, errorReporter, evaluationMode,
enableTripleShift: enableTripleShift,
enableConstFunctions: enableConstFunctions,
@@ -81,8 +81,9 @@ Component transformComponent(
}
ConstantEvaluationData transformLibraries(
Component component,
List<Library> libraries,
ConstantsBackend backend,
Target target,
Map<String, String>? environmentDefines,
TypeEnvironment typeEnvironment,
ErrorReporter errorReporter,
@@ -103,13 +104,14 @@ ConstantEvaluationData transformLibraries(
// ignore: unnecessary_null_comparison
assert(enableConstructorTearOff != null);
final ConstantsTransformer constantsTransformer = new ConstantsTransformer(
backend,
target,
environmentDefines,
evaluateAnnotations,
enableTripleShift,
enableConstFunctions,
enableConstructorTearOff,
errorOnUnevaluatedConstant,
component,
typeEnvironment,
errorReporter,
evaluationMode);
@@ -124,7 +126,8 @@ ConstantEvaluationData transformLibraries(
void transformProcedure(
Procedure procedure,
ConstantsBackend backend,
Target target,
Component component,
Map<String, String>? environmentDefines,
TypeEnvironment typeEnvironment,
ErrorReporter errorReporter,
@@ -145,13 +148,14 @@ void transformProcedure(
// ignore: unnecessary_null_comparison
assert(enableConstructorTearOff != null);
final ConstantsTransformer constantsTransformer = new ConstantsTransformer(
backend,
target,
environmentDefines,
evaluateAnnotations,
enableTripleShift,
enableConstFunctions,
enableConstructorTearOff,
errorOnUnevaluatedConstant,
component,
typeEnvironment,
errorReporter,
evaluationMode);
@@ -341,18 +345,25 @@ class ConstantsTransformer extends RemovingTransformer {
final bool errorOnUnevaluatedConstant;
ConstantsTransformer(
this.backend,
Target target,
Map<String, String>? environmentDefines,
this.evaluateAnnotations,
this.enableTripleShift,
this.enableConstFunctions,
this.enableConstructorTearOff,
this.errorOnUnevaluatedConstant,
Component component,
this.typeEnvironment,
ErrorReporter errorReporter,
EvaluationMode evaluationMode)
: constantEvaluator = new ConstantEvaluator(
backend, environmentDefines, typeEnvironment, errorReporter,
: this.backend = target.constantsBackend,
constantEvaluator = new ConstantEvaluator(
target.dartLibrarySupport,
target.constantsBackend,
component,
environmentDefines,
typeEnvironment,
errorReporter,
enableTripleShift: enableTripleShift,
enableConstFunctions: enableConstFunctions,
errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
@@ -871,11 +882,13 @@ class ConstantsTransformer extends RemovingTransformer {
}
class ConstantEvaluator implements ExpressionVisitor<Constant> {
final DartLibrarySupport dartLibrarySupport;
final ConstantsBackend backend;
final NumberSemantics numberSemantics;
late ConstantIntFolder intFolder;
Map<String, String>? environmentDefines;
Map<String, String>? _environmentDefines;
final bool errorOnUnevaluatedConstant;
final Component component;
final CoreTypes coreTypes;
final TypeEnvironment typeEnvironment;
StaticTypeContext? _staticTypeContext;
@@ -914,8 +927,8 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
late ConstantWeakener _weakener;
ConstantEvaluator(this.backend, this.environmentDefines, this.typeEnvironment,
this.errorReporter,
ConstantEvaluator(this.dartLibrarySupport, this.backend, this.component,
this._environmentDefines, this.typeEnvironment, this.errorReporter,
{this.enableTripleShift = false,
this.enableConstFunctions = false,
this.errorOnUnevaluatedConstant = false,
@@ -925,7 +938,7 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
canonicalizationCache = <Constant, Constant>{},
nodeCache = <Node, Constant?>{},
env = new EvaluationEnvironment() {
if (environmentDefines == null && !backend.supportsUnevaluatedConstants) {
if (_environmentDefines == null && !backend.supportsUnevaluatedConstants) {
throw new ArgumentError(
"No 'environmentDefines' passed to the constant evaluator but the "
"ConstantsBackend does not support unevaluated constants.");
@@ -947,6 +960,43 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
_weakener = new ConstantWeakener(this);
}
Map<String, String>? _supportedLibrariesCache;
Map<String, String> _computeSupportedLibraries() {
Map<String, String> map = {};
for (Library library in component.libraries) {
if (library.importUri.scheme == 'dart') {
map[library.importUri.path] =
DartLibrarySupport.getDartLibrarySupportValue(
library.importUri.path,
libraryExists: true,
isSynthetic: library.isSynthetic,
isUnsupported: library.isUnsupported,
dartLibrarySupport: dartLibrarySupport);
}
}
return map;
}
String? lookupEnvironment(String key) {
if (DartLibrarySupport.isDartLibraryQualifier(key)) {
String libraryName = DartLibrarySupport.getDartLibraryName(key);
String? value = (_supportedLibrariesCache ??=
_computeSupportedLibraries())[libraryName];
return value ?? "";
}
return _environmentDefines![key];
}
bool hasEnvironmentKey(String key) {
if (key.startsWith(DartLibrarySupport.dartLibraryPrefix)) {
return true;
}
return _environmentDefines!.containsKey(key);
}
bool get hasEnvironment => _environmentDefines != null;
DartType convertType(DartType type) {
switch (evaluationMode) {
case EvaluationMode.strong:
@@ -1375,7 +1425,7 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
Constant constant = node.constant;
Constant result = constant;
if (constant is UnevaluatedConstant) {
if (environmentDefines != null) {
if (hasEnvironment) {
result = _evaluateSubexpression(constant.expression);
if (result is AbortConstant) return result;
} else {
@@ -2902,7 +2952,7 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
Constant _handleFromEnvironment(
Procedure target, StringConstant name, Map<String, Constant> named) {
String? value = environmentDefines![name.value];
String? value = lookupEnvironment(name.value);
Constant? defaultValue = named["defaultValue"];
if (target.enclosingClass == coreTypes.boolClass) {
Constant boolConstant;
@@ -2961,9 +3011,7 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
}
Constant _handleHasEnvironment(StringConstant name) {
return environmentDefines!.containsKey(name.value)
? trueConstant
: falseConstant;
return hasEnvironmentKey(name.value) ? trueConstant : falseConstant;
}
@override
@@ -3015,7 +3063,7 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
positionals.length == 1 &&
(target.name.text == "fromEnvironment" ||
target.name.text == "hasEnvironment")) {
if (environmentDefines != null) {
if (hasEnvironment) {
// Evaluate environment constant.
Constant name = positionals.single;
if (name is StringConstant) {
@@ -1343,8 +1343,9 @@ class KernelTarget extends TargetImplementation {
constants.ConstantEvaluationData constantEvaluationData =
constants.transformLibraries(
component!,
loader.libraries,
backendTarget.constantsBackend,
backendTarget,
environmentDefines,
environment,
new KernelConstantErrorReporter(loader),
@@ -1400,7 +1401,8 @@ class KernelTarget extends TargetImplementation {
constants.transformProcedure(
procedure,
backendTarget.constantsBackend,
backendTarget,
component!,
environmentDefines,
environment,
new KernelConstantErrorReporter(loader),
@@ -139,6 +139,9 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
Uri? get packageUriForTesting => _packageUri;
@override
final bool isUnsupported;
final List<Object> accessors = <Object>[];
@override
@@ -250,7 +253,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
Library library,
LibraryBuilder? nameOrigin,
Library? referencesFrom,
bool? referenceIsPartOwner)
bool? referenceIsPartOwner,
bool isUnsupported)
: this.fromScopes(
loader,
fileUri,
@@ -261,7 +265,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
origin,
library,
nameOrigin,
referencesFrom);
referencesFrom,
isUnsupported);
SourceLibraryBuilder.fromScopes(
this.loader,
@@ -273,7 +278,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
SourceLibraryBuilder? origin,
this.library,
this._nameOrigin,
this.referencesFrom)
this.referencesFrom,
this.isUnsupported)
: _languageVersion = packageLanguageVersion,
currentTypeParameterScopeBuilder = _libraryTypeParameterScopeBuilder,
referencesFromIndexed =
@@ -462,7 +468,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
Library? target,
LibraryBuilder? nameOrigin,
Library? referencesFrom,
bool? referenceIsPartOwner})
bool? referenceIsPartOwner,
required bool isUnsupported})
: this.internal(
loader,
fileUri,
@@ -480,7 +487,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
..setLanguageVersion(packageLanguageVersion.version)),
nameOrigin,
referencesFrom,
referenceIsPartOwner);
referenceIsPartOwner,
isUnsupported);
@override
bool get isPart => partOfName != null || partOfUri != null;
@@ -703,7 +711,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
int uriOffset) {
if (configurations != null) {
for (Configuration config in configurations) {
if (lookupImportCondition(config.dottedName) == config.condition) {
if (loader.getLibrarySupportValue(config.dottedName) ==
config.condition) {
uri = config.importUri;
break;
}
@@ -717,26 +726,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
exports.add(new Export(this, exportedLibrary, combinators, charOffset));
}
String lookupImportCondition(String dottedName) {
const String prefix = "dart.library.";
if (!dottedName.startsWith(prefix)) return "";
dottedName = dottedName.substring(prefix.length);
if (!loader.target.uriTranslator.isLibrarySupported(dottedName)) return "";
LibraryBuilder? imported =
loader.lookupLibraryBuilder(new Uri(scheme: "dart", path: dottedName));
if (imported == null) {
LibraryBuilder coreLibrary = loader.readAsEntryPoint(resolve(
this.importUri,
new Uri(scheme: "dart", path: "core").toString(),
-1));
imported = coreLibrary.loader
.lookupLibraryBuilder(new Uri(scheme: 'dart', path: dottedName));
}
return imported != null && !imported.isSynthetic ? "true" : "";
}
void addImport(
List<MetadataBuilder>? metadata,
String uri,
@@ -750,7 +739,8 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
int importIndex) {
if (configurations != null) {
for (Configuration config in configurations) {
if (lookupImportCondition(config.dottedName) == config.condition) {
if (loader.getLibrarySupportValue(config.dottedName) ==
config.condition) {
uri = config.importUri;
break;
}
@@ -1076,6 +1066,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
if (!modifyTarget) return library;
library.isSynthetic = isSynthetic;
library.isUnsupported = isUnsupported;
addDependencies(library, new Set<SourceLibraryBuilder>());
library.name = name;
@@ -26,6 +26,7 @@ import 'package:kernel/class_hierarchy.dart'
show ClassHierarchy, HandleAmbiguousSupertypes;
import 'package:kernel/core_types.dart' show CoreTypes;
import 'package:kernel/reference_from_index.dart' show ReferenceFromIndex;
import 'package:kernel/target/targets.dart';
import 'package:kernel/type_environment.dart';
import 'package:kernel/util/graph.dart';
import 'package:package_config/package_config.dart' as package_config;
@@ -318,7 +319,32 @@ class SourceLoader extends Loader {
loader: this,
origin: origin,
referencesFrom: referencesFrom,
referenceIsPartOwner: referenceIsPartOwner);
referenceIsPartOwner: referenceIsPartOwner,
isUnsupported: origin?.library.isUnsupported ??
importUri.scheme == 'dart' &&
!target.uriTranslator.isLibrarySupported(importUri.path));
}
/// Return `"true"` if the [dottedName] is a 'dart.library.*' qualifier for a
/// supported dart:* library, and `""` otherwise.
///
/// This is used to determine conditional imports and `bool.fromEnvironment`
/// constant values for "dart.library.[libraryName]" values.
String getLibrarySupportValue(String dottedName) {
if (!DartLibrarySupport.isDartLibraryQualifier(dottedName)) {
return "";
}
String libraryName = DartLibrarySupport.getDartLibraryName(dottedName);
Uri uri = new Uri(scheme: "dart", path: libraryName);
LibraryBuilder? library = lookupLibraryBuilder(uri);
// TODO(johnniwinther): Why is the dill target sometimes not loaded at this
// point? And does it matter?
library ??= target.dillTarget.loader.lookupLibraryBuilder(uri);
return DartLibrarySupport.getDartLibrarySupportValue(libraryName,
libraryExists: library != null,
isSynthetic: library?.isSynthetic ?? true,
isUnsupported: library?.isUnsupported ?? true,
dartLibrarySupport: target.backendTarget.dartLibrarySupport);
}
SourceLibraryBuilder _createSourceLibraryBuilder(
@@ -50,9 +50,7 @@ class UriTranslator {
}
bool isLibrarySupported(String libraryName) {
// TODO(sigmund): change this to `?? false` when all backends provide the
// `libraries.json` file by default (Issue #32657).
return dartLibraries.libraryInfoFor(libraryName)?.isSupported ?? true;
return dartLibraries.libraryInfoFor(libraryName)?.isSupported ?? false;
}
Uri? _translateDartUri(Uri uri) {
@@ -7,43 +7,33 @@ import 'dart:typed_data' show Uint8List;
import 'package:_fe_analyzer_shared/src/messages/codes.dart';
import 'package:compiler/src/kernel/dart2js_target.dart' show Dart2jsTarget;
import 'package:dev_compiler/src/kernel/target.dart' show DevCompilerTarget;
import 'package:front_end/src/api_prototype/compiler_options.dart'
show CompilerOptions, DiagnosticMessage;
import 'package:front_end/src/api_prototype/experimental_flags.dart'
show ExperimentalFlag;
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/fasta/incremental_compiler.dart'
show IncrementalCompiler;
import 'package:front_end/src/fasta/kernel/constant_evaluator.dart' as constants
show EvaluationMode, transformLibraries, ErrorReporter;
import 'package:front_end/src/fasta/kernel/kernel_target.dart';
import 'package:front_end/src/fasta/kernel/utils.dart' show serializeComponent;
import 'package:kernel/ast.dart';
import 'package:kernel/binary/ast_from_binary.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/class_hierarchy.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/target/changed_structure_notifier.dart';
import 'package:kernel/target/targets.dart'
show ConstantsBackend, DiagnosticReporter, Target, TargetFlags;
show DiagnosticReporter, Target, TargetFlags;
import 'package:kernel/type_environment.dart';
import "package:vm/target/flutter.dart" show FlutterTarget;
import "package:vm/target/vm.dart" show VmTarget;
import 'incremental_suite.dart' show getOptions;
import 'package:front_end/src/fasta/kernel/utils.dart' show serializeComponent;
bool? tryWithNoEnvironment;
bool verbose = false;
bool skipNonNullEnvironment = false;
@@ -80,8 +70,6 @@ void benchmark(Component component, List<Library> libraries) {
stopwatch.reset();
CoreTypes coreTypes = new CoreTypes(component);
ConstantsBackend constantsBackend =
target.backendTarget.constantsBackend;
ClassHierarchy hierarchy = new ClassHierarchy(component, coreTypes);
TypeEnvironment environment = new TypeEnvironment(coreTypes, hierarchy);
if (verbose) {
@@ -91,8 +79,9 @@ void benchmark(Component component, List<Library> libraries) {
stopwatch.reset();
constants.transformLibraries(
component,
component.libraries,
constantsBackend,
target.backendTarget,
environmentDefines,
environment,
new SilentErrorReporter(),
@@ -94,7 +94,8 @@ Future<void> main() async {
new DillTarget(c.options.ticker, uriTranslator,
new NoneTarget(new TargetFlags())),
uriTranslator)
.loader);
.loader,
isUnsupported: false);
libraryBuilder.markLanguageVersionFinal();
LoadLibraryBuilder loadLibraryBuilder =
new LoadLibraryBuilder(libraryBuilder, dummyLibraryDependency, -1);
+25 -53
View File
@@ -5,91 +5,63 @@
library fasta.testing.suite;
import 'dart:convert' show jsonDecode, utf8;
import 'dart:io' show Directory, File, Platform;
import 'dart:typed_data' show Uint8List;
import 'package:_fe_analyzer_shared/src/scanner/token.dart'
show LanguageVersionToken, Token;
import 'package:_fe_analyzer_shared/src/util/colors.dart' as colors;
import 'package:_fe_analyzer_shared/src/util/libraries_specification.dart'
show LibraryInfo;
import 'package:_fe_analyzer_shared/src/util/options.dart';
import 'package:compiler/src/kernel/dart2js_target.dart';
import 'package:dev_compiler/src/kernel/target.dart';
import 'package:front_end/src/api_prototype/compiler_options.dart'
show
CompilerOptions,
DiagnosticMessage,
parseExperimentalArguments,
parseExperimentalFlags;
import 'package:front_end/src/api_prototype/constant_evaluator.dart'
show ConstantEvaluator, ErrorReporter, EvaluationMode;
import 'package:front_end/src/api_prototype/experimental_flags.dart'
show
AllowedExperimentalFlags,
ExperimentalFlag,
defaultAllowedExperimentalFlags,
isExperimentEnabled;
import 'package:front_end/src/api_prototype/file_system.dart'
show FileSystem, FileSystemEntity, FileSystemException;
import 'package:front_end/src/api_prototype/incremental_kernel_generator.dart'
show IncrementalCompilerResult;
import 'package:front_end/src/api_prototype/standard_file_system.dart'
show StandardFileSystem;
import 'package:front_end/src/base/command_line_options.dart';
import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
import 'package:front_end/src/base/processed_options.dart'
show ProcessedOptions;
import 'package:front_end/src/compute_platform_binaries_location.dart'
show computePlatformBinariesLocation, computePlatformDillName;
import 'package:front_end/src/base/command_line_options.dart';
import 'package:front_end/src/base/nnbd_mode.dart' show NnbdMode;
import 'package:front_end/src/fasta/builder/library_builder.dart'
show LibraryBuilder;
import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
import 'package:front_end/src/fasta/dill/dill_target.dart' show DillTarget;
import 'package:front_end/src/fasta/incremental_compiler.dart'
show IncrementalCompiler;
import 'package:front_end/src/fasta/kernel/hierarchy/hierarchy_builder.dart'
show ClassHierarchyBuilder;
import 'package:front_end/src/fasta/kernel/hierarchy/hierarchy_node.dart'
show ClassHierarchyNode;
import 'package:front_end/src/fasta/kernel/kernel_target.dart'
show KernelTarget;
import 'package:front_end/src/fasta/kernel/utils.dart' show ByteSink;
import 'package:front_end/src/fasta/messages.dart' show LocatedMessage;
import 'package:front_end/src/fasta/ticker.dart' show Ticker;
import 'package:front_end/src/fasta/uri_translator.dart' show UriTranslator;
import 'package:front_end/src/fasta/kernel/verifier.dart' show verifyComponent;
import 'package:front_end/src/fasta/messages.dart' show LocatedMessage;
import 'package:front_end/src/fasta/ticker.dart' show Ticker;
import 'package:front_end/src/fasta/uri_translator.dart' show UriTranslator;
import 'package:front_end/src/fasta/util/parser_ast.dart'
show ParserAstVisitor, getAST;
import 'package:front_end/src/fasta/util/parser_ast_helper.dart';
import 'package:kernel/ast.dart'
show
AwaitExpression,
@@ -111,24 +83,16 @@ import 'package:kernel/ast.dart'
Version,
Visitor,
VisitorVoidMixin;
import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
import 'package:kernel/core_types.dart' show CoreTypes;
import 'package:kernel/kernel.dart'
show RecursiveResultVisitor, loadComponentFromBytes;
import 'package:kernel/reference_from_index.dart' show ReferenceFromIndex;
import 'package:kernel/target/changed_structure_notifier.dart'
show ChangedStructureNotifier;
import 'package:kernel/target/targets.dart'
show
ConstantsBackend,
DiagnosticReporter,
NoneConstantsBackend,
NoneTarget,
@@ -137,10 +101,8 @@ import 'package:kernel/target/targets.dart'
TestTargetFlags,
TestTargetMixin,
TestTargetWrapper;
import 'package:kernel/type_environment.dart'
show StaticTypeContext, TypeEnvironment;
import 'package:testing/testing.dart'
show
Chain,
@@ -151,11 +113,9 @@ import 'package:testing/testing.dart'
Step,
TestDescription,
StdioProcess;
import 'package:vm/target/vm.dart' show VmTarget;
import '../../testing_utils.dart' show checkEnvironment;
import '../../utils/kernel_chain.dart'
show
ComponentResult,
@@ -165,7 +125,6 @@ import '../../utils/kernel_chain.dart'
Print,
TypeCheck,
WriteDill;
import '../../utils/validating_instrumentation.dart'
show ValidatingInstrumentation;
@@ -901,12 +860,12 @@ class StressConstantEvaluatorStep
Future<Result<ComponentResult>> run(
ComponentResult result, FastaContext context) {
KernelTarget target = result.sourceTarget;
ConstantsBackend constantsBackend = target.backendTarget.constantsBackend;
TypeEnvironment environment =
new TypeEnvironment(target.loader.coreTypes, target.loader.hierarchy);
StressConstantEvaluatorVisitor stressConstantEvaluatorVisitor =
new StressConstantEvaluatorVisitor(
constantsBackend,
target.backendTarget,
result.component,
result.options.environmentDefines,
target.isExperimentEnabledGlobally(ExperimentalFlag.tripleShift),
environment,
@@ -937,7 +896,8 @@ class StressConstantEvaluatorVisitor extends RecursiveResultVisitor<Node>
List<String> output = [];
StressConstantEvaluatorVisitor(
ConstantsBackend backend,
Target target,
Component component,
Map<String, String>? environmentDefines,
bool enableTripleShift,
TypeEnvironment typeEnvironment,
@@ -945,12 +905,22 @@ class StressConstantEvaluatorVisitor extends RecursiveResultVisitor<Node>
bool errorOnUnevaluatedConstant,
EvaluationMode evaluationMode) {
constantEvaluator = new ConstantEvaluator(
backend, environmentDefines, typeEnvironment, this,
target.dartLibrarySupport,
target.constantsBackend,
component,
environmentDefines,
typeEnvironment,
this,
enableTripleShift: enableTripleShift,
errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
evaluationMode: evaluationMode);
constantEvaluatorWithEmptyEnvironment = new ConstantEvaluator(
backend, {}, typeEnvironment, this,
target.dartLibrarySupport,
target.constantsBackend,
component,
{},
typeEnvironment,
this,
enableTripleShift: enableTripleShift,
errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
evaluationMode: evaluationMode);
@@ -990,7 +960,7 @@ class StressConstantEvaluatorVisitor extends RecursiveResultVisitor<Node>
}
}
if (!evaluate) return node;
if (constantEvaluator.environmentDefines != null) {
if (constantEvaluator.hasEnvironment) {
throw "Unexpected UnevaluatedConstant "
"when the environment is not null.";
}
@@ -1010,7 +980,7 @@ class StressConstantEvaluatorVisitor extends RecursiveResultVisitor<Node>
bool evaluatedWithEmptyEnvironment = false;
if (x is UnevaluatedConstant && x.expression is! InvalidExpression) {
// try with an environment
if (constantEvaluator.environmentDefines != null) {
if (constantEvaluator.hasEnvironment) {
throw "Unexpected UnevaluatedConstant (with an InvalidExpression in "
"it) when the environment is not null.";
}
@@ -1760,6 +1730,8 @@ Target createTarget(FolderOptions folderOptions, FastaContext context) {
forceConstructorTearOffLoweringForTesting:
folderOptions.forceConstructorTearOffLowering,
enableNullSafety: context.soundNullSafety,
supportedDartLibraries: {'_supported.by.target'},
unsupportedDartLibraries: {'unsupported.by.target'},
);
Target target;
switch (folderOptions.target) {
@@ -688,6 +688,7 @@ jakemac
java
jenkins
jensj
jit
job
johnniwinther
js
@@ -8,7 +8,11 @@ import "conditional_import.dart"
if (dart.library.html) "dart:html" as a;
// All three libraries have an HttpRequest class.
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as b;
import "conditional_import.dart"
if (dart.library.html) "dart:html"
if (dart.library.io) "dart:io" as b;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as c;
class HttpRequest {}
@@ -20,6 +24,13 @@ testA(a.HttpRequest request) {
}
testB(b.HttpRequest request) {
request.certificate; // error (from dart:io)
request.response; // ok (from dart:io and dart:html)
request.readyState; // ok (from dart:html)
request.hashCode; // ok
}
testC(c.HttpRequest request) {
request.certificate; // error
request.response; // error
request.readyState; // error
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,12 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:_interceptors" as _in;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +48,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +88,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +98,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,12 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:_interceptors" as _in;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +48,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +88,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +98,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -1,11 +1,15 @@
import "conditional_import.dart"
if (dart.library.io) "dart:io"
if (dart.library.html) "dart:html" as a;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as b;
import "conditional_import.dart"
if (dart.library.html) "dart:html"
if (dart.library.io) "dart:io" as b;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as c;
class HttpRequest {}
testA(a.HttpRequest request) {}
testB(b.HttpRequest request) {}
testC(c.HttpRequest request) {}
void main() {}
expect(expected, actual) {}
@@ -1,4 +1,7 @@
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as b;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as c;
import "conditional_import.dart"
if (dart.library.html) "dart:html"
if (dart.library.io) "dart:io" as b;
import "conditional_import.dart"
if (dart.library.io) "dart:io"
if (dart.library.html) "dart:html" as a;
@@ -8,4 +11,5 @@ class HttpRequest {}
expect(expected, actual) {}
testA(a.HttpRequest request) {}
testB(b.HttpRequest request) {}
testC(c.HttpRequest request) {}
void main() {}
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,12 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:_interceptors" as _in;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +48,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +88,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +98,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,12 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:_interceptors" as _in;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +48,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +88,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +98,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -1,10 +1,11 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:html" as html;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -12,9 +13,11 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic
static method testA(html::HttpRequest request) → dynamic
;
static method testB(self::HttpRequest request) → dynamic
static method testB(html::HttpRequest request) → dynamic
;
static method testC(self::HttpRequest request) → dynamic
;
static method main() → void
;
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,12 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:_interceptors" as _in;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +48,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{_in::Interceptor::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dart2js/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dart2js/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +88,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +98,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -8,7 +8,11 @@ import "conditional_import.dart"
if (dart.library.html) "dart:html" as a;
// All three libraries have an HttpRequest class.
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as b;
import "conditional_import.dart"
if (dart.library.html) "dart:html"
if (dart.library.io) "dart:io" as b;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as c;
class HttpRequest {}
@@ -20,6 +24,13 @@ testA(a.HttpRequest request) {
}
testB(b.HttpRequest request) {
request.certificate; // error (from dart:io)
request.response; // ok (from dart:io and dart:html)
request.readyState; // ok (from dart:html)
request.hashCode; // ok
}
testC(c.HttpRequest request) {
request.certificate; // error
request.response; // error
request.readyState; // error
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,11 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +47,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +87,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +97,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,11 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +47,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +87,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +97,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -1,11 +1,15 @@
import "conditional_import.dart"
if (dart.library.io) "dart:io"
if (dart.library.html) "dart:html" as a;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as b;
import "conditional_import.dart"
if (dart.library.html) "dart:html"
if (dart.library.io) "dart:io" as b;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as c;
class HttpRequest {}
testA(a.HttpRequest request) {}
testB(b.HttpRequest request) {}
testC(c.HttpRequest request) {}
void main() {}
expect(expected, actual) {}
@@ -1,4 +1,7 @@
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as b;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as c;
import "conditional_import.dart"
if (dart.library.html) "dart:html"
if (dart.library.io) "dart:io" as b;
import "conditional_import.dart"
if (dart.library.io) "dart:io"
if (dart.library.html) "dart:html" as a;
@@ -8,4 +11,5 @@ class HttpRequest {}
expect(expected, actual) {}
testA(a.HttpRequest request) {}
testB(b.HttpRequest request) {}
testC(c.HttpRequest request) {}
void main() {}
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,11 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +47,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +87,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +97,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,11 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +47,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +87,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +97,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -1,10 +1,11 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:html" as html;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -12,9 +13,11 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic
static method testA(html::HttpRequest request) → dynamic
;
static method testB(self::HttpRequest request) → dynamic
static method testB(html::HttpRequest request) → dynamic
;
static method testC(self::HttpRequest request) → dynamic
;
static method main() → void
;
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // ok (from dart:html)
// ^^^^^^^^^^
// pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:html'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error (from dart:io)
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -28,11 +34,11 @@ library /*isNonNullableByDefault*/;
//
import self as self;
import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:html" as html;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:html" as a;
import "dart:html" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -41,28 +47,38 @@ class HttpRequest extends core::Object {
static method _#new#tearOff() → self::HttpRequest
return new self::HttpRequest::•();
}
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // ok (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
static method testA(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:20:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(html::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:27:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:html'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error (from dart:io)
^^^^^^^^^^^" in request{<unresolved>}.certificate;
request.{html::HttpRequest::response}{dynamic};
request.{html::HttpRequest::readyState}{core::int};
request.{core::Object::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/dartdevc/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/dartdevc/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -71,7 +87,7 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(false, #C1);
self::expect(true, #C1);
self::expect(true, #C2);
self::expect(false, #C1);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
@@ -81,4 +97,5 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
constants {
#C1 = false
#C2 = true
}
@@ -8,7 +8,11 @@ import "conditional_import.dart"
if (dart.library.html) "dart:html" as a;
// All three libraries have an HttpRequest class.
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as b;
import "conditional_import.dart"
if (dart.library.html) "dart:html"
if (dart.library.io) "dart:io" as b;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as c;
class HttpRequest {}
@@ -20,6 +24,13 @@ testA(a.HttpRequest request) {
}
testB(b.HttpRequest request) {
request.certificate; // ok (from dart:io)
request.response; // ok (from dart:io and dart:html)
request.readyState; // error (from dart:html)
request.hashCode; // ok
}
testC(c.HttpRequest request) {
request.certificate; // error
request.response; // error
request.readyState; // error
@@ -1,11 +1,15 @@
import "conditional_import.dart"
if (dart.library.io) "dart:io"
if (dart.library.html) "dart:html" as a;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as b;
import "conditional_import.dart"
if (dart.library.html) "dart:html"
if (dart.library.io) "dart:io" as b;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as c;
class HttpRequest {}
testA(a.HttpRequest request) {}
testB(b.HttpRequest request) {}
testC(c.HttpRequest request) {}
void main() {}
expect(expected, actual) {}
@@ -1,4 +1,7 @@
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as b;
import "conditional_import.dart" if (dart.library.foo) "dart:foo" as c;
import "conditional_import.dart"
if (dart.library.html) "dart:html"
if (dart.library.io) "dart:io" as b;
import "conditional_import.dart"
if (dart.library.io) "dart:io"
if (dart.library.html) "dart:html" as a;
@@ -8,4 +11,5 @@ class HttpRequest {}
expect(expected, actual) {}
testA(a.HttpRequest request) {}
testB(b.HttpRequest request) {}
testC(c.HttpRequest request) {}
void main() {}
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:22:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error (from dart:html)
// ^^^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:29:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error (from dart:html)
// ^^^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -32,7 +38,8 @@ import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:io" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -42,25 +49,35 @@ class HttpRequest extends core::Object {
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:22:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:29:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -69,8 +86,8 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(true, #C1);
self::expect(false, #C1);
self::expect(false, #C1);
self::expect(false, #C2);
self::expect(false, #C2);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual))
@@ -78,5 +95,6 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
}
constants {
#C1 = false
#C1 = true
#C2 = false
}
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:22:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error (from dart:html)
// ^^^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:29:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error (from dart:html)
// ^^^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -32,7 +38,8 @@ import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:io" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -42,25 +49,35 @@ class HttpRequest extends core::Object {
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:22:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:29:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -69,8 +86,8 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(true, #C1);
self::expect(false, #C1);
self::expect(false, #C1);
self::expect(false, #C2);
self::expect(false, #C2);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual))
@@ -78,5 +95,6 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
}
constants {
#C1 = false
#C1 = true
#C2 = false
}
@@ -4,7 +4,8 @@ import "dart:core" as core;
import "dart:_http" as _ht;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:io" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -12,7 +13,9 @@ class HttpRequest extends core::Object {
}
static method testA(_ht::HttpRequest request) → dynamic
;
static method testB(self::HttpRequest request) → dynamic
static method testB(_ht::HttpRequest request) → dynamic
;
static method testC(self::HttpRequest request) → dynamic
;
static method main() → void
;
@@ -2,25 +2,31 @@ library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:22:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error (from dart:html)
// ^^^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:29:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'dart:_http'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error (from dart:html)
// ^^^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
// request.certificate; // error
// ^^^^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
// request.response; // error
// ^^^^^^^^
//
// pkg/front_end/testcases/general/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// pkg/front_end/testcases/general/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
// - 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
// request.readyState; // error
@@ -32,7 +38,8 @@ import "dart:_http" as _ht;
import "dart:io" as io;
import "dart:io" as a;
import "org-dartlang-testcase:///conditional_import.dart" as b;
import "dart:io" as b;
import "org-dartlang-testcase:///conditional_import.dart" as c;
class HttpRequest extends core::Object {
synthetic constructor •() → self::HttpRequest
@@ -42,25 +49,35 @@ class HttpRequest extends core::Object {
static method testA(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:18:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:22:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
}
static method testB(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:23:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
static method testB(_ht::HttpRequest request) → dynamic {
request.{_ht::HttpRequest::certificate}{io::X509Certificate?};
request.{_ht::HttpRequest::response}{_ht::HttpResponse};
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:29:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'dart:_http'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error (from dart:html)
^^^^^^^^^^" in request{<unresolved>}.readyState;
request.{core::Object::hashCode}{core::int};
}
static method testC(self::HttpRequest request) → dynamic {
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:34:11: Error: The getter 'certificate' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'certificate'.
request.certificate; // error
^^^^^^^^^^^" in request{<unresolved>}.certificate;
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:24:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:35:11: Error: The getter 'response' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'response'.
request.response; // error
^^^^^^^^" in request{<unresolved>}.response;
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:25:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
invalid-expression "pkg/front_end/testcases/general/conditional_import.dart:36:11: Error: The getter 'readyState' isn't defined for the class 'HttpRequest'.
- 'HttpRequest' is from 'pkg/front_end/testcases/general/conditional_import.dart'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'readyState'.
request.readyState; // error
@@ -69,8 +86,8 @@ Try correcting the name to the name of an existing getter, or defining a getter
}
static method main() → void {
self::expect(true, #C1);
self::expect(false, #C1);
self::expect(false, #C1);
self::expect(false, #C2);
self::expect(false, #C2);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual))
@@ -78,5 +95,6 @@ static method expect(dynamic expected, dynamic actual) → dynamic {
}
constants {
#C1 = false
#C1 = true
#C2 = false
}
@@ -0,0 +1,5 @@
// Copyright (c) 2022, 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.
String field = 'default';
@@ -0,0 +1,5 @@
// Copyright (c) 2022, 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.
String field = 'supported.by.spec';
@@ -0,0 +1,5 @@
// Copyright (c) 2022, 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.
String field = 'supported.by.target';
@@ -0,0 +1,5 @@
// Copyright (c) 2022, 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.
String field = 'unsupported.by.spec_internal';
@@ -0,0 +1,5 @@
// Copyright (c) 2022, 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.
String field = 'unsupported.by.spec';
@@ -0,0 +1,5 @@
// Copyright (c) 2022, 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.
String field = 'unsupported.by.target';
@@ -0,0 +1,23 @@
{
"none": {
"libraries": {
"supported.by.spec": {
"uri": "supported.by.spec_lib.dart"
},
"_supported.by.target": {
"uri": "supported.by.target_lib.dart"
},
"unsupported.by.spec": {
"uri": "unsupported.by.spec_lib.dart",
"supported": false
},
"unsupported.by.target": {
"uri": "unsupported.by.target_lib.dart",
"supported": true
},
"_unsupported.by.spec_internal": {
"uri": "unsupported.by.spec_internal_lib.dart"
}
}
}
}
@@ -0,0 +1,63 @@
// Copyright (c) 2022, 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:supported.by.spec';
import 'dart:unsupported.by.spec';
import 'dart:unsupported.by.target';
import 'import_default_lib.dart'
if (dart.library.supported.by.spec) 'import_supported.by.spec_lib.dart'
if (dart.library._supported.by.target) 'import_supported.by.target_lib.dart'
if (dart.library.unsupported.by.target) 'import_unsupported.by.target_lib.dart'
if (dart.library.unsupported.by.spec) 'import_unsupported.by.spec_lib.dart'
if (dart.library._unsupported.by.spec_internal) 'import_unsupported.by.spec_internal_lib.dart'
as from_supported_by_spec_first;
import 'import_default_lib.dart'
if (dart.library.unsupported.by.target) 'import_unsupported.by.target_lib.dart'
if (dart.library.unsupported.by.spec) 'import_unsupported.by.spec_lib.dart'
if (dart.library._unsupported.by.spec_internal) 'import_unsupported.by.spec_internal_lib.dart'
if (dart.library._supported.by.target) 'import_supported.by.target_lib.dart'
if (dart.library.supported.by.spec) 'import_supported.by.spec_lib.dart'
as from_supported_by_target;
import 'import_default_lib.dart'
if (dart.library.unsupported.by.spec) 'import_unsupported.by.spec_lib.dart'
if (dart.library.unsupported.by.target) 'import_unsupported.by.target_lib.dart'
if (dart.library._unsupported.by.spec_internal) 'import_unsupported.by.spec_internal_lib.dart'
if (dart.library.supported.by.spec) 'import_supported.by.spec_lib.dart'
if (dart.library._supported.by.target) 'import_supported.by.target_lib.dart'
as from_supported_by_spec_last;
main() {
supportedBySpec();
supportedByTarget(); // Exported through dart:supported.by.spec
unsupportedBySpec();
unsupportedByTarget();
unsupportedBySpecInternal(); // Exported through dart:unsupported.by.spec
expect('supported.by.spec', from_supported_by_spec_first.field);
expect('supported.by.target', from_supported_by_target.field);
expect('supported.by.spec', from_supported_by_spec_last.field);
// `dart:supported.by.spec` is supported by the libraries specification.
expect(true, const bool.fromEnvironment('dart.library.supported.by.spec'));
// `dart:_supported.by.target` is internal and therefore not supported by
// the libraries specification, but the test target supports it explicitly.
expect(true, const bool.fromEnvironment('dart.library._supported.by.target'));
// `dart:unsupported.by.spec` is unsupported by the libraries specification.
expect(false, const bool.fromEnvironment('dart.library.unsupported.by.spec'));
// `dart:unsupported.by.target` is unsupported by the libraries specification,
// but the test target explicitly marks it as unsupported.
expect(
false, const bool.fromEnvironment('dart.library.unsupported.by.target'));
// `dart:_unsupported.by.spec_internal` is internal and therefore not
// supported by the libraries specification.
expect(false,
const bool.fromEnvironment('dart.library._unsupported.by.spec_internal'));
}
expect(expected, actual) {
if (expected != actual) throw 'Expected $expected, actual $actual';
}
@@ -0,0 +1,27 @@
import 'dart:supported.by.spec';
import 'dart:unsupported.by.spec';
import 'dart:unsupported.by.target';
import 'import_default_lib.dart'
if (dart.library.supported.by.spec) 'import_supported.by.spec_lib.dart'
if (dart.library._supported.by.target) 'import_supported.by.target_lib.dart'
if (dart.library.unsupported.by.target) 'import_unsupported.by.target_lib.dart'
if (dart.library.unsupported.by.spec) 'import_unsupported.by.spec_lib.dart'
if (dart.library._unsupported.by.spec_internal) 'import_unsupported.by.spec_internal_lib.dart'
as from_supported_by_spec_first;
import 'import_default_lib.dart'
if (dart.library.unsupported.by.target) 'import_unsupported.by.target_lib.dart'
if (dart.library.unsupported.by.spec) 'import_unsupported.by.spec_lib.dart'
if (dart.library._unsupported.by.spec_internal) 'import_unsupported.by.spec_internal_lib.dart'
if (dart.library._supported.by.target) 'import_supported.by.target_lib.dart'
if (dart.library.supported.by.spec) 'import_supported.by.spec_lib.dart'
as from_supported_by_target;
import 'import_default_lib.dart'
if (dart.library.unsupported.by.spec) 'import_unsupported.by.spec_lib.dart'
if (dart.library.unsupported.by.target) 'import_unsupported.by.target_lib.dart'
if (dart.library._unsupported.by.spec_internal) 'import_unsupported.by.spec_internal_lib.dart'
if (dart.library.supported.by.spec) 'import_supported.by.spec_lib.dart'
if (dart.library._supported.by.target) 'import_supported.by.target_lib.dart'
as from_supported_by_spec_last;
main() {}
expect(expected, actual) {}
@@ -0,0 +1,27 @@
import 'dart:supported.by.spec';
import 'dart:unsupported.by.spec';
import 'dart:unsupported.by.target';
import 'import_default_lib.dart'
if (dart.library.supported.by.spec) 'import_supported.by.spec_lib.dart'
if (dart.library._supported.by.target) 'import_supported.by.target_lib.dart'
if (dart.library.unsupported.by.target) 'import_unsupported.by.target_lib.dart'
if (dart.library.unsupported.by.spec) 'import_unsupported.by.spec_lib.dart'
if (dart.library._unsupported.by.spec_internal) 'import_unsupported.by.spec_internal_lib.dart'
as from_supported_by_spec_first;
import 'import_default_lib.dart'
if (dart.library.unsupported.by.target) 'import_unsupported.by.target_lib.dart'
if (dart.library.unsupported.by.spec) 'import_unsupported.by.spec_lib.dart'
if (dart.library._unsupported.by.spec_internal) 'import_unsupported.by.spec_internal_lib.dart'
if (dart.library._supported.by.target) 'import_supported.by.target_lib.dart'
if (dart.library.supported.by.spec) 'import_supported.by.spec_lib.dart'
as from_supported_by_target;
import 'import_default_lib.dart'
if (dart.library.unsupported.by.spec) 'import_unsupported.by.spec_lib.dart'
if (dart.library.unsupported.by.target) 'import_unsupported.by.target_lib.dart'
if (dart.library._unsupported.by.spec_internal) 'import_unsupported.by.spec_internal_lib.dart'
if (dart.library.supported.by.spec) 'import_supported.by.spec_lib.dart'
if (dart.library._supported.by.target) 'import_supported.by.target_lib.dart'
as from_supported_by_spec_last;
expect(expected, actual) {}
main() {}
@@ -0,0 +1,87 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:supported.by.spec" as spec;
import "dart:_supported.by.target" as by_;
import "dart:unsupported.by.spec" as spec2;
import "dart:unsupported.by.target" as tar;
import "dart:_unsupported.by.spec_internal" as spe;
import "import_supported.by.spec_lib.dart" as spe2;
import "import_supported.by.target_lib.dart" as tar2;
import "dart:core" as core;
import "dart:supported.by.spec";
import "dart:unsupported.by.spec";
import "dart:unsupported.by.target";
import "org-dartlang-testcase:///import_supported.by.spec_lib.dart" as from_supported_by_spec_first;
import "org-dartlang-testcase:///import_supported.by.target_lib.dart" as from_supported_by_target;
import "org-dartlang-testcase:///import_supported.by.spec_lib.dart" as from_supported_by_spec_last;
static method main() → dynamic {
spec::supportedBySpec();
by_::supportedByTarget();
spec2::unsupportedBySpec();
tar::unsupportedByTarget();
spe::unsupportedBySpecInternal();
self::expect("supported.by.spec", spe2::field);
self::expect("supported.by.target", tar2::field);
self::expect("supported.by.spec", spe2::field);
self::expect(true, #C1);
self::expect(true, #C1);
self::expect(false, #C2);
self::expect(false, #C2);
self::expect(false, #C2);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual))
throw "Expected ${expected}, actual ${actual}";
}
library dart.supported.by.spec /*isNonNullableByDefault*/;
import self as spec;
import "dart:_supported.by.target" as by_;
additionalExports = (by_::supportedByTarget)
export "dart:_supported.by.target";
static method supportedBySpec() → void {}
library dart.unsupported.by.spec /*isUnsupported,isNonNullableByDefault*/;
import self as spec2;
import "dart:_unsupported.by.spec_internal" as spe;
additionalExports = (spe::unsupportedBySpecInternal)
export "dart:_unsupported.by.spec_internal";
static method unsupportedBySpec() → void {}
library dart.unsupported.by.target /*isNonNullableByDefault*/;
import self as tar;
static method unsupportedByTarget() → void {}
library /*isNonNullableByDefault*/;
import self as spe2;
import "dart:core" as core;
static field core::String field = "supported.by.spec";
library /*isNonNullableByDefault*/;
import self as tar2;
import "dart:core" as core;
static field core::String field = "supported.by.target";
library dart._supported.by_target /*isUnsupported,isNonNullableByDefault*/;
import self as by_;
static method supportedByTarget() → void {}
library dart._unsupported.by.spec_internal /*isUnsupported,isNonNullableByDefault*/;
import self as spe;
static method unsupportedBySpecInternal() → void {}
constants {
#C1 = true
#C2 = false
}
@@ -0,0 +1,87 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:supported.by.spec" as spec;
import "dart:_supported.by.target" as by_;
import "dart:unsupported.by.spec" as spec2;
import "dart:unsupported.by.target" as tar;
import "dart:_unsupported.by.spec_internal" as spe;
import "import_supported.by.spec_lib.dart" as spe2;
import "import_supported.by.target_lib.dart" as tar2;
import "dart:core" as core;
import "dart:supported.by.spec";
import "dart:unsupported.by.spec";
import "dart:unsupported.by.target";
import "org-dartlang-testcase:///import_supported.by.spec_lib.dart" as from_supported_by_spec_first;
import "org-dartlang-testcase:///import_supported.by.target_lib.dart" as from_supported_by_target;
import "org-dartlang-testcase:///import_supported.by.spec_lib.dart" as from_supported_by_spec_last;
static method main() → dynamic {
spec::supportedBySpec();
by_::supportedByTarget();
spec2::unsupportedBySpec();
tar::unsupportedByTarget();
spe::unsupportedBySpecInternal();
self::expect("supported.by.spec", spe2::field);
self::expect("supported.by.target", tar2::field);
self::expect("supported.by.spec", spe2::field);
self::expect(true, #C1);
self::expect(true, #C1);
self::expect(false, #C2);
self::expect(false, #C2);
self::expect(false, #C2);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual))
throw "Expected ${expected}, actual ${actual}";
}
library dart.supported.by.spec /*isNonNullableByDefault*/;
import self as spec;
import "dart:_supported.by.target" as by_;
additionalExports = (by_::supportedByTarget)
export "dart:_supported.by.target";
static method supportedBySpec() → void {}
library dart.unsupported.by.spec /*isUnsupported,isNonNullableByDefault*/;
import self as spec2;
import "dart:_unsupported.by.spec_internal" as spe;
additionalExports = (spe::unsupportedBySpecInternal)
export "dart:_unsupported.by.spec_internal";
static method unsupportedBySpec() → void {}
library dart.unsupported.by.target /*isNonNullableByDefault*/;
import self as tar;
static method unsupportedByTarget() → void {}
library /*isNonNullableByDefault*/;
import self as spe2;
import "dart:core" as core;
static field core::String field = "supported.by.spec";
library /*isNonNullableByDefault*/;
import self as tar2;
import "dart:core" as core;
static field core::String field = "supported.by.target";
library dart._supported.by_target /*isUnsupported,isNonNullableByDefault*/;
import self as by_;
static method supportedByTarget() → void {}
library dart._unsupported.by.spec_internal /*isUnsupported,isNonNullableByDefault*/;
import self as spe;
static method unsupportedBySpecInternal() → void {}
constants {
#C1 = true
#C2 = false
}
@@ -0,0 +1,64 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:supported.by.spec";
import "dart:unsupported.by.spec";
import "dart:unsupported.by.target";
import "org-dartlang-testcase:///import_supported.by.spec_lib.dart" as from_supported_by_spec_first;
import "org-dartlang-testcase:///import_supported.by.target_lib.dart" as from_supported_by_target;
import "org-dartlang-testcase:///import_supported.by.spec_lib.dart" as from_supported_by_spec_last;
static method main() → dynamic
;
static method expect(dynamic expected, dynamic actual) → dynamic
;
library dart.supported.by.spec /*isNonNullableByDefault*/;
import self as self2;
import "dart:_supported.by.target" as by_;
additionalExports = (by_::supportedByTarget)
export "dart:_supported.by.target";
static method supportedBySpec() → void
;
library dart.unsupported.by.spec /*isUnsupported,isNonNullableByDefault*/;
import self as self3;
import "dart:_unsupported.by.spec_internal" as spe;
additionalExports = (spe::unsupportedBySpecInternal)
export "dart:_unsupported.by.spec_internal";
static method unsupportedBySpec() → void
;
library dart.unsupported.by.target /*isNonNullableByDefault*/;
import self as self4;
static method unsupportedByTarget() → void
;
library /*isNonNullableByDefault*/;
import self as self5;
import "dart:core" as core;
static field core::String field;
library /*isNonNullableByDefault*/;
import self as self6;
import "dart:core" as core;
static field core::String field;
library dart._supported.by_target /*isUnsupported,isNonNullableByDefault*/;
import self as by_;
static method supportedByTarget() → void
;
library dart._unsupported.by.spec_internal /*isUnsupported,isNonNullableByDefault*/;
import self as spe;
static method unsupportedBySpecInternal() → void
;
@@ -0,0 +1,87 @@
library /*isNonNullableByDefault*/;
import self as self;
import "dart:supported.by.spec" as spec;
import "dart:_supported.by.target" as by_;
import "dart:unsupported.by.spec" as spec2;
import "dart:unsupported.by.target" as tar;
import "dart:_unsupported.by.spec_internal" as spe;
import "import_supported.by.spec_lib.dart" as spe2;
import "import_supported.by.target_lib.dart" as tar2;
import "dart:core" as core;
import "dart:supported.by.spec";
import "dart:unsupported.by.spec";
import "dart:unsupported.by.target";
import "org-dartlang-testcase:///import_supported.by.spec_lib.dart" as from_supported_by_spec_first;
import "org-dartlang-testcase:///import_supported.by.target_lib.dart" as from_supported_by_target;
import "org-dartlang-testcase:///import_supported.by.spec_lib.dart" as from_supported_by_spec_last;
static method main() → dynamic {
spec::supportedBySpec();
by_::supportedByTarget();
spec2::unsupportedBySpec();
tar::unsupportedByTarget();
spe::unsupportedBySpecInternal();
self::expect("supported.by.spec", spe2::field);
self::expect("supported.by.target", tar2::field);
self::expect("supported.by.spec", spe2::field);
self::expect(true, #C1);
self::expect(true, #C1);
self::expect(false, #C2);
self::expect(false, #C2);
self::expect(false, #C2);
}
static method expect(dynamic expected, dynamic actual) → dynamic {
if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual))
throw "Expected ${expected}, actual ${actual}";
}
library dart.supported.by.spec /*isNonNullableByDefault*/;
import self as spec;
import "dart:_supported.by.target" as by_;
additionalExports = (by_::supportedByTarget)
export "dart:_supported.by.target";
static method supportedBySpec() → void {}
library dart.unsupported.by.spec /*isUnsupported,isNonNullableByDefault*/;
import self as spec2;
import "dart:_unsupported.by.spec_internal" as spe;
additionalExports = (spe::unsupportedBySpecInternal)
export "dart:_unsupported.by.spec_internal";
static method unsupportedBySpec() → void {}
library dart.unsupported.by.target /*isNonNullableByDefault*/;
import self as tar;
static method unsupportedByTarget() → void {}
library /*isNonNullableByDefault*/;
import self as spe2;
import "dart:core" as core;
static field core::String field = "supported.by.spec";
library /*isNonNullableByDefault*/;
import self as tar2;
import "dart:core" as core;
static field core::String field = "supported.by.target";
library dart._supported.by_target /*isUnsupported,isNonNullableByDefault*/;
import self as by_;
static method supportedByTarget() → void {}
library dart._unsupported.by.spec_internal /*isUnsupported,isNonNullableByDefault*/;
import self as spe;
static method unsupportedBySpecInternal() → void {}
constants {
#C1 = true
#C2 = false
}
@@ -0,0 +1,9 @@
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library dart.supported.by.spec;
export 'dart:_supported.by.target';
void supportedBySpec() {}
@@ -0,0 +1,7 @@
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library dart._supported.by_target;
void supportedByTarget() {}
@@ -0,0 +1,7 @@
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library dart._unsupported.by.spec_internal;
void unsupportedBySpecInternal() {}
@@ -0,0 +1,9 @@
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library dart.unsupported.by.spec;
export 'dart:_unsupported.by.spec_internal';
void unsupportedBySpec() {}
@@ -0,0 +1,7 @@
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library dart.unsupported.by.target;
void unsupportedByTarget() {}
@@ -1,7 +1,9 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE.md file.
// @dart=2.9
main() {
print(const bool.fromEnvironment("dart.library.mirrors"));
}
@@ -7,5 +7,5 @@ static method main() → dynamic {
}
constants {
#C1 = false
#C1 = true
}
@@ -7,5 +7,5 @@ static method main() → dynamic {
}
constants {
#C1 = false
#C1 = true
}
@@ -7,5 +7,5 @@ static method main() → dynamic {
}
constants {
#C1 = false
#C1 = true
}
@@ -33,7 +33,6 @@ general/bug30695: TypeCheckError
general/bug31124: RuntimeError
general/call: RuntimeError
general/cascade: RuntimeError
general/conditional_import: RuntimeError # Issue 47814
general/constructor_initializer_invalid: RuntimeError
general/covariant_field: TypeCheckError
general/covariant_generic: RuntimeError
-1
View File
@@ -47,7 +47,6 @@ general/bug30695: TypeCheckError
general/bug31124: RuntimeError # Test has no main method (and we shouldn't add one).
general/call: RuntimeError
general/cascade: RuntimeError
general/conditional_import: RuntimeError # Issue 47814
general/constructor_initializer_invalid: RuntimeError # Fails execution after recovery
general/covariant_field: TypeCheckError
general/covariant_generic: RuntimeError
@@ -832,6 +832,7 @@ class DocTestIncrementalCompiler extends IncrementalCompiler {
loader: loader,
scope: libraryBuilder.scope.createNestedScope("dartdoctest"),
nameOrigin: libraryBuilder,
isUnsupported: false,
);
if (libraryBuilder is DillLibraryBuilder) {
@@ -51,6 +51,10 @@ ArgParser argParser = ArgParser(allowTrailingOptions: true)
..addFlag('aot',
help: 'Run compiler in AOT mode (enables whole-program transformations)',
defaultsTo: false)
..addFlag('support-mirrors',
help: 'Whether dart:mirrors is supported. By default dart:mirrors is '
'supported when --aot and --minimal-kernel are not used.',
defaultsTo: null)
..addFlag('tfa',
help:
'Enable global type flow analysis and related transformations in AOT mode.',
@@ -487,6 +491,18 @@ class FrontendCompiler implements CompilerInterface {
}
}
if (options['support-mirrors'] == true) {
if (options['aot']) {
print('Error: --support-mirrors option cannot be used with --aot');
return false;
}
if (options['minimal-kernel']) {
print('Error: --support-mirrors option cannot be used with '
'--minimal-kernel');
return false;
}
}
if (options['incremental']) {
if (options['from-dill'] != null) {
print('Error: --from-dill option cannot be used with --incremental');
@@ -505,6 +521,8 @@ class FrontendCompiler implements CompilerInterface {
options['target'],
trackWidgetCreation: options['track-widget-creation'],
nullSafety: compilerOptions.nnbdMode == NnbdMode.Strong,
supportMirrors: options['support-mirrors'] ??
!(options['aot'] || options['minimal-kernel']),
);
if (compilerOptions.target == null) {
print('Failed to create front-end target ${options['target']}.');
+2 -2
View File
@@ -147,7 +147,7 @@ type CanonicalName {
type ComponentFile {
UInt32 magic = 0x90ABCDEF;
UInt32 formatVersion = 75;
UInt32 formatVersion = 76;
Byte[10] shortSdkHash;
List<String> problemsAsJson; // Described in problems.md.
Library[] libraries;
@@ -237,7 +237,7 @@ type Name {
}
type Library {
Byte flags (isSynthetic, isNonNullableByDefault, nnbdModeBit1, nnbdModeBit2);
Byte flags (isSynthetic, isNonNullableByDefault, nnbdModeBit1, nnbdModeBit2, isUnsupported);
UInt languageVersionMajor;
UInt languageVersionMinor;
CanonicalNameReference canonicalName;
+8
View File
@@ -273,6 +273,7 @@ class Library extends NamedNode
static const int NonNullableByDefaultFlag = 1 << 1;
static const int NonNullableByDefaultModeBit1 = 1 << 2;
static const int NonNullableByDefaultModeBit2 = 1 << 3;
static const int IsUnsupportedFlag = 1 << 4;
int flags = 0;
@@ -322,6 +323,13 @@ class Library extends NamedNode
}
}
/// If true, the library is not supported through the 'dart.library.*' value
/// used in conditional imports and `bool.fromEnvironment` constants.
bool get isUnsupported => flags & IsUnsupportedFlag != 0;
void set isUnsupported(bool value) {
flags = value ? (flags | IsUnsupportedFlag) : (flags & ~IsUnsupportedFlag);
}
String? name;
/// Problems in this [Library] encoded as json objects.
+1 -1
View File
@@ -176,7 +176,7 @@ class Tag {
/// Internal version of kernel binary format.
/// Bump it when making incompatible changes in kernel binaries.
/// Keep in sync with runtime/vm/kernel_binary.h, pkg/kernel/binary.md.
static const int BinaryFormatVersion = 75;
static const int BinaryFormatVersion = 76;
}
abstract class ConstantTag {
+135 -4
View File
@@ -15,16 +15,20 @@ final List<String> targetNames = targets.keys.toList();
class TargetFlags {
final bool trackWidgetCreation;
final bool enableNullSafety;
final bool supportMirrors;
const TargetFlags(
{this.trackWidgetCreation = false, this.enableNullSafety = false});
{this.trackWidgetCreation = false,
this.enableNullSafety = false,
this.supportMirrors = true});
@override
bool operator ==(other) {
if (identical(this, other)) return true;
return other is TargetFlags &&
trackWidgetCreation == other.trackWidgetCreation &&
enableNullSafety == other.enableNullSafety;
enableNullSafety == other.enableNullSafety &&
supportMirrors == other.supportMirrors;
}
@override
@@ -32,6 +36,7 @@ class TargetFlags {
int hash = 485786;
hash = 0x3fffffff & (hash * 31 + (hash ^ trackWidgetCreation.hashCode));
hash = 0x3fffffff & (hash * 31 + (hash ^ enableNullSafety.hashCode));
hash = 0x3fffffff & (hash * 31 + (hash ^ supportMirrors.hashCode));
return hash;
}
}
@@ -151,6 +156,95 @@ class ConstantsBackend {
bool get keepLocals => false;
}
/// Interface used for determining whether a `dart:*` is considered supported
/// for the current target.
abstract class DartLibrarySupport {
/// Returns `true` if the 'dart:[libraryName]' library is supported.
///
/// [isSupportedBySpec] is `true` if the dart library was supported by the
/// libraries specification.
///
/// This is used to allow AOT to consider `dart:mirrors` as unsupported
/// despite it being supported in the platform dill, and dart2js to consider
/// `dart:_dart2js_runtime_metrics` to be supported despite it being an
/// internal library.
bool computeDartLibrarySupport(String libraryName,
{required bool isSupportedBySpec});
static const String dartLibraryPrefix = "dart.library.";
static bool isDartLibraryQualifier(String dottedName) {
return dottedName.startsWith(dartLibraryPrefix);
}
static String getDartLibraryName(String dottedName) {
assert(isDartLibraryQualifier(dottedName));
return dottedName.substring(dartLibraryPrefix.length);
}
/// Returns `"true"` if the "dart:[libraryName]" is supported and `""`
/// otherwise.
///
/// This is used to determine conditional imports and `bool.fromEnvironment`
/// constant values for "dart.library.[libraryName]" values.
static String getDartLibrarySupportValue(String libraryName,
{required bool libraryExists,
required bool isSynthetic,
required bool isUnsupported,
required DartLibrarySupport dartLibrarySupport}) {
// A `dart:` library can be unsupported for several reasons:
// * If the library doesn't exist from source or from dill, it is not
// supported.
// * If the library has been synthesized, then it doesn't exist, but has
// been synthetically created due to an explicit import or export of it,
// in which case it is also not supported.
// * If the library is marked as not supported in the libraries
// specification, it does exist, but is not supported.
// * If the library is marked as supported in the libraries specification,
// it does exist and is potentially supported. Still the [Target] can
// consider it unsupported. This is for instance used to consider
// `dart:mirrors` as unsupported in AOT. The platform dill is shared with
// JIT, so the library exists and is marked as supported, but for AOT
// compilation it is still unsupported.
bool isSupported = libraryExists && !isSynthetic && !isUnsupported;
isSupported = dartLibrarySupport.computeDartLibrarySupport(libraryName,
isSupportedBySpec: isSupported);
return isSupported ? "true" : "";
}
}
/// [DartLibrarySupport] that only relies on the "supported" property of
/// the libraries specification.
class DefaultDartLibrarySupport implements DartLibrarySupport {
const DefaultDartLibrarySupport();
@override
bool computeDartLibrarySupport(String libraryName,
{required bool isSupportedBySpec}) =>
isSupportedBySpec;
}
/// [DartLibrarySupport] that supports overriding `dart:*` library support
/// otherwise defined by the libraries specification.
class CustomizedDartLibrarySupport implements DartLibrarySupport {
final Set<String> supported;
final Set<String> unsupported;
const CustomizedDartLibrarySupport(
{this.supported: const {}, this.unsupported: const {}});
@override
bool computeDartLibrarySupport(String libraryName,
{required bool isSupportedBySpec}) {
if (supported.contains(libraryName)) {
return true;
} else if (unsupported.contains(libraryName)) {
return false;
}
return isSupportedBySpec;
}
}
/// A target provides backend-specific options for generating kernel IR.
abstract class Target {
TargetFlags get flags;
@@ -434,7 +528,7 @@ abstract class Target {
/// Returns the configured component.
Component configureComponent(Component component) => component;
// Configure environment defines in a target-specific way.
/// Configure environment defines in a target-specific way.
Map<String, String> updateEnvironmentDefines(Map<String, String> map) => map;
@override
@@ -453,6 +547,16 @@ abstract class Target {
Class? concreteStringLiteralClass(CoreTypes coreTypes, String value) => null;
ConstantsBackend get constantsBackend;
/// Returns an [DartLibrarySupport] the defines which, if any, of the
/// `dart:` libraries supported in the platform, that should not be
/// considered supported when queried in conditional imports and
/// `bool.fromEnvironment` constants.
///
/// This is used treat `dart:mirrors` as unsupported in AOT but supported
/// in JIT.
DartLibrarySupport get dartLibrarySupport =>
const DefaultDartLibrarySupport();
}
class NoneConstantsBackend extends ConstantsBackend {
@@ -657,6 +761,8 @@ class TestTargetFlags extends TargetFlags {
final bool? forceStaticFieldLoweringForTesting;
final bool? forceNoExplicitGetterCallsForTesting;
final int? forceConstructorTearOffLoweringForTesting;
final Set<String> supportedDartLibraries;
final Set<String> unsupportedDartLibraries;
const TestTargetFlags(
{bool trackWidgetCreation = false,
@@ -665,7 +771,9 @@ class TestTargetFlags extends TargetFlags {
this.forceStaticFieldLoweringForTesting,
this.forceNoExplicitGetterCallsForTesting,
this.forceConstructorTearOffLoweringForTesting,
bool enableNullSafety = false})
bool enableNullSafety = false,
this.supportedDartLibraries: const {},
this.unsupportedDartLibraries: const {}})
: super(
trackWidgetCreation: trackWidgetCreation,
enableNullSafety: enableNullSafety);
@@ -698,6 +806,29 @@ mixin TestTargetMixin on Target {
int get enabledConstructorTearOffLowerings =>
flags.forceConstructorTearOffLoweringForTesting ??
super.enabledConstructorTearOffLowerings;
@override
late final DartLibrarySupport dartLibrarySupport =
new TestDartLibrarySupport(super.dartLibrarySupport, flags);
}
class TestDartLibrarySupport implements DartLibrarySupport {
final DartLibrarySupport delegate;
final TestTargetFlags flags;
TestDartLibrarySupport(this.delegate, this.flags);
@override
bool computeDartLibrarySupport(String libraryName,
{required bool isSupportedBySpec}) {
if (flags.supportedDartLibraries.contains(libraryName)) {
return true;
} else if (flags.unsupportedDartLibraries.contains(libraryName)) {
return false;
}
return delegate.computeDartLibrarySupport(libraryName,
isSupportedBySpec: isSupportedBySpec);
}
}
class TargetWrapper extends Target {
+8 -1
View File
@@ -454,8 +454,15 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
if (name != null) {
writeWord(name);
}
List<String> flags = [];
if (library.isUnsupported) {
flags.add('isUnsupported');
}
if (library.isNonNullableByDefault) {
writeWord("/*isNonNullableByDefault*/");
flags.add('isNonNullableByDefault');
}
if (flags.isNotEmpty) {
writeWord('/*${flags.join(',')}*/');
}
endLine(';');
+28 -7
View File
@@ -77,6 +77,10 @@ void declareCompilerOptions(ArgParser args) {
help:
'Produce kernel file for AOT compilation (enables global transformations).',
defaultsTo: false);
args.addFlag('support-mirrors',
help: 'Whether dart:mirrors is supported. By default dart:mirrors is '
'supported when --aot and --minimal-kernel are not used.',
defaultsTo: null);
args.addOption('depfile', help: 'Path to output Ninja depfile');
args.addOption('from-dill',
help: 'Read existing dill file instead of compiling from sources',
@@ -193,6 +197,7 @@ Future<int> runCompiler(ArgResults options, String usage) async {
final bool splitOutputByPackages = options['split-output-by-packages'];
final String? manifestFilename = options['manifest'];
final String? dataDir = options['component-name'] ?? options['data-dir'];
final bool? supportMirrors = options['support-mirrors'];
final bool minimalKernel = options['minimal-kernel'];
final bool treeShakeWriteOnlyFields = options['tree-shake-write-only-fields'];
@@ -215,6 +220,18 @@ Future<int> runCompiler(ArgResults options, String usage) async {
}
}
if (supportMirrors == true) {
if (aot) {
print('Error: --support-mirrors option cannot be used with --aot');
return badUsageExitCode;
}
if (minimalKernel) {
print('Error: --support-mirrors option cannot be used with '
'--minimal-kernel');
return badUsageExitCode;
}
}
final fileSystem =
createFrontEndFileSystem(fileSystemScheme, fileSystemRoots);
@@ -258,11 +275,10 @@ Future<int> runCompiler(ArgResults options, String usage) async {
await autoDetectNullSafetyMode(mainUri, compilerOptions);
}
compilerOptions.target = createFrontEndTarget(
targetName,
trackWidgetCreation: options['track-widget-creation'],
nullSafety: compilerOptions.nnbdMode == NnbdMode.Strong,
);
compilerOptions.target = createFrontEndTarget(targetName,
trackWidgetCreation: options['track-widget-creation'],
nullSafety: compilerOptions.nnbdMode == NnbdMode.Strong,
supportMirrors: supportMirrors ?? !(aot || minimalKernel));
if (compilerOptions.target == null) {
print('Failed to create front-end target $targetName.');
return badUsageExitCode;
@@ -442,6 +458,7 @@ Future runGlobalTransformations(
{bool minimalKernel: false,
bool treeShakeWriteOnlyFields: false,
bool useRapidTypeAnalysis: true}) async {
assert(!target.flags.supportMirrors);
if (errorDetector.hasCompilationErrors) return;
final coreTypes = new CoreTypes(component);
@@ -585,12 +602,16 @@ Future<void> autoDetectNullSafetyMode(
/// Create front-end target with given name.
Target? createFrontEndTarget(String targetName,
{bool trackWidgetCreation = false, bool nullSafety = false}) {
{bool trackWidgetCreation = false,
bool nullSafety = false,
bool supportMirrors = true}) {
// Make sure VM-specific targets are available.
installAdditionalTargets();
final TargetFlags targetFlags = new TargetFlags(
trackWidgetCreation: trackWidgetCreation, enableNullSafety: nullSafety);
trackWidgetCreation: trackWidgetCreation,
enableNullSafety: nullSafety,
supportMirrors: supportMirrors);
return getTarget(targetName, targetFlags);
}
+5 -12
View File
@@ -500,18 +500,11 @@ class VmTarget extends Target {
// TODO(alexmarkov): Call this from the front-end in order to have
// the same defines when compiling platform.
map['dart.isVM'] = 'true';
// TODO(dartbug.com/36460): Derive dart.library.* definitions from platform.
for (String library in extraRequiredLibraries) {
Uri libraryUri = Uri.parse(library);
if (libraryUri.scheme == 'dart') {
final path = libraryUri.path;
if (!path.startsWith('_')) {
map['dart.library.${path}'] = 'true';
}
}
}
// dart:core is not mentioned in Target.extraRequiredLibraries.
map['dart.library.core'] = 'true';
return map;
}
@override
DartLibrarySupport get dartLibrarySupport => flags.supportMirrors
? const DefaultDartLibrarySupport()
: const CustomizedDartLibrarySupport(unsupported: {'mirrors'});
}
@@ -28,7 +28,7 @@ main() async {
final Uri packagesFile = sdkRootFile('.packages');
final Uri librariesFile = sdkRootFile('sdk/lib/libraries.json');
final vmTarget = VmTarget(TargetFlags());
final vmTarget = VmTarget(TargetFlags(supportMirrors: false));
await withTempDirectory((Uri uri) async {
final mixinFilename = uri.resolve('mixin.dart');
@@ -71,7 +71,7 @@ Future<void> shakeAndRun(Uri source) async {
}
Future<void> compileAOT(Uri source) async {
final target = TestingVmTarget(TargetFlags());
final target = TestingVmTarget(TargetFlags(supportMirrors: false));
Component component =
await compileTestCaseToKernelProgram(source, target: target);
@@ -817,6 +817,7 @@ class LibraryHelper {
kIsNonNullableByDefault = 1 << 1,
kNonNullableByDefaultCompiledModeBit1 = 1 << 2,
kNonNullableByDefaultCompiledModeBit2 = 1 << 3,
kUnsupported = 1 << 4,
};
explicit LibraryHelper(KernelReaderHelper* helper, uint32_t binary_version)
+2 -2
View File
@@ -20,8 +20,8 @@ namespace kernel {
static const uint32_t kMagicProgramFile = 0x90ABCDEFu;
// Both version numbers are inclusive.
static const uint32_t kMinSupportedKernelFormatVersion = 75;
static const uint32_t kMaxSupportedKernelFormatVersion = 75;
static const uint32_t kMinSupportedKernelFormatVersion = 76;
static const uint32_t kMaxSupportedKernelFormatVersion = 76;
// Keep in sync with package:kernel/lib/binary/tag.dart
#define KERNEL_TAG_LIST(V) \