The following code fails to compile:
open System
open Xunit
[<Theory>]
[<InlineData(12, 1, true, [||])>]
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#.
FWIW, something like this ought to compile as well:
[<InlineData([|2;2;4|], [|2|], 4, true)>]
[<InlineData([|2;2;4|], [|3, 3|], 4, false)>]
The main point here is that it should be possible to pass more than one array, and the arrays shouldn't need to sit rightmost.
I'm explicitly adding this, as I often see people suggest using a ParamArray as a workaround; it's not.
Most helpful comment
FWIW, something like this ought to compile as well:
The main point here is that it should be possible to pass more than one array, and the arrays shouldn't need to sit rightmost.
I'm explicitly adding this, as I often see people suggest using a
ParamArrayas a workaround; it's not.