From 167c97c644802fe4651a54a62b7dd4404fa5d808 Mon Sep 17 00:00:00 2001 From: En3Tho <37334640+En3Tho@users.noreply.github.com> Date: Sat, 14 Nov 2020 21:53:04 +0300 Subject: [PATCH 1/5] Fixes printing argument tuple name in a tooltip --- src/fsharp/CheckExpressions.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/CheckExpressions.fs b/src/fsharp/CheckExpressions.fs index 2ab22e7f411..5f600d7049d 100644 --- a/src/fsharp/CheckExpressions.fs +++ b/src/fsharp/CheckExpressions.fs @@ -1659,8 +1659,8 @@ let CombineSyntacticAndInferredArities g declKind rhsExpr prelimScheme = | [], _ -> [] // Dont infer eliminated unit args from the expression if they don't occur syntactically. | ai, [] -> ai - // If we infer a tupled argument from the expression and/or type then use that - | _ when ai1.Length < ai2.Length -> ai2 + // If we infer a tupled argument from the expression and/or type and at least one arg has a name then use that + | _ when ai1.Length < ai2.Length && ai2 |> List.exists (fun (valInfo: ArgReprInfo) -> valInfo.Name.IsSome) -> ai2 | _ -> ai1 let rec loop ais1 ais2 = match ais1, ais2 with From 5f3326019725333ba4e8d1a95b352608469ef944 Mon Sep 17 00:00:00 2001 From: En3Tho- Date: Sun, 15 Nov 2020 13:48:44 +0300 Subject: [PATCH 2/5] fixed arg names in layout_as_string in sformat.fs to match fsi signature --- src/fsharp/utils/sformat.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/utils/sformat.fs b/src/fsharp/utils/sformat.fs index f2192b869a3..0bfc7733ae4 100644 --- a/src/fsharp/utils/sformat.fs +++ b/src/fsharp/utils/sformat.fs @@ -1303,7 +1303,7 @@ module Display = let output_any writer x = output_any_ex FormatOptions.Default writer x - let layout_as_string options x = x |> any_to_layout options |> layout_to_string options + let layout_as_string options (value, typValue) = (value, typValue) |> any_to_layout options |> layout_to_string options let any_to_string x = layout_as_string FormatOptions.Default x From 602f35d1e210ca4f59516fb2ec342ae932f5d24f Mon Sep 17 00:00:00 2001 From: En3Tho <37334640+En3Tho@users.noreply.github.com> Date: Mon, 16 Nov 2020 12:45:11 +0300 Subject: [PATCH 3/5] Renamed more fs/fsi signature pairs to make them match --- src/fsharp/TypedTreeOps.fsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/fsharp/TypedTreeOps.fsi b/src/fsharp/TypedTreeOps.fsi index c209ace4ec6..f6de350ff51 100755 --- a/src/fsharp/TypedTreeOps.fsi +++ b/src/fsharp/TypedTreeOps.fsi @@ -930,9 +930,9 @@ module PrettyTypes = val PrettifyType : TcGlobals -> TType -> TType * TyparConstraintsWithTypars - val PrettifyInstAndTyparsAndType : TcGlobals -> TyparInst * Typars * TType -> (TyparInst * Typars * TType) * TyparConstraintsWithTypars + val PrettifyInstAndTyparsAndType : g: TcGlobals -> x: (TyparInst * Typars * TType) -> (TyparInst * Typars * TType) * TyparConstraintsWithTypars - val PrettifyTypePair : TcGlobals -> TType * TType -> (TType * TType) * TyparConstraintsWithTypars + val PrettifyTypePair : g: TcGlobals -> x: (TType * TType) -> (TType * TType) * TyparConstraintsWithTypars val PrettifyTypes : TcGlobals -> TTypes -> TTypes * TyparConstraintsWithTypars @@ -943,19 +943,19 @@ module PrettyTypes = val PrettifyInst : TcGlobals -> TyparInst -> TyparInst * TyparConstraintsWithTypars - val PrettifyInstAndType : TcGlobals -> TyparInst * TType -> (TyparInst * TType) * TyparConstraintsWithTypars + val PrettifyInstAndType : g: TcGlobals -> x: (TyparInst * TType) -> (TyparInst * TType) * TyparConstraintsWithTypars - val PrettifyInstAndTypes : TcGlobals -> TyparInst * TTypes -> (TyparInst * TTypes) * TyparConstraintsWithTypars + val PrettifyInstAndTypes : g: TcGlobals -> x: (TyparInst * TTypes) -> (TyparInst * TTypes) * TyparConstraintsWithTypars - val PrettifyInstAndSig : TcGlobals -> TyparInst * TTypes * TType -> (TyparInst * TTypes * TType) * TyparConstraintsWithTypars + val PrettifyInstAndSig : g: TcGlobals -> x: (TyparInst * TTypes * TType) -> (TyparInst * TTypes * TType) * TyparConstraintsWithTypars val PrettifyCurriedTypes : TcGlobals -> TType list list -> TType list list * TyparConstraintsWithTypars - val PrettifyCurriedSigTypes : TcGlobals -> TType list list * TType -> (TType list list * TType) * TyparConstraintsWithTypars + val PrettifyCurriedSigTypes : g: TcGlobals -> x: (TType list list * TType) -> (TType list list * TType) * TyparConstraintsWithTypars - val PrettifyInstAndUncurriedSig : TcGlobals -> TyparInst * UncurriedArgInfos * TType -> (TyparInst * UncurriedArgInfos * TType) * TyparConstraintsWithTypars + val PrettifyInstAndUncurriedSig : g: TcGlobals -> x: (TyparInst * UncurriedArgInfos * TType) -> (TyparInst * UncurriedArgInfos * TType) * TyparConstraintsWithTypars - val PrettifyInstAndCurriedSig : TcGlobals -> TyparInst * TTypes * CurriedArgInfos * TType -> (TyparInst * TTypes * CurriedArgInfos * TType) * TyparConstraintsWithTypars + val PrettifyInstAndCurriedSig : g: TcGlobals -> x: (TyparInst * TTypes * CurriedArgInfos * TType) -> (TyparInst * TTypes * CurriedArgInfos * TType) * TyparConstraintsWithTypars [] type DisplayEnv = From 4360f7bf20db42600722e4eeb021b69db5b624dd Mon Sep 17 00:00:00 2001 From: En3Tho <37334640+En3Tho@users.noreply.github.com> Date: Mon, 16 Nov 2020 13:10:43 +0300 Subject: [PATCH 4/5] Renamed more fs/fsi signature pairs to make them match --- src/fsharp/ConstraintSolver.fsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/ConstraintSolver.fsi b/src/fsharp/ConstraintSolver.fsi index 78872f1d805..1014d965a2a 100644 --- a/src/fsharp/ConstraintSolver.fsi +++ b/src/fsharp/ConstraintSolver.fsi @@ -144,7 +144,7 @@ val SimplifyMeasuresInTypeScheme: TcGlobals -> bool -> Typars -> TType -> TyparC val ResolveOverloadingForCall: DisplayEnv -> ConstraintSolverState -> range -> methodName: string -> ndeep: int -> cx: TraitConstraintInfo option -> callerArgs: CallerArgs -> AccessorDomain -> calledMethGroup: CalledMeth list -> permitOptArgs: bool -> reqdRetTyOpt: TType option -> CalledMeth option * OperationResult -val UnifyUniqueOverloading: DisplayEnv -> ConstraintSolverState -> range -> int * int -> string -> AccessorDomain -> CalledMeth list -> TType -> OperationResult +val UnifyUniqueOverloading: DisplayEnv -> ConstraintSolverState -> range -> callerArgCounts: (int * int) -> string -> AccessorDomain -> CalledMeth list -> TType -> OperationResult /// Remove the global constraints where these type variables appear in the support of the constraint val EliminateConstraintsForGeneralizedTypars: DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> Typars -> unit From 9f206f0f5ea0a6854109efb6018adf97a6302680 Mon Sep 17 00:00:00 2001 From: En3Tho <37334640+En3Tho@users.noreply.github.com> Date: Mon, 16 Nov 2020 16:31:21 +0300 Subject: [PATCH 5/5] Updated tests (dunno if in right way or not) --- tests/fsharp/core/hiding/lib2.mli | 2 +- tests/fsharp/core/printing/z.output.test.1000.stdout.47.bsl | 2 +- tests/fsharp/core/printing/z.output.test.1000.stdout.50.bsl | 2 +- tests/fsharp/core/printing/z.output.test.200.stdout.47.bsl | 2 +- tests/fsharp/core/printing/z.output.test.200.stdout.50.bsl | 2 +- tests/fsharp/core/printing/z.output.test.default.stdout.47.bsl | 2 +- tests/fsharp/core/printing/z.output.test.default.stdout.50.bsl | 2 +- tests/fsharp/core/printing/z.output.test.off.stdout.47.bsl | 2 +- tests/fsharp/core/printing/z.output.test.off.stdout.50.bsl | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/fsharp/core/hiding/lib2.mli b/tests/fsharp/core/hiding/lib2.mli index 1988cfb3da6..63ae8c4661c 100644 --- a/tests/fsharp/core/hiding/lib2.mli +++ b/tests/fsharp/core/hiding/lib2.mli @@ -1,7 +1,7 @@ val f1: Lib.abstractType -> unit (* looks OK, but optimization data may refer to hidden type *) -val f2: Lib.abstractType * Lib.abstractType -> unit (* looks OK, but optimization data may refer to hidden type *) +val f2: x: Lib.abstractType * Lib.abstractType -> unit (* looks OK, but optimization data may refer to hidden type *) val e2: exn diff --git a/tests/fsharp/core/printing/z.output.test.1000.stdout.47.bsl b/tests/fsharp/core/printing/z.output.test.1000.stdout.47.bsl index c57d3604170..598af71a5ba 100644 --- a/tests/fsharp/core/printing/z.output.test.1000.stdout.47.bsl +++ b/tests/fsharp/core/printing/z.output.test.1000.stdout.47.bsl @@ -2661,7 +2661,7 @@ end > > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on match val" -> val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b> +> val ( |A|B| ) : p:bool -> x:('a * 'b) -> Choice<'a,'b> > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on parameters" diff --git a/tests/fsharp/core/printing/z.output.test.1000.stdout.50.bsl b/tests/fsharp/core/printing/z.output.test.1000.stdout.50.bsl index d08359162f3..a337731b50d 100644 --- a/tests/fsharp/core/printing/z.output.test.1000.stdout.50.bsl +++ b/tests/fsharp/core/printing/z.output.test.1000.stdout.50.bsl @@ -2663,7 +2663,7 @@ end > > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on match val" -> val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b> +> val ( |A|B| ) : p:bool -> x:('a * 'b) -> Choice<'a,'b> > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on parameters" diff --git a/tests/fsharp/core/printing/z.output.test.200.stdout.47.bsl b/tests/fsharp/core/printing/z.output.test.200.stdout.47.bsl index b169a6c9e6f..6966b57108e 100644 --- a/tests/fsharp/core/printing/z.output.test.200.stdout.47.bsl +++ b/tests/fsharp/core/printing/z.output.test.200.stdout.47.bsl @@ -1906,7 +1906,7 @@ end > > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on match val" -> val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b> +> val ( |A|B| ) : p:bool -> x:('a * 'b) -> Choice<'a,'b> > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on parameters" diff --git a/tests/fsharp/core/printing/z.output.test.200.stdout.50.bsl b/tests/fsharp/core/printing/z.output.test.200.stdout.50.bsl index 9a31c467346..6da5f60add6 100644 --- a/tests/fsharp/core/printing/z.output.test.200.stdout.50.bsl +++ b/tests/fsharp/core/printing/z.output.test.200.stdout.50.bsl @@ -1908,7 +1908,7 @@ end > > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on match val" -> val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b> +> val ( |A|B| ) : p:bool -> x:('a * 'b) -> Choice<'a,'b> > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on parameters" diff --git a/tests/fsharp/core/printing/z.output.test.default.stdout.47.bsl b/tests/fsharp/core/printing/z.output.test.default.stdout.47.bsl index 487ce5a7190..bde1768680a 100644 --- a/tests/fsharp/core/printing/z.output.test.default.stdout.47.bsl +++ b/tests/fsharp/core/printing/z.output.test.default.stdout.47.bsl @@ -6208,7 +6208,7 @@ end > > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on match val" -> val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b> +> val ( |A|B| ) : p:bool -> x:('a * 'b) -> Choice<'a,'b> > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on parameters" diff --git a/tests/fsharp/core/printing/z.output.test.default.stdout.50.bsl b/tests/fsharp/core/printing/z.output.test.default.stdout.50.bsl index 5dea2230f51..de6354773a1 100644 --- a/tests/fsharp/core/printing/z.output.test.default.stdout.50.bsl +++ b/tests/fsharp/core/printing/z.output.test.default.stdout.50.bsl @@ -6210,7 +6210,7 @@ end > > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on match val" -> val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b> +> val ( |A|B| ) : p:bool -> x:('a * 'b) -> Choice<'a,'b> > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on parameters" diff --git a/tests/fsharp/core/printing/z.output.test.off.stdout.47.bsl b/tests/fsharp/core/printing/z.output.test.off.stdout.47.bsl index cd109a34b67..08780e32951 100644 --- a/tests/fsharp/core/printing/z.output.test.off.stdout.47.bsl +++ b/tests/fsharp/core/printing/z.output.test.off.stdout.47.bsl @@ -1676,7 +1676,7 @@ end > > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on match val" -> val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b> +> val ( |A|B| ) : p:bool -> x:('a * 'b) -> Choice<'a,'b> > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on parameters" diff --git a/tests/fsharp/core/printing/z.output.test.off.stdout.50.bsl b/tests/fsharp/core/printing/z.output.test.off.stdout.50.bsl index e3c5dbfc970..ec328051509 100644 --- a/tests/fsharp/core/printing/z.output.test.off.stdout.50.bsl +++ b/tests/fsharp/core/printing/z.output.test.off.stdout.50.bsl @@ -1678,7 +1678,7 @@ end > > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on match val" -> val ( |A|B| ) : p:bool -> 'a * 'b -> Choice<'a,'b> +> val ( |A|B| ) : p:bool -> x:('a * 'b) -> Choice<'a,'b> > val it : string = "** Expect OK since active pattern result is not too generic, typars depend on parameters"