| 1 |
// run |
| 2 |
|
| 3 |
// Copyright 2025 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
package main |
| 8 |
|
| 9 |
type SourceRange struct { |
| 10 |
x, y int |
| 11 |
} |
| 12 |
|
| 13 |
func (r *SourceRange) String() string { |
| 14 |
return "hello" |
| 15 |
} |
| 16 |
|
| 17 |
type SourceNode interface { |
| 18 |
SourceRange() |
| 19 |
} |
| 20 |
|
| 21 |
type testNode SourceRange |
| 22 |
|
| 23 |
func (tn testNode) SourceRange() { |
| 24 |
} |
| 25 |
|
| 26 |
func main() { |
| 27 |
n := testNode(SourceRange{}) // zero value |
| 28 |
Errorf(n) |
| 29 |
} |
| 30 |
|
| 31 |
//go:noinline |
| 32 |
func Errorf(n SourceNode) { |
| 33 |
n.SourceRange() |
| 34 |
} |