Skip to content

Commit 807bf7c

Browse files
authored
checkers/testdata: remove files needed for Go 1.18 (#1458)
1 parent 0ea975d commit 807bf7c

14 files changed

+62
-84
lines changed

checkers/testdata/badSyncOnceFunc/negative_tests.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build go1.21
2-
31
package checker_test
42

53
import (

checkers/testdata/badSyncOnceFunc/positive_tests.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build go1.21
2-
31
package checker_test
42

53
import (

checkers/testdata/hugeParam/negative_tests.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,11 @@ func (x *bigStruct) bigRecvPtr(y *[2]bigStruct) {}
2020

2121
// String must be ignored #1168.
2222
func (x bigStruct) String() string { return "" }
23+
24+
func genericFunc[T comparable](x T) {}
25+
26+
type Maybe[V any] struct {
27+
value V
28+
}
29+
30+
func (m Maybe[V]) Fn() {}

checkers/testdata/hugeParam/negative_tests_go118.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

checkers/testdata/newDeref/negative_tests.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ func fixedNewExpressions() {
2929
_ = interface{}(nil)
3030
_ = examplepkg.InterfaceType(nil)
3131
}
32+
33+
func genericNew[T any]() T {
34+
return *new(T)
35+
}

checkers/testdata/newDeref/negative_tests118.go

Lines changed: 0 additions & 7 deletions
This file was deleted.

checkers/testdata/paramTypeCombine/negative_tests.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,16 @@ func multiline(
2525
) int {
2626
return 0
2727
}
28+
29+
func genericGood1[T any](a T, b, c int) {}
30+
func genericGood2[T any](a, b T, c int) {}
31+
func genericGood3[T any](a T) {}
32+
func genericGood4[T any]() {}
33+
func genericGood5[T any, Y any](a, b T, c int, d, e Y) {}
34+
35+
func genericUnnamed[T any](T, T) {}
36+
37+
func genericUnnamedResults[T any]() (T, T) {
38+
var t T
39+
return t, t
40+
}

checkers/testdata/paramTypeCombine/negative_tests_go118.go

Lines changed: 0 additions & 16 deletions
This file was deleted.

checkers/testdata/paramTypeCombine/positive_tests.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,20 @@ func withBlank1(_, _ int, _ int, _ int32) {}
4444

4545
/*! func() (_, _ int, _ int, _ int32) could be replaced with func() (_, _, _ int, _ int32) */
4646
func withBlank2() (_, _ int, _ int, _ int32) { return }
47+
48+
/*! func[T any]() (a T, b T, c T) could be replaced with func[T any]() (a, b, c T) */
49+
func genericSimple1[T any]() (a T, b T, c T) { return a, b, c }
50+
51+
/*! func[T any](a T, b T, c T) could be replaced with func[T any](a, b, c T) */
52+
func genericSimple2[T any](a T, b T, c T) {}
53+
54+
/*! func[T any, Y any](a T, b T, c int, d Y, e Y) could be replaced with func[T any, Y any](a, b T, c int, d, e Y) */
55+
func genericMixed1[T any, Y any](a T, b T, c int, d Y, e Y) {}
56+
57+
/*! func[T any, Y any]() (a T, b T, c int, d Y, e Y) could be replaced with func[T any, Y any]() (a, b T, c int, d, e Y) */
58+
func genericMixed2[T any, Y any]() (a T, b T, c int, d Y, e Y) { return a, b, c, d, e }
59+
60+
/*! func[T any](a T, b T, c int, d int32, e int32) (f int64, g int64, h T, k T) could be replaced with func[T any](a, b T, c int, d, e int32) (f, g int64, h, k T) */
61+
func genericMixed3[T any](a T, b T, c int, d int32, e int32) (f int64, g int64, h T, k T) {
62+
return f, g, h, k
63+
}

checkers/testdata/paramTypeCombine/positive_tests_go118.go

Lines changed: 0 additions & 20 deletions
This file was deleted.

checkers/testdata/typeDefFirst/negative_tests.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@ func (r *rec) MethodWithRef() {}
99
func (r recv) Method2() {}
1010

1111
func JustFunction() {}
12+
13+
type genericNegativeStruct[T any] struct{ _ []T }
14+
15+
func (_ genericNegativeStruct[T]) Method() {}
16+
func (_ *genericNegativeStruct[T]) MethodWithRef() {}
17+
18+
type multiGenericNegativeStruct[T any, X any] struct{ _ []T }
19+
20+
func (_ multiGenericNegativeStruct[T, X]) Method() {}
21+
func (_ *multiGenericNegativeStruct[T, X]) MethodWithRef() {}

checkers/testdata/typeDefFirst/negative_tests_go118.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

checkers/testdata/typeDefFirst/positive_tests.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ func (r recv) MethodBefore() {}
44

55
/*! definition of type 'recv' should appear before its methods */
66
type recv struct{}
7+
8+
func (_ genericPositiveStruct[T]) Method() {}
9+
10+
/*! definition of type 'genericPositiveStruct' should appear before its methods */
11+
type genericPositiveStruct[T any] struct{ _ []T }
12+
13+
func (_ *multiGenericPositiveStruct[T, X]) MethodWithRef() {}
14+
15+
/*! definition of type 'multiGenericPositiveStruct' should appear before its methods */
16+
type multiGenericPositiveStruct[T any, X any] struct{ _ []T }

checkers/testdata/typeDefFirst/positive_tests_go118.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)