]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: do not mark export for send only chan
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 12 Sep 2019 16:23:10 +0000 (23:23 +0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 12 Sep 2019 17:41:57 +0000 (17:41 +0000)
No changes in compilebench, pass toolstash-check.

Change-Id: I2688f7b45af0eaa0cf3b38e726bce6e68c20f69c
Reviewed-on: https://go-review.googlesource.com/c/go/+/195077
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/bexport.go

index 7c09ab5a34d20b591d5312cfbebcb4b2705aed7c..e67506f4e137ccb6010f83376703e5391fb8f2ff 100644 (file)
@@ -43,11 +43,14 @@ func (p *exporter) markType(t *types.Type) {
        // the user already needs some way to construct values of
        // those types.
        switch t.Etype {
-       case TPTR, TARRAY, TSLICE, TCHAN:
-               // TODO(mdempsky): Skip marking element type for
-               // send-only channels?
+       case TPTR, TARRAY, TSLICE:
                p.markType(t.Elem())
 
+       case TCHAN:
+               if t.ChanDir().CanRecv() {
+                       p.markType(t.Elem())
+               }
+
        case TMAP:
                p.markType(t.Key())
                p.markType(t.Elem())