-
Notifications
You must be signed in to change notification settings - Fork 18k
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: invalid field name *** in struct initializer #50848
Comments
This seems to be fixed at tip. Can you try that to verify, or we should have beta2 out in a few days which should also have this fixed. |
Because this seems to be fixed, not marking as a release blocker. Waiting for info from OP to verify that it's fixed at tip. |
I compiled go from git master and the issue remains $ go version
go version devel go1.18-9ff0039848 Fri Jan 28 02:40:34 2022 +0000 darwin/amd64
$ go test
# github.com/reasno/go1.18beta1bug_test [github.com/reasno/go1.18beta1bug.test]
./main.go:10:24: invalid field name bar.field in struct initializer
FAIL github.com/reasno/go1.18beta1bug [build failed] |
I can't get it to fail at tip (@9ff00398489d9eb1822b3de028cd6ccf5674ebb3) but I can at 1.18beta1. Just to be clear I have a directory go.mod:
issue50848_test.go:
and a directory
Which gives:
( |
Looks like you are right. My IDE has Thanks for the hard work. |
What version of Go are you using (
go version
)?go 1.18beta1
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
when I was playing with generics I discovered a subtle (possible) compiler bug.
go1.18beta1 vet
andgo1.18beta1 build
gives me no complaint but thego1.18beta1 test
failed out of no good reason.The offending code is isolated in https://github.com/Reasno/go1.18beta1bug.
The code with generic:
and the test file:
What did you expect to see?
The
go1.18beta1 test
compilation should be green.What did you see instead?
go1.18beta1 test
rants: ../main.go:10:24: invalid field name bar.field in struct initializerThe text was updated successfully, but these errors were encountered: