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>
21 lines
323 B
Go
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")
|
|
}
|