From ae92904e7d23f5ea544611795e5868fdaa854e1c Mon Sep 17 00:00:00 2001 From: Li Jie Date: Thu, 13 Feb 2025 11:35:46 +0800 Subject: [PATCH] ssa: show type assertion failed details --- compiler/ssa/interface.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ssa/interface.go b/compiler/ssa/interface.go index efdde84b..19321b23 100644 --- a/compiler/ssa/interface.go +++ b/compiler/ssa/interface.go @@ -278,7 +278,7 @@ func (b Builder) TypeAssert(x Expr, assertedTyp Type, commaOk bool) Expr { blks := b.Func.MakeBlocks(2) b.If(eq, blks[0], blks[1]) b.SetBlockEx(blks[1], AtEnd, false) - b.Panic(b.MakeInterface(b.Prog.Any(), b.Str("type assertion failed"))) + b.Panic(b.MakeInterface(b.Prog.Any(), b.Str("type assertion "+x.RawType().String()+" -> "+assertedTyp.RawType().String()+" failed"))) b.SetBlockEx(blks[0], AtEnd, false) b.blk.last = blks[0].last return val()