Skip to content

[new solver] compound assignment of vector components *does not* raise TypeError #2062

@deviaze

Description

@deviaze

Using compound assignment operators (+=, -=, /=, //=, etc.) on components of a vector does not raise a TypeError in strict mode although it causes an error at runtime.

Minimal repro:

--!strict
local function increment(v: vector)
    v.x += 1
    v.x -= 1
    v.y *= 1
    v.z /= 1
end

increment(vector.create(1, 2, 3))

Also, the runtime error message for this is pretty bad:

./src/main.luau:3: attempt to index vector with 'x'

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