]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: prevent importReader reading type parameter twice
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 10 Sep 2021 00:44:02 +0000 (07:44 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 14 Sep 2021 02:52:21 +0000 (02:52 +0000)
commitb8c802b1161528fcf8ba78b1dff5720dd5b4eb9f
tree62146563d7f6a5014c132fd02ca9aa115643c371
parent4a4221e8187189adcc6463d2d96fe2e8da290132
cmd/compile: prevent importReader reading type parameter twice

The importReader always reads type parameter before declaring type stub
declaration. Thus, for recursive type, the type parameter is going to be
read twice, cause the bound more than once error.

To fix this, only read the type parameter after declaring stub obj, thus
r.doDecl can see the type was already inserted and terminate the
recursive call earlier.

Fixes #48280

Change-Id: I272e2f214f739fb8ec71a8628ba297477e1b7755
Reviewed-on: https://go-review.googlesource.com/c/go/+/349009
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
src/cmd/compile/internal/importer/iimport.go
test/typeparam/issue48280.dir/a.go [new file with mode: 0644]
test/typeparam/issue48280.dir/main.go [new file with mode: 0644]
test/typeparam/issue48280.go [new file with mode: 0644]