Releases: luau-lang/luau
0.681
What's Changed?
Short week, so a slightly shorter release! This one has been focused on improving polish in fragment autocomplete and the new solver.
New Type Solver
- Fix a bug where we didn't infer self types correctly under bidirectional type inference.
- Improve the memory consumption of the new solver by reducing the number of expensive allocations performed by
Substitution
. - The New non strict Mode shouldn't issue errors when we call checked functions with
never
values. - Extend the number of cases in which the new non strict mode can report unknown symbols.
- Fix a bug where
and
andor
expressions didn't correctly forward information computed by their operands. This should allow more programs using these expressions to complete typechecking correctly. - Small performance improvements for
Generalization
Fragment Autocomplete
- Fragment autocomplete provides richer autofill information when typing
self.|
- Fragment autocomplete now uses refinement information computed in the new solver to provide more accurate incremental completion.
Code Generation
- Fix a bug where Codegen could sometimes try to execute a non-executable page
Co-authored-by: Ariel Weiss aaronweiss@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
Co-authored-by: Vyacheslav Egorov vegorov@roblox.com
Full Changelog: 0.680...0.681
0.680
What's Changed?
This week includes many changes to bring the behaviours of the Old and
New Luau Type Solver more in line.
- The old solver now stringifies tables identically to the new solver.
Sealed tables are stringified as{ ... }
and unsealed tables are
represented by{| ... |}
, regardless of your choice of solver.
New Type Solver
- Miscellaneous fixes to make the Luau Frontend able to dynamically
toggle which solve is used. - Small fixes to reduce instances of nondeterminism of the New Type
Solver. - Issue an error when a function that has multiple non-viable overloads
is used. - Subtyping now returns more information about the generics for type
inference to consume. - Stop stuck type-functions from blocking type inference. This should
lead to fewer instances of 'type inference failed to complete'.
Fragment Autocomplete
- Fixed a bug where incremental autocomplete wouldn't be able to provide
results directly on a required module script.
require(script.Module).{request completions here}
will now recommend
the properties returned by the required object.
Full Changelog: 0.679...0.680
Co-authored-by: Andy Friesen afriesen@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: Sora Kanosue skanosue@roblox.com
Co-authored-by: Talha Pathan tpathan@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
0.679
What's Changed?
We've been hard at work fixing bugs and introducing new features!
VM
- Include constant-folding information in Luau cost model for inlining and loop unrolling
- ~1% improvement in compile times
New Type Solver
Luau::shallowClone
's last argument, whether to clone persistent (builtin) types, is now non-optional.- Refinements on properties of tables are now computed with a
read
table property. This resolves some issues around refining table properies and then trying to set them. Fixes #1344. Fixes #1651.
if foo.bar then
-- Prior to this release, this would be `typeof(foo) & { bar: ~(false?) }
-- Now, this is `typeof(foo) & { read bar: ~(false?) }
end
- The type function
keyof
should respect the empty string as a property, as in:
-- equivalent to type Foo =""
type Foo = keyof<{ [""]: number }>
- Descend into literals to report subtyping errors for function calls: this both improves bidirectional inference and makes errors more specific. Before, the error reporting for a table with incorrect members passed to a function would cite the entire table, but now it only cites the members that are incorrectly typed.
- Fixes a case where intersecting two tables without any common properties would create
never
, instead of a table with both of their properties.
Internal Contributors
Co-authored-by: Ariel Weiss aaronweiss@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: James McNellis jmcnellis@roblox.com
Co-authored-by: Sora Kanosue skanosue@roblox.com
Co-authored-by: Talha Pathan tpathan@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
Co-authored-by: Vyacheslav Egorov vegorov@roblox.com
0.678
What's Changed?
We've been hard at work fixing bugs in the new type solver and getting it ready to go!
Native Codegen
- Specialized Luau Codegen instruction for fetching an import.
As a reminder, an import is an expression likeglobal.thing
and covers stuff like libraries without fastcallscoroutine.resume
) and atomic extern libraries.
New Type Solver
- Fix an issue that prevented eager generalization from working properly with OO styled code.
- Avoid copying uninitialized memory in Luau attribute parsing
- Improve type inference of unsealed tables. This fixes #1838 and #1859
- Infer potential singleton string keys in autocomplete when the expected index type is a union type.
- Avoid creating cyclic types when reducing types of the form
t1 where t1 = refine<T, t1, Y>
- The type cloner now does the same thing for the new and old solvers.
- Properly infer polarity (aka variance) for divergent table properties. (ie tables whose read type and write type are not the same)
- Crash fixes.
Internal Contributors
Co-authored-by: Andy Friesen afriesen@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: James McNellis jmcnellis@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
Co-authored-by: Vyacheslav Egorov vegorov@roblox.com
Full Changelog: 0.677...0.678
0.677
What's Changed?
This week comes with many improvements to the new type solver and an important fix to the garbage collection to make it more robust in memory constrained scenarios.
Community Contributions
- Add missing cpp header by @vinnyhorgan in #1833
Runtime
- Garbage collection will no longer run out of memory itself, which could have happened when resizing arrays to a smaller size
New Type Solver
- Type refinements on external types should now work and should no longer normalize the type into
never
- Improved error reporting when
string.format
is used with a dynamic format string - Updated type signature of
getmetatable
library function to use the corresponding type function and produce better type inference - Restored a type mismatch error when converting function types with different number of generic parameters, like
() -> ()
into<T>() -> ()
- Types resulting from compound assignments have been simplified, reducing cyclic type introduction and inference failures
- Fixed function generic types leaking into tables during bidirectional type inference (Fixes #1808 and #1821 )
- Stability and performance improvements (Fixes #1860 )
Internal Contributors
Co-authored-by: Andy Friesen afriesen@roblox.com
Co-authored-by: Ariel Weiss aaronweiss@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: Sora Kanosue skanosue@roblox.com
Co-authored-by: Varun Saini vsaini@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
Co-authored-by: Vyacheslav Egorov vegorov@roblox.com
New Contributors
- @vinnyhorgan made their first contribution in #1833
Full Changelog: 0.676...0.677
0.676
We're back on track after the long weekend!
General
clang-format
ed new code. Keep your code tidy!- Disable some Luau tests that are broken currently.
- Enable fragment autocomplete to do tagged union completion for modules typechecked in the old solver.
New Type Solver
- Fix false positives on generic type packs in non-strict mode.
- Update type signature of
setmetatable
to be<T, MT>(T, MT) -> setmetatable<T, MT>
. - Make local type aliases available in type functions. For example:
type Foo = number
type Array<T> = {T}
type function Bar(t)
return types.unionof(Foo, Array(t))
end
VM/Runtime
- Make sure
lua_unref
doesn't accept refs which did not exist in the table.
Co-authored-by: Andy Friesen afriesen@roblox.com
Co-authored-by: Ariel Weiss aaronweiss@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: Sora Kanosue skanosue@roblox.com
Co-authored-by: Talha Pathan tpathan@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
Co-authored-by: Vyacheslav Egorov vegorov@roblox.com
Full Changelog: 0.675...676
0.675
General
- Introduce
Frontend::parseModules
for parsing a group of modules at once. - Support chained function types in the CST.
New Type Solver
- Enable write-only table properties (described in this RFC).
- Disable singleton inference for large tables to improve performance.
- Fix a bug that occurs when we try to expand a type alias to itself.
- Catch cancelation during the type-checking phase in addition to during constraint solving.
- Fix stringification of the empty type pack:
()
. - Improve errors for calls being rejected on the primitive
function
type. - Rework generalization: We now generalize types as soon as the last constraint relating to them is finished. We think this will reduce the number of cases where type inference fails to complete and reduce the number of instances where
*blocked*
types appear in the inference result.
VM/Runtime
- Dynamically disable native execution for functions that incur a slowdown (relative to bytecode execution).
- Improve names for
thread
/closure
/proto
in the Luau heap dump.
Co-authored-by: Andy Friesen afriesen@roblox.com
Co-authored-by: Ariel Weiss aaronweiss@roblox.com
Co-authored-by: Aviral Goel agoel@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: Talha Pathan tpathan@roblox.com
Co-authored-by: Varun Saini vsaini@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
Co-authored-by: Vyacheslav Egorov vegorov@roblox.com
0.674
General
- Expose an optional
get_alias
API as an alternative toget_config
in Luau.Require and Luau.RequireNavigator. - Improve the Luau CLI's virtual filesystem implementation to fix bugs related to
init.luau
. Fixes #1816
New Type Solver
- Avoid double reporting errors when erroneous arguments are provided to type functions.
- Fix some instances of unresovable cyclic type functions in loops by only considering the first loop cycles. This results in some type inference inaccuracies when the type of a variable in loop through multiple iterations. Fixes #1413.
- Better generalize free types that have meaningful lower and upper bounds, especially for table indexers.
- Report more specific errors when assigning or returning table literal types, instead of citing the entire table type.
- Inference for functions with generic type packs is greatly improved.
- Fix some internal compiler exceptions when using type-stating functions like
table.freeze
inif _ then _ else _
expressions and short circuiting binary operations. - More consistently simplify unions of primitive types, especially in array-like and dictionary-like tables.
- Fix a crash when type checking an erroneous type alias containing
typeof
with a type assertion expression, as in:type MyTable = {} -- This will error at type checking time as it's a duplicate type MyTable = typeof(setmetatable(SomeTable :: {}, SomeMetaTable));
- Fix a crash when inferring the type of an index expression where the indexee is invalid (e.g.
nil
).
Runtime
- Avoid throwing an exception from
luau_load
if we run out of memory. - Type functions are no longer compiled and included in bytecode. Fixes #1817.
- Fix some instances of Luau C API functions reading invalid debug information (generally when the first or last instruction of a block was being inspected). Fixes #1369.
- Avoid potential signed integer overflow when doing bounds checks on tables.
- Support 16 byte aligned userdata objects when system allocation alignment is also 16 bytes.
- Fix memory leaks in
Luau.Require
when using VM build with no exceptions. Fixes #1827.
Internal Contributors
Co-authored-by: Andy Friesen afriesen@roblox.com
Co-authored-by: Ariel Weiss aaronweiss@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: James McNellis jmcnellis@roblox.com
Co-authored-by: Sora Kanosue skanosue@roblox.com
Co-authored-by: Talha Pathan tpathan@roblox.com
Co-authored-by: Varun Saini vsaini@roblox.com
Co-authored-by: Vyacheslav Egorov vegorov@roblox.com
0.673
General Changes
- Remove a
static_assert
that prevented Luau from building on 32-bit targets. - Fix
proxyrequire
(see #1804) - Replace contents API with new
loadname
API in Luau.Require - Store the positions of
:
symbols in the CST. - Fix a minor bug in the new incremental autocomplete engine: Properly suggest
else
andelseif
if the cursor is currently within anif
block.
New Type Solver
- Allow generics to be substituted for negation types when performing subtype tests
- Crash fixes
- Surface subtyping errors more consistently.
- Avoid creating double-negation types (like
~~(false?)
) when generating constraints.
Internal Contributors
Co-authored-by: Andy Friesen afriesen@roblox.com
Co-authored-by: Ariel Weiss aaronweiss@roblox.com
Co-authored-by: Aviral Goel agoel@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: Sora Kanosue skanosue@roblox.com
Co-authored-by: Talha Pathan tpathan@roblox.com
Co-authored-by: Varun Saini vsaini@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
Co-authored-by: Vyacheslav Egorov vegorov@roblox.com
Full Changelog: 0.672...0.673
0.672
What's Changed?
Hi there, folks! It's been another busy week in the type mines, trying to bring you all the very best type inference system we can. We've got a bunch of updates to large pain points across the new type solver, and our next big update (currently under a debug flag) improving type generalization is finally nearing completion (and should hopefully eliminate quite a lot of "type solver failed to complete" errors). We've also continued polishing both the CST Parser and the Luau.Require
library we introduced a few releases ago based on user feedback and bug reports, and we're really happy with how they're turning out.
Parser
- Fixes a bug in the CST tooling where the spacing on return type annotations for functions was not being printed correctly.
- Resolves some issues with the JSON encoding of
AstGenericType
andAstGenericTypePack
Runtime
- Implements support for yielding requires in
Luau.Require
library. - Improves the error messages for require-by-string to include the chunk name that was problematic where possible and the overall require path that failed to be required.
- Fixes a bug that prevented the use of
require
within C functions andpcall
. - Adds an API to support selectively removing chunks from the require cache in
Luau.Require
- Adds an API to support clearing the entire require cache in
Luau.Require
New Type Solver
- Fixes a crash in the new non-strict mode when visiting function return types in incomplete ASTs (e.g. during editing).
- Improves type simplification to support intersections of tables with extern types, resolving one of the causes of frequent refinements unexpectedly leading to
never
. - Improves type inference to better understand diverging branches in functions, reducing false negatives where the type system fails to learn that a binding must now always be initialized.
- Fixes a typo in the type definitions for user-defined function types where the
intersection
tag was misspelled. - Improves the overall accuracy of free type tracking during constraint solving, leading to better inference results overall.
- Implements
types.optional
as a new library function for user-defined type functions to make it easier to union a type withnil
. - Resolves a number of bugs caused by local type inference expanding the domain of upvalues
Internal Contributors
Co-authored-by: Andy Friesen afriesen@roblox.com
Co-authored-by: Ariel Weiss aaronweiss@roblox.com
Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: Talha Pathan tpathan@roblox.com
Co-authored-by: Varun Saini vsaini@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
Full Changelog: 0.671...0.672