`[<System.ParamArray>]` parameter in member function causes type check error.
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
When I use the parameter of `[]` attribute in member function, I cannot pass the parameter using pipeline operator:
```fsharp
> type X () = member _.ID ([] arr) = arr;;
type X =
new: unit -> X
member ID: [] arr: 'a -> 'a
> let x = X();;
val x: X
> x.ID([| 1; 2; 3 |]);;
val it: int array = [|1; 2; 3|]
> [| 1; 2; 3 |] |> x.ID;;
[| 1; 2; 3 |] |> x.ID;;
-----------------^^^^
/home/muqiu/stdin(10,18): error FS0001: This expression was expected to have type
'int array'
but here has type
'unit'
```
And no type check error occurs when the `[]` attribute is not used or using `[]` at the top level:
```fsharp
> type X () = member _.ID (arr) = arr;;
type X =
new: unit -> X
member ID: arr: 'a -> 'a
> let x = X();;
val x: X
> [| 1; 2; 3 |] |> x.ID;;
val it: int array = [|1; 2; 3|]
> let ID ([] arr) = arr;;
val ID: [] arr: 'a -> 'a
> [| 1; 2; 3 |] |> ID;;
val it: int array = [|1; 2; 3|]
```
Why does `[]` behave differently in member functions? Is this a compiler bug?
Contributor guide
Assessment
This issue has not been assessed yet.