Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/fsharp/TypeChecker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10012,11 +10012,13 @@ and TcMethodArg cenv env (lambdaPropagationInfo, tpenv) (lambdaPropagationInfo
// The loop variable callerLambdaTyOpt becomes None if something failed.
let rec loop callerLambdaTy lambdaVarNum =
if lambdaVarNum < numLambdaVars then
let col = [ for row in prefixOfLambdaArgsForEachOverload -> row.[lambdaVarNum] ]
// Check if all the rows give the same argument type
if col |> ListSet.setify (typeEquiv cenv.g) |> isSingleton then
let calledLambdaArgTy = col.[0]
// Force the caller to be a function type.
let calledLambdaArgTy = prefixOfLambdaArgsForEachOverload.[0].[lambdaVarNum]
let allRowsGiveSameArgumentType =
prefixOfLambdaArgsForEachOverload
|> Array.forall (fun row -> typeEquiv cenv.g calledLambdaArgTy row.[lambdaVarNum])

if allRowsGiveSameArgumentType then
// Force the caller to be a function type.
match UnifyFunctionTypeUndoIfFailed cenv env.DisplayEnv mArg callerLambdaTy with
| Some (callerLambdaDomainTy, callerLambdaRangeTy) ->
if AddCxTypeEqualsTypeUndoIfFailed env.DisplayEnv cenv.css mArg calledLambdaArgTy callerLambdaDomainTy then
Expand Down