Skip to content

Commit

Permalink
Use Array.take from FSharp.Core
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed May 21, 2016
1 parent 98de28b commit ddc1503
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/absil/illib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ module Order =

module Array =

let take n xs = xs |> Seq.take n |> Array.ofSeq

let mapq f inp =
match inp with
| [| |] -> inp
Expand Down
6 changes: 3 additions & 3 deletions src/fsharp/TypeChecker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9451,16 +9451,16 @@ and TcMethodArg cenv env (lambdaPropagationInfo,tpenv) (lambdaPropagationInfoF

// Apply the F# 3.1 rule for extracting information for lambdas
//
// Before we check the argume, check to see if we can propagate info from a called lambda expression into the arguments of a received lambda
// Before we check the argument, check to see if we can propagate info from a called lambda expression into the arguments of a received lambda
begin
if lambdaPropagationInfoForArg.Length > 0 then
let allOverloadsAreFuncOrMismatchForThisArg =
lambdaPropagationInfoForArg |> Array.forall (function ArgDoesNotMatch | CallerLambdaHasArgTypes _ -> true | NoInfo | CalledArgMatchesType _ -> false)

if allOverloadsAreFuncOrMismatchForThisArg then
let overloadsWhichAreFuncAtThisPosition = lambdaPropagationInfoForArg |> Array.choose (function CallerLambdaHasArgTypes r -> Some r | _ -> None)
let overloadsWhichAreFuncAtThisPosition = lambdaPropagationInfoForArg |> Array.choose (function CallerLambdaHasArgTypes r -> Some (List.toArray r) | _ -> None)
if overloadsWhichAreFuncAtThisPosition.Length > 0 then
let minFuncArity = overloadsWhichAreFuncAtThisPosition |> Array.minBy List.length |> List.length
let minFuncArity = overloadsWhichAreFuncAtThisPosition |> Array.minBy Array.length |> Array.length
let prefixOfLambdaArgsForEachOverload = overloadsWhichAreFuncAtThisPosition |> Array.map (Array.take minFuncArity)

if prefixOfLambdaArgsForEachOverload.Length > 0 then
Expand Down

0 comments on commit ddc1503

Please sign in to comment.