mirror of
https://github.com/golang/go
synced 2024-11-23 00:10:07 -07:00
go/types: don't declare 'comparable' when typeparams are disabled
Fixes #46453 Change-Id: I92b9b1e43ec5182162b2eeeb667f1f548ea373a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/323609 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
1607c28172
commit
3b770f2ccb
@ -330,6 +330,14 @@ func TestIndexRepresentability(t *testing.T) {
|
|||||||
checkFiles(t, &StdSizes{4, 4}, "", []string{"index.go"}, [][]byte{[]byte(src)}, false)
|
checkFiles(t, &StdSizes{4, 4}, "", []string{"index.go"}, [][]byte{[]byte(src)}, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssue46453(t *testing.T) {
|
||||||
|
if typeparams.Enabled {
|
||||||
|
t.Skip("type params are enabled")
|
||||||
|
}
|
||||||
|
const src = "package p\ntype _ comparable // ERROR \"undeclared name: comparable\""
|
||||||
|
checkFiles(t, nil, "", []string{"issue46453.go"}, [][]byte{[]byte(src)}, false)
|
||||||
|
}
|
||||||
|
|
||||||
func TestCheck(t *testing.T) { DefPredeclaredTestFuncs(); testDir(t, "check") }
|
func TestCheck(t *testing.T) { DefPredeclaredTestFuncs(); testDir(t, "check") }
|
||||||
func TestExamples(t *testing.T) { testDir(t, "examples") }
|
func TestExamples(t *testing.T) { testDir(t, "examples") }
|
||||||
func TestFixedbugs(t *testing.T) { testDir(t, "fixedbugs") }
|
func TestFixedbugs(t *testing.T) { testDir(t, "fixedbugs") }
|
||||||
|
@ -8,6 +8,7 @@ package types
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go/constant"
|
"go/constant"
|
||||||
|
"go/internal/typeparams"
|
||||||
"go/token"
|
"go/token"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -237,7 +238,9 @@ func init() {
|
|||||||
defPredeclaredConsts()
|
defPredeclaredConsts()
|
||||||
defPredeclaredNil()
|
defPredeclaredNil()
|
||||||
defPredeclaredFuncs()
|
defPredeclaredFuncs()
|
||||||
|
if typeparams.Enabled {
|
||||||
defPredeclaredComparable()
|
defPredeclaredComparable()
|
||||||
|
}
|
||||||
|
|
||||||
universeIota = Universe.Lookup("iota").(*Const)
|
universeIota = Universe.Lookup("iota").(*Const)
|
||||||
universeByte = Universe.Lookup("byte").(*TypeName).typ.(*Basic)
|
universeByte = Universe.Lookup("byte").(*TypeName).typ.(*Basic)
|
||||||
|
Loading…
Reference in New Issue
Block a user