Skip to content

Signature generation roundtrip issue: namespace global dropped #19593

Closed

Description

@T-Gro

Implementation:

namespace global
type Foo() = member _.X = 1

Actual generated signature:

type Foo =
    new: unit -> Foo
    member X: int

namespace global declaration is missing.

Error on roundtrip compile:

error FS0222: Files in libraries or multiple-file applications must begin with a namespace or module declaration

Expected signature:

namespace global
type Foo =
    new: unit -> Foo
    member X: int

Verified: roundtrips successfully.

Activity

  1. self-assigned this
    on Apr 15, 2026
  2. added
    Area-Compiler-SigFileGen
    on Apr 15, 2026
  3. added this to the Backlog milestone on Apr 15, 2026
  4. T-Gro commented on Apr 17, 2026

    @T-Gro
    MemberAuthor

    The initial fix only handled namespace global with bare types. An additional case was found:

    // impl
    namespace global
    type Foo() = 
        member _.X = 1
    module Utils = 
       let f (x:Foo) = x

    Before fix, generated sig had module Utils without = sign and body indentation — modules inside namespace global were treated as standalone top-level modules because the empty outer path matched the "no namespace" branch. Fixed by moving namespace global detection into NicePrint.layoutImpliedSignatureOfModuleOrNamespace (also benefits fsc --sig path).

  5. added 3 commits that reference this issue on Apr 17, 2026
    985f830
    3ca7a27
    9e56e09
  6. added a commit that references this issue on Apr 28, 2026
    d6e1dcd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area-Compiler-SigFileGenBugNeeds-Triage

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions