Skip to content

Regression since 0.620: Argument 1 to "__div__" of "int" has incompatible type "float"; expected "int" #5557

Description

@gvanrossum

Consider:

def f(a):
    # type: (Union[int, float]) -> None
    a /= 1.1  # <-- Line 10

This looks fine to me, and gives no errors in 0.620 in either Python 2 or Python 3 mode. In the current master it gives this error in Python 2 mode:

_.py:10: error: Argument 1 to "__div__" of "int" has incompatible type "float"; expected "int"
_.py:10: note: __rdiv__ will not be called when evaluating 'float / float': must define __div__

In Python 3 it gives this error:

_.py:10: error: Unsupported operand types for / (likely involving Union)
_.py:10: note: __rtruediv__ will not be called when evaluating 'float / float': must define __truediv__

@Michael0x2a IIRC you did something with operators recently?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions