Skip to content

fix: end type cast at arithmetic/comparison operators - #25

Merged
JohnnyMorganz merged 4 commits into
mainfrom
claude/fix-issue-24-tdd-0AXOd
Apr 27, 2026
Merged

fix: end type cast at arithmetic/comparison operators#25
JohnnyMorganz merged 4 commits into
mainfrom
claude/fix-issue-24-tdd-0AXOd

Conversation

@JohnnyMorganz

Copy link
Copy Markdown
Owner

Highlighting was lost after a type cast when followed by arithmetic
operators like *, because lookAheadEndOfType didn't recognize those
operators as terminators for the type expression.

Add binary arithmetic operators (*, +, %, ^, /, //, ..,
-, ~=, ==) and logical keywords (and, or) to lookAheadEndOfType
so that expr::Type * value correctly ends the type cast at *.

Care is taken to avoid false positives:

  • -(?![->\])prevents matching--(comments) or->` (function types)
  • (?<!\.)\.\.(?!\.) prevents matching .. inside ... (variadics)

Fixes #24

claude added 3 commits April 19, 2026 09:54
Highlighting was lost after a type cast when followed by arithmetic
operators like `*`, because `lookAheadEndOfType` didn't recognize those
operators as terminators for the type expression.

Add binary arithmetic operators (`*`, `+`, `%`, `^`, `/`, `//`, `..`,
`-`, `~=`, `==`) and logical keywords (`and`, `or`) to `lookAheadEndOfType`
so that `expr::Type * value` correctly ends the type cast at `*`.

Care is taken to avoid false positives:
- `-(?![->\`])` prevents matching `--` (comments) or `->` (function types)
- `(?<!\.)\.\.(?!\.)` prevents matching `..` inside `...` (variadics)

Fixes #24
Break up the monolithic lookAheadEndOfType regex into named sub-variables
with comments explaining each group, making the grammar easier to read
and maintain.

https://claude.ai/code/session_01M3sgc87GoVj2GrtNsV9vdi
@JohnnyMorganz JohnnyMorganz changed the title fix: end type cast at arithmetic/comparison operators (issue #24) fix: end type cast at arithmetic/comparison operators Apr 20, 2026
"6.0" is not a valid value in TypeScript 5.1 (TS5103), causing CI failure.

https://claude.ai/code/session_01M3sgc87GoVj2GrtNsV9vdi
@JohnnyMorganz
JohnnyMorganz merged commit c7beb1f into main Apr 27, 2026
2 checks passed
@JohnnyMorganz
JohnnyMorganz deleted the claude/fix-issue-24-tdd-0AXOd branch April 27, 2026 06:47
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.

Highlighting is lost after type casting.

2 participants