Skip to content

Commit 8f948b1

Browse files
committed
Fix type error introduced in #6081
1 parent 94fe11c commit 8f948b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mypy/semanal.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,7 @@ def analyze_simple_literal_type(self, rvalue: Expression, is_final: bool) -> Opt
19151915
if isinstance(rvalue, FloatExpr):
19161916
return self.named_type_or_none('builtins.float')
19171917

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

19291929
if type_name is not None:
1930+
assert value is not None
19301931
typ = self.named_type_or_none(type_name)
19311932
if typ and is_final:
19321933
return typ.copy_modified(final_value=LiteralType(

0 commit comments

Comments
 (0)