diff options
author | Robert Griesemer <gri@golang.org> | 2021-02-04 17:40:18 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-02-08 22:24:09 +0000 |
commit | a360eeb52831c0dfeb38b49eec6881c06176f181 (patch) | |
tree | 6083bdfa4f56a171e230f931742a9881ebe2289c /src/cmd/compile/internal/types2/predicates.go | |
parent | 0fbde54ea646aa1363fc172610a75e5ba877d4ec (diff) | |
download | go-a360eeb52831c0dfeb38b49eec6881c06176f181.tar.gz go-a360eeb52831c0dfeb38b49eec6881c06176f181.zip |
[dev.typeparams] cmd/compile/internal/types2: conversions to type parameters are not constant
Disabled test/typeparam/fact.go for now as there's an issue
with stenciling.
Change-Id: Ie328a217de6d7b6695737f08ef5c944bcdaabd39
Reviewed-on: https://go-review.googlesource.com/c/go/+/290471
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/predicates.go')
-rw-r--r-- | src/cmd/compile/internal/types2/predicates.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types2/predicates.go b/src/cmd/compile/internal/types2/predicates.go index 94a9b64761..b8fa15cdb8 100644 --- a/src/cmd/compile/internal/types2/predicates.go +++ b/src/cmd/compile/internal/types2/predicates.go @@ -69,8 +69,13 @@ func isUntyped(typ Type) bool { return !isTyped(typ) } -func isOrdered(typ Type) bool { return is(typ, IsOrdered) } -func isConstType(typ Type) bool { return is(typ, IsConstType) } +func isOrdered(typ Type) bool { return is(typ, IsOrdered) } + +func isConstType(typ Type) bool { + // Type parameters are never const types. + t, _ := typ.Under().(*Basic) + return t != nil && t.info&IsConstType != 0 +} // IsInterface reports whether typ is an interface type. func IsInterface(typ Type) bool { |