Skip to content

Commit b76a30b

Browse files
committed
Simplify code as per PR review
1 parent db0765f commit b76a30b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mypy/checkpattern.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,12 @@ def visit_class_pattern(self, o: ClassPattern) -> PatternType:
541541
type_info = o.class_ref.node
542542
typ = self.chk.expr_checker.accept(o.class_ref)
543543
p_typ = get_proper_type(typ)
544-
if isinstance(p_typ, AnyType):
545-
pass
546-
elif isinstance(type_info, TypeAlias) and not type_info.no_args:
544+
if isinstance(type_info, TypeAlias) and not type_info.no_args:
547545
self.msg.fail(message_registry.CLASS_PATTERN_GENERIC_TYPE_ALIAS, o)
548546
return self.early_non_match()
549547
elif isinstance(p_typ, FunctionLike) and p_typ.is_type_obj():
550548
typ = fill_typevars_with_any(p_typ.type_object())
551-
else:
549+
elif not isinstance(p_typ, AnyType):
552550
self.msg.fail(
553551
message_registry.CLASS_PATTERN_TYPE_REQUIRED.format(
554552
typ.str_with_options(self.options)

0 commit comments

Comments
 (0)