Skip to content

Commit cb51fb4

Browse files
committed
Remove intermediate collection
1 parent 56e45e1 commit cb51fb4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/fsharp/TypeChecker.fs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10012,15 +10012,13 @@ and TcMethodArg cenv env (lambdaPropagationInfo, tpenv) (lambdaPropagationInfo
1001210012
// The loop variable callerLambdaTyOpt becomes None if something failed.
1001310013
let rec loop callerLambdaTy lambdaVarNum =
1001410014
if lambdaVarNum < numLambdaVars then
10015-
let col = [ for row in prefixOfLambdaArgsForEachOverload -> row.[lambdaVarNum] ]
10015+
let calledLambdaArgTy = prefixOfLambdaArgsForEachOverload.[0].[lambdaVarNum]
1001610016
let allRowsGiveSameArgumentType =
10017-
match col with
10018-
| [] -> false
10019-
| x::rest -> rest |> List.forall (typeEquiv cenv.g x)
10017+
prefixOfLambdaArgsForEachOverload
10018+
|> Array.forall (fun row -> typeEquiv cenv.g calledLambdaArgTy row.[lambdaVarNum])
1002010019

1002110020
if allRowsGiveSameArgumentType then
10022-
let calledLambdaArgTy = col.[0]
10023-
// Force the caller to be a function type.
10021+
// Force the caller to be a function type.
1002410022
match UnifyFunctionTypeUndoIfFailed cenv env.DisplayEnv mArg callerLambdaTy with
1002510023
| Some (callerLambdaDomainTy, callerLambdaRangeTy) ->
1002610024
if AddCxTypeEqualsTypeUndoIfFailed env.DisplayEnv cenv.css mArg calledLambdaArgTy callerLambdaDomainTy then

0 commit comments

Comments
 (0)