Skip to content

Conversation

@JohnnyMorganz
Copy link
Contributor

The latest sync to 703 (#2146) added an explicit constructor to Luau::RequireAlias. However, this is only a single argument constructor for the alias, and does not handle setting the tags.

This broke luau-lsp compilation of code that did Luau::RequireAlias{alias, {"tagname"}}, and now our only option is to first construct the RequireAlias into a separate local, and then set the tags afterwards, then pass the require alias to where we were using it originally.

/Users/runner/work/luau-lsp/luau-lsp/src/platform/StringRequireSuggester.cpp:79:30: error: no matching constructor for initialization of 'Luau::RequireAlias'
   79 |         results.emplace_back(Luau::RequireAlias{aliasInfo.originalCase, {"Alias"}});
      |                              ^                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/luau-lsp/luau-lsp/luau/Analysis/include/Luau/FileResolver.h:39:14: note: candidate constructor not viable: requires single argument 'alias', but 2 arguments were provided
   39 |     explicit RequireAlias(std::string alias)
      |              ^            ~~~~~~~~~~~~~~~~~

For simplicity, this PR adds a two-argument explicit constructor to also set the tags

JohnnyMorganz added a commit to JohnnyMorganz/luau-lsp that referenced this pull request Dec 14, 2025
ideally we would not need to do this, but that requires luau-lang/luau#2149 to be merged
Copy link
Collaborator

@vegorov-rbx vegorov-rbx left a comment

Choose a reason for hiding this comment

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

LGTM

@vegorov-rbx vegorov-rbx merged commit 5db7682 into luau-lang:master Dec 14, 2025
7 checks passed
@vegorov-rbx
Copy link
Collaborator

Thank you.

@JohnnyMorganz JohnnyMorganz deleted the require-alias-explicit-constructor branch December 14, 2025 11:17
JohnnyMorganz added a commit to JohnnyMorganz/luau-lsp that referenced this pull request Dec 14, 2025
* Sync to upstream Luau 0.703

* Fix compilation of Luau::RequireAlias

ideally we would not need to do this, but that requires luau-lang/luau#2149 to be merged

* Revert "Fix compilation of Luau::RequireAlias"

This reverts commit e4ddeda.

Don't need it anymore after upstream change :)

* Update luau version

---------

Co-authored-by: JohnnyMorganz <19635171+JohnnyMorganz@users.noreply.github.com>
Co-authored-by: JohnnyMorganz <johnnymorganz@outlook.com>
{
}

explicit RequireAlias(std::string alias, std::vector<std::string> tags)
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI---don't need explicit if its more than one parameter. There is a very slight difference with brace initialization, but the explicits for the one parameter constructors prevent something much more important

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants