blob: 52c7e7c6527c1856ca7fcfcc41192975fb6d4e85 [file] [log] [blame]
Matthew Dempskye24977d2022-02-28 14:32:19 -08001// compile
Dan Scalesed9e1092021-07-11 13:06:54 -07002
3// Copyright 2020 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7// copied from cmd/compile/internal/types2/testdata/fixedbugs/issue39755.go
8
9package p
10
Matthew Dempsky53557532021-07-28 13:39:30 -070011func _[T interface{ ~map[string]int }](x T) {
Dan Scalesed9e1092021-07-11 13:06:54 -070012 _ = x == nil
13}
14
15// simplified test case from issue
16
17type PathParamsConstraint interface {
Matthew Dempsky53557532021-07-28 13:39:30 -070018 ~map[string]string | ~[]struct{ key, value string }
Dan Scalesed9e1092021-07-11 13:06:54 -070019}
20
21type PathParams[T PathParamsConstraint] struct {
22 t T
23}
24
25func (pp *PathParams[T]) IsNil() bool {
26 return pp.t == nil // this must succeed
27}