-
Notifications
You must be signed in to change notification settings - Fork 521
Add branch for Emscripten to clock #2069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vegorov-rbx
approved these changes
Jan 15, 2026
Collaborator
vegorov-rbx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you
aatxe
added a commit
that referenced
this pull request
Jan 16, 2026
Hello Luaunauts, we're continuing into the second release of the year at
a brisk pace! We've got a number of improvements for both native code
generation and the new type solver, as well as some other assorted
changes, that keep us moving towards the goal of making the best
possible scripting language!
# Analysis
- Refinements against a union of tables would sometimes erroneously
refine to a narrower type than intended. The root cause here was a bug
in the logic that determines how to "simplify" types (for example
knowing that `true | false` is the same as `boolean`).
```luau
export type States = "Closed" | "Closing" | "Opening" | "Open"
export type MyType<A = any> = {
State: States,
IsOpen: boolean,
Open: (self: MyType<A>) -> (),
}
local value = {} :: MyType
function value:Open()
if self.IsOpen == true then
elseif self.State == "Closing" or self.State == "Opening" then
-- Prior, this line errored as we were erroneously refining
-- `self` with `{ State: "Closing" | "Opening" }` rather
-- than `{ read State: "Closing" | "Opening" }
self:Open()
end
end
```
- Adds an option in `ToString.cpp` to disable the use of synthetic
names, which can be used to improve the quality of hover type.
- Fixes a bug where `table.freeze` would incorrectly error on arguments
of `any` type (fixes #2181)
- Subtyping mistakenly did not allow for us to covariantly check tables
with missing properties against table types that gave those properties
optional types. This release should fix these issues, including fixes
#2164.
- Type functions have a global environment that defines all of the type
aliases present in the environment around the type function definition,
and the API of type functions also allows you to mutate types,
specifically table types and function types. Though we never supported
the type functions _actually_ mutating the aliases present in the
environment around them, the mutable API allowed for users to author
type functions that _appeared_ to do so, which could be confusing when
they later discover that their mutation did not take place. This release
introduces new errors for type functions that attempt to call mutable
APIs on types from their environment, e.g.
```luau
type myType = {}
type function create_table_with_key()
myType:setproperty(types.singleton "key", types.optional(types.number))
-- this errors now!
return myType
end
local my_tbl: create_table_with_key<> = {key = "123"}
```
- Bidirectional inference for lambdas on extern types with generic
parameters should work more consistently.
- #2166 fixes a bug with `findBindingAtPosition` that should enable LSP
tools to better support finding references for local functions and their
parameters.
- This release also includes a broad-strokes improvement to error
suppression handling. The New Type Solver should now be more consistent
about not reporting (or re-reporting) errors involving `any` or
`*error-type*` or directly downstream of an existing type error.
- This release removes the experimental
`DebugLuauStringSingletonBasedOnQuotes` flag that trialed basing
singleton type inference solely on the usage of different quote styles.
We do not think we will be proceeding with this approach at this time.
# Native Code Generation
- Fixes a crash in `getOffsetBase` when the passed in IrOp is not an
IrInst.
- Improves inlining support by passing the argument value as the
initializer for the temporary being allocated in cases like anonymous
function arguments or referring to upvalues in a function body.
- Fixes the function end byte offset value, along side a number of other
internal values that could lead to incorrect code size values.
- Adds a more direct implementation of code generation for `vector`
equality and inequality that leads to fewer instructions in the IR and a
smaller number of produced basic blocks.
- Adds a more optimized code generation flow for situations where we're
indexing a table with keys that have unexpected type tags.
- Fixes a bug where NCG would sometimes mistakenly optimize away
necessary entry tag checks.
- Introduces a customizable per-VM storage for use from "execution
callbacks" system, with NCG as its first consumer for extra spill
spaces. This adds 32x 8-byte spill slots on arm64 (on top of existing
22) and 64x 8-byte spill slots on x64 (on top of existing 12*).
- Changes codegen for bit32 operations to use guards, rather than normal
control flow, leading to significant (~30%) performance improvements in
some benchmarks that heavily leverage these operations.
- Adds a combined instruction `UINT_TO_FLOAT` to replace instances where
we needed to emit `UINT_TO_NUM` and `NUM_TO_FLOAT` paired up. This leads
to some very modest performance improvements.
# Runtime
- We previously added constant string constant folding with the results
stored in AST allocator. This release also moves interpolation
formatting strings to AST allocator to resolve #1965.
- #2069 adds support for using `os.clock` in Emscripten build targets,
like the [Luau Playground](https://play.luau.org).
- #2149 extends the C++ Require library to support constructing aliases
with tags associated with them.
- #2054 fixes a bugged comparison in `api_update_top` that would cause
an unnecessary runtime error if the API was used in a way that should be
a noop.
# Internal Contributors
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Annie Tang <annietang@roblox.com>
Co-authored-by: Ariel Weiss <arielweiss@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: Vighnesh Vijay <vvijay@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
---------
Co-authored-by: Hunter Goldstein <hgoldstein@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: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Ilya Rezvov <irezvov@roblox.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had problem of getting 0 from lua_clock when using Emscripten. This pull request adds a define check for when using Emscripten and uses emscripten_get_now.