Skip to content

Sync to upstream/release/672#1800

Merged
aatxe merged 66 commits intomasterfrom
merge
May 2, 2025
Merged

Sync to upstream/release/672#1800
aatxe merged 66 commits intomasterfrom
merge

Conversation

@aatxe
Copy link
Member

@aatxe aatxe commented May 2, 2025

What's Changed?

Hi there, folks! It's been another busy week in the type mines, trying to bring you all the very best type inference system we can. We've got a bunch of updates to large pain points across the new type solver, and our next big update (currently under a debug flag) improving type generalization is finally nearing completion (and should hopefully eliminate quite a lot of "type solver failed to complete" errors). We've also continued polishing both the CST Parser and the Luau.Require library we introduced a few releases ago based on user feedback and bug reports, and we're really happy with how they're turning out.

Parser

  • Fixes a bug in the CST tooling where the spacing on return type annotations for functions was not being printed correctly.
  • Resolves some issues with the JSON encoding of AstGenericType and AstGenericTypePack

Runtime

  • Implements support for yielding requires in Luau.Require library.
  • Improves the error messages for require-by-string to include the chunk name that was problematic where possible and the overall require path that failed to be required.
  • Fixes a bug that prevented the use of require within C functions and pcall.
  • Adds an API to support selectively removing chunks from the require cache in Luau.Require
  • Adds an API to support clearing the entire require cache in Luau.Require

New Type Solver

  • Fixes a crash in the new non-strict mode when visiting function return types in incomplete ASTs (e.g. during editing).
  • Improves type simplification to support intersections of tables with extern types, resolving one of the causes of frequent refinements unexpectedly leading to never.
  • Improves type inference to better understand diverging branches in functions, reducing false negatives where the type system fails to learn that a binding must now always be initialized.
  • Fixes a typo in the type definitions for user-defined function types where the intersection tag was misspelled.
  • Improves the overall accuracy of free type tracking during constraint solving, leading to better inference results overall.
  • Implements types.optional as a new library function for user-defined type functions to make it easier to union a type with nil.
  • Resolves a number of bugs caused by local type inference expanding the domain of upvalues

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: Talha Pathan tpathan@roblox.com
Co-authored-by: Varun Saini vsaini@roblox.com
Co-authored-by: Vighnesh Vijay vvijay@roblox.com

hgoldstein and others added 30 commits January 10, 2025 09:13
Note: Fixed conflicts by hand in:
- Analysis/src/ConstraintGenerator.cpp
- CodeGen/src/OptimizeConstProp.cpp
- VM/src/lmathlib.cpp
- tests/Conformance.test.cpp
a03c92095f6 #unflagged CLI-141149 Added lua_clonetable (#97902)
d66c43f36aa #flagged CLI-140903: Do not crash on duplicate keys in table literals (#97833)
8a2687f1690 #nonprod Luau: fix a test configuration issue breaking OSS CI. (#97878)
7add6d9dde9 #nojira CI-debugger revert #unflagged CLI-132461 Luau: refactor subtyping to also include the generic mapping it came up with. (#97872)
0c731fd3cc4 #flag-removal Clip `LuauNewSolverVisitErrorExprLvalues` (#96942)
2fe783b9615 #unflagged CLI-132461 Luau: refactor subtyping to also include the generic mapping it came up with. (#97803)
0cc41a0afae #unflagged CLI-141053 Luau buffer readbits/writebits implementation for big endian machines (#97826)
ae50bf04f99 #nonprod CLI-140027 Simplify require-by-string path resolution, fix bug when running CLI tools on unprefixed path (#97468)
77004599a6f #flag-removal Cleanup Luau VM and Compiler flags (#97799)
86777e269dd #flag-removal Remove LuauUserTypeFunPrintToError, LuauUserTypeFunNoExtraConstraint, LuauUserTypeFunUpdateAllEnvs, LuauUserTypeFunThreadBuffer and LuauUserTypeFunExportedAndLocal (#97624)
349b133fdc4 #nojira CI-debugger revert #unflagged CLI-132461 Luau: refactor subtyping to also include the generic mapping it came up with. (#97759)
2e820646ffa #flagged CLI-139615: Treat user defined type functions as opaque in eqSatSimplify (#96897)
c0845205e37 #flag-removal CLI-140688 Clean up `FFlagLuauIntersectNormalsNeedsToTrackResourceLimits` as `true`. (#97719)
3e07876a043 #flagged CLI-140571: Track interior free table types generated during constraint solving (#97498)
199b558dc36 #unflagged CLI-132461 Luau: refactor subtyping to also include the generic mapping it came up with. (#95646)
fd9255f62d3 #nonprod CLI-140762 unittest for fragment ac crash (#97669)
e9c710e017f #flag-removal FFlagLuauStoreCommentsForDefinitionFiles (#93359)
b184b940d55 CLI-140702 #unflagged Fix most clang-tidy warnings in TypeChecker2 (#97604)
1fc857f1bb3 CLI-140489 #unflagged Fix a potential hash collision bug in StringCache. (#97539)
58f62f900a2 #nonprod Some new unit testing macros for Luau tests. (#97336)
ab43a354b25 #flag-removal Remove LuauVectorMetatable and LuauVectorDefinitionsExtra (#97528)
c4c28694390 #flagged CLI-140485 Do not retain the Def/RefinementKey arenas when retainFullTypeGraphs is false (#97422)
This test fails due to a bad interaction when `FFlagLuauStoreCSTData` is
enabled, whilst `FFlagLexerFixInterpStringStart` is disabled.
The OSS test suite, when run with `--fflags=true`, enables all
flags starting with a `Luau` prefix, but does not enable any other flag.

To resolve this, we explicitly enable both fflags for the failing
interpolated string test cases. As a consequence, we technically lose
the check that these tests pass when all flags are disabled.
vrn-sn and others added 25 commits March 21, 2025 11:51
Three tests have been disabled:

1. `fuzz_propagate_normalization_failures` has been disabled because it fails on 32 bit Windows machines. It probably uses a lot of memory and can be fixed by supplying smaller limits in integer flags.
2. `TypeCorrectLocalReturn_assert` and `TypeCorrectLocalRank_assert` have been disabled because of ASAN failures on Ubuntu.

We will provide fixes in the following releases.
@aatxe aatxe requested a review from andyfriesen May 2, 2025 20:14
@aatxe aatxe merged commit 72f6c8b into master May 2, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants