Skip to content

Commit c0c872e

Browse files
committed
[dev.go2go] go/types: the underlying type of a type parameter is itself
No need to call Under() when we know that we have a type parameter. While at it: Turn off debug mode. Change-Id: Ia0b39d88191c8e5ac580e7e84a512061911c40cf Reviewed-on: https://go-review.googlesource.com/c/go/+/239162 Reviewed-by: Robert Griesemer <[email protected]>
1 parent cbdb93d commit c0c872e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/go/types/check.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
// debugging/development support
18-
const debug = true // leave on during development
18+
const debug = false // leave on during development
1919

2020
// If forceStrict is set, the type-checker enforces additional
2121
// rules not specified by the Go 1 spec, but which will

src/go/types/type.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -836,17 +836,17 @@ func optype(typ Type) Type {
836836
}
837837

838838
// Converter methods
839-
func (t *TypeParam) Basic() *Basic { return optype(t.Under()).Basic() }
840-
func (t *TypeParam) Array() *Array { return optype(t.Under()).Array() }
841-
func (t *TypeParam) Slice() *Slice { return optype(t.Under()).Slice() }
842-
func (t *TypeParam) Struct() *Struct { return optype(t.Under()).Struct() }
843-
func (t *TypeParam) Pointer() *Pointer { return optype(t.Under()).Pointer() }
844-
func (t *TypeParam) Tuple() *Tuple { return optype(t.Under()).Tuple() }
845-
func (t *TypeParam) Signature() *Signature { return optype(t.Under()).Signature() }
846-
func (t *TypeParam) Sum() *Sum { return optype(t.Under()).Sum() }
847-
func (t *TypeParam) Interface() *Interface { return optype(t.Under()).Interface() }
848-
func (t *TypeParam) Map() *Map { return optype(t.Under()).Map() }
849-
func (t *TypeParam) Chan() *Chan { return optype(t.Under()).Chan() }
839+
func (t *TypeParam) Basic() *Basic { return optype(t).Basic() }
840+
func (t *TypeParam) Array() *Array { return optype(t).Array() }
841+
func (t *TypeParam) Slice() *Slice { return optype(t).Slice() }
842+
func (t *TypeParam) Struct() *Struct { return optype(t).Struct() }
843+
func (t *TypeParam) Pointer() *Pointer { return optype(t).Pointer() }
844+
func (t *TypeParam) Tuple() *Tuple { return optype(t).Tuple() }
845+
func (t *TypeParam) Signature() *Signature { return optype(t).Signature() }
846+
func (t *TypeParam) Sum() *Sum { return optype(t).Sum() }
847+
func (t *TypeParam) Interface() *Interface { return optype(t).Interface() }
848+
func (t *TypeParam) Map() *Map { return optype(t).Map() }
849+
func (t *TypeParam) Chan() *Chan { return optype(t).Chan() }
850850

851851
// func (t *TypeParam) Named() *Named // named types are not permitted in type lists
852852
// func (t *TypeParam) TypeParam() *TypeParam // declared below
@@ -966,7 +966,7 @@ func (t *Interface) Underlying() Type { return t }
966966
func (t *Map) Underlying() Type { return t }
967967
func (t *Chan) Underlying() Type { return t }
968968
func (t *Named) Underlying() Type { return t.underlying }
969-
func (t *TypeParam) Underlying() Type { return t.Under() }
969+
func (t *TypeParam) Underlying() Type { return t }
970970
func (t *instance) Underlying() Type { return t }
971971
func (t *bottom) Underlying() Type { return t }
972972
func (t *top) Underlying() Type { return t }

0 commit comments

Comments
 (0)