LuaLS / LuaLS/lua-language-server
Feature request: Opaque/nominal types
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
The problem
It often happens that library functions return objects the type of which is an implementation detail. For example an identifier may be an integer but could suddenly be changed to a string, and the client code shouldn't fail because of that.
Safely typing such an identifier in LLS is currently impossible:
- typing it as
integerdepends on a potentially unstable implementation detail - typing it as
anyis unsound
In other words, structural typing fails when the structure isn't stable or known.
Feature request
An annotations that declares a completely opaque/nominal type. It could be --@opaque typename, --@alias typename without any arguments, or anything else. Values belonging of such a type cannot be inspected in any way and can only be passed around. Values of different opaque types cannot be mixed up (so this is stronger than unknown in typescript)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Es werden keine Dateien, Tests oder Einstiegspunkte genannt. Beginne damit, den Code für Annotationen und Typprüfung von Aliasen und unbekannten Typen zu finden, und verfolge dann, wie Werte untersucht oder vermischt werden. Fertig ist die Aufgabe, wenn der language server unterschiedliche opake Typen unterstützt, die nur weitergereicht werden können, mit Testabdeckung für das angeforderte Verhalten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100