Files
llgo/cl/_testgo
xgopilot 88d32c9930 fix(ssa): correct PkgPath for interface metadata in cross-package conversions
Fixes #1370 - Segmentation Fault When Calling Interface Private Methods Cross-Package

This commit fixes a critical bug where interface metadata's PkgPath was incorrectly
set when converting concrete type pointers to interfaces with private methods across
package boundaries.

Problem:
- When a concrete type pointer was converted to an interface with private methods
  in a package different from the interface definition package, the compiler
  incorrectly set the interface metadata's PkgPath to the current compilation
  package instead of the interface definition package
- This caused the runtime to only fill exported methods in the itab, leaving
  private method slots as NULL (0x0), resulting in segmentation faults

Solution:
- Modified abiInterfaceOf() in ssa/abitype.go to extract the package path from
  the interface's private methods (if any)
- Use that package path instead of the current compilation package path
- Fall back to current package path only if all methods are exported

Changes:
- ssa/abitype.go: Use abi.PathOf() to get correct package path
- ssa/interface.go: Refactor to simplify interface type handling
- Added comprehensive test cases and demos for go/types, go/token, and go/ast
- Updated all test outputs to reflect correct interface metadata generation

This fix resolves segmentation faults when using Go standard library interfaces
and user-defined interfaces with private methods across package boundaries.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
2025-10-30 06:24:23 +00:00
..
2025-05-05 10:19:23 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-09-25 20:16:44 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-09-25 20:16:44 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-05-05 10:19:23 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00
2025-04-03 16:26:11 +08:00