fix: three codegen/parser/ffi bugs (#587, #589, #591)#593
Merged
Conversation
Contributor
Benchmark Results (Linux x86-64)
CLI Tool Benchmarks
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three independent fixes, one commit each:
459665de→02aecec1pre-rebase) —fix(codegen): arrow literal assigned to a class field inside the ctor body was emittingstore i8* __lambda_N, i8** %X(missing@sigil). Clang rejected. Fix normalizes raw__lambda_Noperands to@__lambda_Nat the single class-field store site instoreFieldValueDirect. 1 file, +3 LOC (src/codegen/infrastructure/assignment-generator.ts).887c76fc→9fcf31a8pre-rebase) —fix(parser):CallExpressionvisitor now acceptsElementAccessExpressionas a callee alongsideCallExpression/ParenthesizedExpression. Unblocks parsingarr[i](args)dispatch-table shapes (codegen still needs function-pointer array indirect-call support to run end-to-end; that's tracked separately — the parser no longer rejects the shape). 1 file, +1/-1 LOC (src/parser-ts/handlers/expressions.ts).d50c5199→25693fe1pre-rebase) —fix(ffi):declare functionreturning achar*now round-trips NULL as the empty string. Added aselect i1 (icmp eq ptr null), empty_str, resultcoercion at the FFI call return for declare-function i8* returns, soif (someBridge() === "")works without per-bridge_is_*probes. 1 file, +12 LOC (src/codegen/expressions/calls.ts).Before / After
#587
store i8* __lambda_0, i8** %5→ clangerror: expected value tokenstore i8* @__lambda_0, i8** %5→ compiles and calls correctly.#589
Unsupported call expression: ElementAccessExpression.method_callwithmethod: ""just like existing paren/IIFE-callee shapes; downstream semantic layer now returns the real "IIFE not supported" error, making the function-array codegen gap visible and addressable as a separate follow-up.#591
char*fell into the null-vs-string branch of the===strcmp lowering and producedfalse(bothNull was false because""is a real string).v === ""is true.Test files added
tests/fixtures/classes/class-arrow-field-in-ctor.ts(codegen: arrow-literal in class ctor body emits IR with missing @ sigil on lambda reference #587)tests/fixtures/edge-cases/call-element-access-callee.ts(parser: rejects arr[i](args) — ElementAccessExpression as callee #589 — compile-error fixture asserting the parser now reaches the IIFE semantic error)tests/fixtures/edge-cases/ffi-null-string-to-empty.ts(ffi: NULL char* does not reliably round-trip to empty string in TS #591)Verify
Full
npm run verifypassed on this branch before opening the PR:Test plan
npm run verifynpm test(fixture suite picks up the three new tests)