Skip to content

Conversation

@alexmccord
Copy link
Contributor

@alexmccord alexmccord commented Sep 17, 2025

The original wasn't actually allowing universal references and if you have a datatype with a deleted copy constructor, the template substitution would fail here. This lets me use TypedAllocator for some type that isn't copyable. I doubt there would be any performance difference due to copy elision anyway.

@alexmccord alexmccord changed the title Actually perfect forwarding Fix perfect forwarding in TypedAllocator::allocate. Sep 17, 2025
Copy link
Member

@vrn-sn vrn-sn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Alex!

@vrn-sn vrn-sn merged commit 4b3bb06 into luau-lang:master Sep 19, 2025
7 checks passed
@alexmccord alexmccord deleted the perfection branch September 20, 2025 17:06
hgoldstein added a commit that referenced this pull request Sep 26, 2025
# New Solver
* Avoid bidirectional inference always forcing constraints for simple
code such as the example below. Fixes #2017.
```luau
type Suit = "Hearts" | "Spades" | "Clubs" | "Diamonds"

local getSuits(): { Suit }
    return { "Hearts", "Spades", "Clubs", "Diamonds" }
end
```
* Iterating over an empty pack, such as in the below example, should
error but still allow type inference to complete.
```luau
local function foo() end -- has type `() -> ()`
for _ in foo() do end -- Errors, as you can't iterate over `()`, but type inference still completes.
```
* Implement arity based overload selection: this allows for overloaded
functions with generics to more consistently infer reasonable results.
For example:
```luau
-- This code no longer errors  as we determine that the first overload to 
-- table.insert is what the author intended.
table.insert({} :: { any }, 42)
```
* Allow the`table` type to be a subtype of generic tables. This means
code like the following no longer raises a type error:
```luau
local function doSomething(t: unknown)
    if type(t) == "table" then
        -- Prior we would error as `table` is not a subtype of a generic table
        -- Also works with `pairs` and similar builtin functions.
        local foo, bar = next(t)
    end
end
```
* Descend into intersection types when performing bidirectional
inference, this allows us to correctly bidirectionally infer code like:
```luau
type A = { foo: "a" }
type B = { bar: "b" }
type AB = A & B
-- No longer errors as the literals "a" and "b" will be inferred to be their singleton types.
local t: AB = { foo = "a", bar = "b" }
```
* #2008
* Fix intersections between table types and extern types to preserve
intersections when either type contains an indexer, fixing a regression
introduced when trying to refine table and extern types more precisely:
```luau
function f(obj: { [any]: any }, functionName: string)
    if typeof(obj) == "userdata" then
        -- No longer errors as we still have a `class & { [any]: any }` rather than a `class`
        local _ = obj[functionName]
    end
end
```
* Separated recursion limits for different parts of the new solver. No
immediate changes, but this creates more tools to tamp down on stack
overflows without affecting other subsystems.

# Runtime
* Implement "stackless" `pcall` / `xpcall` in yieldable contexts: this
lets recursive calls to `pcall` nest further, erroring at the Luau call
stack limit (20000 calls as of this writing) rather than the C call
stack limit (200 calls as of this writing)

---

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>

---------

Co-authored-by: Varun Saini <61795485+vrn-sn@users.noreply.github.com>
Co-authored-by: Alexander Youngblood <ayoungblood@roblox.com>
Co-authored-by: Menarul Alam <malam@roblox.com>
Co-authored-by: Aviral Goel <agoel@roblox.com>
Co-authored-by: Vighnesh <vvijay@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
Co-authored-by: Ariel Weiss <aaronweiss@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants