make MatchResult::matchCode type safe and const