From 31d3243e2b1652f0d1ceaf2ba87f6d5ff04649fa Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Wed, 28 Jan 2026 10:20:58 -0800 Subject: [PATCH] [messages] Ignore placeholders when spell checking diagnostic messages. This will allow diagnostic message parameters to use names that wouldn't normally be accepted by the spell checker for English-language text (e.g. `actualType`). The parameter names will still be checked by the spell checker as code, however, by virtue of the fact that they get emitted into generated code. Change-Id: I6a6a69648a05713e5344ba3dd90b090eec3b6d67 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476082 Reviewed-by: Konstantin Shcheglov Commit-Queue: Paul Berry --- pkg/front_end/test/messages_suite.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/front_end/test/messages_suite.dart b/pkg/front_end/test/messages_suite.dart index dbbb87ad036..4807ef69e69 100644 --- a/pkg/front_end/test/messages_suite.dart +++ b/pkg/front_end/test/messages_suite.dart @@ -14,6 +14,7 @@ import 'package:_fe_analyzer_shared/src/messages/diagnostic_message.dart' import 'package:_fe_analyzer_shared/src/messages/severity.dart' show CfeSeverity, severityEnumValues; import 'package:analyzer_utilities/extensions/string.dart'; +import 'package:analyzer_utilities/messages.dart'; import 'package:front_end/src/api_prototype/compiler_options.dart' show CompilerOptions, parseExperimentalArguments, parseExperimentalFlags; import 'package:front_end/src/api_prototype/experimental_flags.dart' @@ -255,7 +256,9 @@ class MessageTestSuite extends ChainContext { case "problemMessage": if (skipSpellCheck) continue; spell.SpellingResult spellingResult = spell.spellcheckString( - node.span.text.replaceAll(r"\n", "\n\n"), + node.span.text + .replaceAll(placeholderPattern, '*') + .replaceAll(r"\n", "\n\n"), dictionaries: const [ spell.Dictionaries.common, spell.Dictionaries.cfeMessages, @@ -279,7 +282,9 @@ class MessageTestSuite extends ChainContext { case "correctionMessage": if (skipSpellCheck) continue; spell.SpellingResult spellingResult = spell.spellcheckString( - node.span.text.replaceAll(r"\n", "\n\n"), + node.span.text + .replaceAll(placeholderPattern, '*') + .replaceAll(r"\n", "\n\n"), dictionaries: const [ spell.Dictionaries.common, spell.Dictionaries.cfeMessages,