| 1 | // Function-pointer signatures should NOT match across alias-equivalent |
| 2 | // result/option payloads, because the `_result_*` / `_option_*` C wrapper |
| 3 | // structs are distinct types — the conversion path used for `return some_call()` |
| 4 | // (#27264) doesn't run at the fn-signature boundary, so accepting these would |
| 5 | // pass V checking and then emit incompatible C function-pointer ABI. |
| 6 | |
| 7 | type Token = string |
| 8 | type Tokens = []string |
| 9 | |
| 10 | type ReturnsTokens = fn () !Tokens |
| 11 | |
| 12 | fn returns_array_of_token() ![]Token { |
| 13 | return [Token('hi')] |
| 14 | } |
| 15 | |
| 16 | fn main() { |
| 17 | // Without `unsafe`, this must error: `fn () ![]Token` is *not* assignable |
| 18 | // to `fn () !Tokens` even though the payloads have the same layout. |
| 19 | _ := ReturnsTokens(returns_array_of_token) |
| 20 | } |
| 21 | |