File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1821,15 +1821,7 @@ def check_callable_call(
18211821 ):
18221822 proper_arg = get_proper_type (arg_types [0 ])
18231823 if isinstance (proper_arg , Instance ) and proper_arg .type .is_protocol :
1824- callee = callee .copy_modified (
1825- ret_type = UnionType (
1826- [
1827- self .named_type ("builtins.type" ),
1828- self .named_type ("types.ModuleType" ),
1829- AnyType (TypeOfAny .special_form ),
1830- ]
1831- )
1832- )
1824+ callee = callee .copy_modified (ret_type = self .named_type ("builtins.type" ))
18331825 else :
18341826 callee = callee .copy_modified (ret_type = TypeType .make_normalized (arg_types [0 ]))
18351827
Original file line number Diff line number Diff line change @@ -4249,8 +4249,8 @@ import mod
42494249
42504250a: P = mod
42514251value = type(a)
4252- reveal_type(value) # N: Revealed type is "Union[ builtins.type, types.ModuleType, Any] "
4253- reveal_type(value.foo) # E: Item "type" of "Union[type, Module, Any] " has no attribute "foo" \
4252+ reveal_type(value) # N: Revealed type is "builtins.type"
4253+ reveal_type(value.foo) # E: "type" has no attribute "foo" \
42544254 # N: Revealed type is "Any"
42554255
42564256class Namespace: ...
@@ -4259,13 +4259,14 @@ n.foo = lambda: None # E: "Namespace" has no attribute "foo"
42594259
42604260b: P = cast(Any, n)
42614261value = type(b)
4262- reveal_type(value) # N: Revealed type is "Union[ builtins.type, types.ModuleType, Any] "
4263- reveal_type(value.foo) # E: Item "type" of "Union[type, Module, Any] " has no attribute "foo" \
4262+ reveal_type(value) # N: Revealed type is "builtins.type"
4263+ reveal_type(value.foo) # E: "type" has no attribute "foo" \
42644264 # N: Revealed type is "Any"
42654265[file mod.py]
42664266def foo() -> None: ...
42674267
42684268[builtins fixtures/tuple.pyi]
4269+
42694270[case testOverloadProtocolSubtyping]
42704271from typing import Protocol, Self, overload
42714272
You can’t perform that action at this time.
0 commit comments