Skip to content

Commit 7c81ac0

Browse files
authored
Indent internal records type definitions. (dotnet#13798)
1 parent b3219dd commit 7c81ac0

File tree

9 files changed

+90
-39
lines changed

9 files changed

+90
-39
lines changed

src/Compiler/Checking/NicePrint.fs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ module PrintTypes =
480480
| Const.Zero -> tagKeyword(if isRefTy g ty then "null" else "default")
481481
wordL str
482482

483-
let layoutAccessibility (denv: DisplayEnv) accessibility itemL =
483+
let layoutAccessibilityCore (denv: DisplayEnv) accessibility =
484484
let isInternalCompPath x =
485485
match x with
486486
| CompPath(ILScopeRef.Local, []) -> true
@@ -491,10 +491,13 @@ module PrintTypes =
491491
| _ when List.forall isInternalCompPath p -> Internal
492492
| _ -> Private
493493
match denv.contextAccessibility, accessibility with
494-
| Public, Internal -> WordL.keywordInternal ++ itemL // print modifier, since more specific than context
495-
| Public, Private -> WordL.keywordPrivate ++ itemL // print modifier, since more specific than context
496-
| Internal, Private -> WordL.keywordPrivate ++ itemL // print modifier, since more specific than context
497-
| _ -> itemL
494+
| Public, Internal -> WordL.keywordInternal
495+
| Public, Private -> WordL.keywordPrivate
496+
| Internal, Private -> WordL.keywordPrivate
497+
| _ -> emptyL
498+
499+
let layoutAccessibility (denv: DisplayEnv) accessibility itemL =
500+
layoutAccessibilityCore denv accessibility ++ itemL
498501

499502
/// Layout a reference to a type
500503
let layoutTyconRef denv tcref = layoutTyconRefImpl false denv tcref
@@ -1977,6 +1980,9 @@ module TastDefinitionPrinting =
19771980
let addReprAccessL l =
19781981
layoutAccessibility denv tycon.TypeReprAccessibility l
19791982

1983+
let addReprAccessRecord l =
1984+
layoutAccessibilityCore denv tycon.TypeReprAccessibility --- l
1985+
19801986
let addLhs rhsL =
19811987
let brk = not (isNil allDecls) || breakTypeDefnEqn repr
19821988
if brk then
@@ -2019,7 +2025,7 @@ module TastDefinitionPrinting =
20192025
|> applyMaxMembers denv.maxMembers
20202026
|> aboveListL
20212027
|> (if useMultiLine then braceMultiLineL else braceL)
2022-
|> addReprAccessL
2028+
|> addReprAccessRecord
20232029
|> addMaxMembers
20242030
|> addLhs
20252031

src/Compiler/Service/FSharpCheckerResults.fs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,7 +2798,7 @@ type FSharpCheckFileResults
27982798
let (nenv, _), _ = scope.GetBestDisplayEnvForPos cursorPos
27992799
Some(FSharpDisplayContext(fun _ -> nenv.DisplayEnv))
28002800

2801-
member _.GenerateSignature() =
2801+
member _.GenerateSignature(?pageWidth: int) =
28022802
match details with
28032803
| None -> None
28042804
| Some (scope, _builderOpt) ->
@@ -2816,7 +2816,11 @@ type FSharpCheckFileResults
28162816
let layout =
28172817
NicePrint.layoutImpliedSignatureOfModuleOrNamespace true denv infoReader ad range0 mexpr
28182818

2819-
layout |> LayoutRender.showL |> SourceText.ofString)
2819+
match pageWidth with
2820+
| None -> layout
2821+
| Some pageWidth -> Display.squashTo pageWidth layout
2822+
|> LayoutRender.showL
2823+
|> SourceText.ofString)
28202824

28212825
member _.ImplementationFile =
28222826
if not keepAssemblyContents then

src/Compiler/Service/FSharpCheckerResults.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ type public FSharpCheckFileResults =
410410
member OpenDeclarations: FSharpOpenDeclaration[]
411411

412412
/// Lays out and returns the formatted signature for the typechecked file as source text.
413-
member GenerateSignature: unit -> ISourceText option
413+
member GenerateSignature: ?pageWidth: int -> ISourceText option
414414

