diff --git a/src/fsharp/NicePrint.fs b/src/fsharp/NicePrint.fs index 142ccbae07..a4af40c507 100755 --- a/src/fsharp/NicePrint.fs +++ b/src/fsharp/NicePrint.fs @@ -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 diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 7f5804ea1f..4c02ca1322 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -2466,6 +2466,9 @@ module TypecheckTests = [] let ``type check neg110`` () = singleNegTest (testConfig "typecheck/sigs") "neg110" + [] + let ``type check neg111`` () = singleNegTest (testConfig "typecheck/sigs") "neg111" + [] let ``type check neg113`` () = singleNegTest (testConfig "typecheck/sigs") "neg113" diff --git a/tests/fsharp/typecheck/sigs/neg111.bsl b/tests/fsharp/typecheck/sigs/neg111.bsl new file mode 100644 index 0000000000..f41d139d5e --- /dev/null +++ b/tests/fsharp/typecheck/sigs/neg111.bsl @@ -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))' \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/neg111.fs b/tests/fsharp/typecheck/sigs/neg111.fs new file mode 100644 index 0000000000..b544ee5834 --- /dev/null +++ b/tests/fsharp/typecheck/sigs/neg111.fs @@ -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, 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