github.com/JimmyHuang454/JLS-go@v0.0.0-20230831150107-90d536585ba0/internal/types/testdata/fixedbugs/issue49739.go (about)

     1  // Copyright 2021 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  // Verify that we get an empty type set (not just an error)
     6  // when using an invalid ~A.
     7  
     8  package p
     9  
    10  type A int
    11  type C interface {
    12  	~ /* ERROR invalid use of ~ */ A
    13  }
    14  
    15  func f[_ C]()              {}
    16  func g[_ interface{ C }]() {}
    17  func h[_ C | int]()        {}
    18  
    19  func _() {
    20  	_ = f[int /* ERROR cannot satisfy C \(empty type set\) */]
    21  	_ = g[int /* ERROR cannot satisfy interface{C} \(empty type set\) */]
    22  	_ = h[int]
    23  }