docs(lang): sync issues/0089 member-name exemption with the f32/f64 keyword caveat [F0.6]
This commit is contained in:
@@ -67,6 +67,15 @@
|
||||
> ([src/ir/semantic_diagnostics.zig]) check only the *type* name (and method
|
||||
> *params*), not field / tag / variant / method-signature names. The backtick
|
||||
> is optional there (`obj.s2` and `` obj.`s2 `` resolve to the same member).
|
||||
> This bare member-name exemption covers only the **identifier-classified**
|
||||
> reserved spellings — `s1`..`s64`, `u1`..`u64`, `bool`, `string`, `void`,
|
||||
> `usize`, `isize`, `Any` — which all lex as ordinary identifiers. The two
|
||||
> **keyword-classified** spellings, `f32` and `f64`, are lexer keywords
|
||||
> ([src/token.zig]), and a member-name slot requires an identifier token
|
||||
> ([src/parser.zig]); a bare `f32` / `f64` is therefore rejected at parse
|
||||
> (`expected field name in struct`) even in a member position, and still needs
|
||||
> the backtick there too — `` struct { `f32: s64; } `` / `` union { `f64: … } ``
|
||||
> / `` protocol { `f32 :: (self); } `` work as field / tag / method names.
|
||||
> The exemption stops at member *definitions*: an `impl` method is a real
|
||||
> function reached through the `impl_block` → `fn_decl` arm, so a
|
||||
> reserved-spelled impl method needs the backtick (`` `s2 :: (self) ``), no
|
||||
|
||||
Reference in New Issue
Block a user