This makes it possible to pass the location of that space through to
nested blocks, resulting in less copying, taking, and dropping.
This makes the compiler slightly faster and 19k smaller.
A FIXME is to use 'move' semantics when returning the values from the
block -- don't bump the refcount and drop it again for the returning
block, but simply assign ownership to the receiver. To do this, we'll
need a way to (safely) scrub things from a block's cleanup list.
A non-returning call should have a postcondition in which all predicates
are true -- not just a poststate. Otherwise, alt expressions where
one or more branches terminate in a non-returning call and others
initialize a variable get rejected.
Includes a test case.
* Non-returning calls should set all predicates to be true, not
just the "this function returns" predicate
* Fixed a bug in the expr_alt case in tstate.states that wasn't updating
the changed flag properly, then fixed *another* bug that was updating
it too enthusiastically, but was masked by the first bug.
Changed the typechecker to correctly typecheck the declared variable
type in a for or for-each loop against the vector element type (for
a for loop) or the iterator type (for a for-each loop). Added a
test case.
Previously, block_ty returned the type of the terminating
expression of the block (or nil if said expression was absent).
I changed check_expr to write the type of that expression into
the annotation for the block itself, so now block_ty can use the
block's annotation.
The test was meant to verify that the typechecker correctly
allows a _|_ value (break, here) to be used in any context.
However, the compiler fails with an LLVM assertion failure.
I xfailed it, but wanted it to be on the record anyway.
The typechecker had a number of special cases for unifying types
with _|_ (as with checking if and alt). But, a value of type _|_
should be usable in any context, as such a value always diverges,
and will never be used by its immediate context. Changed unify
accordingly, removed special cases.