Go version
go1.21.4 (playground). Also any version since Go 1.18.
What operating system and processor architecture are you using (go env)?
What did you do?
https://go.dev/play/p/_OT3OvSlSeg
package main
type I interface{}
type T struct{ X *I }
var i I
var t = T{i}
func main() {}
Compile this code.
What did you expect to see?
./i.go:7:11: cannot use i (type I) as type *I in field value:
*I is pointer to interface, not interface
This is what Go 1.17 and before emit.
What did you see instead?
./i.go:7:11: cannot use i (variable of type I) as *I value in struct literal: I does not implement *I (type *I is pointer to interface, not interface)
Specifically, it contains I does not implement *I. In the spec "implements" is only used for implementing an interface or a type constraint. There is no "implementing a pointer to an interface". So this does not implement *I is confusing. We probably want to remove it.
Go version
go1.21.4 (playground). Also any version since Go 1.18.
What operating system and processor architecture are you using (
go env)?What did you do?
https://go.dev/play/p/_OT3OvSlSeg
Compile this code.
What did you expect to see?
This is what Go 1.17 and before emit.
What did you see instead?
Specifically, it contains
I does not implement *I. In the spec "implements" is only used for implementing an interface or a type constraint. There is no "implementing a pointer to an interface". So thisdoes not implement *Iis confusing. We probably want to remove it.