Skip to content
6 changes: 3 additions & 3 deletions mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import mypy.typeops
from mypy import errorcodes as codes, message_registry
from mypy.constant_fold import constant_fold_expr
from mypy.erasetype import erase_type
from mypy.errorcodes import ErrorCode
from mypy.errors import (
Expand Down Expand Up @@ -50,7 +51,6 @@
MypyFile,
NameExpr,
ReturnStmt,
StrExpr,
SymbolNode,
SymbolTable,
TypeInfo,
Expand Down Expand Up @@ -808,10 +808,10 @@ def incompatible_argument(
)
arg_label = f'"{arg_name}"'
if isinstance(outer_context, IndexExpr) and isinstance(
outer_context.index, StrExpr
index := constant_fold_expr(outer_context.index, "<unused>"), str
):
msg = 'Value of "{}" has incompatible type {}; expected {}'.format(
outer_context.index.value,
index,
quote_type_string(arg_type_str),
quote_type_string(expected_type_str),
)
Expand Down