diff --git a/test/escape_iface_with_devirt_type_assertions.go b/test/escape_iface_with_devirt_type_assertions.go index abc72a9641d1ce..bf7cdfc052a178 100644 --- a/test/escape_iface_with_devirt_type_assertions.go +++ b/test/escape_iface_with_devirt_type_assertions.go @@ -119,6 +119,14 @@ func t2() { callA(a) // ERROR "devirtualizing" "inlining call" callIfA(a) // ERROR "devirtualizing" "inlining call" } + + { + var a M = &Impl{} // ERROR "does not escape" + // Note the !ok condition, devirtualizing here is fine. + if v, ok := a.(M); !ok { + v.M() // ERROR "devirtualizing" "inlining call" + } + } } func newM() M { // ERROR "can inline"