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

incorrectly removed ; that is required to disambuguate syntax #173

Closed
matthargett opened this issue Jun 4, 2021 · 1 comment · Fixed by #177
Closed

incorrectly removed ; that is required to disambuguate syntax #173

matthargett opened this issue Jun 4, 2021 · 1 comment · Fixed by #177
Labels
bug Something isn't working

Comments

@matthargett
Copy link

This is a fun one, tested with latest main as of 3 Jun 2021:

local function add(value: any, onDelete: () -> any): Entry<any>
        local entry: Entry<any> = {
                value = value,
                onDelete = onDelete,
                next_ = nil,
                previous = nil,
        }
        if first == nil then
                entry.next_ = entry
                entry.previous = entry.next_
                first = entry
        else
                local last = (first :: Entry<any>).previous
                last.next_ = entry
                entry.previous = last; --[[ this semicolon is necessary ]]
                (first :: Entry<any>).previous = entry
                entry.next_ = first :: Entry<any>

                first = entry
        end
        size += 1
        return entry
end
@JohnnyMorganz
Copy link
Owner

Ah, I had this for function calls, but I didn't anticipate parentheses around type ascription!

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

Successfully merging a pull request may close this issue.

2 participants