LuaLS / LuaLS/lua-language-server

Adding an overload to an @class changes the result and gives type errors.

オープン
#2,978 コメント 5 件 リアクション 3 件 担当者 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?

Linux

What is the issue affecting?

Type Checking

Expected Behaviour

Adding an Overload under ---@class should not change anything about how the type is handled.

Actual Behaviour

image

Here we have a class declaration and it's exactly how I want.

image

Adding an overload for the constructor generates warnings? Doesn't really make any sense.

Reproduction steps

Use ---@class to define a class.
Add ---@overload.
Make sure the class library you're using returns anything but any when extending or creating a new class.

Additional Notes

No response

Log File

No response

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

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

はじめの一歩

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

調査の方向性

ペイロードにはソースファイルもテストも示されていないため、まず Visual Studio Code 拡張機能で Lua の ---@class 宣言と ---@overload を使ってこのケースを再現し、その後、overload の有無による型チェック結果を比較します。関係するクラスとコンストラクターの処理を追跡し、overload を追加しても有効な型の扱いが変わらず、報告された警告も発生しなくなった時点で、この問題は解決したものとします。

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

評価

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

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

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