feat(lang): universal raw identifier — parser exhaustiveness + raw type continuations + sema/LSP [F0.6]
Closes the remaining three F0.6 findings so the universal backtick raw identifier holds in BOTH classifiers and at EVERY parser construction site. 1. Struct-body constants thread is_raw + name_span. The struct-body const forms (untyped `` `s2 :: 5 `` and typed `` `s2 : T : v ``) built the const_decl node without name_span/is_raw, so a backtick const was falsely rejected and a bare reserved-name const caretted at 1:1. They now capture both. Structural cure: `ast.ConstDecl`'s name_span + is_raw carry NO default, so the compiler rejects any construction site that omits them (mirrors checkBindingName's required `is_raw` arg). FnDecl keeps its defaults — every parser fn_decl routes through parseFnDecl whose `name_is_raw` is a required parameter (equivalent guarantee). 2. Raw identifier in TYPE position flows through the normal continuations. parseTypeExpr no longer returns a terminal type_expr for a raw atom; the raw flag rides the atom through the qualified-path / Closure / parameterized continuations, so `` `s2(s64) ``, `` *`s2 ``, `` ?`s2 `` all parse. ParameterizedTypeExpr carries is_raw; resolveParameterizedWithBindings skips the `Vector` intrinsic when raw. 3. sema/LSP (the second classifier) honors is_raw. Type.fromTypeExpr returns null for a raw type_expr; resolveTypeNode skips the builtin classifier when raw; resolveTypeNameStr takes a skip_builtin arg threaded from te/id.is_raw (compound inner names pass false). A backtick reserved-name annotation now resolves to the user type in the editor index, not the builtin. Tests: examples/0156 (struct-body const), 0157 (parameterized raw type + wrappers), 1142 (bare struct-body const errors, caret on name); src/sema.test.zig pins the LSP raw-type resolution (fail-before verified). Gate: 365 unit tests, 429 examples, 0 failed.
This commit is contained in:
11
readme.md
11
readme.md
@@ -125,11 +125,12 @@ x : s2 = 3; // bare `s2` in type position is still the int type
|
||||
```
|
||||
|
||||
It works in every identifier position — local, global, parameter, struct field,
|
||||
union tag, function name, type/alias/import name, constant, and the control-flow /
|
||||
capture / binding forms (destructure, `if`/`while` binding, `for` capture, match
|
||||
capture, `catch`/`onfail` tag) — and a reserved-spelled function is bare-callable
|
||||
(`s2(10)`). A backtick name used as a type resolves to a `` `name ``-declared type,
|
||||
else a normal `unknown type` error.
|
||||
union tag, function name, type/alias/import name, a top-level or struct-body
|
||||
constant, and the control-flow / capture / binding forms (destructure, `if`/`while`
|
||||
binding, `for` capture, match capture, `catch`/`onfail` tag) — and a reserved-spelled
|
||||
function is bare-callable (`s2(10)`). A backtick name used as a type resolves to a
|
||||
`` `name ``-declared type — including a parameterized template (`` `s2(s64) ``) and
|
||||
under pointer/optional wrappers — else a normal `unknown type` error.
|
||||
|
||||
Foreign declarations from `#import c { … }` are exempt automatically: C names that
|
||||
collide with reserved type names (e.g. `s1`, `s2`) import unedited, and a foreign
|
||||
|
||||
Reference in New Issue
Block a user