mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile: introduce IsTypeParam() helper
better than Kind() == types.TTYPEPARAM Change-Id: I4f35a177cd0cda3be615a92b7b2af1b5a60a3bbc Reviewed-on: https://go-review.googlesource.com/c/go/+/325410 Trust: Keith Randall <khr@golang.org> Trust: Dan Scales <danscales@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
f0c97219a3
commit
bcb3927cb5
5 changed files with 11 additions and 7 deletions
|
|
@ -63,7 +63,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.Kind() != types.TTYPEPARAM {
|
||||
if !typ.IsTypeParam() {
|
||||
ir.AssertValidTypeForConst(typ, val)
|
||||
}
|
||||
return val
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue