pyrefly
pyrefly copied to clipboard
Strict mode
Describe the Bug
mypy has strict mode, and pyright / basedpyright also have various modes (e.g. "strict", "standard"). Will pyrefly consider having this as well?
This is to account for different preferences in the level of strictness for type checkers.
Sandbox Link
No response
(Only applicable for extension issues) IDE Information
No response
Yes! We plan to have a strict mode.
We're still figuring out exactly what it should do. But my broad thinking is:
- Gradual: Everything gets inferred to be Any. You rarely get a type error without an annotation.
- Standard: We infer return types and list types.
- Strict: We error if we can't infer with reasonable precision (e.g. if we infer an Any).
Merging https://github.com/facebook/pyrefly/issues/1295 into this issue. Some things we'll likely want in strict mode:
-
implicit-any(see https://github.com/facebook/pyrefly/commit/a01efe55997c6ec89417c367b58ab337725fd133 and https://github.com/facebook/pyrefly/commit/e6eaf1f06df0c908ae3b9bfac9fd4c908e74fe70). - Error on unpacking an open TypedDict into another TypedDict (see https://github.com/facebook/pyrefly/issues/1351#issuecomment-3464392546).