UCSD-PL / refscript

Refinement Types for Scripting Languages
BSD 3-Clause "New" or "Revised" License
65 stars 3 forks source link

Varinit #26

Closed panagosg7 closed 10 years ago

panagosg7 commented 10 years ago

[Addresses issue #24]

Allowing a phi variables to be uninitialized when joining environments.

In case of an uninitialized loop phi variable, e.g.

var i;
var sum = 0; 
while (n > 0) {
  i = n;
  sum += i;
}
return sum;

The "invariant" T_i type for i will be: number + undefined.

Types need to be aligned (ziptype) when subtyping the "base" type (before loop) and "step" type (after loop body) against T_i.

ranjitjhala commented 10 years ago

Wow -- amazing!! that was super fast, thanks @panagosg7 !!! (Since there was quite a bit of changes in the while code, am assuming tests pass?)

ranjitjhala commented 10 years ago

all tests pass. merging.