Skip to content

Fix private function collisions across modules - #531

Merged
godofecht merged 11 commits into
mainfrom
test/private-function-module-collision
Aug 17, 2026
Merged

godofecht merged 11 commits into
mainfrom
test/private-function-module-collision

Conversation

@godofecht

@godofecht godofecht commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #465.

Adds a minimal two-module regression where each module defines a private _same helper with a different parameter type and exposes a wrapper. The regression proves both overloads survive module resolution and monomorphization, then requires generated C to contain both mangled definitions, compile with clang, and execute to the expected result.

Root cause was flow_to_c() deduplicating non-exported functions by source name before overload registration. The fix keys pre-generation deduplication by (name, parameter-type signature) instead, preserving intentional duplicate identical helpers while allowing legitimate overloads from separate modules to reach normal C name mangling.

@godofecht godofecht changed the title Reproduce private function collisions across modules Fix private function collisions across modules Aug 17, 2026
@godofecht
godofecht marked this pull request as ready for review August 17, 2026 09:58
@cursor

cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@godofecht
godofecht merged commit 25c5af9 into main Aug 17, 2026
15 checks passed
@godofecht
godofecht deleted the test/private-function-module-collision branch August 18, 2026 07:24
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.

Non-exported functions with same name in different modules collide in generated C

1 participant