Matthew Dempsky | e24977d | 2022-02-28 14:32:19 -0800 | [diff] [blame] | 1 | // compile |
Dan Scales | ed9e109 | 2021-07-11 13:06:54 -0700 | [diff] [blame] | 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 | |
Matthew Dempsky | 5355753 | 2021-07-28 13:39:30 -0700 | [diff] [blame] | 11 | func _[T interface{ ~map[string]int }](x T) { |
Dan Scales | ed9e109 | 2021-07-11 13:06:54 -0700 | [diff] [blame] | 12 | _ = x == nil |
| 13 | } |
| 14 | |
| 15 | // simplified test case from issue |
| 16 | |
| 17 | type PathParamsConstraint interface { |
Matthew Dempsky | 5355753 | 2021-07-28 13:39:30 -0700 | [diff] [blame] | 18 | ~map[string]string | ~[]struct{ key, value string } |
Dan Scales | ed9e109 | 2021-07-11 13:06:54 -0700 | [diff] [blame] | 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 | } |