LuaLS / LuaLS/lua-language-server

Annotation type any not working properly

Offen
#2,637 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Lua
Sterne
4.4k
Forks
442
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das gemeldete Annotationsbeispiel in der Visual Studio Code-Erweiterung zu reproduzieren: Vergleiche Test() mit Test(nil) für @param cc any und @param cc any|nil. Das Issue stellt mehrere mögliche Semantiken vor, nennt aber weder eine Quelldatei noch einen Test; ermittle zunächst, welche Regel beabsichtigt ist, und überprüfe dann, dass das abgeschlossene Verhalten ausgelassene Argumente von explizitem nil unterscheidet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
lua, vscode
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.