Skip to content

Fix checkGrammarForInvalidDynamicName #1063

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 5, 2025

fixes #983

@Copilot Copilot AI review requested due to automatic review settings June 5, 2025 10:35
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 fixes the behavior of checkGrammarForInvalidDynamicName by inverting the condition that determines when to trigger a grammar error, and updates several baseline error outputs accordingly.

  • In grammarchecks.go, the condition is inverted to correctly handle dynamic names.
  • Multiple test baseline error files were updated to reflect the corrected error messages.

Reviewed Changes

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

Show a summary per file
File Description
testdata/baselines/reference/submodule/compiler/overloadsWithComputedNames.errors.txt Baseline error count reduced and updated error messages.
testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsClasses.errors.txt* Updated error message baselines for computed property name issues.
testdata/baselines/reference/submodule/compiler/indexWithoutParamType2.errors.txt* Updated error message baselines.
testdata/baselines/reference/submodule/compiler/indexSignatureMustHaveTypeAnnotation.errors.txt* Updated error message baselines.
testdata/baselines/reference/submodule/compiler/decoratorsOnComputedProperties.errors.txt* Updated error message baselines related to decorators and computed properties.
testdata/baselines/reference/submodule/compiler/declarationEmit* Baseline updates for declaration emit errors.
testdata/baselines/reference/submodule/compiler/complicatedPrivacy.errors.txt* Baseline update for complicated privacy errors.
testdata/baselines/reference/submodule/compiler/capturedParametersInInitializers2.errors.txt* Baseline update for captured parameter errors.
internal/checker/grammarchecks.go Fixed logic in checkGrammarForInvalidDynamicName to correctly handle dynamic names.

(* Asterisk indicates multiple related baseline diff files.)

Comments suppressed due to low confidence (1)

internal/checker/grammarchecks.go:1422

  • Consider adding an inline comment to explain the inversion of this condition, clarifying that grammar errors should only be triggered for nodes that are bindable dynamic names. This will aid future maintainers in understanding the purpose of the change.
if !c.isNonBindableDynamicName(node) {

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

Issue with symbol - computed property name error
2 participants