Skip to content

fix: typeof returns 'boolean' for boolean variables instead of 'number'#244

Merged
cs01 merged 2 commits intomainfrom
fix/typeof-boolean
Mar 11, 2026
Merged

fix: typeof returns 'boolean' for boolean variables instead of 'number'#244
cs01 merged 2 commits intomainfrom
fix/typeof-boolean

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 11, 2026

Summary

  • typeof boolVar now correctly returns "boolean" instead of "number"
  • Boolean variables were tracked as SymbolKind.Number in the variable allocator — changed to SymbolKind.Boolean in all allocation paths (null-initialized, declared-type, and literal-initialized)
  • Added isBoolean() check in generateTypeof() so typeof dispatches correctly for boolean variables
  • Fixed duplicate isComparisonOp function name collision between templates.ts and concatenation.ts that broke self-hosting

Test plan

  • New test fixture types/typeof-boolean.ts covers literal booleans, boolean variables, and comparison results
  • All existing tests pass
  • Self-hosting Stage 1 passes

@cs01 cs01 merged commit 237cc97 into main Mar 11, 2026
12 checks passed
@cs01 cs01 deleted the fix/typeof-boolean 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