We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
commit 8e3d5f0
This bug was found by @FiloSottile in https://go-review.googlesource.com/c/go/+/360015.
Here's a smaller testscript reproducer:
go run ./pkg1 -- go.mod -- module m go 1.18 -- pkg1/main.go -- package main import ( "fmt" "os" "reflect" "m/pkg2" "m/pkg3" ) func main() { i1 := pkg3.GetI() i2 := pkg2.Inst instEqual := i1 == i2 if !instEqual { v1, v2 := reflect.ValueOf(i1), reflect.ValueOf(i2) ptrEqual := v1.Pointer() == v2.Pointer() typeEqual := v1.Type() == v2.Type() if !ptrEqual { fmt.Printf("pointer values are unequal\n") } if !typeEqual { fmt.Printf("types are not equal\n\t%v\n\t%v\n", v1.Type(), v2.Type()) } os.Exit(1) } } -- pkg2/x.go -- package pkg2 import "m/pkg3" var Inst = pkg3.GetI() -- pkg3/x.go -- package pkg3 type I interface{} type impl[P any] struct{ _ byte } var instance = &impl[int]{} func GetI() I { return instance }
Running this prints the following:
> go run ./pkg1 [stdout] types are not equal *pkg3.impl[int] *pkg3.impl[int] [stderr] exit status 1
The values are not equal when they should be. The pointer values are identical but the types are not.
The text was updated successfully, but these errors were encountered:
is this the same as #49241 ?
Sorry, something went wrong.
I think it's the same issue, but @rogpeppe wrote a minimal reproducer, so perhaps this is still useful. cc @randall77 @griesemer
Yep, merging into #49241 which has more discussion, but thank you @rogpeppe for preparing a much better issue and reproducer.
No branches or pull requests
commit 8e3d5f0
This bug was found by @FiloSottile in https://go-review.googlesource.com/c/go/+/360015.
Here's a smaller testscript reproducer:
Running this prints the following:
The values are not equal when they should be. The pointer values are identical but the types are not.
The text was updated successfully, but these errors were encountered: