1
Fork 0

Don't emit "field expressions may not have generic arguments" if it's a method call without ()

This commit is contained in:
Orion Gonzalez 2024-12-11 00:53:07 +01:00
parent 33c245b9e9
commit 014363e89e
6 changed files with 18 additions and 17 deletions

View file

@ -1369,11 +1369,14 @@ impl<'a> Parser<'a> {
))
} else {
// Field access `expr.f`
let span = lo.to(self.prev_token.span);
if let Some(args) = seg.args {
self.dcx().emit_err(errors::FieldExpressionWithGeneric(args.span()));
// See `StashKey::GenericInFieldExpr` for more info on why we stash this.
self.dcx()
.create_err(errors::FieldExpressionWithGeneric(args.span()))
.stash(seg.ident.span, StashKey::GenericInFieldExpr);
}
let span = lo.to(self.prev_token.span);
Ok(self.mk_expr(span, ExprKind::Field(self_arg, seg.ident)))
}
}