Files
llgo/_demo/go/issue1370_case2/main.go
xgopilot b62dafbc3a fix(ssa): use abi.PathOf() for correct package path in interface metadata
Fixes os.ReadDir segfault caused by package path mismatch between llgo
overlay packages and canonical standard library paths.

The issue occurred in: os.ReadDir → sort.Slice → reflectlite.Swapper
where internal/reflectlite.Type interface has private methods common()
and uncommon(). Using mPkg.Path() returned the overlay path
'github.com/goplus/llgo/runtime/internal/lib/internal/reflectlite'
instead of the canonical 'internal/reflectlite', causing runtime to
only fill public methods and leave private method pointers NULL.

Changed to use abi.PathOf() which returns the correct canonical package
path for matching, ensuring all interface methods (both public and
private) are properly filled in the interface table.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 11:32:38 +00:00

21 lines
323 B
Go

package main
import (
"fmt"
"go/ast"
"go/token"
)
func main() {
ident := &ast.Ident{
NamePos: token.Pos(1),
Name: "foo",
}
var expr ast.Expr = ident
fmt.Printf("Identifier: %s\n", ident.Name)
fmt.Printf("Position: %d\n", expr.Pos())
println("SUCCESS: ast.Expr interface conversion works correctly")
}