From 8f948b1dd0ebdaa7aa5bfc7389e3222106dc8654 Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Mon, 7 Jan 2019 22:01:45 -0800 Subject: [PATCH] Fix type error introduced in #6081 --- mypy/semanal.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mypy/semanal.py b/mypy/semanal.py index 6999b5431199..26df4b357de0 100644 --- a/mypy/semanal.py +++ b/mypy/semanal.py @@ -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' @@ -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(