Skip to content

[type-system] explicit dispatch in fieldToLlvmType, fail-loud on empty interface types#752

Merged
cs01 merged 3 commits intomainfrom
refactor/silent-default-interface-genctx
Apr 27, 2026
Merged

[type-system] explicit dispatch in fieldToLlvmType, fail-loud on empty interface types#752
cs01 merged 3 commits intomainfrom
refactor/silent-default-interface-genctx

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Apr 27, 2026

Before

fieldToLlvmType in class.ts had two return "i8*" catch-alls that silently handled any unrecognized tsType. tsTypeToLlvm/tsTypeToLlvmForField in interface-struct-generator.ts silently returned i8* for null/empty types.

After

Both fieldToLlvmType sites now explicitly dispatch on known type categories (string, void, any/unknown/object, null/undefined/never, unions, inline objects, string literals, function types, LLVM types) before the remaining catch-all. Interface-struct-generator throws on null/empty types instead of silently returning i8*.

No user-facing change. Internal refactor only.

Description

Part of #710 (eliminate silent-default dispatch). Fourth PR in series after #749, #750, #751. The fieldToLlvmType catch-all return "i8*" is retained because the function can't distinguish interface names from truly unknown types without access to the interface struct generator — but the explicit dispatch narrows it to only interface/class name resolution.

@cs01 cs01 closed this Apr 27, 2026
@cs01 cs01 deleted the refactor/silent-default-interface-genctx branch April 27, 2026 00:25
@cs01 cs01 restored the refactor/silent-default-interface-genctx branch April 27, 2026 00:25
@cs01 cs01 reopened this Apr 27, 2026
@cs01 cs01 merged commit b8497fe into main Apr 27, 2026
18 checks passed
@cs01 cs01 deleted the refactor/silent-default-interface-genctx branch April 27, 2026 00:39
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