rise-lang / shine

The Shine compiler for the RISE language
https://rise-lang.org
MIT License
73 stars 8 forks source link

Records of variable length arrays do not generate valid code #227

Open Bastacyclop opened 2 years ago

Bastacyclop commented 2 years ago

Example from #220 (other tests are ignored in this PR for the same reason):

    val e = depFun((n: Nat, m: Nat) => fun(n`.`n`.`m`.`m`.`f32)(in =>
      in |> mapWorkGroup(0)(mapWorkGroup(1)(fun(x =>
        zip(x)(x) |> mapLocal(1)(fun(p =>
          zip(fst(p))(snd(p)) |> mapLocal(0)(fun(p =>
            makePair(fst(p))(snd(p))
          )) |> unzip
        )) |> toLocal |> unzip |> fst |>
        mapLocal(0)(mapLocal(1)(id))
      )))
    ))

Invalid code:

/tmp/code-4209632813176923104.cl:4:14: error: use of undeclared identifier 'n5'
  float _fst[n5];
             ^
/tmp/code-4209632813176923104.cl:5:14: error: use of undeclared identifier 'n5'
  float _snd[n5];
             ^
2 errors generated.
==========
SyntaxChecker failed for code:

struct Record_n5_float_n5_float {
  float _fst[n5];
  float _snd[n5];
};

[...]