Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion crates/hir/src/analysis/name_resolution/path_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,18 @@ pub fn resolve_name_res<'db>(
path,
})
}
ScopeId::FuncParam(item, idx) => PathRes::FuncParam(item, idx),
ScopeId::FuncParam(item, idx) => {
if !args.is_empty() {
return Err(PathResError::new(
PathResErrorKind::ArgNumMismatch {
expected: 0,
given: args.len(),
},
path,
));
}
PathRes::FuncParam(item, idx)
}
ScopeId::Field(..) => unreachable!(),
ScopeId::Block(..) => unreachable!(),
},
Expand Down
12 changes: 11 additions & 1 deletion crates/hir/src/analysis/ty/ty_check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,17 @@ impl<'db> TyChecker<'db> {
ExprProp::invalid(self.db)
}
}
PathRes::Mod(_) | PathRes::FuncParam(..) => todo!(),
PathRes::Mod(scope) => {
let diag = BodyDiag::NotValue {
primary: path_expr_span.clone().into(),
given: Either::Left(scope.item()),
};
self.push_diag(diag);
ExprProp::invalid(self.db)
}
PathRes::FuncParam(..) => {
unreachable!("func params should be resolved as bindings")
}
},
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mod m {}

fn test(x: i32) {
m
x<i32>
}
16 changes: 16 additions & 0 deletions crates/uitest/fixtures/ty_check/not_value_mod_and_func_param.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
source: crates/uitest/tests/ty_check.rs
expression: diags
input_file: fixtures/ty_check/not_value_mod_and_func_param.fe
---
error[2-0011]: incorrect number of generic arguments for `x`; expected 0, given 1
┌─ not_value_mod_and_func_param.fe:5:5
5 │ x<i32>
│ ^ expected 0 arguments, but 1 were given

error[8-0030]: value is expected
┌─ not_value_mod_and_func_param.fe:4:5
4 │ m
│ ^ `mod` cannot be used as a value