diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2022-12-01 17:24:40 -0800 |
|---|---|---|
| committer | Matthew Dempsky <mdempsky@google.com> | 2023-01-26 21:56:38 +0000 |
| commit | f5eb0a7a5aa3880c02dd887d5ded4b7395a91005 (patch) | |
| tree | a1d8996712bcf76e58c120b1dbcdd6ffa9ae658b /src/cmd/compile/internal/noder | |
| parent | ea6d4b0eaf20da4d2d9a88b995314eeeac614ef3 (diff) | |
| download | go-f5eb0a7a5aa3880c02dd887d5ded4b7395a91005.tar.xz | |
cmd/compile/internal/types: remove TTYPEPARAM and TUNION types
These were used by the nounified frontend for representing
uninstantiated generic types; however, the unified frontend only needs
types1 to represent instantiated types.
Updates #57410.
Change-Id: Iac417fbf2b86f4e08bd7fdd26ae8ed17395ce833
Reviewed-on: https://go-review.googlesource.com/c/go/+/458621
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/noder')
| -rw-r--r-- | src/cmd/compile/internal/noder/helpers.go | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/cmd/compile/internal/noder/helpers.go b/src/cmd/compile/internal/noder/helpers.go index 4ef46a477b..ff2d50fcc8 100644 --- a/src/cmd/compile/internal/noder/helpers.go +++ b/src/cmd/compile/internal/noder/helpers.go @@ -61,9 +61,7 @@ func FixValue(typ *types.Type, val constant.Value) constant.Value { if !typ.IsUntyped() { val = typecheck.DefaultLit(ir.NewBasicLit(src.NoXPos, val), typ).Val() } - if !typ.IsTypeParam() { - ir.AssertValidTypeForConst(typ, val) - } + ir.AssertValidTypeForConst(typ, val) return val } @@ -211,15 +209,7 @@ var one = constant.MakeInt64(1) func IncDec(pos src.XPos, op ir.Op, x ir.Node) *ir.AssignOpStmt { assert(x.Type() != nil) bl := ir.NewBasicLit(pos, one) - if x.Type().HasTParam() { - // If the operand is generic, then types2 will have proved it must be - // a type that fits with increment/decrement, so just set the type of - // "one" to n.Type(). This works even for types that are eventually - // float or complex. - typed(x.Type(), bl) - } else { - bl = typecheck.DefaultLit(bl, x.Type()) - } + bl = typecheck.DefaultLit(bl, x.Type()) return ir.NewAssignOpStmt(pos, op, x, bl) } |
