mirror of
https://github.com/golang/go
synced 2024-09-29 07:14:29 -06:00
reflect: FuncOf support more than 50 arguments
Fixes #54669 Change-Id: I34cbe729d187437ddeafbaa910af6ed001b2603f Reviewed-on: https://go-review.googlesource.com/c/go/+/425461 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
2eba2ff8a1
commit
d7a3fa120d
@ -6258,6 +6258,13 @@ func TestFuncOf(t *testing.T) {
|
||||
FuncOf([]Type{TypeOf(1), TypeOf(""), SliceOf(TypeOf(false))}, nil, true)
|
||||
shouldPanic("must be slice", func() { FuncOf([]Type{TypeOf(0), TypeOf(""), TypeOf(false)}, nil, true) })
|
||||
shouldPanic("must be slice", func() { FuncOf(nil, nil, true) })
|
||||
|
||||
//testcase for #54669
|
||||
var in []Type
|
||||
for i := 0; i < 51; i++ {
|
||||
in = append(in, TypeOf(1))
|
||||
}
|
||||
FuncOf(in, nil, false)
|
||||
}
|
||||
|
||||
type B1 struct {
|
||||
|
@ -2077,9 +2077,7 @@ func FuncOf(in, out []Type, variadic bool) Type {
|
||||
args = append(args, t)
|
||||
hash = fnv1(hash, byte(t.hash>>24), byte(t.hash>>16), byte(t.hash>>8), byte(t.hash))
|
||||
}
|
||||
if len(args) > 50 {
|
||||
panic("reflect.FuncOf does not support more than 50 arguments")
|
||||
}
|
||||
|
||||
ft.tflag = 0
|
||||
ft.hash = hash
|
||||
ft.inCount = uint16(len(in))
|
||||
|
Loading…
Reference in New Issue
Block a user