Fix #630, correctly determine type of as-patterns