Dedup format specifier locations in computation expressions#19791
Dedup format specifier locations in computation expressions#19791T-Gro wants to merge 4 commits into
Conversation
…e 16419) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
❗ Release notes requiredCaution No release notes found for the changed paths (see table below). Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format. The following format is recommended for this repository:
If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request. You can open this PR in browser to add release notes: open in github.dev
|
T-Gro
left a comment
There was a problem hiding this comment.
Clean, minimal fix that correctly addresses the duplicate format specifier issue in computation expressions.
What I verified:
rangeis a struct with[<CustomEquality; NoComparison>]and properEquals/GetHashCodeoverrides (ignoring synthetic/debug-point bits), so the defaultHashSetcomparer works correctly here.- The dedup-via-HashSet pattern is already established in this class (
capturedNameResolutionIdentifiers,capturedModulesAndNamespaces), so this is consistent. - No concern about
numArgsbeing silently dropped — a format specifier at a given source location always resolves to the same arity, so deduplicating by range alone is sound. - Test clearly targets the exact repro scenario (format specifier inside
seqCE).
LGTM 👍
Fixes #16419
Adds a HashSet guard in TcResultsSinkImpl.NotifyFormatSpecifierLocation to prevent duplicate entries when CE desugaring re-typechecks format strings.