]> Cypherpunks.ru repositories - gostls13.git/commitdiff
test: add regress test for issue 55101
authorMatthew Dempsky <mdempsky@google.com>
Fri, 16 Sep 2022 20:11:49 +0000 (13:11 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 19 Sep 2022 18:47:00 +0000 (18:47 +0000)
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 <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/go/internal/gcimporter/gcimporter_test.go
test/run.go
test/typeparam/issue55101.go [new file with mode: 0644]

index dd41c2550c2a2b9c22b3130f5c30cc9d602c07fb..54fda8620817390a7fcb69bc5cba871252ac19fc 100644 (file)
@@ -179,6 +179,7 @@ func TestImportTypeparamTests(t *testing.T) {
                "issue50417.go": "inconsistent interface member sorting",
                "issue53419.go": "fails to compile",
                "issue53477.go": "fails to compile",
+               "issue55101.go": "fails to compile",
        }
 
        for _, entry := range list {
index 3c5b10ad32c46d7e32fb8518f6986c974ed713c1..f4d24c597b59fe12a1ee5efae79a075ba972f97f 100644 (file)
@@ -1987,6 +1987,7 @@ var go118Failures = setOf(
        "typeparam/issue51521.go",  // 1.18 compiler produces bad panic message and link error
        "typeparam/issue54456.go",  // 1.18 compiler fails to distinguish local generic types
        "typeparam/issue54497.go",  // 1.18 compiler is more conservative about inlining due to repeated issues
+       "typeparam/issue55101.go",  // 1.18 compiler ICEs writing export data
        "typeparam/mdempsky/16.go", // 1.18 compiler uses interface shape type in failed type assertions
        "typeparam/mdempsky/17.go", // 1.18 compiler mishandles implicit conversions from range loops
        "typeparam/mdempsky/18.go", // 1.18 compiler mishandles implicit conversions in select statements
diff --git a/test/typeparam/issue55101.go b/test/typeparam/issue55101.go
new file mode 100644 (file)
index 0000000..2d45c87
--- /dev/null
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package p
+
+func F() *Cache[error] { return nil }
+
+type Cache[T any] struct{ l *List[entry[T]] }
+type entry[T any] struct{ value T }
+type List[T any] struct{ len int }
+
+func (c *Cache[V]) Len() int { return c.l.Len() }
+func (l *List[T]) Len() int  { return l.len }