Skip to content

Commit a8d77f7

Browse files
T-GroCopilot
andcommitted
Add enum and primitive empty array attribute tests for #12796
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 25ba872 commit a8d77f7

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

tests/FSharp.Compiler.ComponentTests/Language/AttributeCheckingTests.fs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,34 @@ type B = { [<DefaultValue([||] : A[])>] BField: A[] }
207207
|> asLibrary
208208
|> compile
209209
|> shouldSucceed
210+
211+
// https://github.com/dotnet/fsharp/issues/12796
212+
[<Fact>]
213+
let ``Issue 12796 - Empty array of enum type in attribute should succeed`` () =
214+
FSharp
215+
"""
216+
module TestModule
217+
218+
type MyEnum = A = 0 | B = 1
219+
type MyAttr(v: obj) = inherit System.Attribute()
220+
type T = { [<MyAttr([||] : MyEnum[])>] F: int }
221+
"""
222+
|> asLibrary
223+
|> compile
224+
|> shouldSucceed
225+
226+
// https://github.com/dotnet/fsharp/issues/12796
227+
[<Fact>]
228+
let ``Issue 12796 - Empty array of primitive type in attribute should succeed`` () =
229+
FSharp
230+
"""
231+
module TestModule
232+
233+
type MyAttr(v: int[]) = inherit System.Attribute()
234+
type T = { [<MyAttr([||])>] F: int }
235+
"""
236+
|> asLibrary
237+
|> compile
238+
|> shouldSucceed
239+
240+

0 commit comments

Comments
 (0)