From 2fe3f762f3402bb23e71579961b9fea55e342faa Mon Sep 17 00:00:00 2001 From: nojaf Date: Wed, 31 May 2023 09:00:09 +0200 Subject: [PATCH 1/8] Don't consider seq`1 prefix in NicePrint. --- src/Compiler/Checking/NicePrint.fs | 2 +- src/Compiler/TypedTree/TypedTreeOps.fs | 3 +++ src/Compiler/TypedTree/TypedTreeOps.fsi | 3 +++ .../FSharp.Compiler.ComponentTests.fsproj | 1 + .../Signatures/SeqTests.fs | 10 ++++++++++ 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index 95da6fa9bfd..cf5c23e766f 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -164,7 +164,7 @@ module internal PrintUtilities = let usePrefix (denv: DisplayEnv) (tcref: TyconRef) = match denv.genericParameterStyle with - | GenericParameterStyle.Implicit -> tcref.IsPrefixDisplay + | GenericParameterStyle.Implicit -> not (isSeqTyconRef denv.g tcref) && tcref.IsPrefixDisplay | GenericParameterStyle.Prefix -> true | GenericParameterStyle.Suffix -> false diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 702f7292429..9b7accf5a06 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -1749,6 +1749,9 @@ let isArrayTyconRef (g: TcGlobals) tcref = g.il_arr_tcr_map |> Array.exists (tyconRefEq g tcref) +let isSeqTyconRef (g: TcGlobals) tcref = + tyconRefEq g g.seq_tcr tcref + let rankOfArrayTyconRef (g: TcGlobals) tcref = match g.il_arr_tcr_map |> Array.tryFindIndex (tyconRefEq g tcref) with | Some idx -> diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 8582edaa5fc..bb883f752fd 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -1618,6 +1618,9 @@ val mkArrayTy: TcGlobals -> int -> TType -> range -> TType /// Check if a type definition is one of the artificial type definitions used for array types of different ranks val isArrayTyconRef: TcGlobals -> TyconRef -> bool +/// Check if a type definition is of Microsoft.FSharp.Collections.seq`1 +val isSeqTyconRef: TcGlobals -> TyconRef -> bool + /// Determine the rank of one of the artificial type definitions used for array types val rankOfArrayTyconRef: TcGlobals -> TyconRef -> int diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index dcc966aface..16b9795217e 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -244,6 +244,7 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs new file mode 100644 index 00000000000..899d5907c2e --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs @@ -0,0 +1,10 @@ +module FSharp.Compiler.ComponentTests.Signatures.SeqTests + +open Xunit +open FSharp.Compiler.ComponentTests.Signatures.TestHelpers + +[] +let ``int seq`` () = + assertSingleSignatureBinding + "let s = seq { yield 1 }" + "val s: int seq" From 121bed0aa710672c891835df64222d60b13e8d42 Mon Sep 17 00:00:00 2001 From: nojaf Date: Wed, 31 May 2023 09:48:07 +0200 Subject: [PATCH 2/8] Update baselines. --- .../CompilerOptions/fsc/flaterrors.fs | 8 +-- .../neg_invalid_constructor.fs.err.bsl | 2 +- tests/fsharp/core/auto-widen/5.0/test.bsl | 53 ++++++++++--------- tests/fsharp/core/auto-widen/preview/test.bsl | 52 +++++++++--------- 4 files changed, 58 insertions(+), 57 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors.fs index bd917a838c2..4f4142a76f1 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/flaterrors.fs @@ -26,8 +26,8 @@ module flaterrors = |> compile options |> shouldFail |> withDiagnostics [ - (Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\n ''a list' \nbut here has type\n 'seq<'b>' ") - (Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\n ''a list' \nbut here has type\n 'seq' ") + (Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\n ''a list' \nbut here has type\n ''b seq' ") + (Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\n ''a list' \nbut here has type\n 'int seq' ") (Warning 20, Line 1, Col 1, Line 1, Col 17, "The result of this expression has type ''a list' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.") ] @@ -40,8 +40,8 @@ module flaterrors = |> compile options |> shouldFail |> withDiagnostics [ - (Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\029 ''a list' \029but here has type\029 'seq<'b>'") - (Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\029 ''a list' \029but here has type\029 'seq'") + (Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\029 ''a list' \029but here has type\029 ''b seq'") + (Error 1, Line 1, Col 11, Line 1, Col 16, "This expression was expected to have type\029 ''a list' \029but here has type\029 'int seq'") ] [] //once diff --git a/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/neg_invalid_constructor.fs.err.bsl b/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/neg_invalid_constructor.fs.err.bsl index 6d456b36851..960310bbe1c 100644 --- a/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/neg_invalid_constructor.fs.err.bsl +++ b/tests/FSharp.Compiler.ComponentTests/ConstraintSolver/neg_invalid_constructor.fs.err.bsl @@ -17,6 +17,6 @@ neg_invalid_constructor.fs (7,30)-(7,60) typecheck error A unique overload for m Known type of argument: 'a list Candidates: - - new: col: 'b -> ImmutableStack<'a> when 'b :> seq<'c> + - new: col: 'b -> ImmutableStack<'a> when 'b :> 'c seq - private new: items: 'a list -> ImmutableStack<'a> neg_invalid_constructor.fs (7,30)-(7,60) typecheck error This is not a valid object construction expression. Explicit object constructors must either call an alternate constructor or initialize all fields of the object and specify a call to a super class constructor. \ No newline at end of file diff --git a/tests/fsharp/core/auto-widen/5.0/test.bsl b/tests/fsharp/core/auto-widen/5.0/test.bsl index f16d2696867..b424faff834 100644 --- a/tests/fsharp/core/auto-widen/5.0/test.bsl +++ b/tests/fsharp/core/auto-widen/5.0/test.bsl @@ -664,62 +664,62 @@ but here has type 'int' test.fsx(335,28,335,39): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(337,9,338,34): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(340,9,341,33): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(343,9,344,35): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(346,9,347,36): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(349,9,349,36): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(351,9,351,40): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(353,9,354,40): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(356,9,357,41): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(359,9,359,35): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(361,9,362,36): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' test.fsx(364,9,365,37): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a list' @@ -779,72 +779,72 @@ but here has type 'int' test.fsx(390,28,390,41): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(391,30,392,57): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(393,30,394,56): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(395,30,396,58): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(397,30,398,59): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(399,30,399,59): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(400,30,400,63): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(401,30,402,63): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(403,30,404,64): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(405,31,405,59): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(406,31,407,60): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(408,31,409,61): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type ''a array' test.fsx(429,10,437,16): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type 'OtherSeq<'a>' test.fsx(448,9,450,49): typecheck error FS0001: This expression was expected to have type - 'seq' + 'int64 seq' but here has type 'OtherSeqImpl<'a>' @@ -855,5 +855,6 @@ but here has type test.fsx(454,46,454,47): typecheck error FS0001: This expression was expected to have type 'int64' + 'int64' but here has type 'int' diff --git a/tests/fsharp/core/auto-widen/preview/test.bsl b/tests/fsharp/core/auto-widen/preview/test.bsl index 24fa4a641cd..c17dc66908f 100644 --- a/tests/fsharp/core/auto-widen/preview/test.bsl +++ b/tests/fsharp/core/auto-widen/preview/test.bsl @@ -369,69 +369,69 @@ test.fsx(331,38,331,39): typecheck error FS3389: This expression uses a built-in test.fsx(331,38,331,39): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(335,28,335,39): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(335,28,335,39): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(335,36,335,37): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(335,36,335,37): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(337,9,338,34): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(337,9,338,34): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(337,17,337,18): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(337,17,337,18): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(340,9,341,33): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(340,9,341,33): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(341,30,341,31): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(341,30,341,31): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(343,9,344,35): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(343,9,344,35): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(344,32,344,33): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(344,32,344,33): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(346,9,347,36): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(346,9,347,36): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(346,17,346,18): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(346,17,346,18): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(349,9,349,36): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(349,9,349,36): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(351,9,351,40): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(351,9,351,40): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(351,37,351,38): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(351,37,351,38): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(353,9,354,40): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(353,9,354,40): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(354,37,354,38): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(354,37,354,38): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(356,9,357,41): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(356,9,357,41): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(356,17,356,18): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(356,17,356,18): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(359,9,359,35): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(359,9,359,35): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(359,21,359,22): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(359,21,359,22): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(361,9,362,36): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(361,9,362,36): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(362,21,362,22): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(362,21,362,22): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(364,9,365,37): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(364,9,365,37): typecheck error FS3388: This expression implicitly converts type 'int64 list' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(364,17,364,18): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. @@ -481,77 +481,77 @@ test.fsx(386,40,386,41): typecheck error FS3389: This expression uses a built-in test.fsx(386,40,386,41): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(390,28,390,41): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(390,28,390,41): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(390,37,390,38): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(390,37,390,38): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(391,30,392,57): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(391,30,392,57): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(391,39,391,40): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(391,39,391,40): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(393,30,394,56): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(393,30,394,56): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(394,52,394,53): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(394,52,394,53): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(395,30,396,58): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(395,30,396,58): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(396,54,396,55): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(396,54,396,55): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(397,30,398,59): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(397,30,398,59): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(397,39,397,40): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(397,39,397,40): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(399,30,399,59): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(399,30,399,59): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(400,30,400,63): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(400,30,400,63): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(400,59,400,60): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(400,59,400,60): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(401,30,402,63): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(401,30,402,63): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(402,59,402,60): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(402,59,402,60): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(403,30,404,64): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(403,30,404,64): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(403,39,403,40): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(403,39,403,40): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(405,31,405,59): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(405,31,405,59): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(405,44,405,45): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(405,44,405,45): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(406,31,407,60): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(406,31,407,60): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(407,44,407,45): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(407,44,407,45): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(408,31,409,61): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(408,31,409,61): typecheck error FS3388: This expression implicitly converts type 'int64 array' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(408,40,408,41): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. test.fsx(408,40,408,41): typecheck error FS3388: This expression implicitly converts type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(429,10,437,16): typecheck error FS3388: This expression implicitly converts type 'OtherSeq' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(429,10,437,16): typecheck error FS3388: This expression implicitly converts type 'OtherSeq' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. -test.fsx(448,9,450,49): typecheck error FS3388: This expression implicitly converts type 'OtherSeqImpl' to type 'seq'. See https://aka.ms/fsharp-implicit-convs. +test.fsx(448,9,450,49): typecheck error FS3388: This expression implicitly converts type 'OtherSeqImpl' to type 'int64 seq'. See https://aka.ms/fsharp-implicit-convs. test.fsx(452,32,452,33): typecheck error FS3389: This expression uses a built-in implicit conversion to convert type 'int' to type 'int64'. See https://aka.ms/fsharp-implicit-convs. From cc96550b58a028fc888d3c3eee15e583fd0c9d26 Mon Sep 17 00:00:00 2001 From: nojaf Date: Wed, 31 May 2023 11:34:55 +0200 Subject: [PATCH 3/8] Update full framework baselines. --- .../neg_known_return_type_and_known_type_arguments.bsl | 2 +- tests/fsharp/typecheck/sigs/neg04.bsl | 8 ++++---- tests/fsharp/typecheck/sigs/neg119a.bsl | 4 ++-- tests/fsharp/typecheck/sigs/neg18.bsl | 2 +- tests/fsharp/typecheck/sigs/neg20.bsl | 2 +- tests/fsharp/typecheck/sigs/version50/neg20.bsl | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/fsharp/typecheck/overloads/neg_known_return_type_and_known_type_arguments.bsl b/tests/fsharp/typecheck/overloads/neg_known_return_type_and_known_type_arguments.bsl index 698171eac59..363ac731b27 100644 --- a/tests/fsharp/typecheck/overloads/neg_known_return_type_and_known_type_arguments.bsl +++ b/tests/fsharp/typecheck/overloads/neg_known_return_type_and_known_type_arguments.bsl @@ -21,6 +21,6 @@ Available overloads: - static member Zero.Zero: ^t * Default2 -> ('a1 -> 'a1) when ^t: null and ^t: struct // Argument at index 1 doesn't match - static member Zero.Zero: ^t * Default2 -> ^t when (FromInt32 or ^t) : (static member FromInt32: ^t * FromInt32 -> (int32 -> ^t)) // Argument at index 1 doesn't match - static member Zero.Zero: ^t * Default3 -> ^t when ^t: (static member Empty: ^t) // Argument at index 1 doesn't match - - static member Zero.Zero: seq<'a> * Zero -> seq<'a> // Argument at index 1 doesn't match + - static member Zero.Zero: 'a seq * Zero -> 'a seq // Argument at index 1 doesn't match - static member Zero.Zero: string * Zero -> string // Argument at index 1 doesn't match - static member Zero.Zero: unit * Zero -> unit // Argument at index 1 doesn't match diff --git a/tests/fsharp/typecheck/sigs/neg04.bsl b/tests/fsharp/typecheck/sigs/neg04.bsl index 25a4a425582..3630185c4ba 100644 --- a/tests/fsharp/typecheck/sigs/neg04.bsl +++ b/tests/fsharp/typecheck/sigs/neg04.bsl @@ -27,18 +27,18 @@ but given a tuple of length 3 of type neg04.fs(47,30,47,51): typecheck error FS0001: Type mismatch. Expecting a - 'seq<'a> -> 'n' + ''a seq -> 'n' but given a ''o list -> 'p' -The type 'seq<'a>' does not match the type ''n list' +The type ''a seq' does not match the type ''n list' neg04.fs(47,49,47,51): typecheck error FS0784: This numeric literal requires that a module 'NumericLiteralN' defining functions FromZero, FromOne, FromInt32, FromInt64 and FromString be in scope neg04.fs(47,30,47,51): typecheck error FS0001: Type mismatch. Expecting a - 'seq<'a> -> 'n' + ''a seq -> 'n' but given a ''o list -> 'p' -The type 'seq<'a>' does not match the type ''n list' +The type ''a seq' does not match the type ''n list' neg04.fs(61,25,61,40): typecheck error FS0001: This expression was expected to have type 'ClassType1' diff --git a/tests/fsharp/typecheck/sigs/neg119a.bsl b/tests/fsharp/typecheck/sigs/neg119a.bsl index 58a84ff82a8..7d9659a091d 100644 --- a/tests/fsharp/typecheck/sigs/neg119a.bsl +++ b/tests/fsharp/typecheck/sigs/neg119a.bsl @@ -8,5 +8,5 @@ Known type parameters: < obj , Applicatives.Ap > Available overloads: - static member Applicatives.Ap.Return: ('r -> 'a) * Ap: Applicatives.Ap -> (('a -> 'r -> 'a2) -> 'a3 -> 'a -> 'r -> 'a2) // Argument at index 1 doesn't match - static member Applicatives.Ap.Return: System.Tuple<'a> * Ap: Applicatives.Ap -> ('a -> System.Tuple<'a>) // Argument at index 1 doesn't match - - static member Applicatives.Ap.Return: r: ^R * obj -> ('a1 -> ^R) when ^R: (static member Return: 'a1 -> ^R) // Argument 'r' doesn't match - - static member Applicatives.Ap.Return: seq<'a> * Ap: Applicatives.Ap -> ('a -> seq<'a>) // Argument at index 1 doesn't match Consider adding further type constraints + - static member Applicatives.Ap.Return: 'a seq * Ap: Applicatives.Ap -> ('a -> 'a seq) // Argument at index 1 doesn't match + - static member Applicatives.Ap.Return: r: ^R * obj -> ('a1 -> ^R) when ^R: (static member Return: 'a1 -> ^R) // Argument 'r' doesn't match Consider adding further type constraints diff --git a/tests/fsharp/typecheck/sigs/neg18.bsl b/tests/fsharp/typecheck/sigs/neg18.bsl index 4d98d9345c8..634d3b127e8 100644 --- a/tests/fsharp/typecheck/sigs/neg18.bsl +++ b/tests/fsharp/typecheck/sigs/neg18.bsl @@ -1,5 +1,5 @@ -neg18.fs(7,13,7,20): typecheck error FS0001: The type 'int' is not compatible with the type 'seq<'a>' +neg18.fs(7,13,7,20): typecheck error FS0001: The type 'int' is not compatible with the type ''a seq' neg18.fs(25,21,25,24): typecheck error FS0033: The type 'Test.AmbiguousTypeNameTests.TwoAmbiguousGenericTypes.M.C<_>' expects 1 type argument(s) but is given 0 diff --git a/tests/fsharp/typecheck/sigs/neg20.bsl b/tests/fsharp/typecheck/sigs/neg20.bsl index 88f483967e4..ffdaf4e95f0 100644 --- a/tests/fsharp/typecheck/sigs/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/neg20.bsl @@ -70,7 +70,7 @@ The type 'A' does not match the type 'B' neg20.fs(80,23,80,39): typecheck error FS0193: Type constraint mismatch. The type 'C list' is not compatible with type - 'seq' + 'B seq' neg20.fs(81,34,81,43): typecheck error FS0001: Type mismatch. Expecting a diff --git a/tests/fsharp/typecheck/sigs/version50/neg20.bsl b/tests/fsharp/typecheck/sigs/version50/neg20.bsl index 37e8f71a499..bc723ef371a 100644 --- a/tests/fsharp/typecheck/sigs/version50/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/version50/neg20.bsl @@ -101,7 +101,7 @@ The type 'A' does not match the type 'B' neg20.fs(80,23,80,39): typecheck error FS0193: Type constraint mismatch. The type 'C list' is not compatible with type - 'seq' + 'B seq' neg20.fs(81,34,81,43): typecheck error FS0001: Type mismatch. Expecting a From 7c21316aa4de4015fce735194b0c39881345f7f1 Mon Sep 17 00:00:00 2001 From: nojaf Date: Wed, 31 May 2023 13:26:12 +0200 Subject: [PATCH 4/8] Moar baselines --- .../Signatures/SeqTests.fs | 6 ++++++ tests/fsharp/core/printing/output.1000.stdout.bsl | 12 ++++++------ tests/fsharp/core/printing/output.200.stdout.bsl | 12 ++++++------ tests/fsharp/core/printing/output.47.stdout.bsl | 12 ++++++------ .../fsharp/core/printing/output.multiemit.stdout.bsl | 12 ++++++------ tests/fsharp/core/printing/output.off.stdout.bsl | 12 ++++++------ tests/fsharp/core/printing/output.stdout.bsl | 12 ++++++------ tests/fsharp/core/span/test3.bsl | 4 ++-- 8 files changed, 44 insertions(+), 38 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs index 899d5907c2e..4ef73013d99 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/SeqTests.fs @@ -8,3 +8,9 @@ let ``int seq`` () = assertSingleSignatureBinding "let s = seq { yield 1 }" "val s: int seq" + +[] +let ``tuple seq`` () = + assertSingleSignatureBinding + "let s = seq { yield (1, 'b', 2.) }" + "val s: (int * char * float) seq" diff --git a/tests/fsharp/core/printing/output.1000.stdout.bsl b/tests/fsharp/core/printing/output.1000.stdout.bsl index db31e53778b..ddde159fd6b 100644 --- a/tests/fsharp/core/printing/output.1000.stdout.bsl +++ b/tests/fsharp/core/printing/output.1000.stdout.bsl @@ -44,9 +44,9 @@ val x9: Lazy type ClassInFile2 = new: unit -> ClassInFile2 -> val x1: seq -val x2: seq -val x3: seq +> val x1: string seq +val x2: string seq +val x3: string seq val f1: System.Windows.Forms.Form = System.Windows.Forms.Form, Text: f1 form val fs: System.Windows.Forms.Form array = [|System.Windows.Forms.Form, Text: fs #0; @@ -208,7 +208,7 @@ val sxs0: Set = set [] > module M = val a: string = "sub-binding" val b: - (seq * seq * seq * System.Windows.Forms.Form) option * + (string seq * string seq * string seq * System.Windows.Forms.Form) option * (string list * string list * string array2d) option = (Some (, , , System.Windows.Forms.Form, Text: f1 form), Some @@ -1444,7 +1444,7 @@ module internal PrivateM = type private T14 = new: unit -> T14 -> val it: seq = +> val it: (int * string * int) seq = seq [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2); (58, "2/10/2009", 1)] @@ -1487,7 +1487,7 @@ module Test4343d = val xOption: int option = Some 12 val xArray2: (int * int) array2d = [[(0, 0); (0, 1)] [(1, 0); (1, 1)]] - val xSeq: seq + val xSeq: int seq module Test4343e = type C = new: x: int -> C diff --git a/tests/fsharp/core/printing/output.200.stdout.bsl b/tests/fsharp/core/printing/output.200.stdout.bsl index 68a147da461..89f13b2b05f 100644 --- a/tests/fsharp/core/printing/output.200.stdout.bsl +++ b/tests/fsharp/core/printing/output.200.stdout.bsl @@ -44,9 +44,9 @@ val x9: Lazy type ClassInFile2 = new: unit -> ClassInFile2 -> val x1: seq -val x2: seq -val x3: seq +> val x1: string seq +val x2: string seq +val x3: string seq val f1: System.Windows.Forms.Form = System.Windows.Forms.Form, Text: f1 form val fs: System.Windows.Forms.Form array = [|System.Windows.Forms.Form, Text: fs #0; @@ -110,7 +110,7 @@ val sxs0: Set = set [] > module M = val a: string = "sub-binding" val b: - (seq * seq * seq * System.Windows.Forms.Form) option * + (string seq * string seq * string seq * System.Windows.Forms.Form) option * (string list * string list * string array2d) option = (Some (, , , System.Windows.Forms.Form, Text: f1 form), Some @@ -689,7 +689,7 @@ module internal PrivateM = type private T14 = new: unit -> T14 -> val it: seq = +> val it: (int * string * int) seq = seq [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2); (58, "2/10/2009", 1)] @@ -732,7 +732,7 @@ module Test4343d = val xOption: int option = Some 12 val xArray2: (int * int) array2d = [[(0, 0); (0, 1)] [(1, 0); (1, 1)]] - val xSeq: seq + val xSeq: int seq module Test4343e = type C = new: x: int -> C diff --git a/tests/fsharp/core/printing/output.47.stdout.bsl b/tests/fsharp/core/printing/output.47.stdout.bsl index 711b7788174..37a93c6fe8e 100644 --- a/tests/fsharp/core/printing/output.47.stdout.bsl +++ b/tests/fsharp/core/printing/output.47.stdout.bsl @@ -42,9 +42,9 @@ val x9: Lazy type ClassInFile2 = new: unit -> ClassInFile2 -> val x1: seq -val x2: seq -val x3: seq +> val x1: string seq +val x2: string seq +val x3: string seq val f1: System.Windows.Forms.Form = System.Windows.Forms.Form, Text: f1 form val fs: System.Windows.Forms.Form array = [|System.Windows.Forms.Form, Text: fs #0; @@ -206,7 +206,7 @@ val sxs0: Set = set [] > module M = val a: string = "sub-binding" val b: - (seq * seq * seq * System.Windows.Forms.Form) option * + (string seq * string seq * string seq * System.Windows.Forms.Form) option * (string list * string list * string array2d) option = (Some (, , , System.Windows.Forms.Form, Text: f1 form), Some @@ -4989,7 +4989,7 @@ module internal PrivateM = type private T14 = new: unit -> T14 -> val it: seq = +> val it: (int * string * int) seq = seq [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2); (58, "2/10/2009", 1)] @@ -5032,7 +5032,7 @@ module Test4343d = val xOption: int option = Some 12 val xArray2: (int * int) array2d = [[(0, 0); (0, 1)] [(1, 0); (1, 1)]] - val xSeq: seq + val xSeq: int seq module Test4343e = type C = new: x: int -> C diff --git a/tests/fsharp/core/printing/output.multiemit.stdout.bsl b/tests/fsharp/core/printing/output.multiemit.stdout.bsl index 72fd9b16f80..ceb7d3d69a3 100644 --- a/tests/fsharp/core/printing/output.multiemit.stdout.bsl +++ b/tests/fsharp/core/printing/output.multiemit.stdout.bsl @@ -42,9 +42,9 @@ val x9: Lazy type ClassInFile2 = new: unit -> ClassInFile2 -> val x1: seq -val x2: seq -val x3: seq +> val x1: string seq +val x2: string seq +val x3: string seq val f1: System.Windows.Forms.Form = System.Windows.Forms.Form, Text: f1 form val fs: System.Windows.Forms.Form array = [|System.Windows.Forms.Form, Text: fs #0; @@ -206,7 +206,7 @@ val sxs0: Set = set [] > module M = val a: string = "sub-binding" val b: - (seq * seq * seq * System.Windows.Forms.Form) option * + (string seq * string seq * string seq * System.Windows.Forms.Form) option * (string list * string list * string array2d) option = (Some (, , , System.Windows.Forms.Form, Text: f1 form), Some @@ -4991,7 +4991,7 @@ module internal PrivateM = type private T14 = new: unit -> T14 -> val it: seq = +> val it: (int * string * int) seq = seq [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2); (58, "2/10/2009", 1)] @@ -5034,7 +5034,7 @@ module Test4343d = val xOption: int option = Some 12 val xArray2: (int * int) array2d = [[(0, 0); (0, 1)] [(1, 0); (1, 1)]] - val xSeq: seq + val xSeq: int seq module Test4343e = type C = new: x: int -> C diff --git a/tests/fsharp/core/printing/output.off.stdout.bsl b/tests/fsharp/core/printing/output.off.stdout.bsl index d4f0877f6ea..64444ac405b 100644 --- a/tests/fsharp/core/printing/output.off.stdout.bsl +++ b/tests/fsharp/core/printing/output.off.stdout.bsl @@ -44,9 +44,9 @@ val x9: Lazy type ClassInFile2 = new: unit -> ClassInFile2 -> val x1: seq -val x2: seq -val x3: seq +> val x1: string seq +val x2: string seq +val x3: string seq val f1: System.Windows.Forms.Form val fs: System.Windows.Forms.Form array val xs: string list @@ -79,7 +79,7 @@ val sxs0: Set > module M = val a: string val b: - (seq * seq * seq * System.Windows.Forms.Form) option * + (string seq * string seq * string seq * System.Windows.Forms.Form) option * (string list * string list * string array2d) option type T = new: a: int * b: int -> T @@ -489,7 +489,7 @@ module internal PrivateM = type private T14 = new: unit -> T14 -> val it: seq = +> val it: (int * string * int) seq = seq [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2); (58, "2/10/2009", 1)] @@ -522,7 +522,7 @@ module Test4343d = val xString: string val xOption: int option val xArray2: (int * int) array2d - val xSeq: seq + val xSeq: int seq module Test4343e = type C = new: x: int -> C diff --git a/tests/fsharp/core/printing/output.stdout.bsl b/tests/fsharp/core/printing/output.stdout.bsl index 72fd9b16f80..ceb7d3d69a3 100644 --- a/tests/fsharp/core/printing/output.stdout.bsl +++ b/tests/fsharp/core/printing/output.stdout.bsl @@ -42,9 +42,9 @@ val x9: Lazy type ClassInFile2 = new: unit -> ClassInFile2 -> val x1: seq -val x2: seq -val x3: seq +> val x1: string seq +val x2: string seq +val x3: string seq val f1: System.Windows.Forms.Form = System.Windows.Forms.Form, Text: f1 form val fs: System.Windows.Forms.Form array = [|System.Windows.Forms.Form, Text: fs #0; @@ -206,7 +206,7 @@ val sxs0: Set = set [] > module M = val a: string = "sub-binding" val b: - (seq * seq * seq * System.Windows.Forms.Form) option * + (string seq * string seq * string seq * System.Windows.Forms.Form) option * (string list * string list * string array2d) option = (Some (, , , System.Windows.Forms.Form, Text: f1 form), Some @@ -4991,7 +4991,7 @@ module internal PrivateM = type private T14 = new: unit -> T14 -> val it: seq = +> val it: (int * string * int) seq = seq [(43, "10/28/2008", 1); (46, "11/18/2008", 1); (56, "1/27/2009", 2); (58, "2/10/2009", 1)] @@ -5034,7 +5034,7 @@ module Test4343d = val xOption: int option = Some 12 val xArray2: (int * int) array2d = [[(0, 0); (0, 1)] [(1, 0); (1, 1)]] - val xSeq: seq + val xSeq: int seq module Test4343e = type C = new: x: int -> C diff --git a/tests/fsharp/core/span/test3.bsl b/tests/fsharp/core/span/test3.bsl index 1e6859edcc6..194b88d3d94 100644 --- a/tests/fsharp/core/span/test3.bsl +++ b/tests/fsharp/core/span/test3.bsl @@ -3,12 +3,12 @@ test3.fsx(30,17,30,23): typecheck error FS0027: This value is not mutable. Consi test3.fsx(38,21,38,27): typecheck error FS0027: This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'. -test3.fsx(46,26,46,27): typecheck error FS0001: The type 'Span' is not compatible with the type 'seq<'a>' +test3.fsx(46,26,46,27): typecheck error FS0001: The type 'Span' is not compatible with the type ''a seq' test3.fsx(47,21,47,27): typecheck error FS0027: This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'. test3.fsx(46,26,46,27): typecheck error FS0193: Type constraint mismatch. The type 'Span' is not compatible with type - 'seq' + 'int seq' From 6de84c01b91b5de40eb95f93a746c650cbd73362 Mon Sep 17 00:00:00 2001 From: nojaf Date: Wed, 31 May 2023 13:51:56 +0200 Subject: [PATCH 5/8] Update QuickInfoTests.fs --- vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs index e5188b5eef8..58b30075545 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/QuickInfoTests.fs @@ -299,7 +299,7 @@ module Test = """ let quickInfo = GetQuickInfoTextFromCode code - let expected = "val methodSeq: seq<(int -> string * int)>" + let expected = "val methodSeq: (int -> string * int) seq" Assert.Equal(expected, quickInfo) () From 5ec927d249f5e30291dbd0d8e1fdb315482cd421 Mon Sep 17 00:00:00 2001 From: nojaf Date: Wed, 31 May 2023 14:49:26 +0200 Subject: [PATCH 6/8] Update tests --- .../Tests.LanguageService.QuickInfo.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs index d6e96ede231..f54db72b21e 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs @@ -268,7 +268,7 @@ type Async = static member AwaitWaitHandle: waitHandle: WaitHandle * ?millisecondsTimeout: int -> Async static member CancelDefaultToken: unit -> unit static member Catch: computation: Async<'T> -> Async> - static member Choice: computations: seq> -> Async<'T option> + static member Choice: computations: Async<'T option> seq -> Async<'T option> static member FromBeginEnd: beginAction: (AsyncCallback * obj -> IAsyncResult) * endAction: (IAsyncResult -> 'T) * ?cancelAction: (unit -> unit) -> Async<'T> + 3 overloads static member FromContinuations: callback: (('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> ... @@ -2475,7 +2475,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker1_3*)", "Full name: Microsoft.FSharp.Core.float") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker2_1*)","type seq<'T> = System.Collections.Generic.IEnumerable<'T>") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker2_1*)","Full name: Microsoft.FSharp.Collections.seq<_>") - this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2_2*)", "val seq: seq<'T> -> seq<'T>") + this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2_2*)", "val seq: 'T seq -> 'T seq") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2_2*)", "Full name: Microsoft.FSharp.Core.Operators.seq") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker3_1*)","type Set<'T (requires comparison)> =") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker3_1*)","Full name: Microsoft.FSharp.Collections.Set") @@ -2679,7 +2679,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker1_1*)", "type MyInt = int") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker1_2*)", "val myInt: MyInt") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2_1*)", "type PairOfFloat = float * float") - this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2_2*)", "val MySeq: seq") + this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2_2*)", "val MySeq: PairOfFloat seq") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker3_1*)", "type IA =") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker3_2*)", "type ClassIA =") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker4_1*)", "type GenericClass<'a (requires 'a :> IA)> =") From 2bc1acf8d5c7d69f8688ab97b2f9ffdd962fc024 Mon Sep 17 00:00:00 2001 From: dawe Date: Thu, 1 Jun 2023 11:55:11 +0200 Subject: [PATCH 7/8] adjust expected output --- .../Source/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs | 2 +- .../Source/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs | 2 +- tests/fsharpqa/Source/Diagnostics/NONTERM/quoteExpr01.fs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs index fcb5e10f2ae..1e21dee32de 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/flaterrors/E_MultiLine01.fs @@ -3,6 +3,6 @@ //This expression was expected to have type // ''a list' //but here has type -// 'seq<'b>' +// ''b seq' List.rev {1..10} diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs index 511987567fc..6098e469d5b 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/flaterrors/E_MultiLine02.fs @@ -1,5 +1,5 @@ // #Regression #NoMT #CompilerOptions // Test that using [--flaterrors] flag multi-line errors are flattened, i.e. concatenated into one-line error message. -//This expression was expected to have type. ''a list' .but here has type. 'seq<'b>' +//This expression was expected to have type. ''a list' .but here has type. ''b seq' List.rev {1..10} |> ignore diff --git a/tests/fsharpqa/Source/Diagnostics/NONTERM/quoteExpr01.fs b/tests/fsharpqa/Source/Diagnostics/NONTERM/quoteExpr01.fs index 42e04f7fa44..e6767171375 100644 --- a/tests/fsharpqa/Source/Diagnostics/NONTERM/quoteExpr01.fs +++ b/tests/fsharpqa/Source/Diagnostics/NONTERM/quoteExpr01.fs @@ -1,5 +1,5 @@ // #Regression #Diagnostics // Regression test for FSHARP1.0:2391, FSHARP1.0:1479 -//The result of this expression has type 'seq' and is implicitly ignored +//The result of this expression has type 'Quotations.Var seq' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. #light "off" <@@ 1 @@>.GetFreeVars() From d53ee9b68e3475dfe4396be9552b79b01931bb97 Mon Sep 17 00:00:00 2001 From: nojaf Date: Mon, 5 Jun 2023 16:09:08 +0200 Subject: [PATCH 8/8] Set IsPrefixDisplay to false for seq`1. --- src/Compiler/Checking/NicePrint.fs | 2 +- src/Compiler/Driver/CompilerImports.fs | 3 +++ src/Compiler/TypedTree/TypedTreeOps.fs | 29 ++++++++++++++++++++++--- src/Compiler/TypedTree/TypedTreeOps.fsi | 7 +++--- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index cf5c23e766f..95da6fa9bfd 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -164,7 +164,7 @@ module internal PrintUtilities = let usePrefix (denv: DisplayEnv) (tcref: TyconRef) = match denv.genericParameterStyle with - | GenericParameterStyle.Implicit -> not (isSeqTyconRef denv.g tcref) && tcref.IsPrefixDisplay + | GenericParameterStyle.Implicit -> tcref.IsPrefixDisplay | GenericParameterStyle.Prefix -> true | GenericParameterStyle.Suffix -> false diff --git a/src/Compiler/Driver/CompilerImports.fs b/src/Compiler/Driver/CompilerImports.fs index d182a8d8ebf..c38dd470a65 100644 --- a/src/Compiler/Driver/CompilerImports.fs +++ b/src/Compiler/Driver/CompilerImports.fs @@ -2009,6 +2009,9 @@ and [] TcImports let minfo: PickledCcuInfo = data.RawData let mspec = minfo.mspec + + if mspec.DisplayName = "FSharp.Core" then + updateSeqTypeIsPrefix mspec #if !NO_TYPEPROVIDERS let invalidateCcu = Event<_>() diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 9b7accf5a06..76bdc39cf60 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -1749,9 +1749,6 @@ let isArrayTyconRef (g: TcGlobals) tcref = g.il_arr_tcr_map |> Array.exists (tyconRefEq g tcref) -let isSeqTyconRef (g: TcGlobals) tcref = - tyconRefEq g g.seq_tcr tcref - let rankOfArrayTyconRef (g: TcGlobals) tcref = match g.il_arr_tcr_map |> Array.tryFindIndex (tyconRefEq g tcref) with | Some idx -> @@ -10609,3 +10606,29 @@ let rec serializeEntity path (entity: Entity) = let json = sw.ToString() use out = FileSystem.OpenFileForWriteShim(path, fileMode = System.IO.FileMode.Create) out.WriteAllText(json) + +let updateSeqTypeIsPrefix (fsharpCoreMSpec: ModuleOrNamespace) = + let findModuleOrNamespace (name: string) (entity: Entity) = + if not entity.IsModuleOrNamespace then + None + else + entity.ModuleOrNamespaceType.ModulesAndNamespacesByDemangledName + |> Map.tryFind name + + findModuleOrNamespace "Microsoft" fsharpCoreMSpec + |> Option.bind (findModuleOrNamespace "FSharp") + |> Option.bind (findModuleOrNamespace "Collections") + |> Option.iter (fun collectionsEntity -> + collectionsEntity.ModuleOrNamespaceType.AllEntitiesByLogicalMangledName + |> Map.tryFind "seq`1" + |> Option.iter (fun seqEntity -> + seqEntity.entity_flags <- + EntityFlags( + false, + seqEntity.entity_flags.IsModuleOrNamespace, + seqEntity.entity_flags.PreEstablishedHasDefaultConstructor, + seqEntity.entity_flags.HasSelfReferentialConstructor, + seqEntity.entity_flags.IsStructRecordOrUnionType + ) + ) + ) diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index bb883f752fd..e015cd8ac54 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -1618,9 +1618,6 @@ val mkArrayTy: TcGlobals -> int -> TType -> range -> TType /// Check if a type definition is one of the artificial type definitions used for array types of different ranks val isArrayTyconRef: TcGlobals -> TyconRef -> bool -/// Check if a type definition is of Microsoft.FSharp.Collections.seq`1 -val isSeqTyconRef: TcGlobals -> TyconRef -> bool - /// Determine the rank of one of the artificial type definitions used for array types val rankOfArrayTyconRef: TcGlobals -> TyconRef -> int @@ -2704,3 +2701,7 @@ val tryAddExtensionAttributeIfNotAlreadyPresent: /// Serialize an entity to a very basic json structure. val serializeEntity: path: string -> entity: Entity -> unit + +/// Updates the IsPrefixDisplay to false for the Microsoft.FSharp.Collections.seq`1 entity +/// Meant to be called with the FSharp.Core module spec right after it was unpickled. +val updateSeqTypeIsPrefix: fsharpCoreMSpec: ModuleOrNamespace -> unit