Skip to content

update assert's type to be more accurate#2556

Draft
nnullcolumn wants to merge 1 commit into
luau-lang:masterfrom
nnullcolumn:fix-assert-builtin-definition
Draft

update assert's type to be more accurate#2556
nnullcolumn wants to merge 1 commit into
luau-lang:masterfrom
nnullcolumn:fix-assert-builtin-definition

Conversation

@nnullcolumn

Copy link
Copy Markdown


-- `assert` has a magic function attached that will give more detailed type information
declare function assert<T>(value: T, errorMessage: string?): T
declare function assert<T, Err...>(value: T, ...: Err...): (T, Err...)

@PhoenixWhitefire PhoenixWhitefire Jul 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The EmbeddedBuiltinDefinitions annotation for assert is effectively unused. In the Old Solver it has a magic type attached, and in the New Solver the definition is overwritten directly here:

addGlobalBinding(globals, "assert", assertTy, "@luau");

This is also the reason for the hover type hint in New Solver

image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

thanks, sorry for not being more thorough i'll update with tests and better support

@nnullcolumn
nnullcolumn marked this pull request as draft July 15, 2026 20:28
@nnullcolumn

Copy link
Copy Markdown
Author

marking this as a draft for now since it obviously cannot be merged as-is

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.

assert type signature is incorrect Inaccuracies with "assert" return typing

2 participants