From 889fc8b6a9e9d1b22de9690dc9892af8384a62a6 Mon Sep 17 00:00:00 2001 From: xushiwei Date: Sat, 4 May 2024 17:59:28 +0800 Subject: [PATCH] TestErrCompileValue --- cl/builtin_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cl/builtin_test.go b/cl/builtin_test.go index 4eb7ded8..e09aab97 100644 --- a/cl/builtin_test.go +++ b/cl/builtin_test.go @@ -25,6 +25,25 @@ import ( "golang.org/x/tools/go/ssa" ) +func TestErrCompileValue(t *testing.T) { + defer func() { + if r := recover(); r != "can't use llgo instruction as a value" { + t.Fatal("TestErrCompileValue:", r) + } + }() + pkg := types.NewPackage("foo", "foo") + ctx := &context{ + goTyps: pkg, + link: map[string]string{ + "foo.": "llgo.unreachable", + }, + } + ctx.compileValue(nil, &ssa.Function{ + Pkg: &ssa.Package{Pkg: pkg}, + Signature: types.NewSignatureType(nil, nil, nil, nil, nil, false), + }) +} + func TestErrCompileInstrOrValue(t *testing.T) { defer func() { if r := recover(); r == nil {