Diagnose unresolved self value in path expression

This commit is contained in:
Lukas Wirth 2024-07-06 15:44:12 +02:00
parent f2afcb874e
commit 4420e7148f
2 changed files with 18 additions and 1 deletions

View file

@ -440,7 +440,8 @@ impl InferenceContext<'_> {
let ty = match self.infer_path(p, tgt_expr.into()) {
Some(ty) => ty,
None => {
if matches!(p, Path::Normal { mod_path, .. } if mod_path.is_ident()) {
if matches!(p, Path::Normal { mod_path, .. } if mod_path.is_ident() || mod_path.is_self())
{
self.push_diagnostic(InferenceDiagnostic::UnresolvedIdent {
expr: tgt_expr,
});