Skip to content

Add file name to file-private metaclass types during codegen [fixup #15485]#15505

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
HertzDevil:bug/metaclass-codegen-namespace
Feb 23, 2025
Merged

Add file name to file-private metaclass types during codegen [fixup #15485]#15505
straight-shoota merged 1 commit intocrystal-lang:masterfrom
HertzDevil:bug/metaclass-codegen-namespace

Conversation

@HertzDevil
Copy link
Contributor

Fixes #15503.

(Apparently if you don't pass a filename argument to run in the codegen spec, then all the file-private types will be placed under the top-level namespace instead...?)

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:codegen labels Feb 22, 2025
@straight-shoota straight-shoota added this to the 1.16.0 milestone Feb 22, 2025
@straight-shoota straight-shoota merged commit 29e1b71 into crystal-lang:master Feb 23, 2025
34 checks passed
@straight-shoota straight-shoota changed the title Add file name to file-private metaclass types during codegen Add file name to file-private metaclass types during codegen [fixup #15485] Feb 23, 2025
@HertzDevil HertzDevil deleted the bug/metaclass-codegen-namespace branch March 6, 2025 23:18
straight-shoota pushed a commit that referenced this pull request Jun 15, 2025
This is exactly like #15505, but for `Crystal::VirtualType` and `VirtualMetaclassType`. Also ensures the `~match<...>` internal functions use these file names for proper dynamic dispatch.

Of the remaining internal types, `GenericInstanceType`, `GenericClassInstanceMetaclassType`, and `GenericModuleInstanceMetaclassType` call `Type#to_s` directly inside their `#to_s_with_options` overloads, without forwarding the `codegen` parameter. Most likely, they are also broken in some way.
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.

Seg fault with 2 private classes with the same name in diff files

3 participants