Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Go: Avoid using deprecated class #19882

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
merged 1 commit into from
Jun 26, 2025

Conversation

owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Jun 26, 2025

Go: Improve two class names and add some helper predicates and Go: fix DefinedType.getBaseType got merged in quick succession, without rerunning CI. One deprecated a class and the other introduced a new use of it. This means that the CI job checking that all queries compile is not happy. This PR fixes the issue by updating the new use of the deprecated class to use the replacement class instead.

@Copilot Copilot AI review requested due to automatic review settings June 26, 2025 00:48
@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label Jun 26, 2025
@owen-mc owen-mc requested a review from a team as a code owner June 26, 2025 00:48
@github-actions github-actions bot added the Go label Jun 26, 2025
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 replaces the deprecated DeclaredType cast in getBaseType() with the new DeclaredTypeEntity, ensuring no use of the old class remains in the Go library.

  • Updated the cast in getBaseType() from DeclaredType to DeclaredTypeEntity.
  • Reformatted the method body to block style.
Comments suppressed due to low confidence (2)

go/ql/lib/semmle/go/Types.qll:1048

  • [nitpick] Consider adding a unit test to verify that getBaseType() behaves correctly with DeclaredTypeEntity and that unchanged behavior remains for external-package types.
    result = this.getEntity().(DeclaredTypeEntity).getSpec().getTypeExpr().getType()

go/ql/lib/semmle/go/Types.qll:1048

  • Ensure that DeclaredTypeEntity is properly imported or fully qualified so that the cast compiles successfully.
    result = this.getEntity().(DeclaredTypeEntity).getSpec().getTypeExpr().getType()

@jcogs33 jcogs33 merged commit aa65f54 into github:main Jun 26, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Go no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants