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

Analysis: Make typeof on a type userdata return "type" #1568

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

Conversation

nothing1649
Copy link

This change introduces a flag (LuauUserTypeFunTypeofReturnsType) that, when enabled, sets __type on the type userdata's metatable to "type". This behaviour was described in the user-defined type function RFC (https://rfcs.luau.org/user-defined-type-functions.html), but seems to have been missed; this change implements that behaviour.

Currently this does not change typeof(t) == 'type' emitting an unknown type warning as I don't trust myself to implement it due to my general lack of C++ knowledge; this can be worked on later.

This change introduces a flag (LuauUserTypeFunTypeofReturnsType) that, when enabled, sets __type on the type userdata's metatable to "type".
This behaviour was described in the user-defined type function RFC (https://rfcs.luau.org/user-defined-type-functions.html), but seems to have been missed; this change implements that behaviour.
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