From 1ff0554b5318d5a39e2b26a9c84330e6aa47b1c6 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 23 Aug 2021 18:29:38 -0700 Subject: cmd/compile/internal/types2: use []*TypeParam rather than []*TypeName for type param lists This is a port of CL 343932 from go/types, with the necessary adjustments to the compiler. This change improves type safety slightly, avoids many internal type assertions, and simplifies some code paths. Change-Id: Ie9c4734814f49cd248927152d7b3264d3578428c Reviewed-on: https://go-review.googlesource.com/c/go/+/344614 Trust: Robert Griesemer Run-TryBot: Robert Griesemer TryBot-Result: Go Bot Reviewed-by: Matthew Dempsky Reviewed-by: Dan Scales --- src/cmd/compile/internal/types2/subst.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cmd/compile/internal/types2/subst.go') diff --git a/src/cmd/compile/internal/types2/subst.go b/src/cmd/compile/internal/types2/subst.go index edbbdb4758..467066cc69 100644 --- a/src/cmd/compile/internal/types2/subst.go +++ b/src/cmd/compile/internal/types2/subst.go @@ -15,11 +15,11 @@ type substMap map[*TypeParam]Type // makeSubstMap creates a new substitution map mapping tpars[i] to targs[i]. // If targs[i] is nil, tpars[i] is not substituted. -func makeSubstMap(tpars []*TypeName, targs []Type) substMap { +func makeSubstMap(tpars []*TypeParam, targs []Type) substMap { assert(len(tpars) == len(targs)) proj := make(substMap, len(tpars)) for i, tpar := range tpars { - proj[tpar.typ.(*TypeParam)] = targs[i] + proj[tpar] = targs[i] } return proj } -- cgit v1.2.3-54-g00ecf