LuaLS / LuaLS/lua-language-server
Feature request: Opaque/nominal types
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating the annotation and type-checking code for aliases and unknown types, then trace how values are inspected or mixed. Done means the language server supports distinct opaque types that can only be passed around, with coverage for the requested behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100