type I[T IConstraint] struct {
}
-
-// The following types form an even more complex recursion (through two type
-// constraints), and model the actual types in the issue (#51219) more closely.
-// However, they don't reveal any new issue. But it seems useful to leave this
-// complex set of types in a test in case it might be broken by future changes.
-
-type Message struct {
- Interaction *Interaction[JsonRaw] `json:"interaction,omitempty"`
-}
-
-type ResolvedDataConstraint interface {
- User | Message
-}
-
-type Snowflake uint64
-
-type ResolvedData[T ResolvedDataConstraint] map[Snowflake]T
-
-type User struct {
-}
-
-type Resolved struct {
- Users ResolvedData[User] `json:"users,omitempty"`
-}
-
-type resolvedInteractionWithOptions struct {
- Resolved Resolved `json:"resolved,omitempty"`
-}
-
-type UserCommandInteractionData struct {
- resolvedInteractionWithOptions
-}
-
-type InteractionDataConstraint interface {
- JsonRaw | UserCommandInteractionData
-}
-
-type Interaction[DataT InteractionDataConstraint] struct {
-}
import (
"a"
- "b"
"fmt"
)
func main() {
var x a.I[a.JsonRaw]
- var y b.InteractionRequest[a.JsonRaw]
- fmt.Printf("%v %v\n", x, y)
+ fmt.Printf("%v\n", x)
}
--- /dev/null
+// Copyright 2022 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 a
+
+type Interaction[DataT InteractionDataConstraint] struct {
+}
+
+type InteractionDataConstraint interface {
+ []byte |
+ UserCommandInteractionData
+}
+
+type UserCommandInteractionData struct {
+ resolvedInteractionWithOptions
+}
+
+type resolvedInteractionWithOptions struct {
+ Resolved Resolved `json:"resolved,omitempty"`
+}
+
+type Resolved struct {
+ Users ResolvedData[User] `json:"users,omitempty"`
+}
+
+type ResolvedData[T ResolvedDataConstraint] map[uint64]T
+
+type ResolvedDataConstraint interface {
+ User | Message
+}
+
+type User struct{}
+
+type Message struct {
+ Interaction *Interaction[[]byte] `json:"interaction,omitempty"`
+}
package b
-import "a"
+import (
+ "./a"
+)
+// InteractionRequest is an incoming request Interaction
type InteractionRequest[T a.InteractionDataConstraint] struct {
a.Interaction[T]
}
--- /dev/null
+// Copyright 2022 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 p
+
+import (
+ "./b"
+)
+
+// ResponseWriterMock mocks corde's ResponseWriter interface
+type ResponseWriterMock struct {
+ x b.InteractionRequest[[]byte]
+}
--- /dev/null
+// compiledir -G=3
+
+// Copyright 2022 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 ignored