Skip to content
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

go/types, types2: signature recorded for cap/len built in calls incorrectly uses underlying type of argument #51055

Closed
griesemer opened this issue Feb 7, 2022 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

Type-checking a call of the built-in function cap or len records the signature of the respective function for the actual arguments provided; the type can be found in in the Info.Types map supplied to the the type checker through its API.

The type recorded for these two functions uses the argument's underlying type rather than it's actual type. For instance, given

type List []int
var a List
var n = len(a)

records the signature func ([]int) int. It should record func(List) int instead.

@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 7, 2022
@griesemer griesemer added this to the Go1.18 milestone Feb 7, 2022
@griesemer griesemer self-assigned this Feb 7, 2022
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/383474 mentions this issue: go/types, types2: record correct argument type for cap, len

@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants