Skip to content

Releases: luau-lang/luau

0.661

14 Feb 22:25
7764298
Compare
Choose a tag to compare

What's Changed?

This release introduces numerous improvements to the new solver's non-strict mode that should begin to make it more useful - we warn on Unknown Symbols and correctly visit the whole program now. We've also fixed a number of bugs in the new solver as well as made progress on the new round-trippable AST.

Roundtrippable AST

  • Add a new AstNode, AstGenericType
  • Retain source information for AstExprTypeAssertion

New Type Solver

  • New non-strict mode will report unknown symbol errors, e.g
foo = 5
local wrong1 = foob <- issue warning
  • Fixed a bug where new non-strict mode failed to visit large parts of the program.
  • We now infer the types of unnanotated local variables in statements with multiple assignments, e.g. local x: "a", y, z = "a", f()
  • Fixed bugs in constraint dispatch ordering.
  • Fixed a bug that caused an infinite loop between Subtyping, OverloadResolution, and Type Function Reduction, by preventing calls to Type Function Reduction being re-entrant.
  • Fixed a crash in bidirectional type inference caused by asserting read and write properties on a type that was readonly.

Runtime

  • Fix a stack overflow caused by luaL_checkstack consuming stack space even if the function fails to reserve memory.
  • Using '%c' with a 0 value in Luau string.format will append a '\0'. Resolves #1650

Full Changelog: 0.660...0.661

Co-authored-by: Ariel Weiss [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.660

08 Feb 00:45
2e61028
Compare
Choose a tag to compare

What's Changed

This release introduces initial work on a Roundtrippable AST for Luau, and numerous fixes to the new type solver, runtime, and fragment autocomplete.

Roundtrippable AST

To support tooling around source code transformations, we are extending the parser to retain source information so that we can re-emit the initial source code exactly as the author wrote it. We have made numerous changes to the Transpiler, added new AST types such as AstTypeGroup, and added source information to AST nodes such as AstExprInterpString, AstExprIfElse, AstTypeTable, AstTypeReference, AstTypeSingletonString, and AstTypeTypeof.

New Type Solver

  • Implement setmetatable and getmetatable type functions.
  • Fix handling of nested and recursive union type functions to prevent the solver from getting stuck.
  • Free types in both old and new solver now have an upper and lower bound to resolve mixed mode usage of the solvers in fragment autocomplete.
  • Fix infinite recursion during normalization of cyclic tables.
  • Add normalization support for intersections of subclasses with negated superclasses.

Runtime

  • Fix compilation error in Luau buffer bit operations for big-endian machines.

Miscellaneous

  • Add test and bugfixes to fragment autocomplete.
  • Fixed clang-tidy warnings in Simplify.cpp.

Full Changelog: 0.659...0.660


Co-authored-by: Ariel Weiss [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.659

01 Feb 22:30
f8a1e01
Compare
Choose a tag to compare

What's Changed

General performance improvements and bug fixes. lua_clonetable was added too.

General

Runtime

  • C API now supports lua_clonetable for efficient table cloning.
  • Fix incorrect behavior of buffer.readbits/buffer.writebits on big-endian machines.

New Solver

  • Crashes related to duplicate keys in table literals, fragment AC crashes, and potential hash collisions in the StringCache.
  • We now handle user-defined type functions as opaque and track interior free table types.

Require By String

  • Require-by-string path resolution was simplified.

Full Changelog: 0.658...0.659


Co-authored-by: Andy Friesen [email protected]
Co-authored-by: Ariel Weiss [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.658

24 Jan 20:22
c13b5b7
Compare
Choose a tag to compare

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::functions, 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::functions 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 now MagicFunction::handleOldSolver
  • FunctionType::dcrMagicFunction is now MagicFunction::infer
  • FunctionType::dcrMagicRefinement is now MagicFunction::refine
  • FunctionType::dcrMagicTypeCheck is now MagicFunction::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

18 Jan 00:44
2904750
Compare
Choose a tag to compare

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 to LuaTable.

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.
  • 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

10 Jan 20:02
c759cd5
Compare
Choose a tag to compare

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 and buffer.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

13 Dec 21:27
2e6fdd9
Compare
Choose a tag to compare

What's Changed

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"
  • 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 the LuauBytecodeType 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 API luau_set_compile_constant_* or C++ API setCompileConstant* functions should be used.

New Contributors

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

03 Dec 01:09
8cc289f
Compare
Choose a tag to compare

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

22 Nov 21:07
d19a5f0
Compare
Choose a tag to compare

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 and k+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

15 Nov 23:14
e905e30
Compare
Choose a tag to compare

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 DefIds 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]