Skip to content

Commit 38cecb2

Browse files
committed
test: add regress test for issue 55101
This test case already works with GOEXPERIMENT=unified, and it never worked with Go 1.18 or Go 1.19. So this CL simply adds a regress test to make sure it continues working. Fixes #55101. Change-Id: I7e06bfdc136ce124f65cdcf02d20a1050b841d42 Reviewed-on: https://go-review.googlesource.com/c/go/+/431455 Run-TryBot: Matthew Dempsky <[email protected]> Reviewed-by: Cherry Mui <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cuong Manh Le <[email protected]>
1 parent d74bf73 commit 38cecb2

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/go/internal/gcimporter/gcimporter_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ func TestImportTypeparamTests(t *testing.T) {
179179
"issue50417.go": "inconsistent interface member sorting",
180180
"issue53419.go": "fails to compile",
181181
"issue53477.go": "fails to compile",
182+
"issue55101.go": "fails to compile",
182183
}
183184

184185
for _, entry := range list {

test/run.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,6 +1987,7 @@ var go118Failures = setOf(
19871987
"typeparam/issue51521.go", // 1.18 compiler produces bad panic message and link error
19881988
"typeparam/issue54456.go", // 1.18 compiler fails to distinguish local generic types
19891989
"typeparam/issue54497.go", // 1.18 compiler is more conservative about inlining due to repeated issues
1990+
"typeparam/issue55101.go", // 1.18 compiler ICEs writing export data
19901991
"typeparam/mdempsky/16.go", // 1.18 compiler uses interface shape type in failed type assertions
19911992
"typeparam/mdempsky/17.go", // 1.18 compiler mishandles implicit conversions from range loops
19921993
"typeparam/mdempsky/18.go", // 1.18 compiler mishandles implicit conversions in select statements

test/typeparam/issue55101.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// compile
2+
3+
// Copyright 2022 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
package p
8+
9+
func F() *Cache[error] { return nil }
10+
11+
type Cache[T any] struct{ l *List[entry[T]] }
12+
type entry[T any] struct{ value T }
13+
type List[T any] struct{ len int }
14+
15+
func (c *Cache[V]) Len() int { return c.l.Len() }
16+
func (l *List[T]) Len() int { return l.len }

0 commit comments

Comments
 (0)