Fix parsing of dotted rest when there is an expected type.

Closes PR 13646.