You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A static property over a same-named static field (limit / Limit) emits a duplicate name in C, Go and Rust (compile error) and overwrites the field in Python #444
StandardLanguageGenerator.cs:1186: HashSet<string> taken = MemberNamesMustDiffer ? NamesOf(classDecl.Members) : [];
StandardLanguageGenerator.cs:1290: the getter is renamed only if (MemberNamesMustDiffer && taken.Contains(getterName)).
Only CppGenerator.cs:150 overrides it to true, which was the fix for #140 and covered the C++ instance case. Other targets share one namespace between static fields and the lowered static getter, and never check for a clash:
C and Go move static fields to file or package scope.
Rust puts associated consts in the same impl as the getter fn.
Python's static path, PythonGenerator.GenerateStaticAccessors (PythonGenerator.cs:205-218), names the @staticmethod with GetterName(Snake) and never checks either.
PropertyDeclaration { Name = "Limit", HasGetter = true, IsStatic = true } with getter return 10
A non-const total / Total pair behaves the same way.
Target
Output
Result
C
static const int Gauge_limit = 10; and int Gauge_limit(void)
gcc: 'Gauge_limit' redeclared as different kind of symbol
Go
const GaugeLimit int = 10 and func GaugeLimit()
go vet: GaugeLimit redeclared in this block
Rust
pub const limit: i32 = 10; and pub fn limit() in the same impl
rustc E0592: duplicate definitions with name limit
Python
limit: int = 10 then def limit()
Compiles, but after import Gauge.limit is a function and the field's value is lost
C++
get_limit()
Correct
A field with a PascalCase property over it is the most common C# property pattern, so this hits ordinary models when they are targeted at C, Go, Rust or Python.
Suggested fix / acceptance criteria
When a static or constant field and a property's getter would get the same spelled name in a target's shared namespace, rename the getter with the get prefix C++ already uses (get_limit / GetLimit). This covers C, Go, Rust and Python's static accessor path.
Leave non-colliding names unchanged.
Add a test per target that compiles the snippet above with gcc -std=c11, go vet and rustc, and a Python test that Gauge.limit == 10 after import.
Related: #140 / PR #221 (the C++ instance-member version of this), and #141 (self-references in accessor bodies, a separate issue).
Priority: High. A static field with a PascalCase property over it is the most common C# property pattern. Today it produces output that doesn't compile in C, Go and Rust, and Python output that silently loses the field's value.
Area / suggested assignee:StandardLanguageGenerator (MemberNamesMustDiffer, the getter-renaming logic) and PythonGenerator.GenerateStaticAccessors. Owner: @matt-edmondson
Next step: Detect collisions per target, comparing the spelled name in the target's shared namespace, and rename the getter with the get prefix C++ already uses. Add compile tests for gcc, go vet and rustc, and a Python import test that checks Gauge.limit == 10.
Activity
matt-edmondson commentedon Nov 3, 2026
Triage
StandardLanguageGenerator(MemberNamesMustDiffer, the getter-renaming logic) andPythonGenerator.GenerateStaticAccessors. Owner: @matt-edmondsongetprefix C++ already uses. Add compile tests for gcc, go vet and rustc, and a Python import test that checksGauge.limit == 10.Generated by Claude Code