Open DanielRosenwasser opened 8 months ago
(generator functions might not have this issue since I don't think they become generators unless they have a yield statement)
also, it's not entirely about whether the modifiers differ - in the second example I gave, __aenter__
is declared as async
but has no explicit return type annotation.
@DanielRosenwasser, can you check your "minimal example" above? It is missing the $
and seems like it might be a copy of the "actual behavior" code.
My apologies - I started out with the bottom example, figured it should be more minimal, but got sloppy. Fixed now.
Also, here's the same example on the Pyright playground if you want an easy repro.
Possibly related to #4831?
Environment data
Code Snippet
Minimal example:
Repro Steps
Assume
$
is the cursor. Request completions at the cursor. Commit to the completion entry for__aenter__
.Expected behavior
For minimal example:
Actual behavior
Pylance annotates uses the type that works for the non-
async
base, but one that does not work for theasync
derived type. The derived method is marked asasync
, so the method shouldn't declare it returns anAwaitable
, aCoroutine
, or whatever.Here's something closer to what I actually ran into:
Expected
Actual