delve/_fixtures/testvariables_generic.go
aarzilli 18f2a4c46b proc,dwarf/godwarf: support parametric types with dictionaries
Change debug_info type reader and proc to convert parametric types into
their real types by reading the corresponding dictionary entry and
using the same method used for interfaces to retrieve the DIE from a
runtime._type address.

'2586e9b1'.
2021-10-02 15:44:30 +02:00

23 lines
304 B
Go

package main
import (
"fmt"
"runtime"
)
type astruct struct {
x, y int
}
func testfn[T any, K comparable](arg1 T, arg2 K) {
m := make(map[K]T)
m[arg2] = arg1
runtime.Breakpoint()
fmt.Println(arg1, arg2, m)
}
func main() {
testfn[int, float32](3, 2.1)
testfn(&astruct{0, 1}, astruct{2, 3})
}