Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

InlineParser: `@rbs @ivar` annotation is reported as unused unless it is the first thing in the class body

Đang mở Phù hợp với người mới
#3,175 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@ksss đang làm issue này rồi.

Từ ngày 29/9/2026.

  • #3183 của @ksss — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
ruby
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu trong lib/rbs/inline_parser.rb tại InlineParser#visit_class_or_module_body và tái hiện ví dụ class đã cho bằng RBS::InlineParser.parse. Theo dõi cách each_enclosed_block xử lý body và các annotation ở cấp class. Hoàn tất khi annotation sau def bar không còn tạo ra UnusedInlineAnnotation và tạo ra một InstanceVariableMember.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

rbs 4.2.0

class Foo
  def bar; end

  # @rbs @a: Integer

  X = 1
end

RBS::InlineParser.parse reports UnusedInlineAnnotation for @rbs @a: Integer and no InstanceVariableMember is created. Moving the annotation above def bar makes it work.

Cause: InlineParser#visit_class_or_module_body calls comments.each_enclosed_block(child_node) on the body StatementsNode (whose line range spans from the first member to the last) and reports every block inside it as unused, before the class-level each_enclosed_block(node) that handles InstanceVariableAnnotation runs. Only blocks located before the first member survive.

https://github.com/ruby/rbs/blob/v4.2.0/lib/rbs/inline_parser.rb (visit_class_or_module_body)

Ngôn ngữ chính
Ruby
Star
2.2k
Fork
258
Merge trung bình
1 ngày 4 giờ
Pull request đã merge (30 ngày)
52

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ruby/rbs

Tất cả issue của ruby/rbs

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.