boolean (@Nullable PsiCaseLabelElement pattern, @NotNull PsiType type, boolean forDomination) { PsiPrimaryPattern unconditionalPattern = findUnconditionalPattern(pattern); if (unconditionalPattern == null) return false; if (unconditionalPattern instanceof PsiDeconstructionPattern) { return forDomination && dominates(getPatternType(unconditionalPattern), type); } else if (unconditionalPattern instanceof PsiTypeTestPattern || unconditionalPattern instanceof PsiUnnamedPattern) { return dominates(getPatternType(unconditionalPattern), type); } return false; }