Releases: luau-lang/luau
0.658
What's Changed
General
- Allow types of tables to diverge after using
table.clone
(fixes #1617). - Allow 2-argument vector.create in Luau.
- Fix a crash when suggesting autocomplete after encountering parsing errors.
- Add lua_tolstringatom C API which returns the string length (whether or not the atom exists) and which extends the existing lua_tostringatom function the same way lua_tolstring/lua_tostring do.
- Luau now retains the DFGs of typechecked modules.
- Fix math.map/math.lerp merge fallout by @zeux in #1621
- Fixup desync between internal and external codebases by @vegorov-rbx in #1622
Magic Functions Migration Note
We've made a change to the API used to define magic functions.
Previously, we had a set of function pointers on each FunctionType
that would be invoked by the type inference engine at the correct point.
The problem we'd run into is that they were all std::function
s, we'd grown quite a few of them, and Luau allocates tens of thousands of types as it performs type inference. This adds up to a large amount of memory for data that isn't used by 99% of types.
To slim things down a bit, we've replaced all of those std::function
s with a single shared_ptr
to a new interface called MagicFunction
. This slims down the memory footprint of each type by about 50 bytes.
The virtual methods of MagicFunction
have roughly 1:1 correspondence with the old interface, so updating things should not be too difficult:
FunctionType::magicFunction
is nowMagicFunction::handleOldSolver
FunctionType::dcrMagicFunction
is nowMagicFunction::infer
FunctionType::dcrMagicRefinement
is nowMagicFunction::refine
FunctionType::dcrMagicTypeCheck
is nowMagicFunction::typeCheck
Full Changelog: 0.657...0.658
Co-authored-by: Andy Friesen [email protected]
Co-authored-by: Ariel Weiss [email protected]
Co-authored-by: Aviral Goel [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Talha Pathan [email protected]
Co-authored-by: Varun Saini [email protected]
Co-authored-by: Vighnesh Vijay [email protected]
Co-authored-by: Vyacheslav Egorov [email protected]
0.657
What's Changed
General
- CodeGen: Implement support for math.lerp lowering by @zeux in #1609
- Add 2-component vector constructor by @petrihakkinen in #1569
- Fix a parsing bug related to the starting position of function names.
- Rename Luau's
Table
struct toLuaTable
.
New Solver
- Add support for generics in user-defined type functions (RFC).
- Provide a definition of
math.lerp
to the typechecker. - Implement error suppression in
string.format
.- Fixes #1587.
- Ensure function call discriminant types are always filled when resolving
FunctionCallConstraint
.
Full Changelog: 0.656...0.657
Co-authored-by: Ariel Weiss [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Talha Pathan [email protected]
Co-authored-by: Vyacheslav Egorov [email protected]
0.656
What's Changed
General
- All code has been re-formatted by
clang-format
; this is not mechanically enforced, so Luau may go out-of-sync over the course of the year. - Remove Ast dependency on CLI.Lib by @vegorov-rbx in #1571
- Refactor CLI structure to match the include/src split that our other projects have. by @aatxe in #1573
- Implement support for math.lerp by @zeux in #1608
New Solver
- Fix negation type 'inner' method in user-defined type functions by @vegorov-rbx in #1582
- Track free types interior to a block of code on
Scope
, which should reduce the number of free types that remain un-generalized after type checking is complete (e.g.: less errors like'a <: number is incompatible with number
).
Autocomplete
- Fragment autocomplete now does not provide suggestions within comments (matching non-fragment autocomplete behavior).
- Autocomplete now respects iteration and recursion limits (some hangs will now early exit with a "unification too complex error," some crashes will now become internal complier exceptions).
Runtime
- Add a limit to how many Luau codegen slot nodes addresses can be in use at the same time (fixes #1605, fixes #1558).
- Added constant folding for vector arithmetic (fixes #1553).
- Added support for
buffer.readbits
andbuffer.writebits
(see: luau-lang/rfcs#18).
Full Changelog: 0.655...0.656
Co-authored-by: Ariel Weiss [email protected]
Co-authored-by: David Cope [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Vighnesh Vijay [email protected]
Co-authored-by: Vyacheslav Egorov [email protected]
0.655
What's Changed
- Convert Luau heap dumps to Chrome heap snapshots by @jkelaty-rbx in #1554
New Solver
- Type functions should be able to signal whether or not irreducibility is due to an error
- Do not generate extra expansion constraint for uninvoked user-defined type functions
- Print in a user-defined type function reports as an error instead of logging to stdout
- Many e-graphs bugfixes and performance improvements
- Many general bugfixes and improvements to the new solver as a whole
- Fixed issue with used-defined type functions not being able to call each other
- Infer types of globals under new type solver
Fragment Autocomplete
- Miscellaneous fixes to make interop with the old solver better
Runtime
- Support disabling specific built-in functions from being fast-called or constant-evaluated (Closes #1538)
- New compiler option
disabledBuiltins
accepts a list of library function names like "tonumber" or "math.cos"
- New compiler option
- Added constant folding for vector arithmetic
- Added constant propagation and type inference for vector globals (Fixes #1511)
- New compiler option
librariesWithKnownMembers
accepts a list of libraries for members of which a request for constant value and/or type will be made libraryMemberTypeCb
callback is called to get the type of a global, return one of theLuauBytecodeType
values. 'boolean', 'number', 'string' and 'vector' type are supported.libraryMemberConstantCb
callback is called to setup the constant value of a global. To set a value, C APIluau_set_compile_constant_*
or C++ APIsetCompileConstant*
functions should be used.
- New compiler option
New Contributors
- @jkelaty-rbx made their first contribution in #1554
Full Changelog: 0.654...0.655
What's changed
Co-authored-by: Aaron Weiss [email protected]
Co-authored-by: Andy Friesen [email protected]
Co-authored-by: Aviral Goel [email protected]
Co-authored-by: Daniel Angel [email protected]
Co-authored-by: Jonathan Kelaty [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Varun Saini [email protected]
Co-authored-by: Vighnesh Vijay [email protected]
Co-authored-by: Vyacheslav Egorov [email protected]
0.654
What's Changed?
- Support dead store elimination for
STORE_VECTOR
instruction - Fix parser hang when a separator is used between Luau class
declaration properties - Provide properties and metatable for built-in vector type definition
to fix type errors - Fix Fragment Autocomplete to ensure correct parentheses insertion
behavior. - Add support for 'thread' and 'buffer' primitive types in user-defined
type functions
Co-authored-by: Andy Friesen [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Vighnesh Vijay [email protected]
Co-authored-by: Vyacheslav Egorov [email protected]
New Contributors
Full Changelog: 0.653...0.654
0.653
What's Changed?
- Optimized the vector dot product by up to 24%
- Allow for x/y/z/X/Y/Z vector field access by registering a
vector
metatable
with an__index
method (Fixes #1521) - Fixed a bug preventing consistent recovery from parse errors in table types
- Optimized
k*n
andk+n
when types are known - Allow fragment autocomplete to handle cases like the automatic insertion of
parens, keywords, strings, etc., while maintaining a correct relative positioning
New Solver
- Allow for
nil
assignment to tables and classes with indexers
Internal Contributors:
Co-authored-by: Aaron Weiss [email protected]
Co-authored-by: Andy Friesen [email protected]
Co-authored-by: Aviral Goel [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Varun Saini [email protected]
Co-authored-by: Vighnesh Vijay [email protected]
Co-authored-by: Vyacheslav Egorov [email protected]
Full Changelog: 0.652...0.653
0.652
What's Changed
- Add support for mixed-mode type checking, which allows modules checked
in the old type solver to be checked and autocompleted by the new one. - Generalize
RequireResolver
to support require-by-string semantics in
luau-analyze
. - Fix a bug in incremental autocomplete where
DefId
s associated with
index expressions were not correctly picked up. - Fix a bug that prevented "complex" types in generic parameters (for
example,local x: X<(() -> ())?>
). - CodeGen: Rewrite dot product lowering using a dedicated IR instruction by @zeux in #1512
- Fix mesh-normal-vector benchmark array access by @zeux in #1514
- Remove noexcepts from Config by @vrn-sn in #1523
Issues fixed
New Contributors
Full Changelog: 0.651...0.652
Internal Contributors:
Co-authored-by: Aaron Weiss [email protected]
Co-authored-by: Andy Friesen [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Varun Saini [email protected]
Co-authored-by: Vighnesh Vijay [email protected]
0.651
What's Changed
- Fragment Autocomplete: a new API allows for type checking a small fragment of code against an existing file, significantly speeding up autocomplete performance in large files.
- Requiring a path with a ".lua" or ".luau" extension will now have a bespoke error suggesting to remove said extension.
- Fixes a bug in which whether two
Luau::Symbol
s are equal depends on whether the new solver is enabled. - Fix definition module name & location by @checkraisefold in #1495
- Pre-populate/duplicate check class definitions (new solver) by @checkraisefold in #1493
- Set the defining module even when the new solver cloned the type. by @aatxe in #1506
- Replace old site urls by @Barocena in #1505
New Solver
- E-Graphs have landed: this is an ongoing approach to make the new type solver simplify types in a more consistent and principled manner, based on similar work (see: https://egraphs-good.github.io/).
- Adds support for exporting / local user type functions (previously they were always exported).
- Fixes a set of bugs in which the new solver will fail to complete inference for simple expressions with just literals and operators.
General Updates
New Contributors
- @checkraisefold made their first contribution in #1495
- @Barocena made their first contribution in #1505
Full Changelog: 0.650...651
Internal Contributors:
Co-authored-by: Aaron Weiss [email protected]
Co-authored-by: Andy Friesen [email protected]
Co-authored-by: David Cope [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Varun Saini [email protected]
Co-authored-by: Vighnesh Vijay [email protected]
Co-authored-by: Vyacheslav Egorov [email protected]
0.650
What's Changed
- New
vector
library! See https://rfcs.luau.org/vector-library.html for details - Replace the use of non-portable
strnlen
withmemchr
.strnlen
is not part of any C or C++ standard. - Introduce
lua_newuserdatataggedwithmetatable
for faster tagged userdata creation of userdata with metatables registered withlua_setuserdatametatable
Old Solver
- It used to be the case that a module's result type would unconditionally be inferred to be
any
if it imported any module that participates in any import cycle. This is now fixed.
New Solver
- Improve inference of
table.freeze
: We now infer read-only properties on tables after they have been frozen. - We now correctly flag cases where
string.format
is called with 0 arguments. - Fix a bug in user-defined type functions where table properties could be lost if the table had a metatable
- Reset the random number seed for each evaluation of a type function
- We now retry subtyping arguments if it failed due to hidden variadics.
Internal Contributors
Co-authored-by: Aaron Weiss [email protected]
Co-authored-by: Andy Friesen [email protected]
Co-authored-by: Aviral Goel [email protected]
Co-authored-by: David Cope [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Vyacheslav Egorov [email protected]
Full Changelog: 0.649...0.650
0.649
What's new?
- More progress on the upcoming analysis API for fragment type inference.
- Fix a bug in type normalization where intersection did not appropriately respect resource limits (affects new and old type solvers).
- Allow type normalization to track cyclic pairs of types in inhabitance checks.
- Fix a bug in the old type solver where
Unifier
did not necessarily live long enough. - Check the coroutine stack size before resuming in the Luau VM.
New Type Solver
- Add support for typestating
table.freeze
and updated its behavior to transform the given table types into being marked read-only for all of its properties. More to come here for indexers when we add support for read-only indexers. - Fix #1453 by adding a missing arity check to
string.format
. - Fix a crash when editing caused by invalid AST states not being visited properly by the type solver.
- Fix a crash in type simplification caused by missing follow calls.
Internal Contributors:
Co-authored-by: Aaron Weiss [email protected]
Co-authored-by: Andy Friesen [email protected]
Co-authored-by: Hunter Goldstein [email protected]
Co-authored-by: Vighnesh Vijay [email protected]
Co-authored-by: Vyacheslav Egorov [email protected]