luau icon indicating copy to clipboard operation
luau copied to clipboard

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

Open deviaze opened this issue 2 months ago • 0 comments

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'

deviaze avatar Oct 27 '25 21:10 deviaze