Source file src/internal/types/testdata/fixedbugs/issue39755.go

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

View as plain text