temperlang / temper

3 stars 0 forks source link

continue in orelse counterexample #111

Open mikesamuel opened 7 months ago

mikesamuel commented 7 months ago
let forEach(ls: List<Int>): Void {
  let n = ls.length;
  var i = 0;
  while (i < n) {
    let el: Int;
    do { el = ls.get(i++) } orelse continue;
    console.log(el.toString());
  };
}

This seems to lead to bad flow-sensitive checks.

7: console.log(el.toString());
               ┗┛
[interactive#0:7+16-18]@T: el__6 is not initialized along branches at [interactive#0:6+35-43]
6: s.get(i++) } orelse continue;
                       ┗━━━━━━┛
7: console.log(el.toString());
                  ┗━━━━━━┛
[interactive#0:7+19-27]@G: Expected function type, but got Invalid
7: console.log(el.toString());
               ┗━━━━━━━━━━━┛
[interactive#0:7+16-29]@G: No member toString in MissingType
7: console.log(el.toString());
               ┗┛
[interactive#0:7+16-18]@R: el__6 is not initialized along branches at [interactive#0:6+35-43]
6: s.get(i++) } orelse continue;
                       ┗━━━━━━┛