Fix assertion failure in optimize.
Restore linage after semantic analyze for selectors.