feat(derive): require form parameter for form handles

Emit handle-form facts from slhx-build and have #[slhx::handler] reject generated form handlers that do not accept slhx::Form<_>. Cover the boundary with compile-fail fixtures.

req: form/004

req: form/006

req: test/003
This commit is contained in:
slhx agent
2026-05-25 21:23:37 +02:00
parent 3ea596a218
commit dca26511cc
3 changed files with 81 additions and 2 deletions
+4
View File
@@ -515,6 +515,9 @@ fn __slhx_attr(tag: &str, attr: &str) -> Option<::std::string::String> {
let res = &form.resource;
out.push_str(&format!("form\t{}\t{}\t{}\n", res.symbol, res.ident, res.id));
}
for (handle_ident, form_ident) in &self.handle_forms {
out.push_str(&format!("handle_form\t{handle_ident}\t{form_ident}\n"));
}
for res in self.atoms.values() {
out.push_str(&format!("atom\t{}\t{}\t{}\n", res.symbol, res.ident, res.id));
}
@@ -914,6 +917,7 @@ mod tests {
let syms = std::fs::read_to_string(out.join("slhx.syms")).unwrap();
assert!(syms.contains("atom\t"));
assert!(syms.contains("\tfilter\t"));
assert!(syms.contains("handle_form\tcreate\tnew_todo\n"));
let _ = std::fs::remove_dir_all(&base);
}