]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: define MyBuffer more locally in TestImplicitMapConversion
authorTobias Klauser <tklauser@distanz.ch>
Wed, 18 Apr 2018 09:52:39 +0000 (11:52 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Wed, 18 Apr 2018 12:47:39 +0000 (12:47 +0000)
There are no strange messages anymore, so define type MyBuffer in the
block where it is used.

Change-Id: Ic65b15dc76a40f6f734d9ac2116338502fbb66fd
Reviewed-on: https://go-review.googlesource.com/107735
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/reflect/set_test.go

index 7c39623a9dbb136ed15c031e8a95019999519582..a633e6eee2b3e4e1cae1a128b86a815f719ec9fa 100644 (file)
@@ -14,8 +14,6 @@ import (
        "unsafe"
 )
 
-type MyBuffer bytes.Buffer
-
 func TestImplicitMapConversion(t *testing.T) {
        // Test implicit conversions in MapIndex and SetMapIndex.
        {
@@ -102,10 +100,7 @@ func TestImplicitMapConversion(t *testing.T) {
        }
        {
                // convert identical underlying types
-               // TODO(rsc): Should be able to define MyBuffer here.
-               // 6l prints very strange messages about .this.Bytes etc
-               // when we do that though, so MyBuffer is defined
-               // at top level.
+               type MyBuffer bytes.Buffer
                m := make(map[*MyBuffer]*bytes.Buffer)
                mv := ValueOf(m)
                b1 := new(MyBuffer)