Skip to content

Commit 8ff2671

Browse files
authored
Array postfix notation in fsharp core api (#16564)
* changed array types to postfix form in all signatures * changed array types to postfix form in the implementation files
1 parent 0735d53 commit 8ff2671

35 files changed

+629
-612
lines changed

src/FSharp.Core/Linq.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ module LeafExpressionConverter =
5959
|> System.Reflection.MethodInfo.GetMethodFromHandle
6060
:?> MethodInfo
6161

62-
let SubstHelperRaw (q:Expr, x:Var[], y:obj[]) : Expr =
62+
let SubstHelperRaw (q:Expr, x:Var array, y:obj array) : Expr =
6363
let d = Map.ofArray (Array.zip x y)
6464
q.Substitute(fun v -> v |> d.TryFind |> Option.map (fun x -> Expr.Value (x, v.Type)))
6565

66-
let SubstHelper<'T> (q:Expr, x:Var[], y:obj[]) : Expr<'T> =
66+
let SubstHelper<'T> (q:Expr, x:Var array, y:obj array) : Expr<'T> =
6767
SubstHelperRaw(q, x, y) |> Expr.Cast
6868

6969
let showAll =
@@ -390,15 +390,15 @@ module LeafExpressionConverter =
390390
let (|NewAnonymousObjectHelperQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (NewAnonymousObjectHelper))
391391
let (|ArrayLookupQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun (x, y) -> LanguagePrimitives.IntrinsicFunctions.GetArray x y))
392392

393-
//let (|ArrayAssignQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun -> LanguagePrimitives.IntrinsicFunctions.SetArray : int[] -> int -> int -> unit))
393+
//let (|ArrayAssignQ|_|) = (|SpecificCallToMethod|_|) (methodhandleof (fun -> LanguagePrimitives.IntrinsicFunctions.SetArray : int array -> int -> int -> unit))
394394
//let (|ArrayTypeQ|_|) (ty:System.Type) = if ty.IsArray && ty.GetArrayRank() = 1 then Some (ty.GetElementType()) else None
395395
let substHelperMeth =
396-
methodhandleof (fun (x:Expr, y:Var[], z:obj[]) -> SubstHelper<obj> (x, y, z))
396+
methodhandleof (fun (x:Expr, y:Var array, z:obj array) -> SubstHelper<obj> (x, y, z))
397397
|> System.Reflection.MethodInfo.GetMethodFromHandle
398398
:?> MethodInfo
399399

400400
let substHelperRawMeth =
401-
methodhandleof (fun (x:Expr, y:Var[], z:obj[]) -> SubstHelperRaw (x, y, z))
401+
methodhandleof (fun (x:Expr, y:Var array, z:obj array) -> SubstHelperRaw (x, y, z))
402402
|> System.Reflection.MethodInfo.GetMethodFromHandle
403403
:?> MethodInfo
404404

@@ -737,7 +737,7 @@ module LeafExpressionConverter =
737737
else
738738
Reflection.FSharpType.MakeTupleType(argTypes)
739739
let argsP = ConvExprsToLinq env args
740-
let rec build ty (argsP: Expression[]) =
740+
let rec build ty (argsP: Expression array) =
741741
match Reflection.FSharpValue.PreComputeTupleConstructorInfo ty with
742742
| ctorInfo, None -> Expression.New(ctorInfo, argsP) |> asExpr
743743
| ctorInfo, Some (nestedTy) ->
@@ -879,7 +879,7 @@ module LeafExpressionConverter =
879879
| None ->
880880
null
881881

882-
and ConvExprsToLinq env es : Expression[] =
882+
and ConvExprsToLinq env es : Expression array =
883883
es |> List.map (ConvExprToLinqInContext env) |> Array.ofList
884884

885885
and ConvVarToLinq (v: Var) =

src/FSharp.Core/Linq.fsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ module LeafExpressionConverter =
7878
/// </summary>
7979
///
8080
/// <example-tbd></example-tbd>
81-
val SubstHelper: Expr * Var[] * obj[] -> Expr<'T>
81+
val SubstHelper: Expr * Var array * obj array -> Expr<'T>
8282

8383
/// <summary>
8484
/// A runtime helper used to evaluate nested quotation literals.
8585
/// </summary>
8686
///
8787
/// <example-tbd></example-tbd>
88-
val SubstHelperRaw: Expr * Var[] * obj[] -> Expr
88+
val SubstHelperRaw: Expr * Var array * obj array -> Expr
8989

9090
val internal (|SpecificCallToMethod|_|):
9191
System.RuntimeMethodHandle -> (Expr -> (Expr option * Reflection.MethodInfo * Expr list) option)

0 commit comments

Comments
 (0)