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

オープン
#2,423 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c
領域
compilers

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
C
スター
3
フォーク
7
平均マージ
3時間 28分
マージ済み PR(30日)
270

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

InauguralSystems/EigenScript のほかの issue

InauguralSystems/EigenScript の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。