For UFCS dispatch on foreign-class receivers (`#foreign #objc_class` aliases), `resolveCallParamTypes` was returning an empty slice — both `resolveFuncByName(qualified)` and `fn_ast_map.get(qualified)` miss for `#foreign` methods (they live in `foreign_class_map`, not the regular fn maps). With `param_types` empty, the per-arg `target_type` assignment in `lowerCall` was skipped, leaving `self.target_type` as whatever it held on entry — usually the enclosing function's return type. Inside a `-> BOOL` method, `xx ptr` then lowered with target type `i8`: `ptrtoint ptr to i64` → `trunc i64 to i8`, sending the low byte of the pointer through. Symptom: chess on iOS-sim crashed in `-[NSNotificationCenter addObserver:selector:name:object:]` with `observer = 0xC0` (low byte of the SxAppDelegate receiver) when the AppDelegate method's first param was renamed to anything other than `self`. The original session diagnosed it as a `self`-vs-`this` hardcoding in `lower.zig`, but those hardcoded `"self"` strings are all on compiler-synthesized parameters (init scopes, JNI stubs, property IMPs, dealloc IMPs) — not the user-facing #objc_class body params. The bug was in arg-type resolution. Fix walks `foreign_class_map` + `findForeignMethodInChain` to recover the declared param types (skipping the implicit `*Self` for instance methods). Regression test `examples/issue-0044.sx` exercises the BOOL-return + foreign-class arg shape; pre-fix the receiver round-trip prints WRONG, post-fix it prints ok.
2 lines
2 B
Plaintext
2 lines
2 B
Plaintext
0
|