Skip to content

Commit

Permalink
Print attributes of nested modules in signatures. (#13890)
Browse files Browse the repository at this point in the history
Co-authored-by: Don Syme <[email protected]>
  • Loading branch information
nojaf and dsyme authored Sep 15, 2022
1 parent 5c3f987 commit b4ef994
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Compiler/Checking/NicePrint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2404,7 +2404,9 @@ module InferredSigPrinting =
let nmL = layoutAccessibility denv mspec.Accessibility nmL
let denv = denv.AddAccessibility mspec.Accessibility
let basic = imdefL denv def
let modNameL = wordL (tagKeyword "module") ^^ nmL
let modNameL =
wordL (tagKeyword "module") ^^ nmL
|> layoutAttribs denv None false mspec.TypeOrMeasureKind mspec.Attribs
let modNameEqualsL = modNameL ^^ WordL.equals
let isNamespace = function | Namespace _ -> true | _ -> false
let modIsOuter = (outerPath |> List.forall (fun (_, istype) -> isNamespace istype) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,25 @@ do ()
"""
|> printSignatures
|> should equal "namespace Foobar"

[<Fact>]
let ``Attribute on nested module`` () =
FSharp
"""
namespace MyApp.Types
[<RequireQualifiedAccess>]
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Area =
type Meh = class end
"""
|> printSignatures
|> prependNewline
|> should equal """
namespace MyApp.Types
[<RequireQualifiedAccess; CompilationRepresentation (enum<CompilationRepresentationFlags> (4))>]
module Area =
type Meh =
class end"""

0 comments on commit b4ef994

Please sign in to comment.