Skip to content

Unhandled exception in YARD::Handlers::Ruby::MethodHandler when method uses **nil and has a named block #1621

@trinistr

Description

@trinistr

YARD fails to parse a method when it explicitly disallows keywords with **nil while taking a named block. Affected method is missing from documentation.

Steps to reproduce

This test file reproduces the issue. Extra methods are there to show that they don't cause an issue:

class YardTest
  def a(**nil)
  end

  def b(**nil, &)
  end

  def c(**nil, &block)
    block
  end
end

Actual Output

[error]: Unhandled exception in YARD::Handlers::Ruby::MethodHandler:
  in `lib/yard_test.rb`:8:

        8: def c(**nil, &block)
Image

Expected Output

Method would be correctly parsed and added to the documentation with no listed keyword arguments.

Environment details:
OS: Manjaro Linux
Ruby version (ruby -v): ruby 3.1.6p260 (2024-05-29 revision a777087be6) [x86_64-linux]
YARD version (yard -v): yard 0.9.37

I have read the Contributing Guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions