[red-knot] Fix panic related to f-strings in annotations (#14613)
## Summary
Fix panics related to expressions without inferred types in invalid
syntax examples like:
```py
x: f"Literal[{1 + 2}]" = 3
```
where the `1 + 2` expression (and its sub-expressions) inside the
annotation did not have an inferred type.
## Test Plan
Added new corpus test.
This commit is contained in:
@@ -4229,6 +4229,7 @@ impl<'db> TypeInferenceBuilder<'db> {
|
||||
"annotation-f-string",
|
||||
format_args!("Type expressions cannot use f-strings"),
|
||||
);
|
||||
self.infer_fstring_expression(fstring);
|
||||
Type::Unknown
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user