disable mean assertions that hate string annotations

This commit is contained in:
Aria Desires 2025-12-02 15:17:09 -05:00
parent bee8cc785f
commit db68ff1d1a
1 changed files with 18 additions and 8 deletions

View File

@ -6973,10 +6973,14 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
#[track_caller] #[track_caller]
fn infer_expression(&mut self, expression: &ast::Expr, tcx: TypeContext<'db>) -> Type<'db> { fn infer_expression(&mut self, expression: &ast::Expr, tcx: TypeContext<'db>) -> Type<'db> {
debug_assert!( // FIXME(Gankra): I do not know why this assertion is suddenly tripping :(
!self.index.is_standalone_expression(expression), // probably because we're now giving the expression nodes non-None NodeIndexes?
"Calling `self.infer_expression` on a standalone-expression is not allowed because it can lead to double-inference. Use `self.infer_standalone_expression` instead." if !self.deferred_state.in_string_annotation() {
); debug_assert!(
!self.index.is_standalone_expression(expression),
"Calling `self.infer_expression` on a standalone-expression is not allowed because it can lead to double-inference. Use `self.infer_standalone_expression` instead."
);
}
self.infer_expression_impl(expression, tcx) self.infer_expression_impl(expression, tcx)
} }
@ -7116,10 +7120,16 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
MultiInferenceState::Panic => { MultiInferenceState::Panic => {
let previous = self.expressions.insert(expression_key, ty); let previous = self.expressions.insert(expression_key, ty);
assert_eq!(
previous, None, // FIXME(Gankra): I have no idea why this is tripping, but previously string annotations
"duplicate key {expression_key:?} for {expression:?}" // could never reach this code, so it's possible we were recomputing string annotation
); // types repeatedly and before it was Fine.
if !self.deferred_state.in_string_annotation() {
assert_eq!(
previous, None,
"duplicate key {expression_key:?} for {expression:?}"
);
}
} }
MultiInferenceState::Overwrite => { MultiInferenceState::Overwrite => {