From 6935770e007967e3cdaa75b9a7885d86b77b0b82 Mon Sep 17 00:00:00 2001 From: Libo Zeng Date: Sat, 7 Jan 2017 13:41:23 -0500 Subject: [PATCH 1/3] more robust check for isSequential --- src/fsharp/ConstraintSolver.fs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index 1a3457256cd..ce372a4f9bf 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -1992,7 +1992,7 @@ and ArgsEquivInsideUndo (csenv:ConstraintSolverEnv) isConstraint calledArg (Call if not (typeEquiv csenv.g calledArgTy callerArgTy) then ErrorD(Error(FSComp.SR.csArgumentTypesDoNotMatch(),m)) else CompleteD -and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad (calledMethGroup:CalledMeth<_> list) = +and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad (calledMethGroup:CalledMeth<'T> list) (isSequential:'T -> bool) = let amap = csenv.amap let m = csenv.m @@ -2054,7 +2054,7 @@ and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNam cmeth.ArgSets |> List.exists (fun argSet -> argSet.UnnamedCallerArgs - |> List.exists (fun c -> c.Expr.ToString().EndsWith "Sequential")) + |> List.exists (fun c -> isSequential c.Expr)) if couldBeNameArgs then Error (FSComp.SR.csCtorSignatureMismatchArityProp(methodName, nReqd, nActual, signature), m) @@ -2106,6 +2106,13 @@ and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNam Error (msg,m) |> ErrorD +and ReportNoCandidatesErrorExpr (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad (calledMethGroup:CalledMeth list) = + let isSequential c = match c with | Expr.Sequential (_,_,_,_,_) -> true | _ -> false + ReportNoCandidatesError csenv (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad calledMethGroup isSequential + +and ReportNoCandidatesErrorSynExpr (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad (calledMethGroup:CalledMeth list) = + let isSequential c = match c with | SynExpr.Sequential (_,_,_,_,_) -> true | _ -> false + ReportNoCandidatesError csenv (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad calledMethGroup isSequential // Resolve the overloading of a method // This is used after analyzing the types of arguments @@ -2138,7 +2145,7 @@ and ResolveOverloading None, ErrorD (Error (FSComp.SR.csMethodNotFound(methodName),m)), NoTrace | _,[] when not isOpConversion -> - None, ReportNoCandidatesError csenv callerArgCounts methodName ad calledMethGroup, NoTrace + None, ReportNoCandidatesErrorExpr csenv callerArgCounts methodName ad calledMethGroup, NoTrace | _,_ -> @@ -2447,7 +2454,7 @@ let UnifyUniqueOverloading | [],_ -> ErrorD (Error (FSComp.SR.csMethodNotFound(methodName),m)) | _,[] -> - ReportNoCandidatesError csenv callerArgCounts methodName ad calledMethGroup + ReportNoCandidatesErrorSynExpr csenv callerArgCounts methodName ad calledMethGroup ++ (fun () -> ResultD false) | _ -> ResultD false From a0180b578c93a20f87e65f7ee67c5ffed2e57259 Mon Sep 17 00:00:00 2001 From: Libo Zeng Date: Sat, 7 Jan 2017 14:18:50 -0500 Subject: [PATCH 2/3] using type inference for the signature --- src/fsharp/ConstraintSolver.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index ce372a4f9bf..744fe254f77 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -1992,7 +1992,7 @@ and ArgsEquivInsideUndo (csenv:ConstraintSolverEnv) isConstraint calledArg (Call if not (typeEquiv csenv.g calledArgTy callerArgTy) then ErrorD(Error(FSComp.SR.csArgumentTypesDoNotMatch(),m)) else CompleteD -and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad (calledMethGroup:CalledMeth<'T> list) (isSequential:'T -> bool) = +and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad (calledMethGroup:CalledMeth<_> list) isSequential = let amap = csenv.amap let m = csenv.m From 8244572a4fc34e29aae7ca682e7910a31bf7f602 Mon Sep 17 00:00:00 2001 From: Libo Zeng Date: Sat, 7 Jan 2017 15:11:50 -0500 Subject: [PATCH 3/3] using even more type inferencing --- src/fsharp/ConstraintSolver.fs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index 744fe254f77..ce94175bb78 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -2106,13 +2106,13 @@ and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNam Error (msg,m) |> ErrorD -and ReportNoCandidatesErrorExpr (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad (calledMethGroup:CalledMeth list) = - let isSequential c = match c with | Expr.Sequential (_,_,_,_,_) -> true | _ -> false - ReportNoCandidatesError csenv (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad calledMethGroup isSequential +and ReportNoCandidatesErrorExpr csenv callerArgCounts methodName ad calledMethGroup = + let isSequential e = match e with | Expr.Sequential (_,_,_,_,_) -> true | _ -> false + ReportNoCandidatesError csenv callerArgCounts methodName ad calledMethGroup isSequential -and ReportNoCandidatesErrorSynExpr (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad (calledMethGroup:CalledMeth list) = - let isSequential c = match c with | SynExpr.Sequential (_,_,_,_,_) -> true | _ -> false - ReportNoCandidatesError csenv (nUnnamedCallerArgs,nNamedCallerArgs) methodName ad calledMethGroup isSequential +and ReportNoCandidatesErrorSynExpr csenv callerArgCounts methodName ad calledMethGroup = + let isSequential e = match e with | SynExpr.Sequential (_,_,_,_,_) -> true | _ -> false + ReportNoCandidatesError csenv callerArgCounts methodName ad calledMethGroup isSequential // Resolve the overloading of a method // This is used after analyzing the types of arguments