type-check WriteStmt