ludic/changes/reference-identity.md
Orkuncakilkaya 1900f9ca80 fix(compiler): == / != on references is identity; only text compares by content
emit_bin_vals lowered every pointer-typed ==/!= to @lp_str_eq, so two
distinct records compared their bytes up to the first zero byte. Content
compare now needs both sides to be text (string, or the untyped
pointer/ptr runtime code carries text in); other references use
icmp eq ptr, and string vs a non-text reference is a compile error.
Adds selfhost/tests/identity.ludic; both seeds regenerated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 16:13:31 +03:00

10 lines
586 B
Markdown

bump: patch
type: fix
**`==` / `!=` on records is identity again** — only two strings compare by content.
Every pointer-typed comparison used to be lowered to a C-string content compare,
so two distinct records (properties, slices, enums) compared their bytes up to
the first zero byte: `a == b` could be true for different objects that shared a
leading field, depending on layout. References now compare by identity
(`icmp eq ptr`); `string` (and untyped `pointer`/`pointers` text) still compares by content,
and comparing a `string` with a non-string reference is a compile error.