LuaLS / LuaLS/lua-language-server

Feature request: Opaque/nominal types

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

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

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

説明

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)

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

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

はじめの一歩

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

調査の方向性

ファイル、テスト、エントリポイントは指定されていません。まず、エイリアスと不明な型に関するアノテーションおよび型チェックのコードを見つけ、次に値がどのように検査または混在されるかを追跡してください。要求された動作をカバーするテストがあり、language server が受け渡しだけ可能な個別の不透明型をサポートすれば完了です。

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

評価

技術スタック
lua
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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