Repository navigation
fix(beam): prevent identifier collisions and atom overflow - #5017
Merged
Merged
Conversation
dbrattli
marked this pull request as draft
October 2, 2026 06:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Distinct F# names can collapse to the same Erlang function or map key, silently losing code or state. Long names can also overflow the atom limit, including when
erlcderives closure names or the compiler joins already-bounded names.This change preserves encoded punctuation, reports declaration and state-key collisions, and separates captured class bindings from public members. Atoms are capped at 223 characters to leave room for Erlang-generated names, with consistent construction for interface setter keys and object override names. Direct
GetHashCode()calls honor class overrides.Native BEAM compilation uses SHA-256 for bounded-name suffixes. Standalone retains the existing 32-bit djb2 hash for web examples, without
Crypto.ts, cryptography metadata, or new BCL replacements. Overlong names may differ between compiler hosts; detected standalone state-key collisions are reported to the UI.Validation of the final implementation:
./build.sh test beam: 2,714 .NET tests and 2,763 BEAM tests passed, including generated Erlang compilation, entry-point fixtures, and negative collision diagnostics.git diff --checkpassed.Regression coverage includes colliding bounded mutable names, long interface setters on object expressions and classes, long override entity names, direct hash-code overrides, and interface setter-key collision diagnostics.
Review follow-up
Maxime's suggestions in #5041 are incorporated into this PR:
Crypto.ts, cryptography metadata, and the JavaScript BCL crypto replacements. Native BEAM keeps SHA-256; standalone uses the existing djb2 hash for web examples, accepting different overlong names between compiler hosts.erlcdecorations.The follow-up review and regression tests also led to these fixes in
3a972fab5:GetHashCode()calls, an additional issue exposed by the expanded tests.