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

Autocomplete - Prevent TableState:Free properties with no writeTy to show up when requesting properties from an AST Index #1392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

karl-police
Copy link
Contributor

@karl-police karl-police commented Sep 11, 2024

#1309
#1389

There is a Unit Test, I hope it explains it.

Now the thing is, writeTy is nullopt only in the New Type Solver.

When a property is only read from in the old type solver for some reason it also gets a writeTy assigned, hence why this fix only works for the new type solver 🤷

And when a property is written to writeTy is empty in the old solver no clue how.

 

I do know that this fix doesn't work if the FreeType is getting intersected with anything else, but... you'd loop through the intersection type I guess.

I didn't fix it because I ran into a bug that wasn't caused by this change. Which can be found here: #1391

Summary

If you have a TableType with TableState:Free doing an autocomplete is actually going to fill up the propeties that were never written to, into the entryMap as well.

And this should prevent that from happening. This shouldn't ruin function table based autocompletes.

 

The purpose of Free Table types is to have unsealed tables work anywhere. You can't actually create a Free Table type with Luau syntax I think. At least yet.

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.

1 participant