Skip to content

[type-system] deduplicate fieldTypeToLlvm and add fail-loud default#750

Merged
cs01 merged 2 commits intomainfrom
refactor/silent-default-dispatch
Apr 26, 2026
Merged

[type-system] deduplicate fieldTypeToLlvm and add fail-loud default#750
cs01 merged 2 commits intomainfrom
refactor/silent-default-dispatch

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Apr 26, 2026

Before

fieldTypeToLlvm was duplicated identically in class.ts and control-flow.ts, each with a silent return "i8*" fallback that hides unrecognized types.

After

No user-facing change. Internal refactor only.

Single fieldTypeToLlvm in type-system.ts with explicit handling for every known type category (primitives, arrays, collections, unions, opaque types, function types, class/interface names) and throw on truly unrecognized types.

Description

  • Extracted shared fieldTypeToLlvm() from type-system.ts (29 LOC)
  • class.ts and control-flow.ts now delegate to shared function via thin wrappers that handle enum check locally (enum check uses this.isEnumType() which requires class context)
  • Net -8 LOC (41 insertions, 45 deletions across 4 files)
  • Also deduplicates methodReturnTypeToLlvm union handling would be a behavioral change, so left as-is for a separate coordinated PR

Partial progress on #710.

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