415415
/// Internal constructor
416416
static member internal MakeEmpty:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@
196196
<Compile Include="Globalization\GlobalizationTestCases.fs" />
197197
<Compile Include="OCamlCompat\OCamlCompat.fs" />
198198
<Compile Include="Miscellaneous\ListLiterals.fs" />
199+
<Compile Include="Signatures\TestHelpers.fs" />
199200
<Compile Include="Signatures\ModuleOrNamespaceTests.fs" />
201+
<Compile Include="Signatures\RecordTests.fs" />
200202
</ItemGroup>
201203
<ItemGroup>
202204
<Content Include="resources\**" CopyToOutputDirectory="Never" CopyToPublishDirectory="PreserveNewest" />

tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
module FSharp.Compiler.ComponentTests.Signatures.ModuleOrNamespaceTests
22

3-
open System
43
open Xunit
54
open FsUnit
65
open FSharp.Test.Compiler
7-
8-
let private prependNewline v = String.Concat("\n", v)
9-
10-
let equal x =
11-
let x =
12-
match box x with
13-
| :? String as s -> s.Replace("\r\n", "\n") |> box
14-
| x -> x
15-
16-
equal x
6+
open FSharp.Compiler.ComponentTests.Signatures.TestHelpers
177

188
[<Fact>]
199
let ``Type from shared namespace`` () =
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module FSharp.Compiler.ComponentTests.Signatures.RecordTests
2+
3+
open Xunit
4+
open FsUnit
5+
open FSharp.Test.Compiler
6+
open FSharp.Compiler.ComponentTests.Signatures.TestHelpers
7+
8+
[<Fact>]
9+
let ``Internal record with xml comment`` () =
10+
FSharp
11+
"""
12+
module SignatureFileGeneration.MyModule
13+
14+
type PullActions =
15+
internal
16+
{
17+
/// Any repo which doesn't have a master branch will have one created for it.
18+
Log : int
19+
}
20+
"""
21+
|> printSignaturesWith 80
22+
|> should
23+
equal
24+
"""
25+
module SignatureFileGeneration.MyModule
26+
27+
type PullActions =
28+
internal
29+
{
30+
31+
/// Any repo which doesn't have a master branch will have one created for it.
32+
Log: int
33+
}"""
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module FSharp.Compiler.ComponentTests.Signatures.TestHelpers
2+
3+
open System
4+
open FsUnit
5+
6+
let prependNewline v = String.Concat("\n", v)
7+
8+
let equal x =
9+
let x =
10+
match box x with
11+
| :? String as s -> s.Replace("\r\n", "\n") |> box
12+
| x -> x
13+
14+
equal x

tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.expected

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,7 +1982,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FShar
19821982
FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpDisplayContext] GetDisplayContextForPos(FSharp.Compiler.Text.Position)
19831983
FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpImplementationFileContents] ImplementationFile
19841984
FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Symbols.FSharpImplementationFileContents] get_ImplementationFile()
1985-
FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.ISourceText] GenerateSignature()
1985+
FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.ISourceText] GenerateSignature(Microsoft.FSharp.Core.FSharpOption`1[System.Int32])
19861986
FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse]] GetMethodsAsSymbols(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String])
19871987
FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: Microsoft.FSharp.Core.FSharpOption`1[System.String] GetF1Keyword(Int32, Int32, System.String, Microsoft.FSharp.Collections.FSharpList`1[System.String])
19881988
FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults: System.Collections.Generic.IEnumerable`1[FSharp.Compiler.CodeAnalysis.FSharpSymbolUse] GetAllUsesOfAllSymbolsInFile(Microsoft.FSharp.Core.FSharpOption`1[System.Threading.CancellationToken])
@@ -6709,10 +6709,10 @@ FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Sequential
67096709
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 SequentialOrImplicitYield
67106710
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Set
67116711
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 TraitCall
6712-
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Typar
67136712
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 TryFinally
67146713
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 TryWith
67156714
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Tuple
6715+
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Typar
67166716
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 TypeApp
67176717
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 TypeTest
67186718
FSharp.Compiler.Syntax.SynExpr+Tags: Int32 Typed
@@ -6874,10 +6874,10 @@ FSharp.Compiler.Syntax.SynExpr: Boolean IsSequential
68746874
FSharp.Compiler.Syntax.SynExpr: Boolean IsSequentialOrImplicitYield
68756875
FSharp.Compiler.Syntax.SynExpr: Boolean IsSet
68766876
FSharp.Compiler.Syntax.SynExpr: Boolean IsTraitCall
6877-
FSharp.Compiler.Syntax.SynExpr: Boolean IsTypar
68786877
FSharp.Compiler.Syntax.SynExpr: Boolean IsTryFinally
68796878
FSharp.Compiler.Syntax.SynExpr: Boolean IsTryWith
68806879
FSharp.Compiler.Syntax.SynExpr: Boolean IsTuple
6880+
FSharp.Compiler.Syntax.SynExpr: Boolean IsTypar
68816881
FSharp.Compiler.Syntax.SynExpr: Boolean IsTypeApp
68826882
FSharp.Compiler.Syntax.SynExpr: Boolean IsTypeTest
68836883
FSharp.Compiler.Syntax.SynExpr: Boolean IsTyped
@@ -7011,10 +7011,10 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewSequential(FSh
70117011
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewSequentialOrImplicitYield(FSharp.Compiler.Syntax.DebugPointAtSequential, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range)
70127012
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewSet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range)
70137013
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTraitCall(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range)
7014-
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTypar(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range)
70157014
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTryFinally(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.DebugPointAtTry, FSharp.Compiler.Syntax.DebugPointAtFinally, FSharp.Compiler.SyntaxTrivia.SynExprTryFinallyTrivia)
70167015
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTryWith(FSharp.Compiler.Syntax.SynExpr, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynMatchClause], FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.DebugPointAtTry, FSharp.Compiler.Syntax.DebugPointAtWith, FSharp.Compiler.SyntaxTrivia.SynExprTryWithTrivia)
70177016
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTuple(Boolean, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynExpr], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range)
7017+
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTypar(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range)
70187018
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTypeApp(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Text.Range], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range], FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range)
70197019
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTypeTest(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
70207020
FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTyped(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
@@ -8605,18 +8605,22 @@ FSharp.Compiler.Syntax.SynType: Int32 Tag
86058605
FSharp.Compiler.Syntax.SynType: Int32 get_Tag()
86068606
FSharp.Compiler.Syntax.SynType: System.String ToString()
86078607
FSharp.Compiler.Syntax.SynTypeConstraint
8608+
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereSelfConstrained
86088609
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparDefaultsToType
86098610
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsComparable
86108611
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsDelegate
86118612
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsEnum
86128613
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsEquatable
86138614
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsReferenceType
8614-
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereSelfConstrained
86158615
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsUnmanaged
86168616
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparIsValueType
86178617
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparSubtypeOfType
86188618
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparSupportsMember
86198619
FSharp.Compiler.Syntax.SynTypeConstraint+Tags: Int32 WhereTyparSupportsNull
8620+
FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained: FSharp.Compiler.Syntax.SynType get_selfConstraint()
8621+
FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained: FSharp.Compiler.Syntax.SynType selfConstraint
8622+
FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained: FSharp.Compiler.Text.Range get_range()
8623+
FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained: FSharp.Compiler.Text.Range range
86208624
FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparDefaultsToType: FSharp.Compiler.Syntax.SynTypar get_typar()
86218625
FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparDefaultsToType: FSharp.Compiler.Syntax.SynTypar typar
86228626
FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparDefaultsToType: FSharp.Compiler.Syntax.SynType get_typeName()
@@ -8671,10 +8675,6 @@ FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsNull: FSharp.Compiler
86718675
FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsNull: FSharp.Compiler.Syntax.SynTypar typar
86728676
FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsNull: FSharp.Compiler.Text.Range get_range()
86738677
FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparSupportsNull: FSharp.Compiler.Text.Range range
8674-
FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained: FSharp.Compiler.Syntax.SynType get_selfConstraint()
8675-
FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained: FSharp.Compiler.Syntax.SynType selfConstraint
8676-
FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained: FSharp.Compiler.Text.Range get_range()
8677-
FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained: FSharp.Compiler.Text.Range range
86788678
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereSelfConstrained
86798679
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparDefaultsToType
86808680
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsComparable
@@ -8687,6 +8687,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparIsValueType
86878687
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparSubtypeOfType
86888688
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparSupportsMember
86898689
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean IsWhereTyparSupportsNull
8690+
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereSelfConstrained()
86908691
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparDefaultsToType()
86918692
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsComparable()
86928693
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsDelegate()
@@ -8698,6 +8699,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparIsValueType()
86988699
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparSubtypeOfType()
86998700
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparSupportsMember()
87008701
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereTyparSupportsNull()
8702+
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereSelfConstrained(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
87018703
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparDefaultsToType(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
87028704
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsComparable(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range)
87038705
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparIsDelegate(FSharp.Compiler.Syntax.SynTypar, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Text.Range)
@@ -8710,6 +8712,7 @@ FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstrai
87108712
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsMember(Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.Syntax.SynType], FSharp.Compiler.Syntax.SynMemberSig, FSharp.Compiler.Text.Range)
87118713
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereTyparSupportsNull(FSharp.Compiler.Syntax.SynTypar, FSharp.Compiler.Text.Range)
87128714
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+Tags
8715+
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained
87138716
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparDefaultsToType
87148717
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsComparable
87158718
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereTyparIsDelegate
@@ -8726,9 +8729,6 @@ FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Text.Range get_Range()
87268729
FSharp.Compiler.Syntax.SynTypeConstraint: Int32 Tag
87278730
FSharp.Compiler.Syntax.SynTypeConstraint: Int32 get_Tag()
87288731
FSharp.Compiler.Syntax.SynTypeConstraint: System.String ToString()
8729-
FSharp.Compiler.Syntax.SynTypeConstraint: Boolean get_IsWhereSelfConstrained()
8730-
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint NewWhereSelfConstrained(FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range)
8731-
FSharp.Compiler.Syntax.SynTypeConstraint: FSharp.Compiler.Syntax.SynTypeConstraint+WhereSelfConstrained
87328732
FSharp.Compiler.Syntax.SynTypeDefn
87338733
FSharp.Compiler.Syntax.SynTypeDefn: FSharp.Compiler.Syntax.SynComponentInfo get_typeInfo()
87348734
FSharp.Compiler.Syntax.SynTypeDefn: FSharp.Compiler.Syntax.SynComponentInfo typeInfo
@@ -11099,4 +11099,4 @@ FSharp.Compiler.Xml.XmlDoc: System.String GetXmlText()
1109911099
FSharp.Compiler.Xml.XmlDoc: System.String[] GetElaboratedXmlLines()
1110011100
FSharp.Compiler.Xml.XmlDoc: System.String[] UnprocessedLines
1110111101
FSharp.Compiler.Xml.XmlDoc: System.String[] get_UnprocessedLines()
11102-
FSharp.Compiler.Xml.XmlDoc: Void .ctor(System.String[], FSharp.Compiler.Text.Range)
11102+
FSharp.Compiler.Xml.XmlDoc: Void .ctor(System.String[], FSharp.Compiler.Text.Range)

tests/FSharp.Test.Utilities/Compiler.fs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,15 +1313,15 @@ module rec Compiler =
13131313
let withEvalTypeEquals t (result: CompilationResult) : CompilationResult =
13141314
assertEvalOutput (fun (x: FsiValue) -> x.ReflectionType) t result
13151315

1316-
let signatureText (checkResults: FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults) =
1317-
checkResults.GenerateSignature()
1316+
let signatureText (pageWidth: int option) (checkResults: FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults) =
1317+
checkResults.GenerateSignature(?pageWidth = pageWidth)
13181318
|> Option.defaultWith (fun _ -> failwith "Unable to generate signature text.")
13191319

13201320
let signaturesShouldContain (expected: string) cUnit =
13211321
let text =
13221322
cUnit
13231323
|> typecheckResults
1324-
|> signatureText
1324+
|> signatureText None
13251325

13261326
let actual =
13271327
text.ToString().Split('\n')
@@ -1331,13 +1331,15 @@ module rec Compiler =
13311331
if not (actual |> Array.contains expected) then
13321332
failwith ($"The following signature:\n%s{expected}\n\nwas not found in:\n" + (actual |> String.concat "\n"))
13331333

1334-
let printSignatures cUnit =
1334+
let private printSignaturesImpl pageWidth cUnit =
13351335
cUnit
13361336
|> typecheckResults
1337-
|> signatureText
1337+
|> signatureText pageWidth
13381338
|> string
13391339
|> fun s ->
13401340
s.Replace("\r", "").Split('\n')
13411341
|> Array.map (fun line -> line.TrimEnd())
13421342
|> String.concat "\n"
1343-
|> fun tap -> tap
1343+
1344+
let printSignatures cUnit = printSignaturesImpl None cUnit
1345+
let printSignaturesWith pageWidth cUnit = printSignaturesImpl (Some pageWidth) cUnit

0 commit comments

Comments
 (0)