...

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

Documentation: internal/types/testdata/fixedbugs

     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  package p
     6  
     7  func _[P int](x P) int {
     8  	return x // ERRORx `cannot use x .* as int value in return statement`
     9  }
    10  
    11  func _[P int]() int {
    12  	return P /* ERRORx `cannot use P\(1\) .* as int value in return statement` */ (1)
    13  }
    14  
    15  func _[P int](x int) P {
    16          return x // ERRORx `cannot use x .* as P value in return statement`
    17  }
    18  
    19  func _[P, Q any](x P) Q {
    20          return x // ERRORx `cannot use x .* as Q value in return statement`
    21  }
    22  
    23  // test case from issue
    24  func F[G interface{ uint }]() int {
    25  	f := func(uint) int { return 0 }
    26  	return f(G /* ERRORx `cannot use G\(1\) .* as uint value in argument to f` */ (1))
    27  }
    28  

View as plain text