Version 2.15.0-76.0.dev
Merge commit '6d741a6e5b7a2cd30f7d21d6d4e3080a5a32914e' into 'dev'
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
index b55bf87..f6dab0b 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
@@ -110,7 +110,7 @@
documentation:
'Allow constructor tear-offs and explicit generic instantiations.',
experimentalReleaseVersion: null,
- releaseVersion: null,
+ releaseVersion: Version.parse('2.15.0'),
);
static final control_flow_collections = ExperimentalFeature(
@@ -246,7 +246,7 @@
static const bool constant_update_2018 = true;
/// Default state of the experiment "constructor-tearoffs"
- static const bool constructor_tearoffs = false;
+ static const bool constructor_tearoffs = true;
/// Default state of the experiment "control-flow-collections"
static const bool control_flow_collections = true;
diff --git a/pkg/dartdev/lib/src/analysis_server.dart b/pkg/dartdev/lib/src/analysis_server.dart
index a17a169..0d0ce90 100644
--- a/pkg/dartdev/lib/src/analysis_server.dart
+++ b/pkg/dartdev/lib/src/analysis_server.dart
@@ -24,12 +24,14 @@
/// A class to provide an API wrapper around an analysis server process.
class AnalysisServer {
AnalysisServer(
+ this.packagesFile,
this.sdkPath,
this.analysisRoots, {
@required this.commandName,
@required this.argResults,
});
+ final File packagesFile;
final Directory sdkPath;
final List<FileSystemEntity> analysisRoots;
final String commandName;
@@ -85,6 +87,7 @@
'--disable-server-feature-search',
'--sdk',
sdkPath.path,
+ if (packagesFile != null) '--packages=${packagesFile.path}',
];
_process = await startDartProcess(sdk, command);
diff --git a/pkg/dartdev/lib/src/commands/analyze.dart b/pkg/dartdev/lib/src/commands/analyze.dart
index 27fbf53..8664577 100644
--- a/pkg/dartdev/lib/src/commands/analyze.dart
+++ b/pkg/dartdev/lib/src/commands/analyze.dart
@@ -61,6 +61,13 @@
'the file path and error message fields.',
},
hide: !verbose,
+ )
+ ..addOption(
+ 'packages',
+ valueHelp: 'path',
+ help: 'The path to the package resolution configuration file, which '
+ 'supplies a mapping of package names\ninto paths.',
+ hide: !verbose,
);
}
@@ -97,6 +104,7 @@
machineFormat ? null : log.progress('Analyzing $targetsNames');
final AnalysisServer server = AnalysisServer(
+ _packagesFile(),
io.Directory(sdk.sdkPath),
targets,
commandName: 'analyze',
@@ -179,6 +187,19 @@
}
}
+ io.File _packagesFile() {
+ var path = argResults['packages'];
+ if (path is String) {
+ var file = io.File(path);
+ if (!file.existsSync()) {
+ usageException("The file doesn't exist: $path");
+ }
+ return file;
+ } else {
+ return null;
+ }
+ }
+
@visibleForTesting
static void emitDefaultFormat(
Logger log,
@@ -303,13 +324,6 @@
}));
}
- /// Return a relative path if it is a shorter reference than the given dir.
- static String _relativePath(String givenPath, io.Directory fromDir) {
- String fromPath = fromDir?.absolute?.resolveSymbolicLinksSync();
- String relative = path.relative(givenPath, from: fromPath);
- return relative.length <= givenPath.length ? relative : givenPath;
- }
-
@visibleForTesting
static void emitMachineFormat(Logger log, List<AnalysisError> errors) {
for (final AnalysisError error in errors) {
@@ -342,4 +356,11 @@
}
return result.toString();
}
+
+ /// Return a relative path if it is a shorter reference than the given dir.
+ static String _relativePath(String givenPath, io.Directory fromDir) {
+ String fromPath = fromDir?.absolute?.resolveSymbolicLinksSync();
+ String relative = path.relative(givenPath, from: fromPath);
+ return relative.length <= givenPath.length ? relative : givenPath;
+ }
}
diff --git a/pkg/dartdev/lib/src/commands/fix.dart b/pkg/dartdev/lib/src/commands/fix.dart
index b796a20..b19b433 100644
--- a/pkg/dartdev/lib/src/commands/fix.dart
+++ b/pkg/dartdev/lib/src/commands/fix.dart
@@ -90,6 +90,7 @@
'Computing fixes in ${log.ansi.emphasized(projectName)}$modeText');
var server = AnalysisServer(
+ null,
io.Directory(sdk.sdkPath),
[dir],
commandName: 'fix',
diff --git a/pkg/dartdev/test/analysis_server_test.dart b/pkg/dartdev/test/analysis_server_test.dart
index 05f7597..9902dda 100644
--- a/pkg/dartdev/test/analysis_server_test.dart
+++ b/pkg/dartdev/test/analysis_server_test.dart
@@ -24,15 +24,25 @@
tearDown(() => p?.dispose());
test('can start', () async {
- AnalysisServer server = AnalysisServer(io.Directory(sdk.sdkPath), [p.dir],
- commandName: 'testing', argResults: null);
+ AnalysisServer server = AnalysisServer(
+ null,
+ io.Directory(sdk.sdkPath),
+ [p.dir],
+ commandName: 'testing',
+ argResults: null,
+ );
await server.start();
await server.shutdown();
});
test('can send message', () async {
- AnalysisServer server = AnalysisServer(io.Directory(sdk.sdkPath), [p.dir],
- commandName: 'testing', argResults: null);
+ AnalysisServer server = AnalysisServer(
+ null,
+ io.Directory(sdk.sdkPath),
+ [p.dir],
+ commandName: 'testing',
+ argResults: null,
+ );
await server.start();
final response = await server.getVersion();
diff --git a/pkg/dartdev/test/commands/analyze_test.dart b/pkg/dartdev/test/commands/analyze_test.dart
index d2a43e3..ed11a45 100644
--- a/pkg/dartdev/test/commands/analyze_test.dart
+++ b/pkg/dartdev/test/commands/analyze_test.dart
@@ -376,6 +376,54 @@
expect(stdout, contains('referenced_before_declaration'));
});
+ group('--packages', () {
+ test('existing', () {
+ final foo = project(name: 'foo');
+ foo.file('lib/foo.dart', 'var my_foo = 0;');
+
+ p = project(mainSrc: '''
+import 'package:foo/foo.dart';
+void f() {
+ my_foo;
+}''');
+ p.file('my_packages.json', '''
+{
+ "configVersion": 2,
+ "packages": [
+ {
+ "name": "foo",
+ "rootUri": "file://${foo.dirPath}",
+ "packageUri": "lib/",
+ "languageVersion": "2.12"
+ }
+ ]
+}
+''');
+ var result = p.runSync([
+ 'analyze',
+ '--packages=${p.findFile('my_packages.json').path}',
+ p.dirPath,
+ ]);
+
+ expect(result.exitCode, 0);
+ expect(result.stderr, isEmpty);
+ expect(result.stdout, contains('No issues found!'));
+ });
+
+ test('not existing', () {
+ p = project();
+ var result = p.runSync([
+ 'analyze',
+ '--packages=no.such.file',
+ p.dirPath,
+ ]);
+
+ expect(result.exitCode, 64);
+ expect(result.stderr, contains("The file doesn't exist: no.such.file"));
+ expect(result.stderr, contains(_analyzeUsageText));
+ });
+ });
+
group('display mode', () {
final sampleInfoJson = {
'severity': 'INFO',
diff --git a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
index a840db5..ca19764 100644
--- a/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
+++ b/pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart
@@ -88,7 +88,7 @@
ExperimentalFlag.alternativeInvalidationStrategy: false,
ExperimentalFlag.constFunctions: false,
ExperimentalFlag.constantUpdate2018: true,
- ExperimentalFlag.constructorTearoffs: false,
+ ExperimentalFlag.constructorTearoffs: true,
ExperimentalFlag.controlFlowCollections: true,
ExperimentalFlag.extensionMethods: true,
ExperimentalFlag.extensionTypes: false,
diff --git a/runtime/tests/vm/dart/isolates/dart_api_create_lightweight_isolate_test.dart b/runtime/tests/vm/dart/isolates/dart_api_create_lightweight_isolate_test.dart
index f4005be..2fa4962 100644
--- a/runtime/tests/vm/dart/isolates/dart_api_create_lightweight_isolate_test.dart
+++ b/runtime/tests/vm/dart/isolates/dart_api_create_lightweight_isolate_test.dart
@@ -3,7 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
// SharedObjects=ffi_test_functions
-// VMOptions=--no-enable-isolate-groups
+// VMOptions=
// VMOptions=--enable-isolate-groups --disable-heap-verification
import 'dart:async';
diff --git a/runtime/tests/vm/dart_2/isolates/dart_api_create_lightweight_isolate_test.dart b/runtime/tests/vm/dart_2/isolates/dart_api_create_lightweight_isolate_test.dart
index 0a2fd1c..c14ce31 100644
--- a/runtime/tests/vm/dart_2/isolates/dart_api_create_lightweight_isolate_test.dart
+++ b/runtime/tests/vm/dart_2/isolates/dart_api_create_lightweight_isolate_test.dart
@@ -5,7 +5,7 @@
// @dart = 2.9
// SharedObjects=ffi_test_functions
-// VMOptions=--no-enable-isolate-groups
+// VMOptions=
// VMOptions=--enable-isolate-groups --disable-heap-verification
import 'dart:async';
diff --git a/runtime/vm/experimental_features.cc b/runtime/vm/experimental_features.cc
index 680b3ed..5ebf334 100644
--- a/runtime/vm/experimental_features.cc
+++ b/runtime/vm/experimental_features.cc
@@ -18,15 +18,7 @@
bool GetExperimentalFeatureDefault(ExperimentalFeature feature) {
constexpr bool kFeatureValues[] = {
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
+ true, true, true, true, true, true, true, true, true, true,
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureValues));
return kFeatureValues[static_cast<int>(feature)];
@@ -34,15 +26,16 @@
const char* GetExperimentalFeatureName(ExperimentalFeature feature) {
constexpr const char* kFeatureNames[] = {
- "nonfunction-type-aliases",
- "non-nullable",
- "extension-methods",
- "constant-update-2018",
- "control-flow-collections",
- "generic-metadata",
- "set-literals",
- "spread-collections",
- "triple-shift",
+ "nonfunction-type-aliases",
+ "non-nullable",
+ "extension-methods",
+ "constant-update-2018",
+ "control-flow-collections",
+ "generic-metadata",
+ "set-literals",
+ "spread-collections",
+ "triple-shift",
+ "constructor-tearoffs",
};
ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureNames));
return kFeatureNames[static_cast<int>(feature)];
diff --git a/runtime/vm/experimental_features.h b/runtime/vm/experimental_features.h
index f425f1c..c1db176 100644
--- a/runtime/vm/experimental_features.h
+++ b/runtime/vm/experimental_features.h
@@ -23,6 +23,7 @@
set_literals,
spread_collections,
triple_shift,
+ constructor_tearoffs,
};
bool GetExperimentalFeatureDefault(ExperimentalFeature feature);
diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h
index b5f86e7..1e3544d 100644
--- a/runtime/vm/flag_list.h
+++ b/runtime/vm/flag_list.h
@@ -196,7 +196,8 @@
P(retain_code_objects, bool, true, \
"Serialize all code objects even if not otherwise " \
"needed in the precompiled runtime.") \
- P(enable_isolate_groups, bool, true, "Enable isolate group support.") \
+ P(enable_isolate_groups, bool, false, \
+ "Enable isolate group support in AOT.") \
P(show_invisible_frames, bool, false, \
"Show invisible frames in stack traces.") \
D(trace_cha, bool, false, "Trace CHA operations") \
diff --git a/tests/language/constructor/reference_test.dart b/tests/language/constructor/reference_test.dart
index c1b33371..b15338b 100644
--- a/tests/language/constructor/reference_test.dart
+++ b/tests/language/constructor/reference_test.dart
@@ -80,33 +80,27 @@
Foo();
Foo.bar();
Foo.bar.baz();
-// ^
-// [cfe] Member not found: 'bar'.
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
+// [cfe] The method 'baz' isn't defined for the class 'Foo<X> Function<X>()'.
Foo<int>();
Foo<int>.bar();
Foo<int>.bar.baz();
- // ^^^^^
- // [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
- // [cfe] This requires the 'constructor-tearoffs' language feature to be enabled.
- // ^
- // [cfe] Member not found: 'bar'.
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
+ // [cfe] The method 'baz' isn't defined for the class 'Foo<int> Function()'.
Foo.bar<int>();
// ^
// [cfe] A constructor invocation can't have type arguments after the constructor name.
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
Foo.bar<int>.baz();
-// ^
-// [cfe] Couldn't find constructor 'bar'.
// ^^^^^
// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR
+// ^
+// [cfe] The method 'baz' isn't defined for the class 'Foo<int> Function()'.
Foo.bar.baz<int>();
-// ^
-// [cfe] Member not found: 'bar'.
// ^^^
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
+// [cfe] The method 'baz' isn't defined for the class 'Foo<X> Function<X>()'.
}
diff --git a/tools/VERSION b/tools/VERSION
index db0425c..63359a6 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 75
+PRERELEASE 76
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/experimental_features.yaml b/tools/experimental_features.yaml
index 1ea44cc..50a38bb 100644
--- a/tools/experimental_features.yaml
+++ b/tools/experimental_features.yaml
@@ -122,9 +122,6 @@
const-functions:
help: "Allow more of the Dart language to be executed in const expressions."
- constructor-tearoffs:
- help: "Allow constructor tear-offs and explicit generic instantiations."
-
# Experiment flag only used for testing.
test-experiment:
help: >-
@@ -196,3 +193,17 @@
void main() {
if ((A() >>> 1) == 42) print('feature enabled');
}
+
+ constructor-tearoffs:
+ help: "Allow constructor tear-offs and explicit generic instantiations."
+ enabledIn: '2.15.0'
+ validation: |
+ class A {
+ A() {
+ print('feature enabled');
+ }
+ }
+ void main() {
+ var c = A.new;
+ c();
+ }