Skip to content

Nested module attribute is not resolved in recursive namespace #7931

Closed

Description

@auduchinok
namespace rec Ns



open System.Runtime.CompilerServices



[<Extension>]



module Module =
    [<Extension>]
    let ext1 (x: int) = x.ToString()



[<Extension>]

type T() =
    class end


Screenshot 2019-12-04 at 16 00 18

Screenshot 2019-12-04 at 16 00 12

Activity

  1. added this to the Backlog milestone on Dec 8, 2019
  2. dsyme commented on Aug 31, 2020

    @dsyme
    Contributor

    Linking to issue #5795 since it's a similar underlying problem

  3. added
    Impact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.
    on Aug 31, 2020
  4. self-assigned this
    on Aug 31, 2020
  5. dsyme commented on Apr 4, 2022

    @dsyme
    Contributor

    Just to note this is another case of attribute checking going awry in recursive scopes.

  6. added
    Area-Compiler-CheckingType checking, attributes and all aspects of logic checking
    and removed on Apr 4, 2022
  7. github-actions commented on Mar 26, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    Verified still present in F# 10.0 (F# Interactive 14.0.105.0, commit 251aaf2, 2026-03-26).

    Minimal reproduction showing the difference between namespace and namespace rec:

    // Without rec - compiles fine ✅
    namespace Ns
    
    open System.Runtime.CompilerServices
    
    [(Extension)]
    module Module =
        [(Extension)]
        let ext1 (x: int) = x.ToString()
    // With rec - FS0039 error ❌
    namespace rec Ns
    
    open System.Runtime.CompilerServices
    
    [(Extension)]   // error FS0039: The type 'Extension' is not defined.
    module Module =
        [(Extension)]
        let ext1 (x: int) = x.ToString()

    Error: FS0039: The type 'Extension' is not defined

    The open System.Runtime.CompilerServices is in scope (as the non-recursive version proves), but attribute resolution in namespace rec doesn't see types from the opened namespace.

    Generated by Repo Assist · ◷

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@9135cdfde26838a01779aa966628308404ec1f02
    
  8. 2 remaining items

  9. added 12 commits that reference this issue on Apr 9, 2026
    61fcb2a
    676aa49
    19a43b1
    898193d
    409b042
    bc18f00
    1bebbca
    b90f44e
    a336fc5
    e59207c
    53b6ae8
    c8bd4f1
  10. added a commit that references this issue on May 18, 2026
    a09de4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingArea-Compiler-Checking-AttributesAttribute targets, AllowMultiple, CompiledName, custom attribute encodingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions