Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach debug locations to auto-generated initialize methods #11313

Conversation

HertzDevil
Copy link
Contributor

If a type has no constructors at all, then the compiler automatically generates the .new and #initialize methods. The former is attached to the first declaration of the type, but the latter isn't; this PR gives it the same treatment.

In particular, Reference#initialize used to have no locations, and this caused the auto-generated constructors for generic classes to lose theirs too:

class Foo(T)
end

Foo(Int32).new # "*Foo(Int32)@Foo(T)::new:Foo(Int32)" has no location

This shows up on Compiler Explorer as the constructors of Thread::LinkedList(T) were never considered library code. They are now filtered after this patch.

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:debugger labels Oct 14, 2021
@straight-shoota straight-shoota added this to the 1.3.0 milestone Oct 26, 2021
@straight-shoota straight-shoota merged commit 40fe965 into crystal-lang:master Oct 28, 2021
@HertzDevil HertzDevil deleted the bug/argless-initialize-debug-loc branch October 28, 2021 10:41
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:debugger
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants