Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Missing diagnostic when calling a non-function value

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
lua
領域
devtools

調査の方向性

数値および文字列の値を呼び出す Lua スニペットで問題を再現し、その後、呼び出し式を処理する診断または型チェックのエントリーポイントを追跡します。明らかに呼び出し不可能な値について診断が報告される一方で、呼び出し可能なテーブルと明示的なオーバーロードまたは __call シグネチャを持つ値は引き続き受け入れられれば完了です。

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

説明

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Diagnostics/Syntax Checking

Expected Behaviour

LuaLS should report a diagnostic when a value whose type is known to be non-callable is called like a function.

For example, calling a number, string, boolean, or a plain table without a known __call / @overload signature should produce a warning/error, because the code will fail at runtime.

Actual Behaviour

No diagnostic is reported.

Even when the value is explicitly annotated or cast as number, LuaLS accepts the call silently.

Reproduction steps

Use the following code:

local x = 1 --[[@as number]]
x()

local y = 1
y()

---@type number
local z = 1
z()

Expected: diagnostics on x(), y(), and z().
Actual: no diagnostics are reported.
At runtime, these calls fail with an error similar to:
attempt to call a number value

Additional Notes

This is different from callable table / __call support.
I am not asking LuaLS to reject values that are explicitly annotated as callable, for example with ---@overload fun(...) or an equivalent __call signature.
The issue is about direct calls to values whose inferred or declared type is definitely not callable, such as number.
This also affects typo detection. For example, code like this can accidentally parse as a function call:

---@param name string
local function greet(name)
    return "Hello " .. name "!"
end

Here name "!" is a call expression, but name is a string, so a diagnostic would be useful.

Log File

No response

主要言語
Lua
スター
4.4k
フォーク
442
平均マージ
8日 9時間
マージ済み PR(30日)
1

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

LuaLS/lua-language-server のほかの issue

LuaLS/lua-language-server の issue をすべて見る

似ている issue

Lua の issue をもっと見る

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

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