Skip to content

Allow boolean literals as class method names#4606

Merged
nekevss merged 5 commits intoboa-dev:mainfrom
AlbertMarashi:claude/resolve-issue-4605-SWyvG
Feb 18, 2026
Merged

Allow boolean literals as class method names#4606
nekevss merged 5 commits intoboa-dev:mainfrom
AlbertMarashi:claude/resolve-issue-4605-SWyvG

Conversation

@AlbertMarashi
Copy link
Contributor

This Pull Request fixes #4605.

It changes the following:

  • Updated the class declaration parser to recognize BooleanLiteral tokens (true and false) as valid method names in class definitions
  • Added support for boolean literals in regular methods, static methods, and getter/setter declarations
  • Added comprehensive test cases covering:
    • Instance methods with boolean literal names
    • Static methods with boolean literal names
    • Getter and setter properties with boolean literal names
  • Added a formatting test to ensure proper parsing and formatting of classes with boolean literal method names

The parser now correctly handles the ECMAScript specification which allows reserved words like true, false, and null to be used as property names in class declarations.

The class element parser was missing `TokenKind::BooleanLiteral(_)` in
4 token kind pattern matches, preventing `true` and `false` from being
used as class method identifiers. The `PropertyName` parser already
handled boolean literals correctly, so only the dispatch patterns in
`class_decl/mod.rs` needed updating.

Fixes boa-dev#4605

https://claude.ai/code/session_017EhjrAqAAkwhGjQkH7uWZy
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,862 52,862 0
Passed 49,471 49,471 0
Ignored 2,249 2,249 0
Failed 1,142 1,142 0
Panics 0 0 0
Conformance 93.59% 93.59% 0.00%

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.61%. Comparing base (6ddc2b4) to head (09130ef).
⚠️ Report is 660 commits behind head on main.

Files with missing lines Patch % Lines
.../statement/declaration/hoistable/class_decl/mod.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4606      +/-   ##
==========================================
+ Coverage   47.24%   56.61%   +9.37%     
==========================================
  Files         476      547      +71     
  Lines       46892    60065   +13173     
==========================================
+ Hits        22154    34007   +11853     
- Misses      24738    26058    +1320     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

claude and others added 3 commits February 6, 2026 04:46
When the VM's `handle_error` encounters a catchable error, and there's
an exception handler in the current frame (e.g. the async module
evaluation handler), it was storing the error without capturing any
backtrace or position info. This meant errors like "not a callable
function" TypeErrors created in Rust code had no source location when
surfaced through module promise rejection.

Two changes:
1. Capture the backtrace at the top of `handle_error`, before checking
   for exception handlers, so it's always available.
2. Inject the caller position from the shadow stack into native errors
   that lack one. This position is preserved through the JsError →
   JS Error object → JsValue → JsError round-trip that occurs during
   promise rejection, since it's stored on the Error object's internal
   data.

https://claude.ai/code/session_017EhjrAqAAkwhGjQkH7uWZy
@AlbertMarashi
Copy link
Contributor Author

Sorry about those other commits... I didn't mean to include them in this PR. They were reverted.

@nekevss nekevss requested a review from a team February 17, 2026 22:16
@nekevss nekevss added the bug Something isn't working label Feb 17, 2026
Copy link
Member

@nekevss nekevss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@nekevss nekevss added this pull request to the merge queue Feb 18, 2026
Merged via the queue into boa-dev:main with commit 55fa3e9 Feb 18, 2026
18 checks passed
@jedel1043 jedel1043 added parser Issues surrounding the parser bug Something isn't working and removed bug Something isn't working labels Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working parser Issues surrounding the parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boa fails to parse reserved keyword class method identifiers

4 participants