Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4c59b11

Browse files
committed
do not drop error arguments entirely, but ignore them then validating consistency of positional\named arguments
1 parentc3a6531 commit4c59b11

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

‎src/fsharp/tc.fs‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,18 +3019,15 @@ let GetMethodArgs arg =
30193019
| SynExprParen(SynExpr.Tuple (args,_,_),_,_,_) | SynExpr.Tuple (args,_,_) -> args
30203020
| SynExprParen(arg,_,_,_) | arg -> [arg]
30213021
let unnamedCallerArgs,namedCallerArgs =
3022-
args
3023-
|> List.filter (fun arg ->
3024-
match arg with
3025-
// drop errors to avoid confusing error messages in cases like foo(a = 1,)
3026-
// here subsequent step will abort overload resolution complaining that name arguments should appear last
3027-
| SynExpr.ArbitraryAfterError _ -> false
3028-
| _ -> true)
3029-
|> List.takeUntil IsNamedArg
3022+
args |> List.takeUntil IsNamedArg
30303023
let namedCallerArgs =
30313024
namedCallerArgs |> List.choose (fun e ->
3032-
if not (IsNamedArg e) then
3033-
error(Error(FSComp.SR.tcNameArgumentsMustAppearLast(), e.Range))
3025+
if not (IsNamedArg e) then
3026+
// ignore errors to avoid confusing error messages in cases like foo(a = 1,)
3027+
// do not abort overload resolution in case if named arguments are mixed with errors
3028+
match e with
3029+
| SynExpr.ArbitraryAfterError _ -> ()
3030+
| _ -> error(Error(FSComp.SR.tcNameArgumentsMustAppearLast(), e.Range))
30343031
TryGetNamedArg e)
30353032
unnamedCallerArgs, namedCallerArgs
30363033

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp