odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.12k stars 550 forks source link

some_var := -SOME_CONSTANT_VECTOR doesn't work #3768

Closed karl-zylinski closed 2 weeks ago

karl-zylinski commented 2 weeks ago

Context

    Odin:    dev-2024-06:a619ea3bc
    OS:      Windows 10 Professional (version: 22H2), build 19045.4529
    CPU:     Intel(R) Core(TM) i7-6950X CPU @ 3.00GHz
    RAM:     32674 MiB
    Backend: LLVM 17.0.1

Expected Behavior

This should work:

TEST :: [3]f32 {1,2,3}
hi := -TEST

Current Behavior

This fails to compile:

TEST :: [3]f32 {1,2,3}
hi := -TEST

with this error: Error: Invalid type, '[3]f32', for constant unary expression '-TEST'

I'm 90% sure this has worked in the past. I could be wrong though!