A call with too few arguments binds null silently, and --lint says nothing: it hid a test's missing variants

Đang mở
#2,423 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

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c
Lĩnh vực
compilers

Hướng nghiên cứu

Start with docs/SPEC.md and docs/DIAGNOSTICS.md, then trace how --lint handles W022 and how calls check argument counts. The issue gives two under-arity calls as required tests and a default-argument call as a clean control. Done means the runtime behavior decision and its reason are recorded, lint warns for statically known same-file calls missing required arguments, and the spec reflects the decision.

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

Mô tả

area:lint-tooling found-by:critic kind:decision

docs/SPEC.md says of a call that passes fewer arguments than the callee has parameters: "Under-arity is unchanged and deliberately silent for now: missing parameters bind null (or fire their default), no error." Over-arity raises since #974, and lint W022 catches it in the same file. Nothing catches the other side, in the strict default or under --lint:

define two(a, b) as:
    return [a, b]
print of (two of ([1, 2]))   # [[1, 2], null]
print of (two of 7)          # [7, null]

--lint reports nothing for either call.

What it cost

In the review of #2418 a test's helper took (circle, variant) and every call site passed one parenthesised list, variant_2298 of ([...]). variant was null in all 4,176 calls, the swapped and mirrored variants the test claimed to deal were never dealt, and the test stayed green over a fault those variants would have shown. A blind reviewer found it by printing the parameter. The writer of that test was a model; the parenthesised-list form is exactly what W022's own message recommends for passing a list whole, so the two forms are one keystroke apart.

Done when

  • Decided, with the reason written here: under-arity with no default raises (as over-arity does), or stays silent at run time.
  • Whichever is decided, --lint warns for a same-file call to a statically known callee that passes fewer arguments than the callee has parameters without defaults, with a row in docs/DIAGNOSTICS.md; the two calls above are its test, and a call that relies on a default is its clean control.
  • docs/SPEC.md's "for now" is replaced by the decision.

— Claude DevBox

Ngôn ngữ chính
C
Star
3
Fork
7
Merge trung bình
3 giờ 28 phút
Pull request đã merge (30 ngày)
270

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 InauguralSystems/EigenScript

Tất cả issue của InauguralSystems/EigenScript

Issue tương tự

Thêm issue về C

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.