Repository: pytorch
Issue: `torch.jit.script` fails on a simple function
Labels: oncall: jit

### 🐛 Describe the bug

This simple function is a valid Python function, but `torch.jit.script` fails to compile.
Perhaps `torch.jit.script` failed to parse `1 ++ 2` correctly, causing the error.
Since `1 ++ 2` is parsed as `1 + (+2)`, the result is `3`.

``` python
import torch

@torch.jit.script
def sample():
    return 1 ++ 2
```

```
Traceback (most recent call last):
  File "C:\sample\bug.py", line 5, in <module>
    def sample():
  File "C:\sample\.venv\lib\site-packages\torch\jit\_script.py", line 1392, in script
    ast = get_jit_def(obj, obj.__name__)
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 372, in get_jit_def
    return build_def(
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 433, in build_def
    return Def(Ident(r, def_name), decl, build_stmts(ctx, body))
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 195, in build_stmts
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 195, in <listcomp>
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 406, in __call__
    return method(ctx, node)
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 721, in build_Return
    return Return(r, None if stmt.value is None else build_expr(ctx, stmt.value))
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 406, in __call__
    return method(ctx, node)
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 950, in build_BinOp
    rhs = build_expr(ctx, expr.right)
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 406, in __call__
    return method(ctx, node)
  File "C:\sample\.venv\lib\site-packages\torch\jit\frontend.py", line 976, in build_UnaryOp
    expr.range(), "unsupported unary operator: " + op.__name__
AttributeError: 'UnaryOp' object has no attribute 'range'
```

### Versions

```
Collecting environment information...
PyTorch version: 2.3.1+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 11 Pro
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A

Python version: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.22631-SP0
Is CUDA available: True
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3060
Nvidia driver version: 546.33
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture=9
CurrentClockSpeed=2801
DeviceID=CPU0
Family=207
L2CacheSize=2560
L2CacheSpeed=
Manufacturer=GenuineIntel
MaxClockSpeed=2801
Name=Intel(R) Core(TM) i9-10900E CPU @ 2.80GHz
ProcessorType=3
Revision=

Versions of relevant libraries:
[pip3] efficientnet_pytorch==0.7.1
[pip3] mypy==0.971
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.23.3
[pip3] onnx==1.15.0
[pip3] onnx-graphsurgeon==0.5.2
[pip3] onnxconverter-common==1.14.0
[pip3] onnxoptimizer==0.3.13
[pip3] onnxruntime-gpu==1.16.3
[pip3] torch==2.3.1+cu118
[pip3] torchvision==0.18.1+cu118
[conda] Could not collect
```

cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel