analyzer: disable unknown doc directive reporting Related to failed engine roll: https://github.com/flutter/flutter/pull/135641 Change-Id: I2411d15fcd5e3091a37e12580d3905b43ca9cad1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328382 Auto-Submit: Samuel Rawlins <srawlins@google.com> Reviewed-by: Zach Anderson <zra@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com> Commit-Queue: Zach Anderson <zra@google.com>
diff --git a/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart b/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart index f875d42..a7a2633 100644 --- a/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart +++ b/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart
@@ -426,12 +426,17 @@ _pushDocDirective(parser.simpleDirective(DocDirectiveType.youtube)); return true; } - _errorReporter?.reportErrorForOffset( - WarningCode.DOC_DIRECTIVE_UNKNOWN, - _characterSequence._offset + nameIndex, - nameEnd - nameIndex, - [name], - ); + // Do not report [WarningCode.DOC_DIRECTIVE_UNKNOWN] until Flutter customer + // code is either cleaned or we support all of the directives they use. + // In particular, https://github.com/macosui/macos_ui uses `@image`. + if (1 == 2) { + _errorReporter?.reportErrorForOffset( + WarningCode.DOC_DIRECTIVE_UNKNOWN, + _characterSequence._offset + nameIndex, + nameEnd - nameIndex, + [name], + ); + } return false; }
diff --git a/pkg/analyzer/test/src/dart/parser/doc_comment_test.dart b/pkg/analyzer/test/src/dart/parser/doc_comment_test.dart index d95d3d0..5c13564 100644 --- a/pkg/analyzer/test/src/dart/parser/doc_comment_test.dart +++ b/pkg/analyzer/test/src/dart/parser/doc_comment_test.dart
@@ -1753,6 +1753,7 @@ '''); } + @FailingTest(reason: 'Not reporting WarningCode.DOC_DIRECTIVE_UNKNOWN yet') test_unknownDocDirective() { final parseResult = parseStringWithErrors(r''' int x = 0;