Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MakeCalledArgs allocates a struct tuple #9223

Merged
merged 2 commits into from
May 27, 2020
Merged
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
2 changes: 1 addition & 1 deletion src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (canSuggestNa
let nameOrOneBasedIndexMessage =
x.calledArg.NameOpt
|> Option.map (fun n -> FSComp.SR.csOverloadCandidateNamedArgumentTypeMismatch n.idText)
|> Option.defaultValue (FSComp.SR.csOverloadCandidateIndexedArgumentTypeMismatch ((snd x.calledArg.Position) + 1))
|> Option.defaultValue (FSComp.SR.csOverloadCandidateIndexedArgumentTypeMismatch ((Lib.vsnd x.calledArg.Position) + 1)) //snd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we always be qualified with Lib? Is that how other functions from Lib are called elsewhere?

sprintf " // %s" nameOrOneBasedIndexMessage
| _ -> ""

Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/MethodCalls.fs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type CallerArg<'T> =

/// Represents the information about an argument in the method being called
type CalledArg =
{ Position: (int * int)
{ Position: struct (int * int)
IsParamArray : bool
OptArgInfo : OptionalArgInfo
CallerInfo : CallerInfo
Expand Down Expand Up @@ -303,7 +303,7 @@ let MakeCalledArgs amap m (minfo: MethInfo) minst =
// Mark up the arguments with their position, so we can sort them back into order later
let paramDatas = minfo.GetParamDatas(amap, m, minst)
paramDatas |> List.mapiSquared (fun i j (ParamData(isParamArrayArg, isInArg, isOutArg, optArgInfo, callerInfoFlags, nmOpt, reflArgInfo, typeOfCalledArg)) ->
{ Position=(i,j)
{ Position=struct(i,j)
IsParamArray=isParamArrayArg
OptArgInfo=optArgInfo
CallerInfo = callerInfoFlags
Expand Down
1 change: 1 addition & 0 deletions src/fsharp/lib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -564,3 +564,4 @@ type MaybeLazy<'T> =
| Strict x -> x
| Lazy x -> x.Force()

let inline vsnd ((_, y): struct('T * 'T)) = y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the ('T*'T) here and not ('a*'b) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this should be ('a * 'b) or ('T * 'U).