Commit ea0077e
Fix crash on params array parameter types in API doc generation
When a C# method has a `params` array parameter (e.g. `params object[] args`),
the array type is represented in FCS as an entity named `[]'1` whose `FullName`
property throws because array types have no qualified name in the F# type system.
Replace the single-expression type-name formatter in `getXmlDocSigForMember` with
a small recursive helper (`formatParamType`) that:
- handles generic parameters as before (via typeArgsMap),
- detects array-type entities (`IsArrayType = true`) and builds the name as
`<element-type-name><DisplayName>` (e.g. `System.Object[]`), and
- falls back to `BasicQualifiedName` for types without a type definition.
Also adds `ParamsMethod(params object[] args)` to the C# test fixture and a
corresponding assertion in the existing csharp-support test to prevent regression.
Fixes #439
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 8e3b463 commit ea0077e
4 files changed
Lines changed: 26 additions & 7 deletions
File tree
- src/FSharp.Formatting.ApiDocs
- tests/FSharp.ApiDocs.Tests
- files/csharpSupport
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
750 | 750 | | |
751 | 751 | | |
752 | 752 | | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
753 | 769 | | |
754 | 770 | | |
755 | 771 | | |
756 | 772 | | |
757 | 773 | | |
758 | 774 | | |
759 | 775 | | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
| 776 | + | |
767 | 777 | | |
768 | 778 | | |
769 | 779 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
813 | 816 | | |
814 | 817 | | |
815 | 818 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
96 | 101 | | |
97 | 102 | | |
98 | 103 | | |
| |||
0 commit comments