Tags: Waffle3z/luau
Tags
Sync to upstream/release/687 (luau-lang#1954) ## What's Changed? This week we have an update with an implementation for one of the RFCs we had approved before, an improvement of the new type solver and a small Lua 5.1 C API compatibility improvement. * `@deprecated` attribute can now have a custom suggestion for a replacement and a reason message as described in [deprecated attribute parameters RFC](https://rfcs.luau.org/syntax-attribute-functions-deprecated.html) For example: ```luau @[deprecated {reason = "foo suffers from performance issues", use = "bar"}] local function foo() ... end -- Function 'foo' is deprecated, use 'bar' instead. foo suffers from performance issues foo() ``` * `lua_cpcall` C API function has been restored both for compatibility with Lua 5.1 and as a safe way to enter protected call environment to work with Luau C API functions that may error Instead of ``` if (!lua_checkstack(L, 2)) return -1; lua_pushcfunction(L, test, nullptr); lua_pushlightuserdata(L, context); int status = lua_pcall(L, 1, 0, 0); ``` you can simply do ``` int status = lua_cpcall(L, test, context); ``` * In Luau CLI, required module return values can now have any type ## New Type Solver - Additional improvements on type refinements used with external types should fix some reported false positive errors where types refined to `never` - Fixed an issue in recursive refinement types in a form of `t1 where t1 = refine<t1, _>` getting 'stuck' - Fixed an issue in subtyping of generic functions, it is now possible to assign `<T>(T, (T) -> T) -> T` to `(number, <X>(X) -> X) -> number` - Fixed an ICE caused by recursive types (Fixes luau-lang#1686) - Added additional iteration and recursion limits to stop the type solver before system resources are used up ## Internal Contributors Co-authored-by: Andy Friesen <[email protected]> Co-authored-by: Annie Tang <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Ilya Rezvov <[email protected]> Co-authored-by: Sora Kanosue <[email protected]> Co-authored-by: Vighnesh Vijay <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]>
Sync to upstream/release/686 (luau-lang#1948) ## General This week has been spent mostly on fixing bugs in incremental autocomplete as well as making the new Type Solver more stable. - Fixes a bug where registered "require" aliases were case-sensitive instead of case-insensitive. ### New Type Solver - Adjust literal sub typing logic to account for unreduced type functions - Implement a number of subtyping stack utilization improvements - Emit a single error if an internal type escapes a module's interface - Checked function errors in the New Non Strict warn about incorrect argument use with one-indexed positions, e.g. `argument luau-lang#1 was used incorrectly` instead of `argument #0 was used incorrectly`. - Improvements to type function reduction that let us progress further while reducing - Augment the generalization system to not emit duplicate constraints. - Fix a bug where we didn't seal tables in modules that failed to complete typechecking. ### Fragment Autocomplete - Provide richer autocomplete suggestions inside of for loops - Provide richer autocomplete suggestions inside of interpolated string expressions - Improve the quality of error messages when typing out interpolated strings. ### Compiler - Fixes REX encoding of extended byte registers for the x86 assembly code generation. - Fixes for table shape constant data encoding --- 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/685 (luau-lang#1940) Another week, another release! ## Analysis - Do not warn on unknown `require`s in non-strict mode. - Improve `Luau::dump`'s output for `DenseHashMap`. - Raise type checking errors when we would otherwise be leaking internal error types from modules. - Fix a crash that would sometimes occur when calling a function with an incomplete type. - Replace uses of `FFlag::LuauSolverV2` in `ClonePublicInterface` with a `solverMode` field. - Limit the number of constraints that can be dynamically created to fail more gracefully in complex cases. - Fix luau-lang#1932. --------- Co-authored-by: Alexander Youngblood <[email protected]> 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/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]>
PreviousNext