Skip to content

Commit 0c28fad

Browse files
kr321kr321
authored andcommitted
added new circumstance of having NONE as the second object of a union with warning message
1 parent 80f9788 commit 0c28fad

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

mypy/messages.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -522,23 +522,12 @@ def has_no_attr(
522522
type(item) == NoneType for item in original_type.items
523523
):
524524
typ_format = '"None"'
525-
if typ_format == '"None"':(
526-
self.fail(
527-
'Item {} of {} has no attribute "{}"{}. ADD HINT HERE'.format(
528-
typ_format, orig_type_format, member, extra
529-
),
530-
context,
531-
code=codes.UNION_ATTR,
532-
)
533-
)
534-
else:(
535-
self.fail(
536-
'Item {} of {} has no attribute "{}"{}'.format(
537-
typ_format, orig_type_format, member, extra
538-
),
539-
context,
540-
code=codes.UNION_ATTR,
541-
)
525+
self.fail(
526+
'Item {} of {} has no attribute "{}"{}'.format(
527+
typ_format, orig_type_format, member, extra
528+
),
529+
context,
530+
code=codes.UNION_ATTR,
542531
)
543532
return codes.UNION_ATTR
544533
elif isinstance(original_type, TypeVarType):

0 commit comments

Comments
 (0)