Skip to content

Fix parsing of as/satisfies between ** operators#4676

Open
magic-akari wants to merge 1 commit into
microsoft:mainfrom
magic-akari:fix/error-unerasable-exponentiation
Open

Fix parsing of as/satisfies between ** operators#4676
magic-akari wants to merge 1 commit into
microsoft:mainfrom
magic-akari:fix/error-unerasable-exponentiation

Conversation

@magic-akari

Copy link
Copy Markdown
Contributor

Follow-up to #4192.

Accounts for ** being right-associative when rejecting as/satisfies expressions that cannot be safely erased. Adds regression coverage for direct and chained forms.

@magic-akari
magic-akari marked this pull request as ready for review July 20, 2026 03:57
Copilot AI review requested due to automatic review settings July 20, 2026 03:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes unsafe erasure of as and satisfies between right-associative exponentiation operators.

Changes:

  • Centralizes binary-operator consumption logic.
  • Handles equal-precedence ** operators correctly.
  • Adds direct and chained regression coverage.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/parser/parser.go Accounts for exponentiation associativity during parsing.
testdata/tests/cases/compiler/disallowUnerasableAssertion.ts Adds regression cases.
testdata/baselines/reference/compiler/disallowUnerasableAssertion.errors.txt Captures expected diagnostics.
testdata/baselines/reference/compiler/disallowUnerasableAssertion.js Captures JavaScript emit.
testdata/baselines/reference/compiler/disallowUnerasableAssertion.symbols Updates symbol baselines.
testdata/baselines/reference/compiler/disallowUnerasableAssertion.types Updates type baselines.

@jakebailey
jakebailey requested a review from ahejlsberg July 21, 2026 15:10
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.

as/satisfies between exponentiation operators cannot be safely erased

3 participants