Improve warn on invalid expressions