Version 2.17.0-167.0.dev
Merge commit 'f5a44882d6199406180076c095be9729fe9335d1' into 'dev'
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
index 4044e88..de30fd9 100644
--- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -222,7 +222,7 @@
@reflectiveTest
class FileResolverTest extends FileResolutionTest {
@override
- bool typeToStringWithNullability = false;
+ bool isNullSafetyEnabled = false;
test_analysisOptions_default_fromPackageUri() async {
newFile('/workspace/dart/analysis_options/lib/default.yaml', content: r'''
@@ -911,7 +911,7 @@
}
test_nullSafety_enabled() async {
- typeToStringWithNullability = true;
+ isNullSafetyEnabled = true;
newFile('/workspace/dart/test/BUILD', content: r'''
dart_package(
@@ -934,7 +934,7 @@
}
test_nullSafety_notEnabled() async {
- typeToStringWithNullability = true;
+ isNullSafetyEnabled = true;
await assertErrorsInCode(r'''
void f(int? a) {}
diff --git a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
index ce3713b..3ee6a27 100644
--- a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
@@ -701,7 +701,7 @@
}
test_nullAware_context() async {
- var question = typeToStringWithNullability ? '?' : '';
+ var question = isNullSafetyEnabled ? '?' : '';
await assertNoErrorsInCode('''
T f<T>() => throw Error();
g(int$question a) {
@@ -1721,7 +1721,7 @@
}
test_simpleIdentifier_parameter_compound_ifNull() async {
- var question = typeToStringWithNullability ? '?' : '';
+ var question = isNullSafetyEnabled ? '?' : '';
await assertNoErrorsInCode('''
void f(num$question x) {
x ??= 0;
@@ -1747,8 +1747,8 @@
}
test_simpleIdentifier_parameter_compound_ifNull2() async {
- var question = typeToStringWithNullability ? '?' : '';
- var errorOffset = typeToStringWithNullability ? 77 : 76;
+ var question = isNullSafetyEnabled ? '?' : '';
+ var errorOffset = isNullSafetyEnabled ? 77 : 76;
await assertErrorsInCode('''
class A {}
class B extends A {}
@@ -1780,7 +1780,7 @@
}
test_simpleIdentifier_parameter_compound_ifNull_notAssignableType() async {
- var question = typeToStringWithNullability ? '?' : '';
+ var question = isNullSafetyEnabled ? '?' : '';
var code = '''
void f(double$question a, int b) {
a ??= b;
@@ -2294,7 +2294,7 @@
}
test_simpleIdentifier_topGetter_topSetter_compound_ifNull2() async {
- var question = typeToStringWithNullability ? '?' : '';
+ var question = isNullSafetyEnabled ? '?' : '';
await assertErrorsInCode('''
void f() {
x ??= C();
diff --git a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
index c5ad2dc..e3c07756 100644
--- a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
@@ -354,7 +354,7 @@
}
test_ifNull() async {
- var question = typeToStringWithNullability ? '?' : '';
+ var question = isNullSafetyEnabled ? '?' : '';
await assertNoErrorsInCode('''
f(int$question a, double b) {
a ?? b;
diff --git a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
index fd06856..7d4c7a1 100644
--- a/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart
@@ -268,6 +268,9 @@
EnableString.super_parameters,
];
+ @override
+ bool get isNullSafetyEnabled => true;
+
/// The path that is not in [workspaceRootPath], contains external packages.
String get packagesRootPath => '/packages';
@@ -281,9 +284,6 @@
String get testPackageRootPath => '$workspaceRootPath/test';
- @override
- bool get typeToStringWithNullability => true;
-
String get workspaceRootPath => '/home';
@override
@@ -452,10 +452,10 @@
mixin WithoutNullSafetyMixin on PubPackageResolutionTest {
@override
- String? get testPackageLanguageVersion => '2.9';
+ bool get isNullSafetyEnabled => false;
@override
- bool get typeToStringWithNullability => false;
+ String? get testPackageLanguageVersion => '2.9';
}
mixin WithStrictCastsMixin on PubPackageResolutionTest {
diff --git a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
index e843e9c..4068baf 100644
--- a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
@@ -1396,7 +1396,7 @@
}
test_error_prefixIdentifierNotFollowedByDot_deferred() async {
- var question = typeToStringWithNullability ? '?' : '';
+ var question = isNullSafetyEnabled ? '?' : '';
await assertErrorsInCode(r'''
import 'dart:math' deferred as math;
@@ -1588,7 +1588,7 @@
null.foo();
}
''', [
- if (typeToStringWithNullability)
+ if (isNullSafetyEnabled)
error(CompileTimeErrorCode.INVALID_USE_OF_NULL_VALUE, 16, 3)
else
error(CompileTimeErrorCode.UNDEFINED_METHOD, 16, 3),
@@ -2444,7 +2444,7 @@
}
test_namedArgument() async {
- var question = typeToStringWithNullability ? '?' : '';
+ var question = isNullSafetyEnabled ? '?' : '';
await assertNoErrorsInCode('''
void foo({int$question a, bool$question b}) {}
@@ -2636,7 +2636,7 @@
}
test_noReceiver_parameter_call_nullAware() async {
- var question = typeToStringWithNullability ? '?' : '';
+ var question = isNullSafetyEnabled ? '?' : '';
await assertNoErrorsInCode('''
double Function(int)$question foo;
@@ -2646,7 +2646,7 @@
''');
var invocation = findNode.methodInvocation('call(1)');
- if (typeToStringWithNullability) {
+ if (isNullSafetyEnabled) {
assertType(invocation.target, 'double Function(int)?');
} else {
assertTypeLegacy(invocation.target);
diff --git a/pkg/analyzer/test/src/dart/resolution/non_nullable_bazel_workspace_test.dart b/pkg/analyzer/test/src/dart/resolution/non_nullable_bazel_workspace_test.dart
index 65aaa92..7c4aad2 100644
--- a/pkg/analyzer/test/src/dart/resolution/non_nullable_bazel_workspace_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/non_nullable_bazel_workspace_test.dart
@@ -18,7 +18,7 @@
@reflectiveTest
class NonNullableBazelWorkspaceTest extends BazelWorkspaceResolutionTest {
@override
- bool get typeToStringWithNullability => true;
+ bool get isNullSafetyEnabled => true;
test_buildFile_legacy_commentedOut() async {
newFile('$myPackageRootPath/BUILD', content: r'''
diff --git a/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart b/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
index 5b7cc34..89408dc 100644
--- a/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
@@ -437,7 +437,7 @@
class NullableTest extends PubPackageResolutionTest
with WithoutNullSafetyMixin {
@override
- bool get typeToStringWithNullability => true;
+ bool get isNullSafetyEnabled => true;
test_class_hierarchy() async {
await assertNoErrorsInCode('''
diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart
index 99d38f1..9dac30e 100644
--- a/pkg/analyzer/test/src/dart/resolution/resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart
@@ -61,6 +61,8 @@
return !result.libraryElement.isNonNullableByDefault;
}
+ bool get isNullSafetyEnabled => false;
+
ClassElement get listElement => typeProvider.listElement;
ClassElement get mapElement => typeProvider.mapElement;
@@ -83,9 +85,6 @@
TypeSystemImpl get typeSystem => result.typeSystem as TypeSystemImpl;
- /// Whether `DartType.toString()` with nullability should be asked.
- bool get typeToStringWithNullability => false;
-
VoidType get voidType => VoidTypeImpl.instance;
void addTestFile(String content) {
@@ -237,7 +236,7 @@
void assertElementString(Element element, String expected) {
var str = element.getDisplayString(
- withNullability: typeToStringWithNullability,
+ withNullability: isNullSafetyEnabled,
);
expect(str, expected);
}
@@ -891,7 +890,7 @@
required List<ExpectedError> nullable,
required List<ExpectedError> legacy,
}) {
- if (typeToStringWithNullability) {
+ if (isNullSafetyEnabled) {
return nullable;
} else {
return legacy;
@@ -997,13 +996,13 @@
/// Return a textual representation of the [type] that is appropriate for
/// tests.
String typeString(DartType type) =>
- type.getDisplayString(withNullability: typeToStringWithNullability);
+ type.getDisplayString(withNullability: isNullSafetyEnabled);
String typeStringByNullability({
required String nullable,
required String legacy,
}) {
- if (typeToStringWithNullability) {
+ if (isNullSafetyEnabled) {
return nullable;
} else {
return legacy;
diff --git a/pkg/analyzer/test/src/dart/resolution/type_name_test.dart b/pkg/analyzer/test/src/dart/resolution/type_name_test.dart
index 99398a5..2e4fc17 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_name_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_name_test.dart
@@ -856,5 +856,5 @@
class TypeNameResolutionWithoutNullSafetyTest extends PubPackageResolutionTest
with TypeNameResolutionTestCases, WithoutNullSafetyMixin {
@override
- bool get typeToStringWithNullability => true;
+ bool get isNullSafetyEnabled => true;
}
diff --git a/tools/VERSION b/tools/VERSION
index 6f1c666..f273964 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 166
+PRERELEASE 167
PRERELEASE_PATCH 0
\ No newline at end of file