test(cl): add test case for go/types Scope.Insert

Add LLVM IR test case for cross-package interface private method calls
using go/types.Scope.Insert. This test verifies the fix in PR #1371
by checking the generated LLVM IR includes correct package path for
interface metadata with private methods.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
This commit is contained in:
xgopilot
2025-10-23 10:59:14 +00:00
parent 816854c9cc
commit 05b382fe64
2 changed files with 2952 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package main
import (
"go/token"
"go/types"
)
func main() {
pkg := types.NewPackage("example", "example")
scope := pkg.Scope()
obj := types.NewVar(token.NoPos, pkg, "testVar", types.Typ[types.Int])
insertedObj := scope.Insert(obj)
if insertedObj != nil {
println("ERROR: Variable already exists in scope")
return
}
lookup := scope.Lookup("testVar")
if lookup == nil {
println("ERROR: Failed to lookup variable")
return
}
if lookup.Name() != "testVar" {
println("ERROR: Wrong variable name")
return
}
println("SUCCESS: Scope.Insert and Lookup work correctly")
}

File diff suppressed because it is too large Load Diff