Skip to content

Fix the Array.tryPick documentation example - #20794

Merged
abonie merged 3 commits into
mainfrom
fix/issue-20780
Oct 19, 2026
Merged

abonie merged 3 commits into
mainfrom
fix/issue-20780

Conversation

@T-Gro

@T-Gro T-Gro commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Fixes #20780

Description

Correct the Array.tryPick example so it compiles and evaluates to None as documented.

Checklist

  • Test cases added

  • Performance benchmarks added in case of performance changes

  • Release notes entry updated:

    Please make sure to add an entry with short succinct description of the change as well as link to this pull request to the respective release notes file, if applicable.

    Release notes files:

    • If anything under src/Compiler has been changed, please make sure to make an entry in docs/release-notes/.FSharp.Compiler.Service/<version>.md, where <version> is usually "highest" one, e.g. 42.8.200
    • If language feature was added (i.e. LanguageFeatures.fsi was changed), please add it to docs/release-notes/.Language/preview.md
    • If a change to FSharp.Core was made, please make sure to edit docs/release-notes/.FSharp.Core/<version>.md where version is "highest" one, e.g. 8.0.200.

    Information about the release notes entries format can be found in the documentation.
    Example:

    If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

Remove the invalid integer comparison from the trypick-2 predicate.
Preserve its None result and the adjacent trypick-1 example unchanged.

Validation: extracted each actual XML example from src\FSharp.Core\array.fsi,
parsed it with System.Xml.XmlDocument, and piped its code plus a result
assertion into FSI using the sprint's Invoke-TryPickDocExample helper.

SDK: 10.0.113
FSI: C:\Program Files\dotnet\sdk\10.0.113\FSharp\fsi.dll
Exact invocation:
$script | dotnet $fsi --nologo --readline- 2>&1 | Out-String

RED before editing:
Invoke-TryPickDocExample 'trypick-2' 'None'
FSI exit 1; the strict expected-failure assertion passed:
stdin(4,49): error FS0001: This expression was expected to have type
    'bool'
but here has type
    'int'

GREEN after editing, rereading the actual source for each invocation:
Invoke-TryPickDocExample 'trypick-2' 'None'
FSI exit 0: trypick-2: None
Invoke-TryPickDocExample 'trypick-1' 'Some "2"'
FSI exit 0: trypick-1: Some "2"
Both example XML elements parsed successfully; git diff --check passed.
Original CRLF line endings preserved. Documentation-only validation;
no full build, new test infrastructure, or release-note change needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Release-note check exempted

The NO_RELEASE_NOTES label or localization-bot authorship exempts this pull request.

Copilot and others added 2 commits October 16, 2026 14:28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 20b10bf6-6a7c-483a-8d09-d521e7ddd73d
@T-Gro T-Gro added the NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes label Oct 16, 2026
@T-Gro
T-Gro requested a review from abonie October 19, 2026 14:33
@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Oct 19, 2026
@abonie
abonie merged commit 2be714d into main Oct 19, 2026
55 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in F# Compiler and Tooling Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Documentation: Array.tryPick code example gives an error

2 participants