-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cannot declare macro for all Class
s
#4732
Comments
This seems to apply only to special ancestor types like class Foo
macro methods
"hello"
end
end
class Bar < Foo; end
class Baz < Bar; end
pp Bar.methods
pp Baz.methods /cc #4639 |
I think it's not a bug after all, defining a macro on class Object
macro methods
{{ @type.methods.map &.name.stringify }}
end
end
puts Bool.methods As macros needs to be called using the Type as receiver, it's not that strange to put it in Object so that all types can have it. WDYT? |
It doesn't make sense to have this method on any object instance. |
@straight-shoota it's not a method, it's a macro I'm just trying to have a macro on alll classes, so I can do |
Macros lookup go through the instance-type hierarchy, so it looks for macros in |
This works in 0.23.0 (https://carc.in/#/r/2ecc) but fails in 0.23.1 (https://carc.in/#/r/2ec8).
This has been introduced by 05a51a1 (from #4649). I don't why/how the changes broke that behavior.
The text was updated successfully, but these errors were encountered: