Bug in declaring multidimensional arrays
Closed this issue · 5 comments
I have run into a problem with declaring arrays with the let binder.
//code works fine with decl
decl works: float[4];
//accepts let binder
let breaks : float[4];
//no problem here
works[1] := 2.0;
//"breaks is not bound in scope." error thrown
breaks[1] := 2.0;
Using a decl
to introduce a variable works fine, but using a let
binder throws an error when trying to compile that the element is not in scope when trying to reference it again.
I have replicated this problem with single-dimensional and a variety of multidimensional arrays of all types, including records.
See the type checker tests for array literals in https://github.com/cucapra/seashell/blob/master/src/test/scala/TypeCheckerSpec.scala#l1124
Starting line 1124. There are some restrictions on how let bound array laterals are used.
I was able to reproduce. Seems like a bug.
Fixed on master. git pull && sbt assembly
to rebuild fuse binary.
Thanks for the bug report!
@rachitnigam can you add the commit number where this is fixed?
let breaks: float[4]
still seem to behave the same.
See #203 for more details. The current workaround is doing something like:
let foo: float[4];
{
... code that uses foo
}
... code that doesn't use foo