boolean (PsiElement typedElement, PsiElement match) { final MatchingHandler initialHandler = matchContext.getPattern().getHandler(typedElement); MatchingHandler handler = initialHandler; if (handler instanceof DelegatingHandler) { handler = ((DelegatingHandler)handler).getDelegate(); } assert handler instanceof SubstitutionHandler : typedElement + " has handler " + (handler != null ? handler.getClass() : "null" + ' ' + initialHandler.getClass()); return ((SubstitutionHandler)handler).handle(match, matchContext); }