Skip to content

Test plan for "file-scoped namespace declarations" #49000

@jcouv

Description

@jcouv

Championed feature: dotnet/csharplang#137
Speclet at: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-10.0/file-scoped-namespaces.md

(checklist currently references changes in #54669)

Compiler

  • LangVer (see NamespaceWithSemicolon_CSharp9)
  • Multiple file-scoped declarations (see MultipleSingleLineNamespaces)
  • Mix and match declarations (see MultipleFileScopedNamespaces)
  • GetDeclaredSymbol in mix&match scenarios (see TestGetDeclaredSymbolFromNestedNamespace)
  • File-scoped declaration after type (see NamespaceWithPrecedingType)
  • test with top-level statement (see FileScopedNamespaceWithPrecedingStatement)
  • lookup rules, LookupSymbols (binder chain) (see SemanticModelAPITests.LookupInNamespace)
  • double-check all NamespaceDeclarationSyntax and SyntaxKind.NamespaceDeclaration references have been adjusted after merge from main branch
  • PROTOTYPE markers
  • EnC (manual validation)
  • smoke build of VS
  • can debug and set breakpoints (manual validation)
  • public API review
  • SyntaxNormalizer (see SyntaxNormalizerTests.TestFileScopedNamespace)

Productivity

  • Formatting
    • Currently, changing a "regular" namespace declaration to file-scoped doesn't automatically unindent the subsequent members. I do not know if this should change or not.
  • Indentation
  • Classification
  • Completion
  • FAR (manual validation)
  • NavBar (manual validation)
  • Convert to file-scoped namespace + code style preference
  • Remove unused usings
    • Currently doesn't work following a file-scoped namespace
  • Move type to new file
    • Currently this doesn't work at all in the presence of a file-scoped namespace (even for members that precede the namespace)
  • Region collapsing (seems fine as-is)
    • Currently, we can't collapse the file scoped namespace's members into the namespace
  • LocationInfo currently doesn't work properly. See the following test:
    [Fact, Trait(Traits.Feature, Traits.Features.DebuggingLocationName)]
    [WorkItem(49000, "https://github.com/dotnet/roslyn/issues/49000")]
    public async Task TestFileScopedNamespace()
    {
    // This test behavior is incorrect. This should be Namespace.Class.Method.
    // See the associated WorkItem for details.
    await TestAsync(
    @"namespace Namespace;
    class Class
    {
    void Method()
    {
    }$$
    }
    ", "Class.Method()", 2);
    }
    • This doesn't seem to impact debugging, navbar, etc. It's not clear to me (@RikkiGibson) what pain is introduced if we merge before fixing this.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions