-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interp: improve handling of embedded fields with binary methods
Only structures with one embedded field can be marked anonymous, due to golang/go#15924. Also check only that the method is defined, do not verify its complete signature, as the receiver may or not be defined in the arguments of the method. Fixes #1537.
- Loading branch information
Showing
2 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"io" | ||
) | ||
|
||
type TMemoryBuffer struct { | ||
*bytes.Buffer | ||
size int | ||
} | ||
|
||
func newTMemoryBuffer() *TMemoryBuffer { | ||
return &TMemoryBuffer{} | ||
} | ||
|
||
var globalMemoryBuffer = newTMemoryBuffer() | ||
|
||
type TTransport interface { | ||
io.ReadWriter | ||
} | ||
|
||
func check(t TTransport) { | ||
println("ok") | ||
} | ||
|
||
func main() { | ||
check(globalMemoryBuffer) | ||
} | ||
|
||
// Output: | ||
// ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters