// run | |
// Copyright 2020 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 | |
type T[A any] struct { | |
V A | |
} | |
type S1 struct { | |
T[int] | |
V string | |
} | |
type Tint = T[int] | |
type Tbool = T[bool] | |
type S2 struct { | |
Tint | |
Tbool | |
V string | |
} | |
type S3 struct { | |
*T[int] | |
} | |
func main() { | |
var s1 S1 | |
if s1.T.V != 0 { | |
panic(s1) | |
} | |
var s2 S2 | |
if s2.Tint.V != 0 || s2.Tbool.V { | |
panic(s2) | |
} | |
var s3 S3 | |
if s3.T != nil { | |
panic(s3) | |
} | |
} |