Skip to content

fix(beam): disambiguate property accessors from ordinary methods - #5049

Merged
dbrattli merged 1 commit into
mainfrom
fix/beam-property-accessor-names
Oct 7, 2026
Merged

dbrattli merged 1 commit into
mainfrom
fix/beam-property-accessor-names

Conversation

@dbrattli

@dbrattli dbrattli commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

BEAM snake_case sanitization merges a property accessor such as set_StatusCode with the ordinary method SetStatusCode. Their argument types also produce the same overload hash, so Fable 5.20 rejects this valid API and earlier output can retain only one body.

Give BEAM property accessors an _accessor suffix after the overload hash in the upstream member-name constructor. Declarations and local, cross-file, and referenced-library calls derive the same name from member metadata. Align CLI event property/getter symbols and the StringBuilder.Length runtime replacement with that naming contract. Ordinary method names remain unchanged, and genuine name/arity collisions still fail compilation.

Add seven behavioral regressions with different property and ordinary method bodies, including a referenced-library caller and a method reference. The saved reproduction now returns 201 through the property and 202 through the method; generated Erlang contains distinct definitions and correctly resolved calls.

Validation:

  • ./build.sh test beam --force-fable-library: 2,729 .NET tests and 2,781 BEAM tests passed, plus entry-point and collision diagnostic fixtures.
  • dotnet fantomas . --check and a final check of the changed F# source files passed.
  • AnalyzeFSharpProject completed for the shared and BEAM transform projects; existing findings remain outside the changed code.
  • git diff --check passed.

Generated getter/setter names change. Rebuild generated libraries, the BEAM runtime, and callers together, and update native Erlang calls to those accessors. The public F# APIs are unchanged. Document this compatibility implication and clarify the remaining Identifiers limitation in FABLE-BEAM.md.

@dbrattli
dbrattli marked this pull request as ready for review October 7, 2026 22:36
@dbrattli
dbrattli merged commit b30dc89 into main Oct 7, 2026
43 checks passed
@dbrattli
dbrattli deleted the fix/beam-property-accessor-names branch October 7, 2026 22:43
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