Tags: Autoplay1999/luau
Tags
Sync to upstream/release/684 (luau-lang#1930) ## General - Support AstStatDeclareGlobal output as a source string (via @karl-police in luau-lang#1889) - Luau heap dump correctly reports the size of a string, now including overhead for the string type - Prevent yields from Luau `xpcall` error handling function. ## Analysis - Avoid exponential blowup when normalizing union of normalized free variables. - Fix type pack-related bugs that caused infinite recursion when: - A generic type pack was bound to itself during subtyping. - In type pack flattening, when that same generic type pack was now being bound another generic type pack which contained it. - Properly simplify `any & (*error-type* | string)` to `*error-type* | *error-type* | string` instead of hanging due to creating a huge union type. --- Co-authored-by: Andy Friesen <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Sora Kanosue <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> --------- Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Varun Saini <[email protected]> Co-authored-by: Menarul Alam <[email protected]> Co-authored-by: Aviral Goel <[email protected]> Co-authored-by: Vighnesh <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Andy Friesen <[email protected]>
Sync to upstream/release/683 (luau-lang#1921) 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. - Fixes luau-lang#1914. - Fix type-checking of if-then-else expressions. - Fixes luau-lang#1815. --- Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Vighnesh Vijay <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]>
Sync to upstream/release/682 (luau-lang#1912) # 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 <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Sora Kanosue <[email protected]> Co-authored-by: Talha Pathan <[email protected]> Co-authored-by: Vighnesh Vijay <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]>
Sync to upstream/release/681 (luau-lang#1902) # 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 <[email protected]> Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Vighnesh Vijay <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> --------- Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Varun Saini <[email protected]> Co-authored-by: Alexander Youngblood <[email protected]> Co-authored-by: Menarul Alam <[email protected]> Co-authored-by: Aviral Goel <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Andy Friesen <[email protected]>
Sync to upstream/release/680 (luau-lang#1894) # 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. --- Co-authored-by: Andy Friesen <[email protected]> Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Sora Kanosue <[email protected]> Co-authored-by: Talha Pathan <[email protected]> Co-authored-by: Vighnesh Vijay <[email protected]>
Sync to upstream/release/679 (luau-lang#1884) # 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 luau-lang#1344. Fixes luau-lang#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 <[email protected]> Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: James McNellis <[email protected]> Co-authored-by: Sora Kanosue <[email protected]> Co-authored-by: Talha Pathan <[email protected]> Co-authored-by: Vighnesh Vijay <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> --------- Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Varun Saini <[email protected]> Co-authored-by: Alexander Youngblood <[email protected]> Co-authored-by: Aviral Goel <[email protected]> Co-authored-by: Vighnesh <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Andy Friesen <[email protected]>
Sync to upstream/release/678 (luau-lang#1878) # 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 luau-lang#1838 * and luau-lang#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. --------- Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Varun Saini <[email protected]> Co-authored-by: Alexander Youngblood <[email protected]> Co-authored-by: Menarul Alam <[email protected]> Co-authored-by: Aviral Goel <[email protected]> Co-authored-by: Vighnesh <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> Co-authored-by: Ariel Weiss <[email protected]>
Sync to upstream/release/677 (luau-lang#1872) # 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. # 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 luau-lang#1808 and luau-lang#1821 ) - Stability and performance improvements (Fixes luau-lang#1860 ) # Internal Contributors Co-authored-by: Andy Friesen <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Sora Kanosue <[email protected]> Co-authored-by: Varun Saini <[email protected]> Co-authored-by: Vighnesh Vijay <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]>
Sync to upstream/release/676 (luau-lang#1856) 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 <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Sora Kanosue <[email protected]> Co-authored-by: Talha Pathan <[email protected]> Co-authored-by: Vighnesh Vijay <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> --------- Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Varun Saini <[email protected]> Co-authored-by: Menarul Alam <[email protected]> Co-authored-by: Aviral Goel <[email protected]> Co-authored-by: Vighnesh <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Andy Friesen <[email protected]>
Sync to upstream/release/675 (luau-lang#1845) ## 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](https://rfcs.luau.org/property-writeonly.html)). - 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 <[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]> --------- Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Alexander Youngblood <[email protected]> Co-authored-by: Menarul Alam <[email protected]> Co-authored-by: Aviral Goel <[email protected]> Co-authored-by: Vighnesh <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Andy Friesen <[email protected]>
PreviousNext