asledgehammer / Candle-Compiler

GNU Lesser General Public License v3.0
2 stars 3 forks source link

Annotate generic classes as generic #5

Open demiurgeQuantified opened 6 months ago

demiurgeQuantified commented 6 months ago

Right now all generic classes are represented without the generic aspect. Generic classes are not actually supported by LuaLS right now, but annotating them as generic would still benefit developers. For example, IsoCell.getZombieList is annotated as returning ArrayList - annotating this as ArrayList<IsoZombie> instead would save a visit to the javadocs. The annotations for this are quite simple:

---@generic T
---@class ArrayList<T>

---@return ArrayList<IsoZombie>

Unfortunately, the type inference ArrayList<T>.get -> T is not possible with LuaLS's current lack of support for generic classes - class methods annotated with the generic get dropped by intellisense completely. Because of this, defining generic classes has no actual effect on the type checker, making this issue a low priority.