[ty] Infer LiteralString for f"{literal_str_a} {literal_str_b}"#23346
Merged
[ty] Infer LiteralString for f"{literal_str_a} {literal_str_b}"#23346
LiteralString for f"{literal_str_a} {literal_str_b}"#23346Conversation
sharkdp
commented
Feb 16, 2026
| struct StringPartsCollector { | ||
| concatenated: Option<String>, | ||
| expression: bool, | ||
| contains_non_literal_str: bool, |
Contributor
Author
There was a problem hiding this comment.
Only renamed for clarity
sharkdp
commented
Feb 16, 2026
|
|
||
| /// Add an expression whose `__str__` return type is not `LiteralString`. | ||
| /// The result will degrade to `str`. | ||
| fn add_non_literal_string_expression(&mut self) { |
Contributor
Author
There was a problem hiding this comment.
Same as add_expression before, just renamed.
Typing conformance results improved 🎉The percentage of diagnostics emitted that were expected errors increased from 84.78% to 84.87%. The percentage of expected errors that received a diagnostic held steady at 75.14%. Summary
False positives removedDetails
|
|
Memory usage reportMemory usage unchanged ✅ |
f2a63e4 to
514ddae
Compare
AlexWaygood
approved these changes
Feb 20, 2026
|
knutwannheden
pushed a commit
to openrewrite/ruff
that referenced
this pull request
Feb 20, 2026
…stral-sh#23346) ## Summary * The first commit modernizes the `LiteralString` test suite. * The second commit adds more precise type inference for `f"{literal_str_a} {literal_str_b}"` to make a conformance test pass. ## Test Plan Updated and new Markdown tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
LiteralStringtest suite.f"{literal_str_a} {literal_str_b}"to make a conformance test pass.This should have a better impact on conformance results once python/typing#2179 lands.(this was merged now)Test Plan
Updated and new Markdown tests