Version 2.14.0-48.0.dev
Merge commit 'ac2cd2d73cbd470445be789784f9a30c6927a873' into 'dev'
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index b1cb812..eed68f4 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -7277,6 +7277,15 @@
r"""Try removing the other directives, or moving them to the library for which this is a part.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeNonPositiveArrayDimensions =
+ messageNonPositiveArrayDimensions;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageNonPositiveArrayDimensions = const MessageCode(
+ "NonPositiveArrayDimensions",
+ message: r"""Array dimensions must be positive numbers.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)>
templateNonSimpleBoundViaReference =
const Template<Message Function(String name)>(
diff --git a/pkg/compiler/lib/src/js_emitter/headers.dart b/pkg/compiler/lib/src/js_emitter/headers.dart
index 08fd664a..9953606 100644
--- a/pkg/compiler/lib/src/js_emitter/headers.dart
+++ b/pkg/compiler/lib/src/js_emitter/headers.dart
@@ -27,11 +27,12 @@
// directly. Instead, a closure that will invoke [main], and its arguments
// [args] is passed to [dartMainRunner].
//
-// dartDeferredLibraryLoader(uri, successCallback, errorCallback):
+// dartDeferredLibraryLoader(uri, successCallback, errorCallback, loadId):
// if this function is defined, it will be called when a deferred library
// is loaded. It should load and eval the javascript of `uri`, and call
// successCallback. If it fails to do so, it should call errorCallback with
-// an error.
+// an error. The loadId argument is the deferred import that resulted in
+// this uri being loaded.
//
// dartCallInstrumentation(id, qualifiedName):
// if this function is defined, it will be called at each entry of a
diff --git a/pkg/front_end/lib/src/api_unstable/vm.dart b/pkg/front_end/lib/src/api_unstable/vm.dart
index bf01283..b2250cf 100644
--- a/pkg/front_end/lib/src/api_unstable/vm.dart
+++ b/pkg/front_end/lib/src/api_unstable/vm.dart
@@ -53,6 +53,7 @@
messageFfiExceptionalReturnNull,
messageFfiExpectedConstant,
messageFfiPackedAnnotationAlignment,
+ messageNonPositiveArrayDimensions,
noLength,
templateFfiDartTypeMismatch,
templateFfiEmptyStruct,
diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status
index 23e753f..9c7263d 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -606,6 +606,7 @@
NonNullableOptOutImplicit/example: Fail
NonPartOfDirectiveInPart/part_wrapped_script1: Fail
NonPartOfDirectiveInPart/script1: Fail
+NonPositiveArrayDimensions/analyzerCode: Fail
NotAConstantExpression/example: Fail
NotAType/example: Fail
NotAnLvalue/example: Fail
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index e5d851a..82ad1a1 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -4646,6 +4646,11 @@
<int>[...null];
}
+NonPositiveArrayDimensions:
+ # Used by dart:ffi
+ template: "Array dimensions must be positive numbers."
+ external: test/ffi_test.dart
+
InvalidTypeVariableInSupertype:
template: "Can't use implicitly 'out' variable '#name' in an '#string2' position in supertype '#name2'."
script: >
diff --git a/pkg/vm/lib/transformations/ffi_definitions.dart b/pkg/vm/lib/transformations/ffi_definitions.dart
index 6dc8a46..beed450 100644
--- a/pkg/vm/lib/transformations/ffi_definitions.dart
+++ b/pkg/vm/lib/transformations/ffi_definitions.dart
@@ -9,6 +9,7 @@
import 'package:front_end/src/api_unstable/vm.dart'
show
messageFfiPackedAnnotationAlignment,
+ messageNonPositiveArrayDimensions,
templateFfiEmptyStruct,
templateFfiFieldAnnotation,
templateFfiFieldNull,
@@ -323,7 +324,8 @@
compoundClassDependencies[node].add(clazz);
_checkPacking(node, packing, clazz, f);
}
- if (arrayDimensions(type) != sizeAnnotations.single.length) {
+ final dimensions = sizeAnnotations.single;
+ if (arrayDimensions(type) != dimensions.length) {
diagnosticReporter.report(
templateFfiSizeAnnotationDimensions
.withArguments(f.name.text),
@@ -331,6 +333,15 @@
f.name.text.length,
f.fileUri);
}
+ for (var dimension in dimensions) {
+ if (dimension < 0) {
+ diagnosticReporter.report(
+ messageNonPositiveArrayDimensions, f.fileOffset,
+ f.name.text.length,
+ f.fileUri);
+ success = false;
+ }
+ }
} else {
diagnosticReporter.report(
templateFfiSizeAnnotation.withArguments(f.name.text),
@@ -478,8 +489,8 @@
final sizeAnnotations = _getArraySizeAnnotations(m).toList();
if (sizeAnnotations.length == 1) {
final arrayDimensions = sizeAnnotations.single;
- type = NativeTypeCfe(this, dartType,
- compoundCache: compoundCache, arrayDimensions: arrayDimensions);
+ type = NativeTypeCfe(this, dartType, compoundCache: compoundCache,
+ arrayDimensions: arrayDimensions);
}
} else if (isPointerType(dartType) || isCompoundSubtype(dartType)) {
type = NativeTypeCfe(this, dartType, compoundCache: compoundCache);
@@ -749,7 +760,7 @@
abstract class NativeTypeCfe {
factory NativeTypeCfe(FfiTransformer transformer, DartType dartType,
{List<int> arrayDimensions,
- Map<Class, CompoundNativeTypeCfe> compoundCache = const {}}) {
+ Map<Class, CompoundNativeTypeCfe> compoundCache = const {}}) {
if (transformer.isPrimitiveType(dartType)) {
final clazz = (dartType as InterfaceType).classNode;
final nativeType = transformer.getType(clazz);
@@ -772,7 +783,7 @@
}
final elementType = transformer.arraySingleElementType(dartType);
final elementCfeType =
- NativeTypeCfe(transformer, elementType, compoundCache: compoundCache);
+ NativeTypeCfe(transformer, elementType, compoundCache: compoundCache);
return ArrayNativeTypeCfe.multi(elementCfeType, arrayDimensions);
}
throw "Invalid type $dartType";
@@ -1135,8 +1146,8 @@
ArrayNativeTypeCfe(this.elementType, this.length);
- factory ArrayNativeTypeCfe.multi(
- NativeTypeCfe elementType, List<int> dimensions) {
+ factory ArrayNativeTypeCfe.multi(NativeTypeCfe elementType,
+ List<int> dimensions) {
if (dimensions.length == 1) {
return ArrayNativeTypeCfe(elementType, dimensions.single);
}
diff --git a/runtime/observatory/BUILD.gn b/runtime/observatory/BUILD.gn
index 022498e..80b6d6e 100644
--- a/runtime/observatory/BUILD.gn
+++ b/runtime/observatory/BUILD.gn
@@ -21,19 +21,7 @@
outputs += [ "$target_gen_dir/observatory/web/main.dart.js.map" ]
}
- version_string = exec_script("../../tools/make_version.py",
- [
- "--quiet",
- "--no_git_hash",
- ], # Arguments to the script
- "trim string", # Input conversions
- [
- "../../tools/VERSION",
- "../tools/utils.py",
- ]) # Dependencies
-
args = [
- "-DOBS_VER=${version_string}",
"-o",
rebase_path(output),
"--packages=" + rebase_path("../../.packages"),
diff --git a/runtime/observatory/tests/service/bad_reload_test.dart b/runtime/observatory/tests/service/bad_reload_test.dart
index eb40b71..3825f85 100644
--- a/runtime/observatory/tests/service/bad_reload_test.dart
+++ b/runtime/observatory/tests/service/bad_reload_test.dart
@@ -2,6 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// OtherResources=bad_reload/v1/main.dart
+// OtherResources=bad_reload/v2/main.dart
+
import 'test_helper.dart';
import 'dart:async';
import 'dart:developer';
@@ -37,6 +40,14 @@
return result.valueAsString as String;
}
+Future<void> invokeTestWithError(Isolate isolate) async {
+ await isolate.reload();
+ Library lib = isolate.rootLibrary;
+ await lib.load();
+ final result = await lib.evaluate('test()');
+ expect(result.isError, isTrue);
+}
+
var tests = <IsolateTest>[
// Stopped at 'debugger' statement.
hasStoppedAtBreakpoint,
@@ -65,14 +76,13 @@
);
// Observe that it failed.
expect(response['success'], isFalse);
- List notices = response['details']['notices'];
+ List notices = response['notices'];
expect(notices.length, equals(1));
Map<String, dynamic> reasonForCancelling = notices[0];
expect(reasonForCancelling['type'], equals('ReasonForCancelling'));
expect(reasonForCancelling['message'], contains('library_isnt_here_man'));
- String v2 = await invokeTest(spawnedIsolate);
- expect(v2, 'apple');
+ await invokeTestWithError(spawnedIsolate);
}
];
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index a06ae74..62bdfcc 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -7,7 +7,6 @@
[ $compiler == app_jitk ]
add_breakpoint_rpc_kernel_test: SkipByDesign # No incremental compiler available.
async_generator_breakpoint_test: SkipByDesign # No incremental compiler available.
-bad_reload_test: RuntimeError
break_on_activation_test: SkipByDesign # No incremental compiler available.
complex_reload_test: RuntimeError
debugger_inspect_test: SkipByDesign # No incremental compiler available.
@@ -24,7 +23,6 @@
sigquit_starts_service_test: SkipByDesign # Spawns a secondary process using Platform.executable.
[ $compiler == dartk ]
-bad_reload_test: RuntimeError # Issue 34025
coverage_optimized_function_test: Pass, Slow
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
diff --git a/runtime/observatory_2/BUILD.gn b/runtime/observatory_2/BUILD.gn
index 1762e1a..412e378 100644
--- a/runtime/observatory_2/BUILD.gn
+++ b/runtime/observatory_2/BUILD.gn
@@ -21,19 +21,7 @@
outputs += [ "$target_gen_dir/observatory/web/main.dart.js.map" ]
}
- version_string = exec_script("../../tools/make_version.py",
- [
- "--quiet",
- "--no_git_hash",
- ], # Arguments to the script
- "trim string", # Input conversions
- [
- "../../tools/VERSION",
- "../tools/utils.py",
- ]) # Dependencies
-
args = [
- "-DOBS_VER=${version_string}",
"-o",
rebase_path(output),
"--packages=" + rebase_path("../../.packages"),
diff --git a/runtime/observatory_2/lib/src/app/analytics.dart b/runtime/observatory_2/lib/src/app/analytics.dart
deleted file mode 100644
index a34c2da..0000000
--- a/runtime/observatory_2/lib/src/app/analytics.dart
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2015, 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.
-
-part of app;
-
-// TODO(eernst): Use 'bool.fromEnvironment' below when possible;
-// for now we use a dual `defaultValue` rewrite.
-const _obsVer = (String.fromEnvironment('OBS_VER', defaultValue: '1') ==
- String.fromEnvironment('OBS_VER', defaultValue: '2'))
- ? String.fromEnvironment('OBS_VER')
- : null;
-
-class Analytics {
- static final _UA = 'UA-26406144-17';
- static final _name = 'Observatory';
- static final _version = _obsVer;
- static final _googleAnalytics = new AnalyticsHtml(_UA, _name, _version);
-
- static initialize() {
- // We only send screen views. This is allowed without user permission.
- // Note, before flipping this to be true we need a UI to allow users to
- // control this.
- _googleAnalytics.analyticsOpt = AnalyticsOpt.optOut;
- }
-
- /// Called whenever an Observatory page is viewed.
- static Future reportPageView(Uri uri) {
- // Only report analytics when running in JavaScript.
- if (Utils.runningInJavaScript()) {
- // The screen name is the uri's path. e.g. inspect, profile.
- final screenName = uri.path;
- return _googleAnalytics.sendScreenView(screenName);
- } else {
- return new Future.value(null);
- }
- }
-}
diff --git a/runtime/observatory_2/observatory_sources.gni b/runtime/observatory_2/observatory_sources.gni
index 9ad1b96..7bf2bbb 100644
--- a/runtime/observatory_2/observatory_sources.gni
+++ b/runtime/observatory_2/observatory_sources.gni
@@ -66,6 +66,7 @@
"lib/src/elements/helpers/nav_menu.dart",
"lib/src/elements/helpers/rendering_queue.dart",
"lib/src/elements/helpers/rendering_scheduler.dart",
+ "lib/src/elements/helpers/tag.dart",
"lib/src/elements/helpers/uris.dart",
"lib/src/elements/icdata_ref.dart",
"lib/src/elements/icdata_view.dart",
diff --git a/runtime/observatory_2/tests/service_2/bad_reload_test.dart b/runtime/observatory_2/tests/service_2/bad_reload_test.dart
index 1aad2dc..0dab172 100644
--- a/runtime/observatory_2/tests/service_2/bad_reload_test.dart
+++ b/runtime/observatory_2/tests/service_2/bad_reload_test.dart
@@ -2,6 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// OtherResources=bad_reload/v1/main.dart
+// OtherResources=bad_reload/v2/main.dart
+
import 'test_helper.dart';
import 'dart:async';
import 'dart:developer';
@@ -37,6 +40,14 @@
return result.valueAsString;
}
+Future<void> invokeTestWithError(Isolate isolate) async {
+ await isolate.reload();
+ Library lib = isolate.rootLibrary;
+ await lib.load();
+ final result = await lib.evaluate('test()');
+ expect(result.isError, isTrue);
+}
+
var tests = <IsolateTest>[
// Stopped at 'debugger' statement.
hasStoppedAtBreakpoint,
@@ -65,14 +76,13 @@
);
// Observe that it failed.
expect(response['success'], isFalse);
- List notices = response['details']['notices'];
+ List notices = response['notices'];
expect(notices.length, equals(1));
Map<String, dynamic> reasonForCancelling = notices[0];
expect(reasonForCancelling['type'], equals('ReasonForCancelling'));
expect(reasonForCancelling['message'], contains('library_isnt_here_man'));
- String v2 = await invokeTest(spawnedIsolate);
- expect(v2, 'apple');
+ await invokeTestWithError(spawnedIsolate);
}
];
diff --git a/runtime/observatory_2/tests/service_2/service_2_kernel.status b/runtime/observatory_2/tests/service_2/service_2_kernel.status
index a06ae74..62bdfcc 100644
--- a/runtime/observatory_2/tests/service_2/service_2_kernel.status
+++ b/runtime/observatory_2/tests/service_2/service_2_kernel.status
@@ -7,7 +7,6 @@
[ $compiler == app_jitk ]
add_breakpoint_rpc_kernel_test: SkipByDesign # No incremental compiler available.
async_generator_breakpoint_test: SkipByDesign # No incremental compiler available.
-bad_reload_test: RuntimeError
break_on_activation_test: SkipByDesign # No incremental compiler available.
complex_reload_test: RuntimeError
debugger_inspect_test: SkipByDesign # No incremental compiler available.
@@ -24,7 +23,6 @@
sigquit_starts_service_test: SkipByDesign # Spawns a secondary process using Platform.executable.
[ $compiler == dartk ]
-bad_reload_test: RuntimeError # Issue 34025
coverage_optimized_function_test: Pass, Slow
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
diff --git a/runtime/vm/dwarf.cc b/runtime/vm/dwarf.cc
index f940ef7..59d7893 100644
--- a/runtime/vm/dwarf.cc
+++ b/runtime/vm/dwarf.cc
@@ -723,7 +723,7 @@
}
}
-static constexpr char kResolvedFileRoot[] = "file://";
+static constexpr char kResolvedFileRoot[] = "file:///";
static constexpr intptr_t kResolvedFileRootLen = sizeof(kResolvedFileRoot) - 1;
static constexpr char kResolvedSdkRoot[] = "org-dartlang-sdk:///sdk/";
static constexpr intptr_t kResolvedSdkRootLen = sizeof(kResolvedSdkRoot) - 1;
@@ -732,7 +732,11 @@
const intptr_t len = strlen(str);
if (len > kResolvedFileRootLen &&
strncmp(str, kResolvedFileRoot, kResolvedFileRootLen) == 0) {
- return str + kResolvedFileRootLen;
+#if defined(HOST_OS_WINDOWS)
+ return str + kResolvedFileRootLen; // Strip off the entire prefix.
+#else
+ return str + kResolvedFileRootLen - 1; // Leave a '/' on the front.
+#endif
}
if (len > kResolvedSdkRootLen &&
strncmp(str, kResolvedSdkRoot, kResolvedSdkRootLen) == 0) {
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index cfaaeee..3f2302d 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -2736,7 +2736,7 @@
waitingForLoad[i] = false;
return new Future.value();
}
- return _loadHunk(uris[i]).then((Null _) {
+ return _loadHunk(uris[i], loadId).then((Null _) {
waitingForLoad[i] = false;
initializeSomeLoadedHunks();
});
@@ -2833,7 +2833,7 @@
throw new UnsupportedError('Cannot extract URI from "$stack"');
}
-Future<Null> _loadHunk(String hunkName) {
+Future<Null> _loadHunk(String hunkName, String loadId) {
var future = _loadingLibraries[hunkName];
_eventLog.add(' - _loadHunk: $hunkName');
if (future != null) {
@@ -2873,8 +2873,10 @@
if (JS('bool', 'typeof # === "function"', deferredLibraryLoader)) {
try {
- JS('void', '#(#, #, #)', deferredLibraryLoader, uri, jsSuccess,
- jsFailure);
+ // Share the loadId that hunk belongs to, this will allow for any
+ // additional loadId based bundling optimizations.
+ JS('void', '#(#, #, #, #)', deferredLibraryLoader, uri, jsSuccess,
+ jsFailure, loadId);
} catch (error, stackTrace) {
failure(error, "invoking dartDeferredLibraryLoader hook", stackTrace);
}
diff --git a/tests/ffi/vmspecific_static_checks_test.dart b/tests/ffi/vmspecific_static_checks_test.dart
index 72636d8..4998b31 100644
--- a/tests/ffi/vmspecific_static_checks_test.dart
+++ b/tests/ffi/vmspecific_static_checks_test.dart
@@ -760,3 +760,24 @@
external Array<TestStruct1604> //# 1606: compile-time error
nestedLooselyPacked; //# 1606: compile-time error
}
+
+class TestStruct1800 extends Struct {
+ external Pointer<Uint8> notEmpty;
+
+ @Array(-1) //# 1800: compile-time error
+ external Array<Uint8> inlineArray; //# 1800: compile-time error
+}
+
+class TestStruct1801 extends Struct {
+ external Pointer<Uint8> notEmpty;
+
+ @Array(1, -1) //# 1801: compile-time error
+ external Array<Uint8> inlineArray; //# 1801: compile-time error
+}
+
+class TestStruct1802 extends Struct {
+ external Pointer<Uint8> notEmpty;
+
+ @Array.multi([2, 2, 2, 2, 2, 2, -1]) //# 1802: compile-time error
+ external Array<Uint8> inlineArray; //# 1802: compile-time error
+}
\ No newline at end of file
diff --git a/tests/ffi_2/vmspecific_static_checks_test.dart b/tests/ffi_2/vmspecific_static_checks_test.dart
index 48e85b8..a81e206 100644
--- a/tests/ffi_2/vmspecific_static_checks_test.dart
+++ b/tests/ffi_2/vmspecific_static_checks_test.dart
@@ -759,3 +759,24 @@
@Array(2) //# 1606: compile-time error
Array<TestStruct1604> nestedLooselyPacked; //# 1606: compile-time error
}
+
+class TestStruct1800 extends Struct {
+ Pointer<Uint8> notEmpty;
+
+ @Array(-1) //# 1800: compile-time error
+ Array<Uint8> inlineArray; //# 1800: compile-time error
+}
+
+class TestStruct1801 extends Struct {
+ Pointer<Uint8> notEmpty;
+
+ @Array(1, -1) //# 1801: compile-time error
+ Array<Uint8> inlineArray; //# 1801: compile-time error
+}
+
+class TestStruct1802 extends Struct {
+ Pointer<Uint8> notEmpty;
+
+ @Array.multi([2, 2, 2, 2, 2, 2, -1]) //# 1802: compile-time error
+ Array<Uint8> inlineArray; //# 1802: compile-time error
+}
\ No newline at end of file
diff --git a/tools/VERSION b/tools/VERSION
index 1c0c045..c93e31d 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 47
+PRERELEASE 48
PRERELEASE_PATCH 0
\ No newline at end of file