Skip to content

Commit 88d5aac

Browse files
committed
[mypyc] feat: support constant folding in MessageBuilder.incompatible_argument
1 parent 053c054 commit 88d5aac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mypy/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,10 +808,10 @@ def incompatible_argument(
808808
)
809809
arg_label = f'"{arg_name}"'
810810
if isinstance(outer_context, IndexExpr) and isinstance(
811-
outer_context.index, StrExpr
811+
index := constant_fold_expr(outer_context.index, "unused"), str
812812
):
813813
msg = 'Value of "{}" has incompatible type {}; expected {}'.format(
814-
outer_context.index.value,
814+
index,
815815
quote_type_string(arg_type_str),
816816
quote_type_string(expected_type_str),
817817
)

0 commit comments

Comments
 (0)