Skip to content

Crystal::Macros::Arg#restriction method always returns Nop #14689

Open
@mjblack

Description

@mjblack

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.

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"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions