]> Cypherpunks repositories - gostls13.git/commit
go/types: check for non-negative index in tparamIndex
authorRobert Findley <rfindley@google.com>
Wed, 17 Nov 2021 14:38:16 +0000 (09:38 -0500)
committerRobert Findley <rfindley@google.com>
Wed, 17 Nov 2021 18:14:41 +0000 (18:14 +0000)
commit0981724eaeb9e3a4553473072c38cf11822bc7fd
tree7a6370aecd593b704cf8d0afc83c66ddbba85191
parent9bdbed1d963a840d8c23640bbd20bd4cb9776859
go/types: check for non-negative index in tparamIndex

There are code paths (particularly error formatting or tracing) that
call tparamIndex before the type parameter is bound. We cannot rely on
the index being non-negative.

Change-Id: Ibad91c691b4f319b0c7b465a750b679a8a7af6a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/364715
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/compile/internal/types2/unify.go
src/go/types/unify.go