Files
llgo/_demo/go/failed/stacktrace/main.go
Li Jie 64df39b3c5 reorganize: consolidate demo directories
- Consolidate _demo, _pydemo, _embdemo into single _demo directory structure
- Organize demos by language: _demo/{go,py,c,embed}/
- Categorize demos based on imports:
- Python library demos (py imports) → _demo/py/
- C/C++ library demos (c/cpp imports) → _demo/c/
- Go-specific demos → _demo/go/
- Embedded demos → _demo/embed/
- Move C-related demos (asm*, cabi*, cgo*, linkname, targetsbuild) from go/ to c/
- Update all path references in README.md and GitHub workflows
- Improve demo organization and navigation as requested in #1256

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-09 15:06:55 +08:00

43 lines
878 B
Go

package main
import (
"fmt"
)
type MyStruct[T any] struct {
value T
}
func (m *MyStruct[T]) Method() {
fmt.Println("In generic method")
genericFunc[T](m.value)
}
func genericFunc[T any](v T) {
fmt.Println("In generic function")
normalFunc()
}
func normalFunc() {
fmt.Println("In normal function")
panic("panic occurs here")
}
func main() {
m := &MyStruct[string]{value: "hello"}
m.Method()
}
//Expected:
// In generic method
// In generic function
// In normal function
// panic: panic occurs here
// [0x00C6D310 github.com/goplus/llgo/internal/runtime.Rethrow+0x2f, SP = 0x60]
// [0x00C6CF44 github.com/goplus/llgo/internal/runtime.Panic+0x2d, SP = 0x50]
// [0x00C69420 main.normalFunc+0xf, SP = 0xa8]
// [0x00C69564 main.genericFunc[string]+0x18, SP = 0x74]
// [0x00C694A8 main.(*MyStruct[string]).Method+0x1f, SP = 0x84]
// [0x00C6936C main+0x4, SP = 0x40]