Source file test/typeparam/issue48337b.dir/a.go
1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package a 6 7 type Container[T any] struct { 8 X T 9 } 10 11 func NewContainer[T any](x T) *Container[T] { 12 return &Container[T]{x} 13 } 14 15 type MetaContainer struct { 16 C *Container[Value] 17 } 18 19 type Value struct{} 20 21 func NewMetaContainer() *MetaContainer { 22 c := NewContainer(Value{}) 23 // c := &Container[Value]{Value{}} // <-- this works 24 return &MetaContainer{c} 25 } 26