Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Go: Make type param test independent of standard library version #19532

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 1 commit into
base: main
Choose a base branch
Loading
from

Conversation

owen-mc
Copy link
Contributor

@owen-mc owen-mc commented May 20, 2025

This will make the test results not depend on the version of the standard library being used, which means we don't have to update it with each new release.

@Copilot Copilot AI review requested due to automatic review settings May 20, 2025 01:19
@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label May 20, 2025
@owen-mc owen-mc requested a review from a team as a code owner May 20, 2025 01:19
@github-actions github-actions bot added the Go label May 20, 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 adjusts the type parameter test so it only counts entities with source locations, preventing standard library additions from affecting results.

  • Adds an exists(ty.getLocation()) check to the query predicate to filter out stdlib types without location metadata.
  • Cleans up the expected output by removing entries for standard library functions.

Reviewed Changes

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

File Description
go/ql/test/library-tests/semmle/go/Function/TypeParamType.ql Added location-existence filter and comment explaining it
go/ql/test/library-tests/semmle/go/Function/TypeParamType.expected Removed unsupported standard library entries

Comment on lines 11 to 12
// Note that we cannot use the location of `ty` itself as we currently fail
// to extract an object for type parameters for methods on generic structs.
Copy link
Preview

Copilot AI May 20, 2025

Choose a reason for hiding this comment

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

[nitpick] The comment suggests ty.getLocation() isn’t usable, yet the code now depends on it. Please update the comment to accurately describe why we require exists(ty.getLocation()).

Suggested change
// Note that we cannot use the location of `ty` itself as we currently fail
// to extract an object for type parameters for methods on generic structs.
// We use `exists(ty.getLocation())` to ensure that `ty` has a valid location.
// This is necessary because type parameters for methods on generic structs
// may not always have an associated location in certain cases.

Copilot uses AI. Check for mistakes.

Positive FeedbackNegative Feedback
Copy link
Contributor Author

@owen-mc owen-mc May 20, 2025

Choose a reason for hiding this comment

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

This made me realise I wrote ty instead of tpt. I've force-pushed a fix to the comment.

This will make the test results not depend on the version of the
standard library being used, which means we don't have to update it with
each new release.
@owen-mc owen-mc force-pushed the go/make-test-version-independent branch from 80999d9 to f6f6a5c Compare May 20, 2025 01:25
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.

1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.