-
-
Save domgetter/c3d3c65d1bec532bc3917fb8eafb6f28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Int | |
macro self_test(name) | |
def self.{{name}} | |
"me!" | |
end | |
{% debug() %} | |
end | |
end | |
Int.self_test(self_method) | |
Int.self_method | |
# The macro debugger prints out | |
# | |
# def self.self_method | |
# "me!" | |
# end | |
# | |
# and then the compiler prints out | |
# | |
# Error in src/class_method_macro.cr:11: undefined method 'self_method' for Int:Class | |
# | |
# Int.self_method | |
# ^~~~~~~~~~~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment