Skip to content

Write namespace- and file-scope variables as declarations, not locals - #325

Open
matt-edmondson wants to merge 2 commits into
mainfrom
claude/project-thread-kddtpg-232
Open

matt-edmondson wants to merge 2 commits into
mainfrom
claude/project-thread-kddtpg-232

Conversation

@matt-edmondson

@matt-edmondson matt-edmondson commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Before: a VariableDeclaration placed directly in a namespace or a file came out in local form, so none of these compiled:

  • C# wrote public static var (CS0825).
  • Rust wrote let outside a function.
  • Go wrote := at package scope.

After: each of the three is written as a proper declaration at that scope:

  • C# gives the type the initialiser establishes, or object with a note when it can't tell.
  • Rust writes a static or const item.
  • Go writes var name = value.

Fixes #232

https://claude.ai/code/session_018tZnrna9oooMZHDaLyXumk


Generated by Claude Code

… [patch]

A VariableDeclaration directly in a namespace or a file came out in
local form: C# wrote `public static var` (CS0825), Rust wrote `let`
outside a function, and Go wrote `:=` at package scope. C# now says the
type the initialiser establishes (or object, with a note), Rust writes a
static or const item, and Go writes `var name = value`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018tZnrna9oooMZHDaLyXumk
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018tZnrna9oooMZHDaLyXumk
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Namespace/file-scope VariableDeclaration generates uncompilable C# (static var, CS0825), Rust (let at module scope) and Go (:= at package scope)

2 participants