1.2.2
Benjamin-Dobell
released this
14 Jan 17:56
·
114 commits
to master
since this release
- New "Illegal Overrides" inspection. Reports illegal member overrides when declaring a field/method on an inherited type.
If you're overriding a method with an incompatible type (e.g. subclassinit
function with different parameters) then you should annotate the parentinit
(and child) as@private
. - Improved support for progressively adding type annotations to an existing Lua codebase. Essentially, local variables (without a declaration site assignment) and function parameters are now assumed to be of type
any
. - Mouse-over documentation now supports indexed fields e.g. docs are now displayed when hovering over the
[1]
inarr[1]
. - Inspections now traverse expressions (function calls, binary operators etc.) so you'll see more specific errors within table literals in more circumstances.
- Many stdlib improvements/fixes (setmetatable, load* functions, getfenv, tostring, pcall, xpcall, assert & collectgarbage).
- Migrated stdlib to the .def.lua extension. If you're writing API types (i.e. files that are never executed) it's suggested you adopt this file extension too.
- Formalised type widening behaviour for overridden fields.
- Best effort type inference for the return type of invalid function calls i.e. more chance of just seeing errors at the call site, rather than all through-out a function.
- Special case handling for resolution of the
self
type when writing classes as closures i.e. expressions that look likesetmetatable(someTable, {__call=function() end})
. In such casesself
type will be resolved based on the return type of__call
. - Various type inference and variance detection performance improvements.
- Improved handling of return types that are a union of multiple results. Rather than being flattened into a multiple result list where each component is a union during type checking, the initial structure is preserved.
- Ensured method override auto-completion works in more circumstances.
- Ensured primitives are never covariant of shapes.
- Made an attempt to ensure the plugin is considered "dynamic" by IDEA.
- Fixed clashes between anonymous types declared at the same offer in files with the same name (in different directories or virtual file systems).
- Fixed several complex type rendering issues (missing brackets etc.) in the UI.
- Fixed a boolean operator type inference bug in the presence of variadic return types.
- Fixed some incorrect inspections when "Unknown type (any) is indexable" is enabled".
- Fixed type inference/inspections involving assignment of
nil
to a member oftable<K, nil | V>
- Fixed "Compute constant value" intention. However, many of the cases supported seem excessive and quite impractical. As such, this intention may be simplified in a future release.
- Fixed type inference & inspections for shapes that recursively reference themselves in their fields.
- Fixed auto-complete and type resolution for fields that are written to
self
typed variables. - Fixed several bugs where generic parameters declared in multiple scopes are involved in type inference.
- Fixed support for generic parameters referring to other generic parameters in their type constraints.
- Fixed occasional misreported generic parameter shadowed errors.