// dirs are the directories to look for *.go files in.
// TODO(bradfitz): just use all directories?
- dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "abi", "typeparam"}
+ dirs = []string{".", "ken", "chan", "interface", "syntax", "dwarf", "fixedbugs", "codegen", "runtime", "abi", "typeparam", "typeparam/mdempsky"}
// ratec controls the max number of tests running at a time.
ratec chan bool
"fixedbugs/issue9691.go", // "cannot assign to int(.autotmp_4)" (probably irgen's fault)
"typeparam/nested.go", // -G=3 doesn't support function-local types with generics
+
+ "typeparam/mdempsky/1.go",
+ "typeparam/mdempsky/2.go",
+ "typeparam/mdempsky/3.go",
+ "typeparam/mdempsky/4.go",
+ "typeparam/mdempsky/5.go",
+ "typeparam/mdempsky/7.go",
+ "typeparam/mdempsky/8.go",
+ "typeparam/mdempsky/9.go",
+ "typeparam/mdempsky/11.go",
+ "typeparam/mdempsky/12.go",
+ "typeparam/mdempsky/13.go",
+ "typeparam/mdempsky/14.go",
)
var unifiedFailures = setOf(
--- /dev/null
+// Copyright 2021 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 a
+
+type T[_ any] int
+
+func F() { _ = new(T[int]) }
--- /dev/null
+// Copyright 2021 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 main
+
+import "./a"
+
+func main() { a.F() }
--- /dev/null
+// compiledir -G=3
+
+// Copyright 2021 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 ignored
--- /dev/null
+// Copyright 2021 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 a
+
+type I[T any] interface{ M() T }
--- /dev/null
+// Copyright 2021 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 main
+
+import "./a"
+
+var m = a.I[int].M
+
+var never bool
+
+func main() {
+ if never {
+ m(nil)
+ }
+}
--- /dev/null
+// rundir -G=3
+
+// Copyright 2021 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 ignored
--- /dev/null
+// errorcheck
+
+// Copyright 2021 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.
+
+// Reported by Cuong Manh Le.
+
+package p
+
+type a struct{}
+
+//go:notinheap
+type b a
+
+var _ = (*b)(new(a)) // ERROR "cannot convert"
--- /dev/null
+// Copyright 2021 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 a
+
+type S[T any] struct {
+ F T
+}
+
+var X = S[int]{}
--- /dev/null
+// Copyright 2021 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 main
+
+import (
+ "./a"
+)
+
+func main() {
+ _ = a.X
+}
--- /dev/null
+// rundir -G=3
+
+// Copyright 2021 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.
+
+// Reported by Cuong Manh Le.
+
+package ignored
--- /dev/null
+// run -gcflags=-G=3
+
+// Copyright 2021 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 main
+
+type Mer interface{ M() }
+
+func F[T Mer](expectPanic bool) {
+ defer func() {
+ err := recover()
+ if (err != nil) != expectPanic {
+ print("FAIL: (", err, " != nil) != ", expectPanic, "\n")
+ }
+ }()
+
+ var t T
+ T.M(t)
+}
+
+type MyMer int
+
+func (MyMer) M() {}
+
+func main() {
+ F[Mer](true)
+ F[struct{ Mer }](true)
+ F[*struct{ Mer }](true)
+
+ F[MyMer](false)
+ F[*MyMer](true)
+ F[struct{ MyMer }](false)
+ F[struct{ *MyMer }](true)
+ F[*struct{ MyMer }](true)
+ F[*struct{ *MyMer }](true)
+}
--- /dev/null
+// run -gcflags=-G=3
+
+// Copyright 2021 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 main
+
+func Zero[T any]() (_ T) { return }
+
+type T[X any] int
+
+func (T[X]) M() {
+ var have interface{} = Zero[X]()
+ var want interface{} = Zero[MyInt]()
+
+ if have != want {
+ println("FAIL")
+ }
+}
+
+type I interface{ M() }
+
+type MyInt int
+type U = T[MyInt]
+
+var x = U(0)
+var i I = x
+
+func main() {
+ x.M()
+ U.M(x)
+ (*U).M(&x)
+
+ i.M()
+ I.M(x)
+}
--- /dev/null
+// compile -G=3
+
+// Copyright 2021 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 main
+
+type T[A, B, C any] int
+
+func (T[A, B, C]) m(x int) {
+ if x <= 0 {
+ return
+ }
+ T[B, C, A](0).m(x - 1)
+}
+
+func main() {
+ T[int8, int16, int32](0).m(3)
+}
--- /dev/null
+// Copyright 2021 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 a
+
+func F[T interface{ chan int }](c T) {}
--- /dev/null
+// Copyright 2021 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 b
+
+import "./a"
+
+func g() { a.F(make(chan int)) }
--- /dev/null
+// compiledir -G=3
+
+// Copyright 2021 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 ignored
--- /dev/null
+// Copyright 2021 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 a
+
+func F[T any](T) {
+Loop:
+ for {
+ break Loop
+ }
+}
--- /dev/null
+// Copyright 2021 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 b
+
+import "./a"
+
+func f() { a.F(0) }
--- /dev/null
+// compiledir -G=3
+
+// Copyright 2021 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 ignored
--- /dev/null
+// compile -G=3
+
+// Copyright 2021 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 a
+
+type X[T any] int
+
+func (X[T]) F(T) {}
+
+func x() {
+ X[interface{}](0).F(0)
+}
--- /dev/null
+// compile -G=3
+
+// Copyright 2021 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 a
+
+type I[T any] interface{ M() T }
+
+var _ = I[int].M
--- /dev/null
+// Copyright 2021 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 a
+
+type I[T any] interface{ M() T }
+
+var X I[int]
--- /dev/null
+// Copyright 2021 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 b
+
+import "./a"
+
+var _ = a.X
--- /dev/null
+// compiledir -G=3
+
+// Copyright 2021 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 ignored
--- /dev/null
+// Copyright 2021 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 a
+
+func F[T interface{ comparable }]() {}
--- /dev/null
+// Copyright 2021 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 b
+
+import "./a"
+
+func init() {
+ a.F[func()]() // ERROR "does not satisfy comparable"
+}
--- /dev/null
+// errorcheckdir -G=3
+
+// Copyright 2021 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 ignored
--- /dev/null
+// compile -G=3
+
+// Copyright 2021 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 a
+
+func f[V any]() []V { return []V{0: *new(V)} }
+
+func g() { f[int]() }