Version 2.11.0-180.0.dev
Merge commit '33044ddd9a678c784ed7376e294be50f22a1efc2' into 'dev'
diff --git a/DEPS b/DEPS
index 04bcae2..87d2db4 100644
--- a/DEPS
+++ b/DEPS
@@ -79,7 +79,7 @@
"collection_rev": "52e219581f72a3eac013d6f5550c580962677425",
"convert_rev": "c1b01f832835d3d8a06b0b246a361c0eaab35d3c",
"crypto_rev": "f7c48b334b1386bc5ab0f706fbcd6df8496a87fc",
- "csslib_rev": "681a6603f86bbbe64e8af42d722aef63b028d241",
+ "csslib_rev": "6f77b3dcee957d3e2d5083f666221a220e9ed1f1",
"dart2js_info_rev" : "0632a623b08e1f601c7eba99e0186a581ae799e9",
# Note: Updates to dart_style have to be coordinated with the infrastructure
@@ -106,7 +106,7 @@
"http_multi_server_rev" : "ea269f79321d659208402088f3297e8920a88ee6",
"http_parser_rev": "6e63a97b5aaa2b4d1215fe01683e51fb73258e54",
"http_retry_tag": "0.1.1",
- "http_rev": "7b55a2c62a5f6fb680ad7a4607bab7281a235563",
+ "http_rev": "ca418355b5fc60cf981de3bd7364ec0dd943fa8f",
"http_throttle_tag" : "1.0.2",
"icu_rev" : "79326efe26e5440f530963704c3c0ff965b3a4ac",
"idl_parser_rev": "5fb1ebf49d235b5a70c9f49047e83b0654031eb7",
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index e7879c4..ddfa135 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -66,6 +66,7 @@
}
}
```
+
### Definite assignment
Definite assignment analysis is the process of determining, for each local
@@ -86,12 +87,12 @@
```dart
void f() {
- late String s;
+ String s;
print(s);
}
```
-But in the following code, the variable `s` is definitely assigned:
+But in the following code, the variable `s` is definitely assigned:
```dart
void f(String name) {
@@ -109,7 +110,7 @@
```dart
void f(String name, bool casual) {
- late String s;
+ String s;
if (casual) {
s = 'Hi $name!';
} else {
@@ -132,7 +133,7 @@
```dart
void f(String name, bool casual) {
- late String s;
+ String s;
if (casual) {
s = 'Hi $name!';
}
diff --git a/pkg/analyzer/tool/diagnostics/generate.dart b/pkg/analyzer/tool/diagnostics/generate.dart
index 74a9b8e..b3401a9 100644
--- a/pkg/analyzer/tool/diagnostics/generate.dart
+++ b/pkg/analyzer/tool/diagnostics/generate.dart
@@ -451,6 +451,7 @@
}
}
```
+
### Definite assignment
Definite assignment analysis is the process of determining, for each local
diff --git a/pkg/compiler/lib/src/kernel/loader.dart b/pkg/compiler/lib/src/kernel/loader.dart
index 67a549e..496d69b 100644
--- a/pkg/compiler/lib/src/kernel/loader.dart
+++ b/pkg/compiler/lib/src/kernel/loader.dart
@@ -75,6 +75,7 @@
var isDill = resolvedUri.path.endsWith('.dill');
void inferNullSafetyMode(bool isSound) {
+ if (isSound) assert(_options.enableNonNullable);
if (_options.nullSafetyMode == NullSafetyMode.unspecified) {
_options.nullSafetyMode =
isSound ? NullSafetyMode.sound : NullSafetyMode.unsound;
@@ -83,6 +84,9 @@
void validateNullSafety() {
assert(_options.nullSafetyMode != NullSafetyMode.unspecified);
+ if (_options.nullSafetyMode == NullSafetyMode.sound) {
+ assert(_options.enableNonNullable);
+ }
}
if (isDill) {
@@ -146,7 +150,7 @@
..onDiagnostic = onDiagnostic;
bool isLegacy =
await fe.uriUsesLegacyLanguageVersion(resolvedUri, options);
- inferNullSafetyMode(!isLegacy);
+ inferNullSafetyMode(_options.enableNonNullable && !isLegacy);
List<Uri> dependencies = [];
if (_options.platformBinaries != null) {
@@ -157,13 +161,6 @@
dependencies.addAll(_options.dillDependencies);
}
- fe.NnbdMode nnbdMode;
- if (_options.enableNonNullable) {
- nnbdMode = _options.useLegacySubtyping
- ? fe.NnbdMode.Weak
- : fe.NnbdMode.Strong;
- }
-
initializedCompilerState = fe.initializeCompiler(
initializedCompilerState,
target,
@@ -171,7 +168,9 @@
dependencies,
_options.packageConfig,
experimentalFlags: _options.languageExperiments,
- nnbdMode: nnbdMode);
+ nnbdMode: _options.useLegacySubtyping
+ ? fe.NnbdMode.Weak
+ : fe.NnbdMode.Strong);
component = await fe.compile(initializedCompilerState, verbose,
fileSystem, onDiagnostic, resolvedUri);
if (component == null) return null;
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index f11a3bb..6d336a5 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -368,7 +368,7 @@
bool get useLegacySubtyping {
assert(nullSafetyMode != NullSafetyMode.unspecified,
"Null safety mode unspecified");
- return nullSafetyMode == NullSafetyMode.unsound;
+ return !enableNonNullable || (nullSafetyMode == NullSafetyMode.unsound);
}
/// The path to the file that contains the profiled allocations.
diff --git a/pkg/compiler/lib/src/serialization/task.dart b/pkg/compiler/lib/src/serialization/task.dart
index f329a54..8a081d7 100644
--- a/pkg/compiler/lib/src/serialization/task.dart
+++ b/pkg/compiler/lib/src/serialization/task.dart
@@ -113,6 +113,7 @@
}
if (component.mode == ir.NonNullableByDefaultCompiledMode.Strong) {
+ assert(_options.enableNonNullable);
_options.nullSafetyMode = NullSafetyMode.sound;
} else {
_options.nullSafetyMode = NullSafetyMode.unsound;
diff --git a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart
index cb832e0..3738a3d 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/runtime.dart
@@ -179,8 +179,8 @@
/// A list of functions to reset static fields back to their uninitialized
/// state.
///
-/// This is populated by [defineLazyField], and only contains the list of fields
-/// that have actually been initialized.
+/// This is populated by [defineLazyField] and [LazyJSType] and only contains
+/// fields that have been initialized.
@notNull
final List<void Function()> _resetFields = JS('', '[]');
diff --git a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
index acb1615..31e7e91 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/types.dart
@@ -177,7 +177,7 @@
/// we disable type checks for in these cases, and allow any JS object to work
/// as if it were an instance of this JS type.
class LazyJSType extends DartType {
- Function()? _getRawJSTypeFn;
+ Function() _getRawJSTypeFn;
@notNull
final String _dartName;
Object? _rawJSType;
@@ -199,14 +199,14 @@
// overhead, especially if exceptions are being thrown. Also it means the
// behavior of a given type check can change later on.
try {
- raw = _getRawJSTypeFn!();
+ raw = _getRawJSTypeFn();
} catch (e) {}
if (raw == null) {
_warn('Cannot find native JavaScript type ($_dartName) for type check');
} else {
_rawJSType = raw;
- _getRawJSTypeFn = null; // Free the function that computes the JS type.
+ JS('', '#.push(() => # = null)', _resetFields, _rawJSType);
}
return raw;
}
diff --git a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
index 4c7f5c5..228fc3a 100644
--- a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
@@ -41,7 +41,8 @@
{bool paused = false,
bool errorsAreFatal = true,
SendPort? onExit,
- SendPort? onError}) {
+ SendPort? onError,
+ String? debugName}) {
throw new UnsupportedError("Isolate.spawn");
}
diff --git a/tests/dartdevc/hot_restart_js_interop_test.dart b/tests/dartdevc/hot_restart_js_interop_test.dart
new file mode 100644
index 0000000..e3899df
--- /dev/null
+++ b/tests/dartdevc/hot_restart_js_interop_test.dart
@@ -0,0 +1,51 @@
+// Copyright (c) 2020, 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.
+
+// Tests that JS interop works with hot restart.
+
+// Requirements=nnbd
+
+@JS()
+library hot_restart_js_interop_test;
+
+import 'dart:js' show context;
+import 'dart:js_util';
+import 'dart:_foreign_helper' as helper show JS;
+import 'dart:_runtime' as dart;
+
+import 'package:expect/expect.dart';
+import 'package:js/js.dart';
+
+@JS()
+external void eval(String code);
+
+@JS('window.MyClass')
+class MyClass {
+ external MyClass();
+}
+
+abstract class Wrapper<T> {
+ T? rawObject;
+
+ Wrapper() {
+ final T defaultObject = createDefault();
+ rawObject = defaultObject;
+ }
+
+ T createDefault();
+}
+
+class WrappedClass extends Wrapper<MyClass> {
+ @override
+ MyClass createDefault() => MyClass();
+}
+
+void main() {
+ // See: https://github.com/flutter/flutter/issues/66361
+ eval("self.MyClass = function MyClass() {}");
+ var c = WrappedClass();
+ dart.hotRestart();
+ eval("self.MyClass = function MyClass() {}");
+ c = WrappedClass();
+}
diff --git a/tools/VERSION b/tools/VERSION
index 783db65..e19680c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 11
PATCH 0
-PRERELEASE 179
+PRERELEASE 180
PRERELEASE_PATCH 0
\ No newline at end of file