LuaLS / LuaLS/lua-language-server
Detect functions that never return (and @noreturn annotation)
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Some functions, such as error, never return control to the caller. This can be used to prove that a value is not nil, for example:
function my_function(input)
local value = input.value or error('Missing value')
-- The following line would currently raise a "Needs nil check" warning
-- However, if it was nil at runtime, an error would have been raised and it would never get this far.
return value:sub(1, 3)
end
It's not just error that can cause this, however. A custom function could be written that never returns as well (the most obvious way is that the function unconditionally calls error, but there may be other ways involving coroutines or functions implemented in C). A @noreturn annotation could be used to indicate this, similar to @nodiscard.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Issue ではファイルもテストも指定されていません。まず nil チェックの警告と既存の @nodiscard アノテーション処理を追跡し、次に戻り値を返さない built-in、カスタム関数、@noreturn をどのように表現すべきかを判断してください。例で警告が出なくなり、アノテーションの動作がカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100