onyx-lang / onyx

✨ The compiler and developer toolchain for Onyx
https://onyxlang.io
BSD 2-Clause "Simplified" License
570 stars 20 forks source link

Bug: declaring and instantiating multiple typed variables #124

Closed josdelien closed 6 months ago

josdelien commented 6 months ago

Consider the following code:

use core {*}

main :: () {
    println(fib(10));
}

fib :: (seqlen: u32) -> [..]u32 {
    seq: [..]u32;
    temp: u32;
    // -a- this works
    // a, b: u32;
    // a, b = 0, 1;
    // 
    // -b- this also works
    // a, b := 0, 1;
    //
    // -c- this yields compile error
    a, b :u32 = 0, 1;
    while seq.length < seqlen {
        array.push(&seq,a);
        temp = a;
        a = b;
        b = a+b;
    }
    return seq;
}

The error yielded is:

expected token ';', got '='.
 18 |     a, b :u32 = 0, 1;
                    ^
josdelien commented 6 months ago

💯