Fix Trac #3102: pre-matching polytypes