[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 <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
Paul Berry
2026-01-28 10:20:58 -08:00
committed by Commit Queue
parent b4b17c7874
commit 31d3243e2b
+7 -2
View File
@@ -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,