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 defaulted operator == is dropped as "supplied by the language": C# a == b fails with CS0019 on a struct, and Python/JS compare by identity #399
FunctionDefinition.Defaulted on == means memberwise equality, as C++ = default provides. Several generators replace it with a comment and nothing else:
Generator
Location
What it writes
C#
Coder/Languages/CSharpGenerator.cs L1260-1265
operator == is supplied by the language, which C# expresses by not declaring it.
Python
Coder/Languages/PythonGenerator.cs ~L753
"supplied by the language" note
JavaScript
Coder/Languages/JavaScriptGenerator.cs ~L573
"supplied by the language" note
C
Coder/Languages/CGenerator.cs ~L273
prototype bool Point_equal(const Point* self, Point other); with no definition, while the call site still writes a raw struct ==
None of these languages supplies memberwise equality:
C#: a struct has no == operator at all, so a == b fails with CS0019. A class gets reference equality instead.
Python: the default __eq__ compares identity.
JavaScript:=== compares identity.
The Go note ("Go gives every type a zero value instead", GoGenerator.cs ~L983-987) describes defaulted constructors, not equality. Go's struct == does happen to compare members.
Repro
Reproduced as follows:
Input: struct Point { x, y }, a defaulted == that takes const Point&, and bool same(Point a, Point b) { return a == b; }.
C++: compiles with g++ -std=c++20.
C#:dotnet build fails with CS0019 "Operator '==' cannot be applied to operands of type 'Point' and 'Point'".
Priority: High. The C# output fails loudly with CS0019. The Python and JavaScript output is worse: it compiles and runs, but a == b silently compares identity and returns False for equal values. The C output declares Point_equal but never defines it. Four generators are affected by one root cause.
Area: the FunctionDefinition.Defaulted handling for == in CSharpGenerator.cs, PythonGenerator.cs, JavaScriptGenerator.cs and CGenerator.cs, plus the Go note's wording in GoGenerator.cs
Activity
matt-edmondson commentedon Oct 31, 2026
Triage
a == bsilently compares identity and returnsFalsefor equal values. The C output declaresPoint_equalbut never defines it. Four generators are affected by one root cause.FunctionDefinition.Defaultedhandling for==inCSharpGenerator.cs,PythonGenerator.cs,JavaScriptGenerator.csandCGenerator.cs, plus the Go note's wording inGoGenerator.cseqbody, E0308). The two issues are distinct, but fixing them together would keep the defaulted-==behaviour consistent across backends. Closed A record that declaresoperator ==doesn't compile in C# (CS0111) or Rust (E0119) because the record already supplies equality #301 (records that declare==) touches neighbouring code.Generated by Claude Code