Skip to content

Releases: luau-lang/luau

0.683

18 Jul 20:52
0ce993f
Compare
Choose a tag to compare

Another week, another release!

Analysis

  • Hide errors in all solver modes (not just strict mode) if the only error is that type inference failed to complete.
  • Make various analysis components solver-agnostic (setType, visit, Scope methods).
  • Fix an issue where type inference may fail to complete when assigning a table's member to the table itself.
  • Fix a bug when accessing a table member on a local after the local is assigned to in an if-else block, loop, or other similar language construct.
  • Fix type-checking of if-then-else expressions.

Co-authored-by: Hunter Goldstein hgoldstein@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com
Co-authored-by: Vyacheslav Egorov vegorov@roblox.com

0.682

11 Jul 18:50
6ff0650
Compare
Choose a tag to compare

What's changed?

Another somewhat quiet week! Don't let the large PR fool you, this is mostly ...

New Solver

  • The code for type functions has been re-organized: instead of everything living in TypeFunction.h and TypeFunction.cpp, we now have separate files for the type function inference machinery (TypeFunction.h), definitions of built-in type functions (BuiltinTypeFunctions.h), and the implementation of user defined type functions (UserDefinedTypeFunction.h).
  • Refinements against *no-refine*, a sentinel type indicating that no refinements should occur, are now always resolved, even if the target of the refinement would be otherwise pending, such as another type function.

Autocomplete

  • Fixed autocomplete to prefer table property completion to string singleton completion. In the below example, the types associated with each member of foo will be displayed in autocomplete popups.
local foo = {
    ["Item/Foo"] = 42,
    ["Item/Bar"] = "it's true",
    ["Item/Baz"] = true,
}
foo["|"] -- cursor at `|`

Native Codegen

  • Fixed native compilation lowering of the new global lookup instruction, which caused code generation to fail with an error or to evaluate incorrect results. Issue affected 678-681 releases when all flags were enabled.

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

0.681

04 Jul 16:33
60cd88a
Compare
Choose a tag to compare

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 and or 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

27 Jun 20:19
e190754
Compare
Choose a tag to compare

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

20 Jun 23:01
8fe64db
Compare
Choose a tag to compare

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

13 Jun 16:51
713ee2f
Compare
Choose a tag to compare

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 like global.thing and covers stuff like libraries without fastcalls coroutine.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

06 Jun 19:15
68cdcc4
Compare
Choose a tag to compare

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

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

Full Changelog: 0.676...0.677

0.676

30 May 18:33
92b0338
Compare
Choose a tag to compare

We're back on track after the long weekend!

General

  • clang-formated 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

27 May 21:51
5965818
Compare
Choose a tag to compare

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

16 May 20:11
92cce57
Compare
Choose a tag to compare

General

  • Expose an optional get_alias API as an alternative to get_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 in if _ 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