You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In the last line, PyCharm issues a warning on passing a string.
However, the value will be coerced into MyStr without problems and thus should not be marked as problem here.
The model can be created no matter if I pass in MyStr("abc") or "abc".
Describe the solution you'd like
Compare the class hierachy of the annotated and the provided type. Do not mark a value as invalid if the type of the provided value is in the hierarchy of the annotated value.
Like in the example: MyStr inherits from str so passing a str is fine.
The text was updated successfully, but these errors were encountered:
chbndrhnns
changed the title
Should not mark values as incorrect type if valid after coercing
Should not mark value as incorrect type if type of value is contained in class hierarchy of annotated type
Jan 7, 2023
Is your feature request related to a problem? Please describe.
In the last line, PyCharm issues a warning on passing a string.
However, the value will be coerced into
MyStr
without problems and thus should not be marked as problem here.The model can be created no matter if I pass in
MyStr("abc")
or"abc"
.Describe the solution you'd like
Compare the class hierachy of the annotated and the provided type. Do not mark a value as invalid if the type of the provided value is in the hierarchy of the annotated value.
Like in the example:
MyStr
inherits fromstr
so passing astr
is fine.The text was updated successfully, but these errors were encountered: