0
1
mirror of https://github.com/golang/go synced 2025-09-29 13:22:42 +00:00
Files
go/test/fixedbugs/issue68526.dir/main.go
Cherry Mui 00a7bdcb55 all: delete aliastypeparams GOEXPERIMENT
Always enable aliastypeparams and remove the GOEXPERIMENT.

Change-Id: Ic38fe25b0bba312a7f83f7bb94b57ab75ce0f0c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/691956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-08-12 06:28:26 -07:00

44 lines
844 B
Go

// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"issue68526.dir/a"
)
func main() {
unexported()
exported()
}
func unexported() {
var want struct{ F int }
if any(want) != any(a.B{}) || any(want) != any(a.F()) {
panic("zero value of alias and concrete type not identical")
}
}
func exported() {
var (
astr a.A[string]
aint a.A[int]
)
if any(astr) != any(struct{ F string }{}) || any(aint) != any(struct{ F int }{}) {
panic("zero value of alias and concrete type not identical")
}
if any(astr) == any(aint) {
panic("zero value of struct{ F string } and struct{ F int } are not distinct")
}
if got := fmt.Sprintf("%T", astr); got != "struct { F string }" {
panic(got)
}
}