Skip to content

Port "Narrow types by typeof operands with extra parenthesis" #1045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Jun 4, 2025

@Copilot Copilot AI review requested due to automatic review settings June 4, 2025 14:30
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ports changes from a TypeScript pull request to improve the handling of extra parentheses in narrowing type checks.

  • Updates expected outputs in test baselines for narrowing types when extra parentheses are used.
  • Modifies operand evaluation in the binder to use ast.SkipParentheses, ensuring consistency in narrowing binary expressions.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
testdata/baselines/reference/submodule/compiler/narrowingTypeofParenthesized1.types.diff Adjusts expected diff output to reflect updated narrowing type behavior.
testdata/baselines/reference/submodule/compiler/narrowingTypeofParenthesized1.types Updates test baseline results to align with new narrowing outcomes.
internal/binder/binder.go Refines narrowing operand evaluation by stripping extra parentheses using ast.SkipParentheses.

@jakebailey jakebailey added this pull request to the merge queue Jun 4, 2025
Merged via the queue into microsoft:main with commit b32c5ae Jun 4, 2025
23 checks passed
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.

2 participants