Skip to content

Allow multiple redefinitions of the same top-level fun#15553

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
HertzDevil:bug/top-level-fun-redefinition
Mar 17, 2025
Merged

Allow multiple redefinitions of the same top-level fun#15553
straight-shoota merged 1 commit intocrystal-lang:masterfrom
HertzDevil:bug/top-level-fun-redefinition

Conversation

@HertzDevil
Copy link
Contributor

Fixes #15523.

After the compiler defines a top-level fun once, every subsequent redefinition marks that same single fun as "dead", omitting it from code generation, but these redefinitions themselves are not "dead". This PR ensures only the last definition wins.

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:codegen labels Mar 14, 2025
@HertzDevil HertzDevil changed the title Allow 3 or more definitions of the same top-level fun Allow 2 or more redefinitions of the same top-level fun Mar 14, 2025
@HertzDevil HertzDevil changed the title Allow 2 or more redefinitions of the same top-level fun Allow multiple redefinitions of the same top-level fun Mar 14, 2025
@straight-shoota straight-shoota added this to the 1.16.0 milestone Mar 14, 2025
@straight-shoota straight-shoota merged commit eec49b9 into crystal-lang:master Mar 17, 2025
33 of 34 checks passed
@HertzDevil HertzDevil deleted the bug/top-level-fun-redefinition branch March 17, 2025 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:codegen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression with fun main in user code

2 participants