| 1 |
// errorcheck -0 -m |
| 2 |
|
| 3 |
// Copyright 2023 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 p |
| 8 |
|
| 9 |
// Test that inlining doesn't break if devirtualization exposes a new |
| 10 |
// inlinable callee. |
| 11 |
|
| 12 |
func f() { // ERROR "can inline f" |
| 13 |
var i interface{ m() } = T(0) // ERROR "T\(0\) does not escape" |
| 14 |
i.m() // ERROR "devirtualizing i.m" "inlining call to T.m" "inlining call to f" "T\(0\) does not escape" |
| 15 |
} |
| 16 |
|
| 17 |
type T int |
| 18 |
|
| 19 |
func (T) m() { // ERROR "can inline T.m" |
| 20 |
if never { |
| 21 |
f() // ERROR "inlining call to f" "devirtualizing i.m" "T\(0\) does not escape" "inlining call to T.m" |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
var never bool |