File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
src/cmd/compile/internal/noder Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -1048,6 +1048,13 @@ func (subst *subster) node(n ir.Node) ir.Node {
1048
1048
case ir .OCLOSURE :
1049
1049
transformCall (call )
1050
1050
1051
+ case ir .ODEREF , ir .OINDEX , ir .OINDEXMAP , ir .ORECV :
1052
+ // Transform a call that was delayed because of the
1053
+ // use of typeparam inside an expression that required
1054
+ // a pointer dereference, array indexing, map indexing,
1055
+ // or channel receive to compute function value.
1056
+ transformCall (call )
1057
+
1051
1058
case ir .OFUNCINST :
1052
1059
// A call with an OFUNCINST will get transformed
1053
1060
// in stencil() once we have created & attached the
Original file line number Diff line number Diff line change
1
+ // compile -G=3
2
+
3
+ // Copyright 2021 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 main
8
+
9
+ type Src1 [T any ] func () Src1 [T ]
10
+
11
+ func (s * Src1 [T ]) Next () {
12
+ * s = (* s )()
13
+ }
14
+
15
+ type Src2 [T any ] []func () Src2 [T ]
16
+
17
+ func (s Src2 [T ]) Next () {
18
+ _ = s [0 ]()
19
+ }
20
+
21
+ type Src3 [T comparable ] map [T ]func () Src3 [T ]
22
+
23
+ func (s Src3 [T ]) Next () {
24
+ var a T
25
+ _ = s [a ]()
26
+ }
27
+
28
+ type Src4 [T any ] chan func () T
29
+
30
+ func (s Src4 [T ]) Next () {
31
+ _ = (<- s )()
32
+ }
33
+
34
+ func main () {
35
+ var src1 Src1 [int ]
36
+ src1 .Next ()
37
+
38
+ var src2 Src2 [int ]
39
+ src2 .Next ()
40
+
41
+ var src3 Src3 [string ]
42
+ src3 .Next ()
43
+
44
+ var src4 Src4 [int ]
45
+ src4 .Next ()
46
+ }
You can’t perform that action at this time.
0 commit comments