From 0aafd6912422570625414da6e5ed5ba2c371fcec Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Thu, 28 Jan 2021 17:43:18 -0800 Subject: [dev.typeparams] cmd/compile: start translating type params in noder2 Also, make some fmt changes so that the type parameters and the typeparam type are displayed in -W=2. You can now parse a simple generic function (but not generic calls or generic types) and print out the noder IR via 'go tool compile -G=2 -W=2 func.go' Change-Id: I1f070fc4a96174a447763ad37999e61c25905901 Reviewed-on: https://go-review.googlesource.com/c/go/+/287833 Run-TryBot: Dan Scales TryBot-Result: Go Bot Trust: Dan Scales Trust: Robert Griesemer Reviewed-by: Robert Griesemer --- src/cmd/compile/internal/types/size.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/cmd/compile/internal/types/size.go') diff --git a/src/cmd/compile/internal/types/size.go b/src/cmd/compile/internal/types/size.go index 98540eefb6..d1203e4a21 100644 --- a/src/cmd/compile/internal/types/size.go +++ b/src/cmd/compile/internal/types/size.go @@ -499,6 +499,11 @@ func CalcSize(t *Type) { base.Warn("bad type %v %d\n", t1, w) } t.Align = 1 + + case TTYPEPARAM: + // TODO(danscales) - remove when we eliminate the need + // to do CalcSize in noder2 (which shouldn't be needed in the noder) + w = int64(PtrSize) } if PtrSize == 4 && w != int64(int32(w)) { -- cgit v1.2.3-54-g00ecf