Skip to content
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

Incorrect readonly property warning when initialising table in new solver strict mode #1518

Closed
nothing1649 opened this issue Nov 10, 2024 · 1 comment
Assignees
Labels
bug Something isn't working new solver This issue is specific to the new solver.

Comments

@nothing1649
Copy link

As of version 0.651, creating a table with a key being a readonly property of another table warns about the property being readonly, despite it not actually being assigned to. This only appears to occur in the new solver, and can be worked around by casting the key to any type or assigning it later.

--!strict
type readonlyTable = {read id: number}
local t:readonlyTable = {id = 1}

local _:{number} = {[t.id] = 1} --Property id of table 'readonlyTable' is read-only
local _:{number} = {[t.id::number] = 1} --no type error

local arr:{number} = {}
arr[t.id] = 1 --no type error
@nothing1649 nothing1649 added the bug Something isn't working label Nov 10, 2024
@aatxe aatxe added the new solver This issue is specific to the new solver. label Nov 10, 2024
@aatxe aatxe self-assigned this Nov 13, 2024
@aatxe
Copy link
Collaborator

aatxe commented Nov 13, 2024

Thanks for the report, the fix for this will be in the 0.652 release!

@aatxe aatxe closed this as completed Nov 13, 2024
vrn-sn added a commit that referenced this issue Nov 15, 2024
## What's new?

* Add support for mixed-mode type checking, which allows modules checked
in the old type solver to be checked and autocompleted by the new one.
* Generalize `RequireResolver` to support require-by-string semantics in
`luau-analyze`.
* Fix a bug in incremental autocomplete where `DefId`s associated with
index expressions were not correctly picked up.
* Fix a bug that prevented "complex" types in generic parameters (for
example, `local x: X<(() -> ())?>`).

### Issues fixed
* #1507
* #1518

---

Internal Contributors:

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Hunter Goldstein <hgoldstein@roblox.com>
Co-authored-by: Varun Saini <vsaini@roblox.com>
Co-authored-by: Vighnesh Vijay <vvijay@roblox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new solver This issue is specific to the new solver.
Development

No branches or pull requests

2 participants