LuaLS / LuaLS/lua-language-server

Annotation type any not working properly

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

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

主要言語
Lua
スター
4.4k
フォーク
442
PR マージ指標
30日以内にマージされた PR はありません

説明

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?

Type Checking

Expected Behaviour

Variant 1:
Type 'any' allows any type except 'nil'. Type nil it's nil, not any.
@param cc any|nil should allow to use nil type

Variant 2:
When checking a type, you need to always have an argument, no matter what type. The argument must be specified in the method call. Сalling with an empty argument is not allowed

Variant 3: a special flag in param annotation that indicates an argument must be specified here

Actual Behaviour
---@param cc any
local function Test(cc)
	print(cc)
end

Test() -- no error

Type any allow nil type.

For example:
LUA + luabind C++.
C++ required argument on all bindings. Test(nil) and Test() have different behaviour for luabind.

Reproduction steps
  1. Go to '...'
  2. Click '...'
  3. See error '...'
Additional Notes

No response

Log File

No response

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

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

はじめの一歩

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

調査の方向性

まず、Visual Studio Code 拡張機能で報告されたアノテーションの例を再現します。@param cc any と @param cc any|nil について、Test() と Test(nil) を比較してください。Issue ではいくつかのセマンティクスの候補が示されていますが、ソースファイルもテストも指定されていません。まずどのルールが意図されているのかを判断し、その後、完成した動作が省略された引数と明示的な nil を区別することを確認してください。

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

評価

技術スタック
lua, vscode
領域
devtools
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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