Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Type[T] comparisons work #1806

Merged
merged 9 commits into from
Jul 8, 2016

Commits on Jul 5, 2016

  1. Make type comparisons work

    This commit introduces a workaround to fix the bug discussed in
    python#1787
    
    Previously, code where you compared two types (eg `int == int`) would
    cause mypy to incorrectly report a "too few arguments" error.
    MichaelLeeDBX committed Jul 5, 2016
    Configuration menu
    Copy the full SHA
    b46f970 View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2016

  1. Make type comparisons work

    This commit introduces a workaround to fix the bug discussed in
    python#1787
    
    Previously, code where you compared two types (eg `int == int`) would
    cause mypy to incorrectly report a "too few arguments" error.
    MichaelLeeDBX committed Jul 7, 2016
    Configuration menu
    Copy the full SHA
    e39d0b4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c9c70f9 View commit details
    Browse the repository at this point in the history

Commits on Jul 8, 2016

  1. Replace hack with a more principled check

    After talking with Guido, I realized Python special-cases literally the
    operators (==, +, etc), NOT the magic methods themselves. So, that means
    we need to special-case "a == b", but not "a.__eq__(b)".
    
    As a result, checking to see if the method name was a magic method or
    not was the wrong thing to do -- if the name of the method is "__eq__",
    there's no way to know if the code was originally "foo == bar" or
    "foo.__eq__(bar)".
    
    So, rather then trying to do something with the operator name, I can
    instead check and see if the node is an OpExpr or ComparisonExpr node vs
    a CallExpr node.
    MichaelLeeDBX committed Jul 8, 2016
    Configuration menu
    Copy the full SHA
    53e001e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0e7f87b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9837852 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    4ca2038 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2c4db3f View commit details
    Browse the repository at this point in the history
  6. Fix ci regression

    MichaelLeeDBX committed Jul 8, 2016
    Configuration menu
    Copy the full SHA
    bf351a4 View commit details
    Browse the repository at this point in the history