obiwan87 / odin-intellij

Odin Support plugin for JetBrains IDEs
https://plugins.jetbrains.com/plugin/22933-odin-support
MIT License
37 stars 3 forks source link

Parse error on type asserts. #33

Closed MineBill closed 5 months ago

MineBill commented 5 months ago

Consider this:

package unions
import "core:fmt"

Value :: union {
    string,
    int,
    f32,
}

main :: proc() {
    a: Value = 2

    as_int := &a.(int) // <--- HERE
    as_int^ = 3

    fmt.printfln("a: %v", a)
}

Taking the address while doing a type assert will produce the following error:

OdinTokenType.IDENTIFIER_TOKEN expected, got '('
obiwan87 commented 5 months ago

Ah thanks. Missed that one. Should be failing with any unary operator (try +, -)?

obiwan87 commented 5 months ago

It's now fixed with commit 3dc3cad