Propagate static flags into with blocks

Need this to properly specialise functions generated using 'with',
otherwise the with blocks get left alone.
Merge pull request #1663 from edwinb/partial-eval

Propagate static flags into with blocks