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

Merged
merged 3 commits into from
Feb 17, 2025

Conversation

nothing1649
Copy link
Contributor

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.

nothing1649 and others added 3 commits December 16, 2024 11:26
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.
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.

Thank you!

@vegorov-rbx vegorov-rbx merged commit 9c19841 into luau-lang:master Feb 17, 2025
7 checks passed
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