Expected a compiler error

This is indeed a missing feature — Closure isolation control
To my understanding, there is just no mechanism yet to achieve this.