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

Definitions: CTV with overloaded metatable function overwrites instead of creates intersection #652

Closed
JohnnyMorganz opened this issue Aug 27, 2022 · 0 comments · Fixed by #653
Labels
bug Something isn't working

Comments

@JohnnyMorganz
Copy link
Contributor

Simple case:

declare class Vector3 end

declare class CFrame
    function __mul(self, other: CFrame): CFrame
    function __mul(self, other: Vector3): Vector3
end

Instead of creating an intersection type var of overloads for __mul, it just uses the last defined function.

Looks like the root cause is at https://github.com/Roblox/luau/blob/f2b334a4bb26c0ac3aedd4db5d828f2d6b5f7de0/Analysis/src/TypeInfer.cpp#L1677-L1683

where it only checks ctv->props.count(), but since it is a metamethod it should be looking at metatable->props

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant