Skip to content

Type inference of abs with user-defined argument type fails #39

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

Closed
JukkaL opened this issue Jan 14, 2013 · 4 comments
Closed

Type inference of abs with user-defined argument type fails #39

JukkaL opened this issue Jan 14, 2013 · 4 comments
Labels
bug mypy got something wrong

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Jan 14, 2013

The type inference of the final line in this example fails:

class A(SupportsAbs[float]):
    def __abs__(self) -> float: return 5.5

print(abs(A()))        # Error

The abs type argument should be inferred automatically.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Sep 21, 2013

See also pythoneval test case testGenericFunctionTypeInferenceProblem.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Aug 25, 2014

There seems to be at least two related bugs. The first one is #410.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Aug 25, 2014

However, the original example now works correctly -- originally there must have been three bugs around this issue!

@JukkaL
Copy link
Collaborator Author

JukkaL commented Aug 25, 2014

testGenericFunctionTypeInferenceProblem was actually broken, and there only seems to be the related bug #410.

@JukkaL JukkaL closed this as completed in 1739518 Aug 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

1 participant