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

Define Crystal::Macros::Path#global? properly #10812

Merged
merged 1 commit into from Jun 12, 2021

Conversation

HertzDevil
Copy link
Contributor

The API docs mention Crystal::Macros::Path#global?, but it was actually #global that was defined:

macro foo(node)
  {% p node.global %}
end

macro bar(node)
  {% p node.global? %}
end

foo(Int32)   # => false
foo(::Int32) # => true
bar(Int32)   # Error: undefined macro method 'Path#global?'
bar(::Int32) # Error: undefined macro method 'Path#global?'

This PR adds #global? back. It makes sense that this is a question method since it is a predicate returning a BoolLiteral. To maintain compatibility, the old #global is now marked as deprecated using the facilities introduced in #9950.

@asterite asterite added this to the 1.1.0 milestone Jun 12, 2021
@asterite asterite merged commit 479b77d into crystal-lang:master Jun 12, 2021
@HertzDevil HertzDevil deleted the bug/path-global branch June 12, 2021 18:03
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.

None yet

4 participants