ffi M5.A.next.3a.C: $args[$i] in fn-pointer type literals
Adds `resolveFunctionTypeWithBindings` so `function_type_expr` in a binding-aware context — local var annotations, return types, nested type expressions — recursively resolves through the active pack bindings. Without this, the fall-through to `type_bridge.resolveAstType` lost pack context and the new `pack_index_type_expr` arm spammed the "outside pack-aware context" diagnostic (the function still worked by accident thanks to the `.s64` fallback). Plumbing: - `resolveTypeWithBindings` adds a `function_type_expr` case in both the bindings-active branch and the fallthrough switch (the same shape as `closure_type_expr`). - `resolveFunctionTypeWithBindings` recursively resolves each param + return type with bindings, then calls `functionTypeCC` with the AST's calling convention. `examples/167-pack-type-fnptr.sx` exercises the pattern step 5's trampoline needs: fp : (*void, $args[0]) -> $args[1] = double_s64; return fp(null, args[0]); Output: 14 (= 7*2 via the typed fn-pointer). 207/207 example tests + `zig build test` green.
This commit is contained in:
1
tests/expected/167-pack-type-fnptr.exit
Normal file
1
tests/expected/167-pack-type-fnptr.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
1
tests/expected/167-pack-type-fnptr.txt
Normal file
1
tests/expected/167-pack-type-fnptr.txt
Normal file
@@ -0,0 +1 @@
|
||||
14
|
||||
Reference in New Issue
Block a user