Files
llgo/cl/_testgo/interface1370/out.ll
xgopilot 05da9ec252 fix: preserve Named interface type information through interface construction
This commit addresses the root cause identified in issue #1370 by preserving
Named interface type information through the interface construction phase.

**Root Cause:**
Named interfaces were prematurely unwrapped via Underlying() in the interface
construction phase (MakeInterface()/unsafeInterface()), causing the subsequent
ABI type generation to hit `case *types.Interface:` instead of
`case *types.Named:`, resulting in loss of package information.

**The Fix:**
1. Modified `unsafeInterface()` to accept a `namedIntf types.Type` parameter
2. Updated all callers to pass the Named type (tinter.raw.Type, assertedTyp.raw.Type, etc.)
3. When namedIntf is available, pass it to `abiType()` to ensure proper routing
   through the type switch to `abiNamedInterfaceOf()` which has correct package context
4. Reverted the workaround logic in `abiInterfaceOf()` that extracted pkgPath from methods

**Impact:**
- Fixes segmentation faults when calling interface private methods across packages
- Ensures runtime receives correct package path for interface metadata
- Allows private method slots in itab to be properly filled

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 10:32:20 +00:00

20 lines
936 B
LLVM

WARNING: Using LLGO root for devel: /workspace
WARNING: Using LLGO root for devel: /workspace
WARNING: Using LLGO root for devel: /workspace
WARNING: Using LLGO root for devel: /workspace
-: package cl/_testgo/interface1370 is not in std (/usr/local/go/src/cl/_testgo/interface1370)
cannot build SSA for package cl/_testgo/interface1370
panic: cannot build SSA for packages
goroutine 1 [running]:
github.com/goplus/llgo/internal/build.check(...)
/workspace/internal/build/build.go:1369
github.com/goplus/llgo/internal/build.Do({0xc00012c420, 0x1, 0x1}, 0xc000194000)
/workspace/internal/build/build.go:339 +0x211b
github.com/goplus/llgo/internal/llgen.genFrom({0x7ffc238209d8, 0x18}, 0x0)
/workspace/internal/llgen/llgenf.go:51 +0x214
github.com/goplus/llgo/internal/llgen.SmartDoFileEx({0x7ffc238209d8?, 0xc00011e0f0?}, 0x99ba30?)
/workspace/internal/llgen/llgenf.go:83 +0x1f
main.main()
/workspace/chore/llgen/llgen.go:38 +0xc5