Skip to content

Commit 0e8899c

Browse files
authored
correctly index into the fields of a types.Struct
Otherwise this line can cause a panic on struct parameters in generic funcs.
1 parent 0df0534 commit 0e8899c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

check/check.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ func containsTypeParam(t types.Type) bool {
624624
case *types.Struct:
625625
nf := t.NumFields()
626626
for i := 0; i < nf; i++ {
627-
if containsTypeParam(t.Field(nf).Type()) {
627+
if containsTypeParam(t.Field(i).Type()) {
628628
return true
629629
}
630630
}

0 commit comments

Comments
 (0)