ffi M1.0 (2/3, xfail): '=>' body inside '#objc_class' member

parseForeignClassDecl ([src/parser.zig:1262]) accepts ';'
(declaration) or '{ ... }' (block body) but not '=>' for member
methods. The arrow form, which parseFnDecl ([src/parser.zig:1647])
already handles for top-level/struct decls (M1.0 1/3), surfaces
'expected ;' at the arrow today.

Snapshot pins that error so the next commit (the parser
extension) shows up as a single diagnostic→runtime-output diff
in 140-expression-bodied-objc-method.{txt,exit}.
This commit is contained in:
agra
2026-05-25 21:16:32 +03:00
parent 6c95b2ae72
commit 4a048d34fd
3 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
// M1.0 (xfail) — '=>' expression-body form inside '#objc_class'
// member methods.
//
// Today: parseForeignClassDecl ([src/parser.zig:1262]) accepts ';'
// (declaration) or '{ ... }' (block body) but not '=>'. Trying
// '=>' surfaces 'expected ;' at the arrow.
//
// Next commit extends the member parser to accept the arrow
// form, mirroring the existing parseFnDecl ('=>') arm, and this
// snapshot flips from a parser error to '42\n'.
#import "modules/std.sx";
SxFoo :: #objc_class("SxFoo") {
greet :: (self: *Self) -> s32 => 42;
}
main :: () -> s32 {
0;
}

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1 @@
/Users/agra/projects/sx/examples/140-expression-bodied-objc-method.sx:15:35: error: expected ';'