- 
                Notifications
    
You must be signed in to change notification settings  - Fork 833
 
Open
Open
Copy link
Milestone
Description
When I use the parameter of [<ParamArray>] attribute in member function, I cannot pass the parameter using pipeline operator:
> type X () = member _.ID ([<System.ParamArray>] arr) = arr;;
type X =
  new: unit -> X
  member ID: [<System.ParamArray>] 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 [<ParamArray>] attribute is not used or using [<ParamArray>] at the top level:
> 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 ([<System.ParamArray>] arr) = arr;;     
val ID: [<System.ParamArray>] arr: 'a -> 'a
> [| 1; 2; 3 |] |> ID;;                     
val it: int array = [|1; 2; 3|]Why does [<ParamArray>] behave differently in member functions? Is this a compiler bug?
ijklam
Metadata
Metadata
Assignees
Type
Projects
Status
New