Refactor and simplify assignment static-checking.