Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Compiler/Checking/CheckDeclarations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,11 @@ module TcRecdUnionAndEnumDeclarations =
error(Error(FSComp.SR.tcReturnTypesForUnionMustBeSameAsType(), m))
rfields, recordTy

let names = rfields |> List.map (fun f -> f.DisplayNameCore)
let names = rfields
|> Seq.filter (fun f -> not f.rfield_name_generated)
|> Seq.map (fun f -> f.DisplayNameCore)
|> Seq.toList

let xmlDoc = xmldoc.ToXmlDoc(true, Some names)
Construct.NewUnionCase id rfields recordTy attrs xmlDoc vis

Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Core/prim-types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3854,7 +3854,7 @@ namespace Microsoft.FSharp.Core
[<DebuggerDisplay("{DebugDisplay,nq}")>]
type ValueOption<'T> =
| ValueNone : 'T voption
| ValueSome : 'T -> 'T voption
| ValueSome : Item: 'T -> 'T voption

member x.Value = match x with ValueSome x -> x | ValueNone -> raise (new InvalidOperationException("ValueOption.Value"))

Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Core/prim-types.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -2441,7 +2441,7 @@ namespace Microsoft.FSharp.Core
/// <param name="Item">The input value.</param>
///
/// <returns>An option representing the value.</returns>
| ValueSome: 'T -> 'T voption
| ValueSome: Item:'T -> 'T voption

/// <summary>Get the value of a 'ValueSome' option. An InvalidOperationException is raised if the option is 'ValueNone'.</summary>
member Value: 'T
Expand Down
26 changes: 25 additions & 1 deletion tests/FSharp.Compiler.ComponentTests/Language/XmlComments.fs
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,28 @@ module M =
|> ignoreWarnings
|> compile
|> shouldSucceed
|> withDiagnostics [ ]
|> withDiagnostics [ ]

[<Fact>]
let ``Union field - unnamed 01`` () =
Fsx"""
type A =
/// <summary>A</summary>
/// <param name="Item">Item</param>
| A of int
"""
|> withXmlCommentChecking
|> compile
|> withDiagnostics [ Warning 3390, Line 3, Col 13, Line 4, Col 48, "This XML comment is invalid: unknown parameter 'Item'" ]

[<Fact>]
let ``Union field - unnamed 02`` () =
Fsx"""
type A =
/// <summary>A</summary>
/// <param name="a">a</param>
| A of int * a: int
"""
|> withXmlCommentChecking
|> compile
|> withDiagnostics [ ]