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 unary expression loses its static type: C writes void* b = (-a);, Go types -(1.5f) as float64, and Python/JS do true division on -a / 2 #267
StaticType(Expression) in Coder/Languages/StandardLanguageGenerator.cs:322-371 handles literals, constructions, conditionals, binaries and variable references. It has no UnaryExpression case, so -a, !on and ~mask fall through to default: return null. Every caller that relies on the static type then goes wrong:
C inferred locals.CGenerator.cs:1189-1191 falls back to void*.
IsIntegerArithmetic (StandardLanguageGenerator.cs ~166) returns false. The Python and JS division/modulo overrides (PythonGenerator.cs:1043, JavaScriptGenerator.cs:756) use it, so they skip integer semantics.
InferredLiteralWidth (~311) loses the width. Go and Rust use it.
Priority: High. The Python and JS output for -a / 2 silently returns -3.5 where C# returns -3, which is wrong arithmetic with no error. C also falls back to void* locals for any unary initializer. The proposed fix is a single case in StaticType.
Area / suggested assignee:StaticType(Expression) in StandardLanguageGenerator. Owner: @matt-edmondson
Activity
matt-edmondson commentedon Oct 19, 2026
Triage
-a / 2silently returns-3.5where C# returns-3, which is wrong arithmetic with no error. C also falls back tovoid*locals for any unary initializer. The proposed fix is a singlecaseinStaticType.StaticType(Expression)inStandardLanguageGenerator. Owner: @matt-edmondsonv + von a struct with a user-defined operator is emitted as a raw+, not a call to the generated operator function, so the output doesn't compile #269 (operator call sites) depends on this. Open PR Map fixed-width integer types and apply variable member defaults in constructors #266 also works with integer types but doesn't add aUnaryExpressioncase.UnaryExpressioncase, then the per-language regression tests listed in the acceptance criteria. Land it before C and Go:v + von a struct with a user-defined operator is emitted as a raw+, not a call to the generated operator function, so the output doesn't compile #269.Generated by Claude Code