| 1 |
// compile |
| 2 |
|
| 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 |
|
| 9 |
package p |
| 10 |
|
| 11 |
func _[T interface{ ~map[string]int }](x T) { |
| 12 |
_ = x == nil |
| 13 |
} |
| 14 |
|
| 15 |
// simplified test case from issue |
| 16 |
|
| 17 |
type PathParamsConstraint interface { |
| 18 |
~map[string]string | ~[]struct{ key, value string } |
| 19 |
} |
| 20 |
|
| 21 |
type PathParams[T PathParamsConstraint] struct { |
| 22 |
t T |
| 23 |
} |
| 24 |
|
| 25 |
func (pp *PathParams[T]) IsNil() bool { |
| 26 |
return pp.t == nil // this must succeed |
| 27 |
} |