onyx-lang/onyx

Type inference fails when using array literals with negative numbers

Closed this issue · 1 comments

The following fails to compile with the error "Waiting for iteration expression type to be known":

use core {println}

main :: () {
    for x: .[-1, 0, 2, 3, 4] {
        println(x);
    }
}

However, the following compiles successfully:

use core {println}

main :: () {
    for x: .[0, 2, 3, 4] {
        println(x);
    }
}

I am using compiler version 2a0d19e but the same errors occur on try.onyxlang.io.

I believe this issue has been solve in #94. I tested locally with nightly release and it works correctly.

Like #96, it had to do with slightly complicated array literals not correctly inferring the type of their elements.