You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crystal::Macros::Arg#restriction always returns Nop even if there is an ASTNode. I have tested this on Crystal version 1.12.2 on MacOS Sonoma. It was also tested by @Blacksmoke16 with Crystal master branch and the issue still exists.
The issue also exists for Crystal::Macros::FunDef#return_type.
lib MyLib
type Int = LibC::Int
fun foo(foo : LibC::Int) : Void
end
{% MyLib.methods.first.args.each { |t| pp t; pp t.restriction.class_name } %}
{% pp MyLib.methods.first.return_type.class_name %}
# => "foo"
# => "Nop"
# => "Nop"
The text was updated successfully, but these errors were encountered:
I looked more into this the other day, and basically came to the conclusion that this is somewhat of expected behavior as part of #12848
Note: lib types won't be solved at the top-level because that happens later on. The reason for that is to not require forward declarations. But I think that even without resolved types this is useful.
As such this is more likely a feature request/enhancement than a bug.
Bug Report
Crystal::Macros::Arg#restriction
always returns Nop even if there is an ASTNode. I have tested this on Crystal version 1.12.2 on MacOS Sonoma. It was also tested by @Blacksmoke16 with Crystal master branch and the issue still exists.The issue also exists for
Crystal::Macros::FunDef#return_type
.The text was updated successfully, but these errors were encountered: