Skip to content

bugc: reject == and != on arrays and structs - #397

Merged
gnidan merged 3 commits into
mainfrom
bugc-reject-aggregate-eq
Oct 15, 2026
Merged

gnidan merged 3 commits into
mainfrom
bugc-reject-aggregate-eq

Conversation

@gnidan

@gnidan gnidan commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

As in Solidity, == and != on an array (fixed or dynamic, in memory or in storage), a struct or a mapping are now type errors ("Cannot compare "), the same diagnostic that bytes and strings in calldata already give.

Before, an array or struct in memory, or a struct copied from storage, compared by its address in memory, so equal contents in two places were unequal; an array in storage failed in IR generation ("cannot copy ... to or from storage"). Comparing contents is not planned. Dynamic bytes and strings keep comparing by contents (#391), and elementary types are unchanged.

No example uses these comparisons: bytecode for every example that compiles (all but the @wip ones), at O0 through O3, is the same as on main.

As in Solidity, `==` and `!=` on an array (fixed or dynamic), a struct
or a mapping are now type errors. Before, an array or struct in memory,
or a struct copied from storage, compared by its address in memory, so
equal contents in two places were unequal, and an array in storage
failed in IR generation. Bytes and strings still compare by contents.
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-15 16:56 UTC

@gnidan
gnidan merged commit 372e974 into main Oct 15, 2026
8 checks passed
@gnidan
gnidan deleted the bugc-reject-aggregate-eq branch October 15, 2026 16:52
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.

1 participant