Skip to content

Commit de1f400

Browse files
quyenthoclaude
andauthored
Fix Array.exists2 XML doc examples to use equal-length arrays (#19672)
* Fix Array.exists2 XML doc examples to use equal-length arrays Both examples used arrays of different lengths (2 vs 3 elements), which would cause ArgumentException at runtime. The documented 'Evaluates to false/true' results were therefore incorrect. Fixed by using equal-length input arrays that produce the stated results: - inputs2 = [| 1; 3 |] with inputs1 = [| 1; 2 |] evaluates to false (neither 1>1 nor 2>3) - inputs2 = [| 1; 3 |] with inputs1 = [| 1; 4 |] evaluates to true (4>3) * Add release notes for Array.exists2 doc fix Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f03143a commit de1f400

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Fixed
2+
3+
* Fix `Array.exists2` documentation examples to use equal-length arrays; the previous examples would throw `ArgumentException` at runtime instead of returning the documented `false`/`true` values. ([PR #19672](https://github.com/dotnet/fsharp/pull/19672))

src/FSharp.Core/array.fsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ module Array =
840840
/// <example id="exists2-1">
841841
/// <code lang="fsharp">
842842
/// let inputs1 = [| 1; 2 |]
843-
/// let inputs2 = [| 1; 2; 0 |]
843+
/// let inputs2 = [| 1; 3 |]
844844
///
845845
/// (inputs1, inputs2) ||> Array.exists2 (fun a b -> a > b)
846846
/// </code>
@@ -850,7 +850,7 @@ module Array =
850850
/// <example id="exists2-2">
851851
/// <code lang="fsharp">
852852
/// let inputs1 = [| 1; 4 |]
853-
/// let inputs2 = [| 1; 3; 5 |]
853+
/// let inputs2 = [| 1; 3 |]
854854
///
855855
/// (inputs1, inputs2) ||> Array.exists2 (fun a b -> a > b)
856856
/// </code>

0 commit comments

Comments
 (0)