Skip to content

Go: Improve two class names and add some helper predicates #19677

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

owen-mc
Copy link
Contributor

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

This pull request introduces deprecations and enhancements to the Go QL library, focusing on improving the link between declarations and the things that have been declared. Key changes include the deprecation of BuiltinType and DeclaredType in favor of new replacements, the addition of new methods for going from type and field declarations to the type and fields that have been declared, and updates to tests.

@Copilot Copilot AI review requested due to automatic review settings June 5, 2025 10:02
@owen-mc owen-mc requested a review from a team as a code owner June 5, 2025 10:02
@owen-mc owen-mc requested a review from jeongsoolee09 June 5, 2025 10:02
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 renames two core QL classes to better reflect their roles, deprecates the old names, and adds helper methods and predicates to navigate between declarations and the entities they declare.

  • Rename DeclaredTypeDeclaredTypeEntity and BuiltinTypeBuiltinTypeEntity, with deprecated aliases for backward compatibility.
  • Introduce new methods on TypeSpec (getDeclaredType, getRhsType) and on FieldDecl (getField, isEmbedded), plus updated docs.
  • Update library tests to exercise the new helpers and adjust expected outputs accordingly.

Reviewed Changes

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

Show a summary per file
File Description
go/ql/test/library-tests/semmle/go/Types/FieldDecl.ql Added test predicates for getField and isEmbedded.
go/ql/test/library-tests/semmle/go/Types/FieldDecl.expected Updated expected output to include the new field declaration tests.
go/ql/test/library-tests/semmle/go/Decl/TypeSpec.ql Expanded select to output getDeclaredType and getRhsType.
go/ql/test/library-tests/semmle/go/Decl/TypeSpec.expected Adjusted expected columns to match the expanded select clause.
go/ql/lib/semmle/go/Scopes.qll Renamed DeclaredType/BuiltinType classes to *Entity versions and added deprecated aliases; updated builtin type generators.
go/ql/lib/semmle/go/Decls.qll Added getDeclaredType, getRhsType, getField, isEmbedded methods and updated related documentation.
go/ql/lib/change-notes/2025-06-05-deprecate-DeclaredType-BuiltinType.md Documented deprecation of the old class names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant