Fix XmlDoc validation for get/set property pairs (#13684)#19884
Conversation
Each accessor's xmlDoc is now validated against the union of both accessors' parameter names, eliminating spurious 'unknown parameter' and 'no documentation for parameter' warnings under --warnon:3390 when a property documents the full parameter set across getter and setter. The fix adds a private PreXmlDocPairedWith DU case carrying extra parameter names, exposed via PreXmlDoc.WithExtraParamsForCheck. In desugarGetSetMembers, each accessor's xmlDoc is rewrapped with the other accessor's argument names before emitting the two SynBindings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
❗ Release notes required
|
T-Gro
left a comment
There was a problem hiding this comment.
Review
Clean, well-scoped fix for issue #13684. The wrapper-DU approach is elegant and minimally invasive.
What works well
- Minimal surface change: The
PreXmlDocPairedWithcase wraps the existing doc with extra param names, only affecting validation (not the producedXmlDoccontent). - All match arms handled:
ToXmlDoc,Range,IsEmpty,MarkAsInvalidall delegate correctly through the new case. - Guard against empty lists:
WithExtraParamsForCheckshort-circuits on[], avoiding unnecessary wrapping. - Good test coverage: Positive (no false warnings), negative (real warnings still fire), edge cases (ghost params, indexed properties), and the exact repro from issue #13684.
Observations (non-blocking)
-
Duplicate warning deduplication: Both accessors share the same
xmlDoc(captured once inParseHelpers.fs:273). After rewrapping, both will emit a "missing param" warning at the same source range when a param is truly undocumented. The testActually missing param doc still warns for get-setexpects exactly one diagnostic, relying on the compiler's range-based warning deduplication. This is fine in practice — just noting the implicit dependency. -
Public API:
WithExtraParamsForCheckis now part of the FCS public surface. This is appropriate sincePreXmlDocis already public and the method has clear utility for tooling that synthesizes or transforms bindings. -
paramNamesOpt = Nonepassthrough: WhenparamNamesOptisNone(checking disabled), the extra names are correctly ignored — no-op behavior preserved.
Overall: solid fix, good tests, clean implementation.
Summary
Each accessor's xmlDoc is now validated against the union of both accessors' parameter names, eliminating spurious 'unknown parameter' and 'no documentation for parameter' warnings under --warnon:3390 when a property documents the full parameter set across getter and setter.
Details
The fix adds a private PreXmlDocPairedWith DU case carrying extra parameter names, exposed via PreXmlDoc.WithExtraParamsForCheck. In desugarGetSetMembers, each accessor's xmlDoc is rewrapped with the other accessor's argument names before emitting the two SynBindings.
Fixes #13684