Cannot use array/list/etc literals in attribute parameters
Open
Feature Improvement
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
The following code fails to compile:
```fsharp
open System
open Xunit
[]
[]
let banana (x, y, maybe, arr) = ()
```
This is because array literals are not considered constants for the purposes of attribute checking: https://github.com/dotnet/fsharp/blob/9be86c23a9540c41929ff3dbcd904d069ba34a34/src/fsharp/PostInferenceChecks.fs#L1589-L1613
Although not idiomatic F#, this pattern exists in multiple test frameworks (NUnit has the same feature) and should probably typecheck, considering it is allowed in C#.
From: https://twitter.com/ploeh/status/1200096980275519489
Contributor guide
Assessment
This issue has not been assessed yet.