Skip to content

fix: resolve inline type assertions to matching interfaces#162

Merged
cs01 merged 1 commit intomainfrom
fix/inline-assertion-codegen
Mar 9, 2026
Merged

fix: resolve inline type assertions to matching interfaces#162
cs01 merged 1 commit intomainfrom
fix/inline-assertion-codegen

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 9, 2026

Summary

  • When codegen encounters as { name: string; type: string }, it now parses the inline fields and finds the matching declared interface
  • Uses accessObjectPropertyWithNamedInterface with correct GEP indices instead of falling back to untyped member access
  • Added findInterfaceForFields(fieldNames) to generator context and LLVMGenerator
  • Falls back to existing synthetic member access if no matching interface found

This is the root cause fix for the 294 corrupted type strings per native compiler build. Previously, inline multi-field type assertions caused the native compiler to use JSON-style field lookup (csyyjson_obj_get) instead of direct struct access (GEP), reading garbage memory.

Test plan

  • npm run build — clean
  • npm test — 437 tests pass
  • npm run verify:quick — Stage 0 + Stage 1 self-hosting passes

@cs01 cs01 merged commit 9ba76da into main Mar 9, 2026
12 checks passed
@cs01 cs01 deleted the fix/inline-assertion-codegen branch March 12, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant