Skip to content

Commit d174bb5

Browse files
abelbraaksmarealvictorprm
authored andcommitted
Fix srtp constraint printing (#9728)
* Fix #5768 Corrected wrong formatted print of a trait member constraint Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Adding regression test. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Fix test to expect an error. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Apply review, move and add new test to typecheck\sigs. Signed-off-by: realvictorprm <mueller.vpr@gmail.com> * Rename neg111 to neg112 to ease merging * Bring layoutReturnType into scope, and use instead of layoutTypeWithInfoAndPrec * Fix test neg112 to use proper directory * Fix tests that suggest overloads to use parens around returned functions * Mention correct file and col numbers in new neg112 test Co-authored-by: realvictorprm <mueller.vpr@gmail.com>
1 parent 1515930 commit d174bb5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/fsharp/NicePrint.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ module private PrintTypes =
892892
| tys -> bracketL (layoutTypesWithInfoAndPrec denv env 2 (wordL (tagKeyword "or")) tys)
893893
tysL ^^ wordL (tagPunctuation ":") ---
894894
bracketL (stat ++ wordL (tagMember nm) ^^ wordL (tagPunctuation ":") ---
895-
((layoutTypesWithInfoAndPrec denv env 2 (wordL (tagPunctuation "*")) argtys --- wordL (tagPunctuation "->")) --- (layoutTypeWithInfo denv env rty)))
895+
((layoutTypesWithInfoAndPrec denv env 2 (wordL (tagPunctuation "*")) argtys --- wordL (tagPunctuation "->")) --- (layoutReturnType denv env rty)))
896896

897897

898898
/// Layout a unit expression
@@ -995,6 +995,8 @@ module private PrintTypes =
995995
and private layoutTypesWithInfoAndPrec denv env prec sep typl =
996996
sepListL sep (List.map (layoutTypeWithInfoAndPrec denv env prec) typl)
997997

998+
and private layoutReturnType denv env rty = layoutTypeWithInfoAndPrec denv env 4 rty
999+
9981000
/// Layout a single type, taking TypeSimplificationInfo into account
9991001
and private layoutTypeWithInfo denv env ty =
10001002
layoutTypeWithInfoAndPrec denv env 5 ty
@@ -1032,8 +1034,6 @@ module private PrintTypes =
10321034
|> List.map (sepListL (wordL (tagPunctuation "*")))
10331035
allArgsL
10341036

1035-
let layoutReturnType denv env rty = layoutTypeWithInfoAndPrec denv env 4 rty
1036-
10371037
let layoutGenericParameterTypes denv env =
10381038
function
10391039
| [] -> emptyL

0 commit comments

Comments
 (0)