8000 Self is not resolved correctly with asynq call to classmethod · Issue #836 · quora/pyanalyze · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Self is not resolved correctly with asynq call to classmethod #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JelleZijlstra opened this issue Nov 26, 2024 · 0 comments
Open

Self is not resolved correctly with asynq call to classmethod #836

JelleZijlstra opened this issue Nov 26, 2024 · 0 comments

Comments

@JelleZijlstra
Copy link
Contributor
from asynq import asynq
from typing_extensions import Self

class C:
    @asynq()
    @classmethod
    def load(cls) -> Self:
        return cls()

@asynq()
def f():
    reveal_type(C.load())
    reveal_type((yield C.load.asynq()))

Produces:

Revealed type is 'C' (code: reveal_type)
In <code> at line 12
   9: 
  10: @asynq()
  11: def f():
  12:     reveal_type(C.load())
                      ^
  13:     reveal_type((yield C.load.asynq()))

Revealed type is 'Any[generic_argument]' (code: reveal_type)
In <code> at line 13
  10: @asynq()
  11: def f():
  12:     reveal_type(C.load())
  13:     reveal_type((yield C.load.asynq()))
                       ^

With the asynq call we lose the precise type somewhere along the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0