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:
2025-12-25 00:04:55 +09:00
parent 9227673ef7
commit cc05c37ae3
7 changed files with 73 additions and 13 deletions

View File

@ -17,7 +17,7 @@ logic := compare (('&&' | '||') compare)*
compare := sum (( '==' | '!=' | '<' | '>' | '<=' | '>=' ) sum)?
sum := term (('+' | '-') term)*
term := unary (('*' | '/') unary)*
unary := ('-' | '!' | 'not') unary | factor
unary := ('-' | '!' | 'not' | '~' | 'weak') unary | factor
factor := INT
| STRING