[ty] Respect debug text interpolation in f-strings (#22151)
## Summary Per @carljm's comment, we just fall back to `str`. Closes https://github.com/astral-sh/ty/issues/2151.
This commit is contained in:
@@ -7594,7 +7594,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
||||
range: _,
|
||||
node_index: _,
|
||||
expression,
|
||||
debug_text: _,
|
||||
debug_text,
|
||||
conversion,
|
||||
format_spec,
|
||||
} = expression;
|
||||
@@ -7613,7 +7613,10 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
||||
// (`Type::format`?) that handles the `__format__` method.
|
||||
// Conversion flags should be handled before calling `__format__`.
|
||||
// https://docs.python.org/3/library/string.html#format-string-syntax
|
||||
if !conversion.is_none() || format_spec.is_some() {
|
||||
if debug_text.is_some()
|
||||
|| !conversion.is_none()
|
||||
|| format_spec.is_some()
|
||||
{
|
||||
collector.add_expression();
|
||||
} else {
|
||||
if let Type::StringLiteral(literal) = ty.str(self.db()) {
|
||||
|
||||
Reference in New Issue
Block a user