generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
Description
This assertion succeeds:
def functionAssertPgm : Program :=
#strata
program Core;
inline function foo(x : int, $__y0 : int) : int { x + $__y0 }
procedure TestFoo() returns ()
{
var y : int;
assert [fooEq]: (foo(y, 2) == 4);
};
#end
#eval verify functionAssertPgm
The reason is that in the evaluation of Factory functions, arguments are substituted for the free variables sequentially, so one can be captured by a future substitution. Here we first substitute x -> $__y0 and then substitute $__y0 -> 2. This particular example relies on giving an "illegal" variable name, but since functions and expressions can be constructed via an API, name clashes are possible.
The most straightforward fix is to do simultaneous substitution rather than sequential substitution when evaluating Factory functions.
Reactions are currently unavailable