-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[red-knot] support fstring expressions #13511
Merged
carljm
merged 12 commits into
astral-sh:main
from
Slyces:feat/support-fstring-expressions
Sep 27, 2024
Merged
[red-knot] support fstring expressions #13511
carljm
merged 12 commits into
astral-sh:main
from
Slyces:feat/support-fstring-expressions
Sep 27, 2024
Commits on Sep 26, 2024
-
[red-knot] feat: support f-string expressions
Current implementation (based on mypy behaviour): - evaluate any fstring with expressions as `builtin.str` - evaluate static fstrings (could be regular strings) as `Literal[..]` if it fits the max size or `LiteralString` (same as regular strings)
Configuration menu - View commit details
-
Copy full SHA for 7e81de0 - Browse repository at this point
Copy the full SHA 7e81de0View commit details -
[red-knot] feat: resolve literals (bool, int, str) in f-string expres…
…sions Resolves f-strings made entirely of literals (bool, int, str) at compile time (not supported by mypy). Example: 'f"{True}"' -> 'True'
Configuration menu - View commit details
-
Copy full SHA for 95b906c - Browse repository at this point
Copy the full SHA 95b906cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 47d3544 - Browse repository at this point
Copy the full SHA 47d3544View commit details -
Configuration menu - View commit details
-
Copy full SHA for eaac2cd - Browse repository at this point
Copy the full SHA eaac2cdView commit details -
Configuration menu - View commit details
-
Copy full SHA for e714f9a - Browse repository at this point
Copy the full SHA e714f9aView commit details -
[red-knot] feat: implement and use
repr
/str
forf-strings
Implement the methods `Type::str` and `Type::repr` for some basic types and use it when infering the type of an f-string expression. Ensure we always infer sub-expressions in an f-string expression, even when we're done figuring out its type.
Configuration menu - View commit details
-
Copy full SHA for 9bc5a57 - Browse repository at this point
Copy the full SHA 9bc5a57View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1746775 - Browse repository at this point
Copy the full SHA 1746775View commit details -
Configuration menu - View commit details
-
Copy full SHA for 397aea4 - Browse repository at this point
Copy the full SHA 397aea4View commit details -
Configuration menu - View commit details
-
Copy full SHA for daacaf7 - Browse repository at this point
Copy the full SHA daacaf7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 04ed1b5 - Browse repository at this point
Copy the full SHA 04ed1b5View commit details
Commits on Sep 27, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 36a2fa4 - Browse repository at this point
Copy the full SHA 36a2fa4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 47a4b3d - Browse repository at this point
Copy the full SHA 47a4b3dView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.