Text file src/go/types/testdata/fixedbugs/issue48712.go2

     1  // Copyright 2022 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 _[P comparable](x, y P) {
     8  	_ = x == x
     9  	_ = x == y
    10  	_ = y == x
    11  	_ = y == y
    12  
    13  	_ = x /* ERROR type parameter P is not comparable with < */ < y
    14  }
    15  
    16  func _[P comparable](x P, y any) {
    17  	_ = x == x
    18  	_ = x == y
    19  	_ = y == x
    20  	_ = y == y
    21  
    22  	_ = x /* ERROR type parameter P is not comparable with < */ < y
    23  }
    24  
    25  func _[P any](x, y P) {
    26  	_ = x /* ERROR type parameter P is not comparable with == */ == x
    27  	_ = x /* ERROR type parameter P is not comparable with == */ == y
    28  	_ = y /* ERROR type parameter P is not comparable with == */ == x
    29  	_ = y /* ERROR type parameter P is not comparable with == */ == y
    30  
    31  	_ = x /* ERROR type parameter P is not comparable with < */ < y
    32  }
    33  
    34  func _[P any](x P, y any) {
    35  	_ = x /* ERROR type parameter P is not comparable with == */ == x
    36  	_ = x /* ERROR type parameter P is not comparable with == */ == y
    37  	_ = y == x // ERROR type parameter P is not comparable with ==
    38  	_ = y == y
    39  
    40  	_ = x /* ERROR type parameter P is not comparable with < */ < y
    41  }
    42  

View as plain text