Revert "Do not infer types for invalid binary expressions in annotations"

This reverts commit f2e50c4f83.
This commit is contained in:
David Peter 2025-12-11 12:51:58 +01:00
parent aa27925e87
commit 533d9093b2
1 changed files with 6 additions and 0 deletions

View File

@ -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!(