Version 2.11.0-221.0.dev
Merge commit 'b5fd660dd33c3afae13c70b3f7e9312fcff46ebf' into 'dev'
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 1fc4689..b34e638 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -357,7 +357,8 @@
/// a version that is too low for opting in to the experiment.
bool get enableNonNullableInLibrary => _enableNonNullableInLibrary ??=
loader.target.isExperimentEnabledInLibrary(
- ExperimentalFlag.nonNullable, _packageUri ?? importUri);
+ ExperimentalFlag.nonNullable, _packageUri ?? importUri) &&
+ !isOptOutTest(library.importUri);
Version get enableNonNullableVersionInLibrary =>
_enableNonNullableVersionInLibrary ??= loader.target
@@ -458,8 +459,7 @@
bool _computeIsNonNullableByDefault() =>
enableNonNullableInLibrary &&
- languageVersion.version >= enableNonNullableVersionInLibrary &&
- !isOptOutTest(library.importUri);
+ languageVersion.version >= enableNonNullableVersionInLibrary;
static bool isOptOutTest(Uri uri) {
String path = uri.path;
diff --git a/pkg/front_end/test/enable_non_nullable/data/allowed_package/lib/tests/language_2/implicitly_not_nnbd.dart b/pkg/front_end/test/enable_non_nullable/data/allowed_package/lib/tests/language_2/implicitly_not_nnbd.dart
new file mode 100644
index 0000000..a316359
--- /dev/null
+++ b/pkg/front_end/test/enable_non_nullable/data/allowed_package/lib/tests/language_2/implicitly_not_nnbd.dart
@@ -0,0 +1,18 @@
+// 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.
+
+// Partial copy of tests/language_2/syntax/pre_nnbd_modifiers_test.dart.
+
+class late {
+ int get g => 1;
+}
+
+class required {
+ int get g => 2;
+}
+
+class C {
+ late l = late();
+ required r = required();
+}
diff --git a/pkg/front_end/test/enable_non_nullable/data/main.dart b/pkg/front_end/test/enable_non_nullable/data/main.dart
index cc333b0..5744d19 100644
--- a/pkg/front_end/test/enable_non_nullable/data/main.dart
+++ b/pkg/front_end/test/enable_non_nullable/data/main.dart
@@ -7,11 +7,13 @@
import 'package:allowed_package/versioned_2_9_lib.dart';
import 'package:allowed_package/versioned_2_10_lib.dart';
import 'package:allowed_package/versioned_2_11_lib.dart';
+import 'package:allowed_package/tests/language_2/implicitly_not_nnbd.dart';
import 'package:not_allowed_package/unversioned_lib.dart';
import 'package:not_allowed_package/versioned_2_8_lib.dart';
import 'package:not_allowed_package/versioned_2_9_lib.dart';
import 'package:not_allowed_package/versioned_2_10_lib.dart';
import 'package:not_allowed_package/versioned_2_11_lib.dart';
+import 'package:not_allowed_package/tests/language_2/implicitly_not_nnbd.dart';
import 'unversioned_lib.dart';
import 'versioned_2_8_lib.dart';
import 'versioned_2_9_lib.dart';
diff --git a/pkg/front_end/test/enable_non_nullable/data/not_allowed_package/lib/tests/language_2/implicitly_not_nnbd.dart b/pkg/front_end/test/enable_non_nullable/data/not_allowed_package/lib/tests/language_2/implicitly_not_nnbd.dart
new file mode 100644
index 0000000..a316359
--- /dev/null
+++ b/pkg/front_end/test/enable_non_nullable/data/not_allowed_package/lib/tests/language_2/implicitly_not_nnbd.dart
@@ -0,0 +1,18 @@
+// 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.
+
+// Partial copy of tests/language_2/syntax/pre_nnbd_modifiers_test.dart.
+
+class late {
+ int get g => 1;
+}
+
+class required {
+ int get g => 2;
+}
+
+class C {
+ late l = late();
+ required r = required();
+}
diff --git a/pkg/front_end/test/enable_non_nullable/enable_non_nullable_test.dart b/pkg/front_end/test/enable_non_nullable/enable_non_nullable_test.dart
index d6feb1d..96722a8 100644
--- a/pkg/front_end/test/enable_non_nullable/enable_non_nullable_test.dart
+++ b/pkg/front_end/test/enable_non_nullable/enable_non_nullable_test.dart
@@ -10,6 +10,7 @@
import 'package:front_end/src/api_prototype/kernel_generator.dart';
import 'package:front_end/src/api_prototype/language_version.dart';
import 'package:front_end/src/compute_platform_binaries_location.dart';
+import 'package:front_end/src/fasta/source/source_library_builder.dart';
import 'package:kernel/ast.dart';
/// The version used in this test as the experiment release version.
@@ -83,11 +84,18 @@
ExperimentalFlag.nonNullable: experimentEnabledVersion
};
+ bool hadDiagnostic = false;
+ options.onDiagnostic = (DiagnosticMessage message) {
+ hadDiagnostic = true;
+ };
+
Directory directory = new Directory.fromUri(
Uri.base.resolve('pkg/front_end/test/enable_non_nullable/data/'));
CompilerResult result = await kernelForProgramInternal(
directory.uri.resolve('main.dart'), options,
retainDataForTesting: true);
+ Expect.isFalse(
+ hadDiagnostic, "Compilation had diagnostics (errors, warnings)!");
for (Library library in result.component.libraries) {
if (library.importUri.scheme != 'dart') {
bool usesLegacy =
@@ -112,7 +120,8 @@
" (package) uri=${versionAndPackageUri.packageUri}");
Expect.isTrue(
library.languageVersion < versionImpliesOptIn ||
- library.isNonNullableByDefault,
+ library.isNonNullableByDefault ||
+ SourceLibraryBuilder.isOptOutTest(library.fileUri),
"Expected library ${library.importUri} with version "
"${library.languageVersion} to be opted in.");
Expect.isTrue(
@@ -120,7 +129,8 @@
!versionAndPackageUri.packageUri.path
.startsWith('allowed_package') ||
library.languageVersion < versionOptsInAllowed ||
- library.isNonNullableByDefault,
+ library.isNonNullableByDefault ||
+ SourceLibraryBuilder.isOptOutTest(library.fileUri),
"Expected allowed library ${library.importUri} with version "
"${library.languageVersion} to be opted in.");
}
diff --git a/pkg/front_end/testcases/old_dills/dills/dart2js.version.46.compile.1.dill b/pkg/front_end/testcases/old_dills/dills/dart2js.version.46.compile.1.dill
deleted file mode 100644
index d766ad5..0000000
--- a/pkg/front_end/testcases/old_dills/dills/dart2js.version.46.compile.1.dill
+++ /dev/null
Binary files differ
diff --git a/tools/VERSION b/tools/VERSION
index 2ebd798..ba84698 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 11
PATCH 0
-PRERELEASE 220
+PRERELEASE 221
PRERELEASE_PATCH 0
\ No newline at end of file