Skip to content
Closed
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/NicePrint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ module private PrintTypes =
| tys -> bracketL (layoutTypesWithInfoAndPrec denv env 2 (wordL (tagKeyword "or")) tys)
tysL ^^ wordL (tagPunctuation ":") ---
bracketL (stat ++ wordL (tagMember nm) ^^ wordL (tagPunctuation ":") ---
((layoutTypesWithInfoAndPrec denv env 2 (wordL (tagPunctuation "*")) argtys --- wordL (tagPunctuation "->")) --- (layoutTypeWithInfo denv env rty)))
((layoutTypesWithInfoAndPrec denv env 2 (wordL (tagPunctuation "*")) argtys --- wordL (tagPunctuation "->")) --- (layoutTypeWithInfoAndPrec denv env 4 rty)))


/// Layout a unit expression
Expand Down
3 changes: 3 additions & 0 deletions tests/fsharp/tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,9 @@ module TypecheckTests =
[<Test>]
let ``type check neg110`` () = singleNegTest (testConfig "typecheck/sigs") "neg110"

[<Test>]
let ``type check neg111`` () = singleNegTest (testConfig "typecheck/sigs") "neg111"

[<Test>]
let ``type check neg113`` () = singleNegTest (testConfig "typecheck/sigs") "neg113"

Expand Down
6 changes: 6 additions & 0 deletions tests/fsharp/typecheck/sigs/neg111.bsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

test.fs(20,49): error FS0001: A type parameter is missing a constraint 'when (Tuple or ^options) : (static member TupleMap : ^options * Tuple -> (('item -> ^value) -> ^values))'

test.fs(20,49): error FS0001: A type parameter is missing a constraint 'when (Tuple or ^options) : (static member TupleMap : ^options * Tuple -> (('item -> ^value) -> ^values))'

test.fs(20,49): error FS0001: A type parameter is missing a constraint 'when (Tuple or ^options) : (static member TupleMap : ^options * Tuple -> (('item -> ^value) -> ^values))'
22 changes: 22 additions & 0 deletions tests/fsharp/typecheck/sigs/neg111.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module Something
type Tuple =
static member inline TupleMap ((a, b), _ : Tuple) = fun f -> (f a, f b)
static member inline TupleMap ((a, b, c), _ : Tuple) = fun f -> (f a, f b, f c)
static member inline TupleMap ((a, b, c, d), _ : Tuple) = fun f -> (f a, f b, f c, f d)

static member inline Map f (x: 'Tin) : 'Tout =
let inline call_2 (a: ^a, b : ^b) = ((^a or ^b) : (static member TupleMap : ^b * _ -> ^t) (b, a))
call_2 (Unchecked.defaultof<Tuple>, x) f

type IOption<'T> =
abstract member Value : 'T

let inline tupleMap f x = Tuple.Map f x

let inline addOptionValues< ^value, ^options, ^values, 'item when
'item :> IOption< ^value>>
(addUp : ^values -> ^value, sourceOptions : ^options) =
let getValue (i : 'item) = i.Value
let allValues : ^values = tupleMap getValue sourceOptions
let result : ^value = addUp allValues
result