Skip to content

Commit

Permalink
[3.0 alpha] Update CFE messages for Dart 3 sound null safety by-default
Browse files Browse the repository at this point in the history
Fixes #50638

Change-Id: I511c5337099ae9576377ac8a82ef1bb78f6d34b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273844
Reviewed-by: Johnni Winther <[email protected]>
Reviewed-by: Martin Kustermann <[email protected]>
Commit-Queue: Michael Thomsen <[email protected]>
  • Loading branch information
mit-mit authored and Commit Queue committed Dec 9, 2022
1 parent 3166622 commit 9f2a622
Show file tree
Hide file tree
Showing 73 changed files with 162 additions and 179 deletions.
36 changes: 14 additions & 22 deletions pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9382,7 +9382,7 @@ const Template<Message Function(String string2)>
templateNullSafetyDisabledInvalidLanguageVersion =
const Template<Message Function(String string2)>(
problemMessageTemplate:
r"""This requires the null safety language feature, which requires language version of #string2 or higher.""",
r"""This requires null safety, which requires language version of #string2 or higher.""",
withArguments: _withArgumentsNullSafetyDisabledInvalidLanguageVersion);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Expand All @@ -9397,7 +9397,7 @@ Message _withArgumentsNullSafetyDisabledInvalidLanguageVersion(String string2) {
if (string2.isEmpty) throw 'No string provided';
return new Message(codeNullSafetyDisabledInvalidLanguageVersion,
problemMessage:
"""This requires the null safety language feature, which requires language version of ${string2} or higher.""",
"""This requires null safety, which requires language version of ${string2} or higher.""",
arguments: {'string2': string2});
}

Expand All @@ -9417,8 +9417,7 @@ const Template<
String
string)> templateNullSafetyOptOutExplicit = const Template<
Message Function(String string)>(
problemMessageTemplate:
r"""Null safety features are disabled for this library.""",
problemMessageTemplate: r"""Null safety is disabled for this library.""",
correctionMessageTemplate:
r"""Try removing the `@dart=` annotation or setting the language version to #string or higher.""",
withArguments: _withArgumentsNullSafetyOptOutExplicit);
Expand All @@ -9433,7 +9432,7 @@ const Code<Message Function(String string)> codeNullSafetyOptOutExplicit =
Message _withArgumentsNullSafetyOptOutExplicit(String string) {
if (string.isEmpty) throw 'No string provided';
return new Message(codeNullSafetyOptOutExplicit,
problemMessage: """Null safety features are disabled for this library.""",
problemMessage: """Null safety is disabled for this library.""",
correctionMessage:
"""Try removing the `@dart=` annotation or setting the language version to ${string} or higher.""",
arguments: {'string': string});
Expand All @@ -9445,8 +9444,7 @@ const Template<
String
string)> templateNullSafetyOptOutImplicit = const Template<
Message Function(String string)>(
problemMessageTemplate:
r"""Null safety features are disabled for this library.""",
problemMessageTemplate: r"""Null safety is disabled for this library.""",
correctionMessageTemplate:
r"""Try removing the package language version or setting the language version to #string or higher.""",
withArguments: _withArgumentsNullSafetyOptOutImplicit);
Expand All @@ -9461,7 +9459,7 @@ const Code<Message Function(String string)> codeNullSafetyOptOutImplicit =
Message _withArgumentsNullSafetyOptOutImplicit(String string) {
if (string.isEmpty) throw 'No string provided';
return new Message(codeNullSafetyOptOutImplicit,
problemMessage: """Null safety features are disabled for this library.""",
problemMessage: """Null safety is disabled for this library.""",
correctionMessage:
"""Try removing the package language version or setting the language version to ${string} or higher.""",
arguments: {'string': string});
Expand Down Expand Up @@ -10997,23 +10995,19 @@ const Code<Null> codeStrongModeNNBDButOptOut = messageStrongModeNNBDButOptOut;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageStrongModeNNBDButOptOut = const MessageCode(
"StrongModeNNBDButOptOut",
problemMessage:
r"""A library can't opt out of null safety by default, when using sound null safety.""");
problemMessage: r"""Library doesn't support null safety.""");

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
List<String>
_names)> templateStrongModeNNBDPackageOptOut = const Template<
Message Function(List<String> _names)>(
problemMessageTemplate:
r"""Cannot run with sound null safety, because the following dependencies
don't support null safety:
const Template<Message Function(List<String> _names)>
templateStrongModeNNBDPackageOptOut =
const Template<Message Function(List<String> _names)>(
problemMessageTemplate:
r"""The following dependencies don't support null safety:

#names

For solutions, see https://dart.dev/go/unsound-null-safety""",
withArguments: _withArgumentsStrongModeNNBDPackageOptOut);
withArguments: _withArgumentsStrongModeNNBDPackageOptOut);

// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(List<String> _names)>
Expand All @@ -11027,9 +11021,7 @@ Message _withArgumentsStrongModeNNBDPackageOptOut(List<String> _names) {
if (_names.isEmpty) throw 'No names provided';
String names = itemizeNames(_names);
return new Message(codeStrongModeNNBDPackageOptOut,
problemMessage:
"""Cannot run with sound null safety, because the following dependencies
don't support null safety:
problemMessage: """The following dependencies don't support null safety:

${names}

Expand Down
11 changes: 5 additions & 6 deletions pkg/front_end/messages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ ExperimentDisabled:
analyzerCode: ParserErrorCode.EXPERIMENT_NOT_ENABLED

NullSafetyDisabledInvalidLanguageVersion:
problemMessage: "This requires the null safety language feature, which requires language version of #string2 or higher."
problemMessage: "This requires null safety, which requires language version of #string2 or higher."
analyzerCode: ParserErrorCode.EXPERIMENT_NOT_ENABLED

ExperimentDisabledInvalidLanguageVersion:
Expand Down Expand Up @@ -1591,12 +1591,11 @@ Unspecified:
problemMessage: "#string"

StrongModeNNBDButOptOut:
problemMessage: "A library can't opt out of null safety by default, when using sound null safety."
problemMessage: "Library doesn't support null safety."

StrongModeNNBDPackageOptOut:
problemMessage: |
Cannot run with sound null safety, because the following dependencies
don't support null safety:
The following dependencies don't support null safety:
#names
Expand Down Expand Up @@ -5173,15 +5172,15 @@ FieldNonNullableNotInitializedByConstructorError:
problemMessage: "This constructor should initialize field '#name' because its type '#type' doesn't allow null."

NullSafetyOptOutExplicit:
problemMessage: "Null safety features are disabled for this library."
problemMessage: "Null safety is disabled for this library."
correctionMessage: "Try removing the `@dart=` annotation or setting the language version to #string or higher."

ExperimentOptOutExplicit:
problemMessage: "The '#string' language feature is disabled for this library."
correctionMessage: "Try removing the `@dart=` annotation or setting the language version to #string2 or higher."

NullSafetyOptOutImplicit:
problemMessage: "Null safety features are disabled for this library."
problemMessage: "Null safety is disabled for this library."
correctionMessage: "Try removing the package language version or setting the language version to #string or higher."

NullSafetyOptOutComment:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Problems in component:
//
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart: Error: A library can't opt out of null safety by default, when using sound null safety.
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart: Error: Library doesn't support null safety.
//
library /*isNonNullableByDefault*/;
import self as self;
Expand Down Expand Up @@ -76,7 +76,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart:5:1: Error: Library doesn't support null safety.
// // @dart=2.9
// ^^^^^^^^^^^^
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Problems in component:
//
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart: Error: A library can't opt out of null safety by default, when using sound null safety.
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart: Error: Library doesn't support null safety.
//
library /*isNonNullableByDefault*/;
import self as self;
Expand Down Expand Up @@ -76,7 +76,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart:5:1: Error: Library doesn't support null safety.
// // @dart=2.9
// ^^^^^^^^^^^^
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart:5:1: Error: Library doesn't support null safety.
// // @dart=2.9
// ^^^^^^^^^^^^
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart:5:1: Error: A library can't opt out of null safety by default, when using sound null safety.
// pkg/front_end/testcases/dart2js/mixin_from_opt_in/opt_out_lib.dart:5:1: Error: Library doesn't support null safety.
// // @dart=2.9
// ^^^^^^^^^^^^
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
//
// Problems outside component:
//
// pkg/front_end/testcases/general/experiment_release_version/allowed_package/lib/versioned_2_8_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/allowed_package/lib/versioned_2_8_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.9 or higher.
// int? versioned_2_8_AllowedPackage; // error
// ^
// pkg/front_end/testcases/general/experiment_release_version/allowed_package/lib/versioned_2_8_lib.dart:5:1: Context: This is the annotation that opts out this library from null safety features.
// // @dart=2.8
// ^^^^^^^^^^^^
//
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/unversioned_lib.dart:5:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/unversioned_lib.dart:5:4: Error: Null safety is disabled for this library.
// Try removing the package language version or setting the language version to 2.10 or higher.
// int? versionedUnallowedPackage; // error
// ^
//
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_8_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_8_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_8_AllowedPackage; // error
// ^
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_8_lib.dart:5:1: Context: This is the annotation that opts out this library from null safety features.
// // @dart=2.8
// ^^^^^^^^^^^^
//
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_9_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_9_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_9_AllowedPackage; // error
// ^
Expand Down Expand Up @@ -58,7 +58,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_8_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_8_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_8_Library; // error
// ^
Expand All @@ -75,7 +75,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_9_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_9_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_9_Library; // error
// ^
Expand All @@ -92,7 +92,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_10_lib.dart:8:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_10_lib.dart:8:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_10_Library; // error
// ^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
//
// Problems outside component:
//
// pkg/front_end/testcases/general/experiment_release_version/allowed_package/lib/versioned_2_8_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/allowed_package/lib/versioned_2_8_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.9 or higher.
// int? versioned_2_8_AllowedPackage; // error
// ^
// pkg/front_end/testcases/general/experiment_release_version/allowed_package/lib/versioned_2_8_lib.dart:5:1: Context: This is the annotation that opts out this library from null safety features.
// // @dart=2.8
// ^^^^^^^^^^^^
//
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/unversioned_lib.dart:5:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/unversioned_lib.dart:5:4: Error: Null safety is disabled for this library.
// Try removing the package language version or setting the language version to 2.10 or higher.
// int? versionedUnallowedPackage; // error
// ^
//
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_8_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_8_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_8_AllowedPackage; // error
// ^
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_8_lib.dart:5:1: Context: This is the annotation that opts out this library from null safety features.
// // @dart=2.8
// ^^^^^^^^^^^^
//
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_9_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/not_allowed_package/lib/versioned_2_9_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_9_AllowedPackage; // error
// ^
Expand Down Expand Up @@ -58,7 +58,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_8_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_8_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_8_Library; // error
// ^
Expand All @@ -75,7 +75,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_9_lib.dart:7:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_9_lib.dart:7:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_9_Library; // error
// ^
Expand All @@ -92,7 +92,7 @@ library;
//
// Problems in library:
//
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_10_lib.dart:8:4: Error: Null safety features are disabled for this library.
// pkg/front_end/testcases/general/experiment_release_version/versioned_2_10_lib.dart:8:4: Error: Null safety is disabled for this library.
// Try removing the `@dart=` annotation or setting the language version to 2.10 or higher.
// int? versioned_2_10_Library; // error
// ^
Expand Down
Loading

0 comments on commit 9f2a622

Please sign in to comment.