Skip to content

Pyrefly does not flag invalid return value for method annotated with Self #2304

Closed

Description

@migeed-z

Activity

  1. added this to the V1 Release milestone on Feb 5, 2026
  2. added
    help wantedLarger than "good first issue", but still well-defined and ready for someone to pick up
    on Feb 5, 2026
  3. yangdanny97 commented on Feb 5, 2026

    @yangdanny97
    Collaborator

    Another case to test - we should not error if the class is final

    from typing import Self, final
    
    @final
    class Shape:
        def method(self) -> Self:
            return Shape()  # ok
    
        @classmethod
        def cls_method(cls) -> Self:
            return Shape()  # ok
    
  4. GrimNej commented on Feb 13, 2026

    @GrimNej

    I've been working on it!

  5. removed this from the V1 Release milestone on Mar 16, 2026
  6. rchen152 commented on Jun 12, 2026

    @rchen152
    Contributor

    This is fixed :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    conformancehelp wantedLarger than "good first issue", but still well-defined and ready for someone to pick uptypechecking

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions