Skip to content

unreachable error not triggered when unreachable line calls function with NoReturn return type #10916

Closed

Activity

  1. KotlinIsland commented on Feb 8, 2022

    @KotlinIsland
    Contributor

    raise statements also count as NoReturn/<nothing>:

    if False:
        raise Exception("AMONGUS")  # no error 😳
  2. KotlinIsland commented on Feb 8, 2022

    @KotlinIsland
    Contributor

    This looks to be the same issue as #11437

  3. JelleZijlstra commented on Mar 21, 2022

    @JelleZijlstra
    Member

    This is intentional, so that you can write a runtime assertion that fails if the types are wrong and the code is unexpectedly reached at runtime.

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

    bugmypy got something wrongtopic-reachabilityDetecting unreachable code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions