Skip to content

strict-equality #576

@zwing99

Description

@zwing99

Question

Is tests for strict equality on the roadmap for ty. In mypy we can check for "strict equality" using the --strict-equality flag or equivalent configuration setting. This check flags a class of error where the developer might accidentally be comparing disparate types for equality. Naively it looks like this but you can imagine more complex scenarios.

Example:

an_int: int = 42
a_str: str = "42"

if an_int == a_str:
    print("This should not print, as int and str are not equal")

mypy returns:

main.py:###: error: Non-overlapping equality check (left operand type: "int", right operand type: "str")  [comparison-overlap]

ty does not warn or give an error and all the default ignored rules do not seem like they would capture this.

Anyways, the point is me wondering if this is on ty's roadmap? It is a feature of mypy that i discovered recently and seems very valuable!

Version

0.0.1-alpha.8 (c1337c9 2025-06-02)

Metadata

Metadata

Assignees

No one assigned

    Labels

    lintLabel for features that we would implement as lint rules, not core type checker features

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions