dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.31k stars 1.59k forks source link

Lint `public_member_api_docs` false positive #59518

Open matanlurey opened 3 months ago

matanlurey commented 3 months ago

The analyzer and dartdoc understand this is documented, but the lint rule does not:

// lib/format.dart
/// A format.
class Format {
  /// Is documented to do a thing.
  void doThing() {}
}

/// A mixin that adds a method to [Format].
mixin FormatMixin1 on Format {
  @override
  void doThing({String? optionalString}) {}
}

/// A mixin that adds a method to [Format].
mixin FormatMixin2 on Format {
  @override
  void doThing({int? optionalInteger}) {}
}

/// A mixin that is both [FormatMixin1] and [FormatMixin2].
mixin FormatMixins on Format implements FormatMixin1, FormatMixin2 {
  // Missing documentation for a public member.
  // Try adding documentation for the member.dart[public_member_api_docs] 
  // (https://dart.dev/lints/public_member_api_docs)
  @override
  void doThing({String? optionalString, int? optionalInteger}) {}
}

Dart SDK version: 3.5.0 (stable) (Tue Jul 30 02:17:59 2024 -0700) on "macos_arm64"

dart-github-bot commented 3 months ago

Summary: The public_member_api_docs lint incorrectly flags a method in a mixin as undocumented, even though the method is documented in a superclass mixin. This occurs when a mixin inherits from multiple mixins, each of which overrides the same method with different optional parameters.