| 1 |
// Copyright 2025 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 _() { |
| 8 |
f(foo /* ERROR "undefined: foo" */) // ERROR "not enough arguments in call to f\n\thave (unknown type)\n\twant (int, int)" |
| 9 |
} |
| 10 |
|
| 11 |
func f(_, _ int) {} |
| 12 |
|
| 13 |
// test case from issue |
| 14 |
|
| 15 |
type S struct{} |
| 16 |
|
| 17 |
func (S) G() {} |
| 18 |
|
| 19 |
func main() { |
| 20 |
var s S |
| 21 |
_ = must(s.F /* ERROR "s.F undefined" */ ()) // ERROR "not enough arguments in call to must\n\thave (unknown type)\n\twant (T, error)" |
| 22 |
} |
| 23 |
|
| 24 |
func must[T any](x T, err error) T { |
| 25 |
if err != nil { |
| 26 |
panic(err) |
| 27 |
} |
| 28 |
return x |
| 29 |
} |