...

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

Documentation: internal/types/testdata/fixedbugs

     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 "incomparable types in type set" */ == x
    27  	_ = x /* ERROR "incomparable types in type set" */ == y
    28  	_ = y /* ERROR "incomparable types in type set" */ == x
    29  	_ = y /* ERROR "incomparable types in type set" */ == 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 "incomparable types in type set" */ == x
    36  	_ = x /* ERROR "incomparable types in type set" */ == y
    37  	_ = y == x // ERROR "incomparable types in type set"
    38  	_ = y == y
    39  
    40  	_ = x /* ERROR "type parameter P is not comparable with <" */ < y
    41  }
    42  

View as plain text