Skip to content
Open
Show file tree
Hide file tree
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
22 changes: 5 additions & 17 deletions src/Compiler/Checking/Expressions/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9350,16 +9350,10 @@ and TcUnionCaseOrExnCaseOrActivePatternResultItemThen (cenv: cenv) overallTy env
// This is where the constructor expects arguments but is not applied to arguments, hence build a lambda
numArgTys,
(fun () ->
let argNamesIfFeatureEnabled =
if g.langVersion.SupportsFeature LanguageFeature.ImprovedImpliedArgumentNames then
argNames
else
[]

let vs, args =
argTys
|> List.mapi (fun i ty ->
let argName = argNamesIfFeatureEnabled |> List.tryItem i |> Option.map (fun x -> x.idText) |> Option.defaultWith (fun () -> "arg" + string i)
let argName = argNames |> List.tryItem i |> Option.map (fun x -> x.idText) |> Option.defaultWith (fun () -> "arg" + string i)
mkCompGenLocal mItem argName ty)
|> List.unzip

Expand Down Expand Up @@ -10545,13 +10539,7 @@ and TcMethodApplication_CheckArguments
let denv = env.DisplayEnv
match curriedCallerArgsOpt with
| None ->
let curriedArgTys, curriedArgNamesIfFeatureEnabled, returnTy =
let paramNamesIfFeatureEnabled (g: TcGlobals) (meth: MethInfo) =
if g.langVersion.SupportsFeature LanguageFeature.ImprovedImpliedArgumentNames then
meth.GetParamNames()
else
[]

let curriedArgTys, curriedArgNames, returnTy =
match candidates with
// "single named item" rule. This is where we have a single accessible method
// member x.M(arg1, ..., argN)
Expand All @@ -10563,21 +10551,21 @@ and TcMethodApplication_CheckArguments
// to their default values (for optionals) and be part of the return tuple (for out args).
| [calledMeth] ->
let curriedArgTys, returnTy = UnifyMatchingSimpleArgumentTypes cenv env exprTy.Commit calledMeth mMethExpr mItem
curriedArgTys, paramNamesIfFeatureEnabled g calledMeth, MustEqual returnTy
curriedArgTys, calledMeth.GetParamNames(), MustEqual returnTy
| _ ->
let domainTy, returnTy = UnifyFunctionTypeAndRecover None cenv denv mMethExpr exprTy.Commit
let argTys = if isUnitTy g domainTy then [] else tryDestRefTupleTy g domainTy
// Only apply this rule if a candidate method exists with this number of arguments
let argTys, argNames =
match candidates |> List.tryFind (CalledMethHasSingleArgumentGroupOfThisLength argTys.Length) with
| Some meth -> argTys, paramNamesIfFeatureEnabled g meth
| Some meth -> argTys, meth.GetParamNames()
| None -> [domainTy], [[None]]
[argTys], argNames, MustEqual returnTy

let lambdaVarsAndExprs =
curriedArgTys
|> List.mapiSquared (fun i j ty ->
let argName = curriedArgNamesIfFeatureEnabled |> List.tryItem i |> Option.bind (List.tryItem j) |> Option.flatten |> Option.defaultWith (fun () -> "arg" + string i + string j)
let argName = curriedArgNames |> List.tryItem i |> Option.bind (List.tryItem j) |> Option.flatten |> Option.defaultWith (fun () -> "arg" + string i + string j)
mkCompGenLocal mMethExpr argName ty)

let unnamedCurriedCallerArgs = lambdaVarsAndExprs |> List.mapSquared (fun (_, e) -> CallerArg(tyOfExpr g e, e.Range, false, e))
Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/Checking/MethodCalls.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1388,9 +1388,9 @@ let BuildNewDelegateExpr (eventInfoOpt: EventInfo option, g, amap, delegateTy, d
if List.exists (isByrefTy g) delArgTys then
error(Error(FSComp.SR.tcFunctionRequiresExplicitLambda(delArgTys.Length), m))

let delFuncArgNamesIfFeatureEnabled =
let delFuncArgNames =
match delFuncExpr with
| Expr.Val (valRef = vref) when g.langVersion.SupportsFeature LanguageFeature.ImprovedImpliedArgumentNames ->
| Expr.Val (valRef = vref) ->
match vref.ValReprInfo with
| Some repr when repr.ArgNames.Length = delArgTys.Length -> Some repr.ArgNames
| _ -> None
Expand All @@ -1406,7 +1406,7 @@ let BuildNewDelegateExpr (eventInfoOpt: EventInfo option, g, amap, delegateTy, d
delArgTys
|> List.mapi (fun i argTy ->
let argName =
match delFuncArgNamesIfFeatureEnabled with
match delFuncArgNames with
| Some argNames -> argNames[i]
| None ->
match List.tryItem i delInvokeArgNamesIfFeatureEnabled with
Expand Down
1 change: 0 additions & 1 deletion src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,6 @@ featureStaticMembersInInterfaces,"Static members in interfaces"
featureNonInlineLiteralsAsPrintfFormat,"String values marked as literals and IL constants as printf format"
featureExtendedStringInterpolation,"Extended string interpolation similar to C# raw string literals."
featureWarningWhenMultipleRecdTypeChoice,"Raises warnings when multiple record type matches were found during name resolution because of overlapping field names."
featureImprovedImpliedArgumentNames,"Improved implied argument names"
featureConstraintIntersectionOnFlexibleTypes,"Constraint intersection on flexible types"
featureChkNotTailRecursive,"Raises warnings if a member or function has the 'TailCall' attribute, but is not being used in a tail recursive way."
featureExtendedFixedBindings,"extended fixed bindings for byref and GetPinnableReference"
Expand Down
3 changes: 0 additions & 3 deletions src/Compiler/Facilities/LanguageFeatures.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ type LanguageFeature =
| NonInlineLiteralsAsPrintfFormat
| ExtendedStringInterpolation
| WarningWhenMultipleRecdTypeChoice
| ImprovedImpliedArgumentNames
| ConstraintIntersectionOnFlexibleTypes
| StaticLetInRecordsDusEmptyTypes
| WarningWhenTailRecAttributeButNonTailRecUsage
Expand Down Expand Up @@ -176,7 +175,6 @@ type LanguageVersion(versionText, ?disabledFeaturesArray: LanguageFeature array)
LanguageFeature.NonInlineLiteralsAsPrintfFormat, languageVersion80
LanguageFeature.ExtendedStringInterpolation, languageVersion80
LanguageFeature.WarningWhenMultipleRecdTypeChoice, languageVersion80
LanguageFeature.ImprovedImpliedArgumentNames, languageVersion80
LanguageFeature.WarningWhenTailRecAttributeButNonTailRecUsage, languageVersion80
LanguageFeature.StaticLetInRecordsDusEmptyTypes, languageVersion80
LanguageFeature.ConstraintIntersectionOnFlexibleTypes, languageVersion80
Expand Down Expand Up @@ -370,7 +368,6 @@ type LanguageVersion(versionText, ?disabledFeaturesArray: LanguageFeature array)
| LanguageFeature.NonInlineLiteralsAsPrintfFormat -> FSComp.SR.featureNonInlineLiteralsAsPrintfFormat ()
| LanguageFeature.ExtendedStringInterpolation -> FSComp.SR.featureExtendedStringInterpolation ()
| LanguageFeature.WarningWhenMultipleRecdTypeChoice -> FSComp.SR.featureWarningWhenMultipleRecdTypeChoice ()
| LanguageFeature.ImprovedImpliedArgumentNames -> FSComp.SR.featureImprovedImpliedArgumentNames ()
| LanguageFeature.StaticLetInRecordsDusEmptyTypes -> FSComp.SR.featureStaticLetInRecordsDusEmptyTypes ()
| LanguageFeature.ConstraintIntersectionOnFlexibleTypes -> FSComp.SR.featureConstraintIntersectionOnFlexibleTypes ()
| LanguageFeature.WarningWhenTailRecAttributeButNonTailRecUsage -> FSComp.SR.featureChkNotTailRecursive ()
Expand Down
1 change: 0 additions & 1 deletion src/Compiler/Facilities/LanguageFeatures.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type LanguageFeature =
| NonInlineLiteralsAsPrintfFormat
| ExtendedStringInterpolation
| WarningWhenMultipleRecdTypeChoice
| ImprovedImpliedArgumentNames
| ConstraintIntersectionOnFlexibleTypes
| StaticLetInRecordsDusEmptyTypes
| WarningWhenTailRecAttributeButNonTailRecUsage
Expand Down
5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading