Skip to content

The type of self in metamethods is not checked #1151

Description

@purplesyringa
local record Test
    metamethod __len: function(Test): number
end

local test_mt: metatable<Test> = {
    __len = function(self: number): number -- somehow this typechecks?
        return self
    end
}

local test: Test = setmetatable({}, test_mt)
print(#test)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions