mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-04 00:52:44 +08:00
Fix inferred type of is_dataclass(Any) (#12517)
This commit is contained in:
@@ -41,6 +41,21 @@ if dc.is_dataclass(f):
|
||||
assert_type(f, Foo)
|
||||
|
||||
|
||||
def is_dataclass_any(arg: Any) -> None:
|
||||
if dc.is_dataclass(arg):
|
||||
assert_type(arg, Union["DataclassInstance", Type["DataclassInstance"]])
|
||||
|
||||
|
||||
def is_dataclass_object(arg: object) -> None:
|
||||
if dc.is_dataclass(arg):
|
||||
assert_type(arg, Union["DataclassInstance", Type["DataclassInstance"]])
|
||||
|
||||
|
||||
def is_dataclass_type(arg: type) -> None:
|
||||
if dc.is_dataclass(arg):
|
||||
assert_type(arg, Type["DataclassInstance"])
|
||||
|
||||
|
||||
def check_other_isdataclass_overloads(x: type, y: object) -> None:
|
||||
# TODO: pyright correctly emits an error on this, but mypy does not -- why?
|
||||
# dc.fields(x)
|
||||
|
||||
Reference in New Issue
Block a user