Refine incomplete-pattern checks (Trac #4905)