Skip to content

Commit 2fe3f76

Browse files
committed
Don't consider seq`1 prefix in NicePrint.
1 parent 8bed194 commit 2fe3f76

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

src/Compiler/Checking/NicePrint.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ module internal PrintUtilities =
164164

165165
let usePrefix (denv: DisplayEnv) (tcref: TyconRef) =
166166
match denv.genericParameterStyle with
167-
| GenericParameterStyle.Implicit -> tcref.IsPrefixDisplay
167+
| GenericParameterStyle.Implicit -> not (isSeqTyconRef denv.g tcref) && tcref.IsPrefixDisplay
168168
| GenericParameterStyle.Prefix -> true
169169
| GenericParameterStyle.Suffix -> false
170170

src/Compiler/TypedTree/TypedTreeOps.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,9 @@ let isArrayTyconRef (g: TcGlobals) tcref =
17491749
g.il_arr_tcr_map
17501750
|> Array.exists (tyconRefEq g tcref)
17511751

1752+
let isSeqTyconRef (g: TcGlobals) tcref =
1753+
tyconRefEq g g.seq_tcr tcref
1754+
17521755
let rankOfArrayTyconRef (g: TcGlobals) tcref =
17531756
match g.il_arr_tcr_map |> Array.tryFindIndex (tyconRefEq g tcref) with
17541757
| Some idx ->

src/Compiler/TypedTree/TypedTreeOps.fsi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,9 @@ val mkArrayTy: TcGlobals -> int -> TType -> range -> TType
16181618
/// Check if a type definition is one of the artificial type definitions used for array types of different ranks
16191619
val isArrayTyconRef: TcGlobals -> TyconRef -> bool
16201620

1621+
/// Check if a type definition is of Microsoft.FSharp.Collections.seq`1
1622+
val isSeqTyconRef: TcGlobals -> TyconRef -> bool
1623+
16211624
/// Determine the rank of one of the artificial type definitions used for array types
16221625
val rankOfArrayTyconRef: TcGlobals -> TyconRef -> int
16231626

tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@
244244
<Compile Include="Signatures\ModuleOrNamespaceTests.fs" />
245245
<Compile Include="Signatures\RecordTests.fs" />
246246
<Compile Include="Signatures\ArrayTests.fs" />
247+
<Compile Include="Signatures\SeqTests.fs" />
247248
<Compile Include="Signatures\TypeTests.fs" />
248249
<Compile Include="Signatures\SigGenerationRoundTripTests.fs" />
249250
<Compile Include="StaticLinking\StaticLinking.fs" />
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module FSharp.Compiler.ComponentTests.Signatures.SeqTests
2+
3+
open Xunit
4+
open FSharp.Compiler.ComponentTests.Signatures.TestHelpers
5+
6+
[<Fact>]
7+
let ``int seq`` () =
8+
assertSingleSignatureBinding
9+
"let s = seq { yield 1 }"
10+
"val s: int seq"

0 commit comments

Comments
 (0)