facebook / facebook/pyrefly

method names shadow Python builtins in torch stubs

Open
#3,323 0 comments 1 reaction 0 assignees View on GitHub
tensor-shapes
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

I noticed

```
# ==== Dtype Conversion Methods ====
# Note: These method names shadow Python builtins, so type annotations
# after this point should use builtins.int, builtins.bool, builtins.float
```

but after it:

```
`|` is not supported between `(self: Self@Tensor) -> Self@Tensor` and `(self: Self@Tensor) -> Self@Tensor`
Cannot find `__or__` or `__ror__`Pyrefly[unsupported-operation](https://pyrefly.org/en/docs/error-kinds/#unsupported-operation)
(method) float: def float(self: Self@Tensor) -> Self@Tensor: ...
Convert tensor to float32 dtype. Shape-preserving operation.
```

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.