Skip to content

fix: remove unnecessary double casts in json, json-array, and variable-allocator#150

Merged
cs01 merged 1 commit intomainfrom
fix/remove-remaining-double-casts
Mar 9, 2026
Merged

fix: remove unnecessary double casts in json, json-array, and variable-allocator#150
cs01 merged 1 commit intomainfrom
fix/remove-remaining-double-casts

Conversation

@cs01
Copy link
Owner

@cs01 cs01 commented Mar 9, 2026

Summary

  • Replaced 9 as unknown as double casts with direct as casts in json.ts, json-array.ts, and variable-allocator.ts
  • All casts are from Expression union type to its member types (ObjectNode, ArrayNode, TypeAssertionNode, VariableNode) — TypeScript allows direct narrowing casts on union members
  • Double casts bypass TypeScript's type checker and give the native compiler less type information for GEP index resolution

Test plan

  • tsc --noEmit passes (direct casts are type-safe)
  • npm run verify:quick passes (tests + self-hosting Stage 0 + Stage 1)

🤖 Generated with Claude Code

@cs01 cs01 merged commit 0f9def6 into main Mar 9, 2026
12 checks passed
@cs01 cs01 deleted the fix/remove-remaining-double-casts 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