Skip to content

Commit 8849609

Browse files
committed
[dev.go2go] go/types: remove incorrect assert and replace with explanatory comment
Addresses crash 26 of #39634. Also, added test case for crash 25 which was fixed with https://golang.org/cl/245739. Updates #39634. Change-Id: I19793eb79fce63052ba055cde0b1dafdd9476895 Reviewed-on: https://go-review.googlesource.com/c/go/+/245740 Reviewed-by: Robert Griesemer <[email protected]>
1 parent f0e6640 commit 8849609

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/go/types/fixedbugs/issue39634.go2

+9
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ func F21(type *T Z21)() { ( /* ERROR not used */ F21(Z21)) }
6868
type T24(type P) P
6969
func (r T24(P)) m() { T24 /* ERROR without instantiation */ .m() }
7070

71+
// crash 25
72+
type T25(type A) int
73+
func (t T25(A)) m1() {}
74+
var x T25 /* ERROR without instantiation */ .m1
75+
76+
// crash 26
77+
type T26 = interface{ F26(type Z)() }
78+
func F26(type Z)() T26 { return F26() /* ERROR cannot infer Z */ }
79+
7180
// crash 27
7281
func e27(type T)() interface{ (x27 /* ERROR not a type */ ) }
7382
func x27() { e27() /* ERROR cannot infer T */ }

src/go/types/infer.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ func isParameterized(typ Type, seen map[Type]bool) (res bool) {
200200
return isParameterizedList(t.types, seen)
201201

202202
case *Signature:
203-
assert(t.tparams == nil) // TODO(gri) is this correct?
203+
// t.tparams may not be nil if we are looking at a signature
204+
// of a function type (or an interface method) that is part of
205+
// the type we're testing. We don't care about these parameters.
204206
// TODO(gri) Rethink check below.
205207
//assert(t.recv == nil || !isParameterized(t.recv.typ))
206208
return isParameterized(t.params, seen) || isParameterized(t.results, seen)

0 commit comments

Comments
 (0)