mirror of https://github.com/astral-sh/ruff
Revert "Do not infer types for invalid binary expressions in annotations"
This reverts commit f2e50c4f83.
This commit is contained in:
parent
aa27925e87
commit
533d9093b2
|
|
@ -155,6 +155,12 @@ impl<'db> TypeInferenceBuilder<'db, '_> {
|
||||||
}
|
}
|
||||||
// anything else is an invalid annotation:
|
// anything else is an invalid annotation:
|
||||||
op => {
|
op => {
|
||||||
|
// Avoid inferring the types of invalid binary expressions that have been
|
||||||
|
// parsed from a string annotation, as they are not present in the semantic
|
||||||
|
// index.
|
||||||
|
if !self.deferred_state.in_string_annotation() {
|
||||||
|
self.infer_binary_expression(binary, TypeContext::default());
|
||||||
|
}
|
||||||
self.report_invalid_type_expression(
|
self.report_invalid_type_expression(
|
||||||
expression,
|
expression,
|
||||||
format_args!(
|
format_args!(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue