interp: fix fieldName method parsing embedded + generic fields
Fix https://github.com/traefik/yaegi/issues/1571
This commit is contained in:
20
_test/issue-1571.go
Normal file
20
_test/issue-1571.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
type A struct {
|
||||||
|
*B[string]
|
||||||
|
}
|
||||||
|
|
||||||
|
type B[T any] struct {
|
||||||
|
data T
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
_ = &A{
|
||||||
|
B: &B[string]{},
|
||||||
|
}
|
||||||
|
|
||||||
|
println("PASS")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output:
|
||||||
|
// PASS
|
||||||
@@ -1230,6 +1230,8 @@ func fieldName(n *node) string {
|
|||||||
return fieldName(n.child[1])
|
return fieldName(n.child[1])
|
||||||
case starExpr:
|
case starExpr:
|
||||||
return fieldName(n.child[0])
|
return fieldName(n.child[0])
|
||||||
|
case indexExpr:
|
||||||
|
return fieldName(n.child[0])
|
||||||
case identExpr:
|
case identExpr:
|
||||||
return n.ident
|
return n.ident
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user