Skip to content

self argument is not assignable to variable typed as Self #17760

Closed as not planned
@DetachHead

Description

@DetachHead
from typing import Self

class Foo:
    def foo(self) -> None:
        asdf: Self = self
main.py:5: error: Incompatible types in assignment (expression has type "Foo", variable has type "Self")  [assignment]
Found 1 error in 1 file (checked 1 source file)

playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions