-
Notifications
You must be signed in to change notification settings - Fork 46
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
Narrowed field types are rejected #1019
Comments
This is correct as this code is technically unsafe (if you have an object of type However, the error can likely be improved. |
Is there a better way to express this logic? In my circumstance, every instance of |
Probably mark it as read-only on the base class by using |
That suggestion works. Feel free to close the issue, or keep it open for the error message improvement. |
A.x
has a union type.B
andC
inherit fromA
, andB.x
andC.x
each have non-union types belong to the union.mypy --strict
accepts this, butmypyc
raises errors:It would be cool if Mypyc would accept this. Barring that, the error message could be better. Something to the effect of "the types are compatible, but Mypyc requires that they be identical".
The text was updated successfully, but these errors were encountered: