Skip to content

Commit

Permalink
Fix "Missing return statement" mypy error (#49276)
Browse files Browse the repository at this point in the history
Summary:
Adds `return None` after `assert_never` in the inner `get_one` function
Without it, TestTypeHints.test_run_mypy_strict using mypy  0.770 fails with the above mentioned error, see https://app.circleci.com/pipelines/github/pytorch/pytorch/249909/workflows/597d8e34-ff04-4efa-9dde-9e28fbded341/jobs/9557705

Pull Request resolved: #49276

Reviewed By: jamesr66a

Differential Revision: D25513658

Pulled By: malfet

fbshipit-source-id: 318eaff7e0534b10eafe46c0b834b7f7cefea757
  • Loading branch information
malfet authored and facebook-github-bot committed Dec 12, 2020
1 parent b5b8fe9 commit 8999915
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/codegen/gen.py
Expand Up @@ -468,6 +468,8 @@ def gen_one(f: NativeFunction) -> Optional[str]:
return f'm.impl("{f.func.name}", {payload});'
else:
assert_never(self.target)
# Silence mypy's "Missing return statement" error
return None

return list(mapMaybe(gen_one, g.functions()))

Expand Down

0 comments on commit 8999915

Please sign in to comment.