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

cmd/compile: spurious inference error with undefined value #60434

Open
rsc opened this issue May 25, 2023 · 4 comments
Open

cmd/compile: spurious inference error with undefined value #60434

rsc opened this issue May 25, 2023 · 4 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented May 25, 2023

% cat /tmp/x.go
package p

import "slices"

var s struct{ x int }

func _() {
	slices.Clip(s.y)
}
% go build /tmp/x.go
# command-line-arguments
/tmp/x.go:8:13: cannot infer S ($GOROOT/src/slices/slices.go:403:11)
/tmp/x.go:8:16: s.y undefined (type struct{x int} has no field or method y)
% 

The first error should not be printed, since it is caused by the second error.

@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label May 25, 2023
@rsc rsc added this to the Go1.22 milestone May 25, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label May 25, 2023
@gyanendrasng
Copy link

Hi, can I try fixing it? I am new to GO, not sure if I will be able to anyways

@gyanendrasng
Copy link

Dont wanna sound dumb, but should I look into the slices package or some other package to get a fix?

@macrombilux
Copy link

macrombilux commented May 28, 2023 via email

@griesemer
Copy link
Contributor

@gyanendrasng This is a compiler issue; the only relation to the slices package is that the example uses slices. I prefer fixing this myself - also this is not urgent. But thanks for offer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants