Skip to content

fix: .length on chained method call results returns correct value#324

Merged
cs01 merged 1 commit intomainfrom
fix-chain-length
Mar 13, 2026
Merged

fix: .length on chained method call results returns correct value#324
cs01 merged 1 commit intomainfrom
fix-chain-length

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 13, 2026

Summary

  • [1,2,3,4,5].filter(x => x > 3).length was returning 5 (original array length) instead of 2
  • Root cause: handleLengthProperty had no handler for method_call/call expression types — fell through to getStringLength which treated the array pointer as a string
  • Added type-aware dispatch for method call results: checks getVariableType on the generated result and routes to the correct array/string length getter

Test plan

  • New fixture arrays/filter-chain-length.ts — filter().length on both number[] and string[]
  • All tests pass (619 total)
  • Self-hosting verification passes

🤖 Generated with Claude Code

@cs01 cs01 merged commit 6dea9bf into main Mar 13, 2026
12 checks passed
@cs01 cs01 deleted the fix-chain-length branch March 19, 2026 05:23
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