Skip to content

fix LiteralString inference on dict keys #2517#4211

Open
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:2517
Open

fix LiteralString inference on dict keys #2517#4211
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:2517

Conversation

@asukaminato0721

Copy link
Copy Markdown
Collaborator

Summary

Fixes #2517

changes dict key inference so inferred dict keys are widened to their natural runtime type (str for string-like keys, and similarly for other literals) instead of staying pinned to literal precision.

Test Plan

add test

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

Diff from mypy_primer, showing the effect of this PR on open source code:

rotki (https://github.com/rotki/rotki)
- ERROR rotkehlchen/api/services/assets.py:1031:38-77: No matching overload found for function `typing.MutableMapping.setdefault` called with arguments: (str, CounterpartyDetails) [no-matching-overload]

jinja (https://github.com/pallets/jinja)
- ERROR src/jinja2/lexer.py:182:10-34: No matching overload found for function `dict.get` called with arguments: (str, str) [no-matching-overload]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LiteralString inference on dict keys

2 participants