diff options
Diffstat (limited to 'src/cmd/compile/internal/noder/stmt.go')
| -rw-r--r-- | src/cmd/compile/internal/noder/stmt.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/stmt.go b/src/cmd/compile/internal/noder/stmt.go index f85496be40..32a1483b4a 100644 --- a/src/cmd/compile/internal/noder/stmt.go +++ b/src/cmd/compile/internal/noder/stmt.go @@ -42,6 +42,12 @@ func (g *irgen) stmt(stmt syntax.Stmt) ir.Node { return x case *syntax.SendStmt: n := ir.NewSendStmt(g.pos(stmt), g.expr(stmt.Chan), g.expr(stmt.Value)) + if n.Chan.Type().HasTParam() || n.Value.Type().HasTParam() { + // Delay transforming the send if the channel or value + // have a type param. + n.SetTypecheck(3) + return n + } transformSend(n) n.SetTypecheck(1) return n @@ -118,6 +124,14 @@ func (g *irgen) stmt(stmt syntax.Stmt) ir.Node { return ir.NewGoDeferStmt(g.pos(stmt), g.tokOp(int(stmt.Tok), callOps[:]), g.expr(stmt.Call)) case *syntax.ReturnStmt: n := ir.NewReturnStmt(g.pos(stmt), g.exprList(stmt.Results)) + for _, e := range n.Results { + if e.Type().HasTParam() { + // Delay transforming the return statement if any of the + // return values have a type param. + n.SetTypecheck(3) + return n + } + } transformReturn(n) n.SetTypecheck(1) return n |
