Summary:
**Summary**: This commit solves the first part of https://github.com/pytorch/pytorch/issues/52306, which disallows type annotations on instance attributes inside any method other than the constructor.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/67051
Test Plan:
Added test to test_types.py.
**Reviewers**: Zhengxu Chen
**Subscribers**: Zhengxu Chen, Yanan Cao, Peng Wu, Yining Lu
**Tasks**: T103941984
**Tags**: pytorch
**Fixes** https://github.com/pytorch/pytorch/issues/52306
Reviewed By: zhxchen17
Differential Revision: D31843527
Pulled By: andrewor14
fbshipit-source-id: 624879ae801621e367c59228be8b0581ecd30ef4
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59956
Issue #50175. Basically two things need to be checked and are lacking currently:
1. Overload declarations should always have a single `pass` statement as the body.
2. There should be always an implementation provided for decls which doesn't
have the torch.jit._overload decorator. So in this case we need to check
whether we are actually compiling a function body with decorator ahead.
Test Plan:
python test/test_jit.py TestScript.test_function_overloads
Imported from OSS
Reviewed By: gmagogsfm
Differential Revision: D29106555
fbshipit-source-id: 2d9d7df2fb51ab6db0e1b726f9644e4cfbf733d6