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