dimitriv / Ziria

A domain-specific-language and compiler for low-level bitstream processing.
92 stars 18 forks source link

Type checker does not distinguish between let and letref #84

Open edsko opened 9 years ago

edsko commented 9 years ago

The following program makes it through the type checker without errors:

fun f(a : int) {
  let b = 1;
  b := 2;
  return a + b;
}

let comp main = read[int] >>> map f >>> write[int] 

In fact, it makes it all the way through to code generation, even after optimization turns this into

/*
let f(a: int32) =
      1 := 2;
      a+1
in
read >>>
map f >>>
write
edsko commented 9 years ago

Same for for bound variables (for i in ..).