1
2
3
4
5
6
7 package main
8
9 import (
10 "fmt"
11
12 "issue68526.dir/a"
13 )
14
15 func main() {
16 unexported()
17 exported()
18 }
19
20 func unexported() {
21 var want struct{ F int }
22
23 if any(want) != any(a.B{}) || any(want) != any(a.F()) {
24 panic("zero value of alias and concrete type not identical")
25 }
26 }
27
28 func exported() {
29 var (
30 astr a.A[string]
31 aint a.A[int]
32 )
33
34 if any(astr) != any(struct{ F string }{}) || any(aint) != any(struct{ F int }{}) {
35 panic("zero value of alias and concrete type not identical")
36 }
37
38 if any(astr) == any(aint) {
39 panic("zero value of struct{ F string } and struct{ F int } are not distinct")
40 }
41
42 if got := fmt.Sprintf("%T", astr); got != "struct { F string }" {
43 panic(got)
44 }
45 }
46
View as plain text