File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2917,11 +2917,20 @@ def infer_overload_return_type(
29172917 # check. Pretend that we're checking `Foo.func(instance, ...)` instead of
29182918 # `instance.func(...)`.
29192919 p_object_type = get_proper_type (object_type ) if object_type is not None else None
2920+
2921+ def is_trivial_self (t : CallableType ) -> bool :
2922+ if isinstance (t .definition , FuncDef ):
2923+ return t .definition .is_trivial_self
2924+ if isinstance (t .definition , Decorator ):
2925+ return t .definition .func .is_trivial_self
2926+ return False
2927+
29202928 prepend_self = (
29212929 isinstance (p_object_type , Instance )
29222930 and has_any_type (p_object_type )
29232931 and any (
2924- typ .is_bound and typ .original_self_type is not None for typ in plausible_targets
2932+ typ .is_bound and typ .original_self_type is not None and not is_trivial_self (typ )
2933+ for typ in plausible_targets
29252934 )
29262935 )
29272936 if prepend_self :
You can’t perform that action at this time.
0 commit comments