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

Support __call on class type vars #762

Merged
merged 5 commits into from
Nov 28, 2022

Conversation

JohnnyMorganz
Copy link
Contributor

Currently, the metatable of a class type var is not correctly checked to see if it is callable (i.e. has a __call metatable).
We resolve this issue by checking the metatable in checkCallOverload

Fixes #756

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.

Can you please add a flag for new if block?

It will be enough to have something like:
else if (const ClassTypeVar* ctv = get<ClassTypeVar>(fn); FFlag::LuauCallableClasses && ctv && ctv->metatable)

With a flag definition at the start of the file like: LUAU_FASTFLAGVARIABLE(LuauCallableClasses, false).

And a ScopedFastFlag luauCallableClasses{"LuauCallableClasses", true}; at the start of the test.

@vegorov-rbx vegorov-rbx merged commit 9095fc4 into luau-lang:master Nov 28, 2022
@JohnnyMorganz JohnnyMorganz deleted the class-call branch November 28, 2022 18:30
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.

2 participants