From b9a29c39c5debc9eab2d5518faf2f26a8516ff41 Mon Sep 17 00:00:00 2001 From: agra Date: Thu, 4 Jun 2026 23:02:09 +0300 Subject: [PATCH] =?UTF-8?q?docs(lang):=20fix=20invalid=20protocol=20method?= =?UTF-8?q?-signature=20snippets=20=E2=80=94=20(self)=20->=20()=20->=20s64?= =?UTF-8?q?=20[F0.6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A protocol method signature omits the receiver; a bare `self` has no type, so `protocol { … :: (self) … }` fails at parse with 'expected :'. Correct the three member-exemption doc snippets (readme.md, specs.md, issues/0089) to the valid signature form, matching examples/0158's `Speaker :: protocol { s2 :: () -> s64; }`. --- issues/0089-backtick-raw-identifier.md | 2 +- readme.md | 2 +- specs.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/issues/0089-backtick-raw-identifier.md b/issues/0089-backtick-raw-identifier.md index b0fbd39..bb7d1a0 100644 --- a/issues/0089-backtick-raw-identifier.md +++ b/issues/0089-backtick-raw-identifier.md @@ -75,7 +75,7 @@ > ([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. +> / `` protocol { `f32 :: () -> s64; } `` 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 diff --git a/readme.md b/readme.md index 80ea1da..0c71b8e 100644 --- a/readme.md +++ b/readme.md @@ -113,7 +113,7 @@ function declaration, an `impl` method definition, or a `::` type declaration (`s2 :: 5` and `s2 :: (n) { … }` are rejected just like `s2 := 5`). **Member-name positions are exempt**: a struct *field*, a union *tag*, and a protocol *method-signature* may be a bare reserved spelling (`struct { s2: s64 }`, -`union { u8: … }`, `protocol { s2 :: (self) }`) — they are reached via `obj.name`, +`union { u8: … }`, `protocol { s2 :: () -> s64 }`) — they are reached via `obj.name`, so they never mis-lower. The bare exemption covers only the identifier-classified reserved names (`s1`..`s64`, `u1`..`u64`, `bool`, `string`, `void`, `usize`, `isize`, `Any`); `f32` and `f64` are lexer keywords, so even in a member slot they diff --git a/specs.md b/specs.md index 3683a57..b30853e 100644 --- a/specs.md +++ b/specs.md @@ -45,7 +45,7 @@ reserved spellings — `s1`..`s64`, `u1`..`u64`, `bool`, `string`, `void`, `usiz member-name slots require an identifier token; a bare `f32` / `f64` is therefore rejected at parse (`expected field name in struct`) even in a member position. Use the backtick there too — `` struct { `f32: s64; } `` / `` union { `f64: … } `` / -`` protocol { `f32 :: (self); } `` work as field / tag / method names. +`` protocol { `f32 :: () -> s64; } `` work as field / tag / method names. ```sx s2 := 2.5; // ERROR: 's2' is a reserved type name and cannot be used as an identifier