Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
Change-Id: Ic0453367df8032afedd048916c9292eafd75c2f3
  • Loading branch information
mateusz834 committed Feb 14, 2025
1 parent 7534480 commit 291add4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/escape_iface_with_devirt_type_assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 291add4

Please sign in to comment.