LuaLS / LuaLS/lua-language-server

Feature request: Opaque/nominal types

Aperta
#2,074 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
Lua
Stelle
4.4k
Fork
442
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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 integer depends on a potentially unstable implementation detail
  • typing it as any is 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)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Non vengono nominati file, test o punti di ingresso. Inizia individuando il codice di annotazione e controllo dei tipi per gli alias e i tipi sconosciuti, quindi traccia il modo in cui i valori vengono ispezionati o mescolati. Il lavoro è completato quando il language server supporta tipi opachi distinti che possono solo essere passati, con copertura per il comportamento richiesto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
lua
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.