1// run 2 3// Copyright 2024 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 7package main 8 9func main() { 10 test1() 11 test2() 12} 13 14type I interface { 15 f() 16 g() 17 h() 18} 19 20//go:noinline 21func ld[T any]() { 22 var x I 23 if _, ok := x.(T); ok { 24 } 25} 26 27func isI(x any) { 28 _ = x.(I) 29} 30 31func test1() { 32 defer func() { recover() }() 33 ld[bool]() // add <bool,I> itab to binary 34 _ = any(false).(I) 35} 36 37type B bool 38 39func (B) f() { 40} 41func (B) g() { 42} 43 44func test2() { 45 defer func() { recover() }() 46 ld[B]() // add <B,I> itab to binary 47 _ = any(B(false)).(I) 48} 49