add missing typecheck for const pattern match arm

Fix of issue #4968