[ty] Fix panic when pulling types for UnaryOp expressions inside Literal slices (#18536)

This commit is contained in:
Alex Waygood 2025-06-07 16:26:10 +01:00 committed by GitHub
parent 95497ffaab
commit 72552f31e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 11 deletions

View file

@ -9481,7 +9481,9 @@ impl<'db> TypeInferenceBuilder<'db, '_> {
if matches!(u.op, ast::UnaryOp::USub | ast::UnaryOp::UAdd)
&& u.operand.is_number_literal_expr() =>
{
self.infer_unary_expression(u)
let ty = self.infer_unary_expression(u);
self.store_expression_type(parameters, ty);
ty
}
_ => {
self.infer_expression(parameters);