Skip to content

Commit

Permalink
Fix type error introduced in #6081 (#6159)
Browse files Browse the repository at this point in the history
  • Loading branch information
msullivan authored Jan 8, 2019
1 parent 41d6aea commit 3d248a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@ def analyze_simple_literal_type(self, rvalue: Expression, is_final: bool) -> Opt
if isinstance(rvalue, FloatExpr):
return self.named_type_or_none('builtins.float')

value = None # type: LiteralValue
value = None # type: Optional[LiteralValue]
type_name = None # type: Optional[str]
if isinstance(rvalue, IntExpr):
value, type_name = rvalue.value, 'builtins.int'
Expand All @@ -1927,6 +1927,7 @@ def analyze_simple_literal_type(self, rvalue: Expression, is_final: bool) -> Opt
value, type_name = rvalue.value, 'builtins.unicode'

if type_name is not None:
assert value is not None
typ = self.named_type_or_none(type_name)
if typ and is_final:
return typ.copy_modified(final_value=LiteralType(
Expand Down

0 comments on commit 3d248a3

Please sign in to comment.