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

Fix name locations of FunDef and External nodes #14267

Merged

Conversation

HertzDevil
Copy link
Contributor

Errors for Def nodes are reported at their names:

macro f(x)
  {% x.foo %}
end

f(def foo; end)
#  5 | f(def foo; end)
#            ^--
# Error: undefined macro method 'Def#foo'

{% Array.methods[0].foo %}
#  145 | def initialize(size : Int, value : T)
#            ^---------
# Error: undefined macro method 'Def#foo'

Errors for both top-level and lib funs are not:

macro f(x)
  {% x.foo %}
end

f(fun foo; end)
#  5 | f(fun foo; end)
#        ^
# Error: undefined macro method 'FunDef#foo'

{% LibC.methods[0].foo %}
#  16 | fun dlclose(handle : Void*) : Int
#       ^------
# Error: undefined macro method 'External#foo'

This PR matches the latter's behavior with the former.

@straight-shoota straight-shoota added this to the 1.12.0 milestone Jan 29, 2024
@straight-shoota straight-shoota merged commit 8a2a1a8 into crystal-lang:master Jan 30, 2024
57 checks passed
@HertzDevil HertzDevil deleted the bug/external-name-location branch January 30, 2024 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants