feat(phase285w): Phase 285W-Syntax-0.1 - Reject weak(...) syntax (Parser-level Fail-Fast)
- Parser guard: Reject weak(...) with LPAREN check in parse_unary()
- Error: "Use 'weak expr', not 'weak(expr)'" (helpful message)
- Location: src/parser/expressions.rs:248-256
- MIR builder guard: Defense-in-depth for any bypassed cases
- Location: src/mir/builder/calls/build.rs:37-46
- Rejection test: apps/tests/phase285w_weak_call_rejected.hako
- Smoke test: phase285w_weak_call_rejected_vm.sh (PASS ✅)
- Documentation:
- EBNF.md: Add ~ (BitNot) to unary operators
- lifecycle.md: Document weak(expr) as invalid syntax
- phase-285/README.md: Add Phase 285W-Syntax-0.1 entry
Test results: 5/6 phase285 tests PASS (1 unrelated failure)
SSOT: docs/reference/language/lifecycle.md
Closes: Phase 285W-Syntax-0.1
This commit is contained in:
@ -34,6 +34,17 @@ impl MirBuilder {
|
||||
);
|
||||
}
|
||||
|
||||
// 0. Phase 285W-Syntax-0.1: Reject weak(...) function call syntax
|
||||
// SSOT: docs/reference/language/lifecycle.md - weak <expr> is the ONLY valid syntax
|
||||
if name == "weak" {
|
||||
eprintln!("[Phase285W-0.1] Rejecting weak(...) function call");
|
||||
return Err(format!(
|
||||
"Invalid syntax: weak(...). Use unary operator: weak <expr>\n\
|
||||
Help: Change 'weak(obj)' to 'weak obj' (unary operator, no parentheses)\n\
|
||||
SSOT: docs/reference/language/lifecycle.md"
|
||||
));
|
||||
}
|
||||
|
||||
// 1. TypeOp wiring: isType(value, "Type"), asType(value, "Type")
|
||||
if let Some(result) = self.try_build_typeop_function(&name, &args)? {
|
||||
return Ok(result);
|
||||
|
||||
Reference in New Issue
Block a user